Module: Card::Set::Abstract::Attachment::UploadCache
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod019-carrierwave/abstract/attachment/upload_cache.rb
Overview
Set: Abstract (Attachment, UploadCache)
action id of the cached upload
Instance Attribute Summary collapse
-
#action_id_of_cached_upload ⇒ Object
Returns the value of attribute action_id_of_cached_upload.
Class Method Summary collapse
Instance Method Summary collapse
- #actionable? ⇒ Boolean
- #assign_attachment(file, original_filename) ⇒ Object
- #preliminary_upload? ⇒ Boolean
- #save_preliminary_upload? ⇒ Boolean
-
#tmp_upload_dir(_action_id = nil) ⇒ Object
place for files if card doesn't have an id yet.
-
#upload_cache_card ⇒ Object
used for uploads for new cards until the new card is created.
Methods included from I18nScope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set
Methods included from Helpers
#abstract_set?, #all_set?, #num_set_parts, #shortname, #underscore
Methods included from Card::Set::AdvancedApi
#attachment, #ensure_set, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
Methods included from Inheritance
#include_set, #include_set_formats
Methods included from Basket
#abstract_basket, #add_to_basket, #basket, #unshift_basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
Instance Attribute Details
#action_id_of_cached_upload ⇒ Object
Returns the value of attribute action_id_of_cached_upload.
9 10 11 |
# File 'tmpsets/set/mod019-carrierwave/abstract/attachment/upload_cache.rb', line 9 def action_id_of_cached_upload @action_id_of_cached_upload end |
Class Method Details
.source_location ⇒ Object
8 |
# File 'tmpsets/set/mod019-carrierwave/abstract/attachment/upload_cache.rb', line 8 def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/carrierwave/set/abstract/attachment/upload_cache.rb"; end |
Instance Method Details
#actionable? ⇒ Boolean
11 12 13 |
# File 'tmpsets/set/mod019-carrierwave/abstract/attachment/upload_cache.rb', line 11 def actionable? super || preliminary_upload? end |
#assign_attachment(file, original_filename) ⇒ Object
49 50 51 52 53 |
# File 'tmpsets/set/mod019-carrierwave/abstract/attachment/upload_cache.rb', line 49 def file, original_filename send "#{}=", file write_identifier @current_action&.update! comment: original_filename end |
#preliminary_upload? ⇒ Boolean
82 83 84 |
# File 'tmpsets/set/mod019-carrierwave/abstract/attachment/upload_cache.rb', line 82 def preliminary_upload? Card::Env && Card::Env.params[:attachment_upload] end |
#save_preliminary_upload? ⇒ Boolean
86 87 88 |
# File 'tmpsets/set/mod019-carrierwave/abstract/attachment/upload_cache.rb', line 86 def save_preliminary_upload? @action_id_of_cached_upload.present? end |
#tmp_upload_dir(_action_id = nil) ⇒ Object
place for files if card doesn't have an id yet
91 92 93 |
# File 'tmpsets/set/mod019-carrierwave/abstract/attachment/upload_cache.rb', line 91 def tmp_upload_dir _action_id=nil "#{files_base_dir}/#{upload_cache_card.id}" end |
#upload_cache_card ⇒ Object
used for uploads for new cards until the new card is created
77 78 79 80 |
# File 'tmpsets/set/mod019-carrierwave/abstract/attachment/upload_cache.rb', line 77 def upload_cache_card cache_card_codename = "new_#{}" @upload_cache_card ||= Card::Codename.card(cache_card_codename) { Card[:new_file] } end |