Module: Card::Set::Abstract::Attachment::UploadCache

Extended by:
Card::Set
Defined in:
tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb

Constant Summary

Constants included from Format

Format::TEMPLATE_DIR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from I18nScope

#mod_name, #scope

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

Methods included from Card::Set::AdvancedApi

#attachment, #ensure_set, #stage_method

Methods included from Format

#all_set_format_mod!, #before, #define_on_format, #format, #register_set_format, #view, #view_for_override

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Basket

#abstract_basket, #add_to_basket, #basket

Methods included from Trait

#card_accessor, #card_reader, #card_writer

Methods included from Event::Api

#event

Instance Attribute Details

#action_id_of_cached_uploadObject

action id of the cached upload



5
6
7
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 5

def action_id_of_cached_upload
  @action_id_of_cached_upload
end

Instance Method Details

#assign_attachment(file, original_filename) ⇒ Object



43
44
45
46
47
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 43

def assign_attachment file, original_filename
  send "#{attachment_name}=", file
  write_identifier
  @current_action.update_attributes! comment: original_filename
end

#preliminary_upload?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 69

def preliminary_upload?
  Card::Env && Card::Env.params[:attachment_upload]
end

#save_preliminary_upload?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 73

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



78
79
80
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 78

def tmp_upload_dir _action_id=nil
  "#{files_base_dir}/#{upload_cache_card.id}"
end

#upload_cache_cardObject

used for uploads for new cards until the new card is created



65
66
67
# File 'tmpsets/set/mod015-carrierwave/abstract/attachment/upload_cache.rb', line 65

def upload_cache_card
  @upload_cache_card ||= Card["new_#{attachment_name}".to_sym]
end