Module: FileShare::ApplicationHelper
- Defined in:
- app/helpers/file_share/application_helper.rb
Instance Method Summary collapse
- #file_share_asset_prefix ⇒ Object
- #file_share_javascript_includes ⇒ Object
- #link_to_attachable(attachable, wrapper_options = {}, link_options = {}) ⇒ Object
- #link_to_attachable_or_file_attachments(attachable, wrapper_options = {}, link_options = {}) ⇒ Object
- #link_to_delete_file_attachment(file_attachment, wrapper_options = {}, link_options = {}) ⇒ Object
- #link_to_download_file_attachment(file_attachment, wrapper_options = {}, link_options = {}) ⇒ Object
- #link_to_edit_file_attachment(file_attachment, wrapper_options = {}, link_options = {}) ⇒ Object
- #link_to_file_attachments(wrapper_options = {}, link_options = {}) ⇒ Object
- #link_wrapper(path, wrapper_options = {}, link_options = {}) ⇒ Object
- #links_to_edit_and_delete_file_attachment(file_attachment, wrapper_options = {}, link_options = {}) ⇒ Object
Instance Method Details
#file_share_asset_prefix ⇒ Object
85 86 87 |
# File 'app/helpers/file_share/application_helper.rb', line 85 def file_share_asset_prefix 'file_share/' end |
#file_share_javascript_includes ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'app/helpers/file_share/application_helper.rb', line 88 def file_share_javascript_includes list = [ "#{file_share_asset_prefix}jquery-ui-1.7.2.custom.min.js", "#{file_share_asset_prefix}jquery.tablesorter.min.js", "#{file_share_asset_prefix}jquery.string.1.0-min.js", "#{file_share_asset_prefix}jquery.clonePosition.js", "#{file_share_asset_prefix}lowpro.jquery.js", "#{file_share_asset_prefix}jquery.qtip-1.0.0-rc3.js", "#{file_share_asset_prefix}rails", "#{file_share_asset_prefix}file_share_behaviors", "#{file_share_asset_prefix}file_share", "http://www.google.com/jsapi", "#{file_share_asset_prefix}plupload/gears_init", "#{file_share_asset_prefix}plupload/plupload.full.min.js", "#{file_share_asset_prefix}plupload/jquery.plupload.queue.min.js" ] unless Rails.env == 'production' list.unshift("#{file_share_asset_prefix}jquery") else list.unshift("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js") end list end |
#link_to_attachable(attachable, wrapper_options = {}, link_options = {}) ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'app/helpers/file_share/application_helper.rb', line 61 def link_to_attachable(attachable, ={}, ={}) return unless (:read, attachable) link_wrapper(polymorphic_path(attachable), { :no_wrapper => true }.merge!(), { :link_text => attachable.name }.merge!()) end |
#link_to_attachable_or_file_attachments(attachable, wrapper_options = {}, link_options = {}) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'app/helpers/file_share/application_helper.rb', line 70 def (attachable, ={}, ={}) unless attachable.blank? return link_to_attachable(attachable, { :no_wrapper => false }, { :link_text => '< back', :class => 'fake_button' }) else return ({}, { :link_text => '< back', :class => 'fake_button' }) end end |
#link_to_delete_file_attachment(file_attachment, wrapper_options = {}, link_options = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/helpers/file_share/application_helper.rb', line 40 def (, ={}, ={}) return unless (:delete, ) link_wrapper((), { :no_wrapper => true }.merge!(), { :link_text => 'delete', :method => :delete, :confirm => "Did you mean to Delete #{.name}?", :class => 'fake_button' }.merge!()) end |
#link_to_download_file_attachment(file_attachment, wrapper_options = {}, link_options = {}) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'app/helpers/file_share/application_helper.rb', line 52 def (, ={}, ={}) return unless (:read, ) link_wrapper((), { :no_wrapper => true }.merge!(), { :link_text => .name }.merge!()) end |
#link_to_edit_file_attachment(file_attachment, wrapper_options = {}, link_options = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/helpers/file_share/application_helper.rb', line 30 def (, ={}, ={}) return unless (:update, ) link_wrapper((), { :no_wrapper => true }.merge!(), { :link_text => 'update', :class => 'file_attachment_dynamic_form_link fake_button' }.merge!()) end |
#link_to_file_attachments(wrapper_options = {}, link_options = {}) ⇒ Object
16 17 18 19 20 |
# File 'app/helpers/file_share/application_helper.rb', line 16 def (={}, ={}) link_wrapper(, , { :link_text => 'List / Upload Files' }.merge!()) end |
#link_wrapper(path, wrapper_options = {}, link_options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/file_share/application_helper.rb', line 3 def link_wrapper(path, ={}, ={}) tag = .delete(:tag) || :p link_text = .delete(:link_text) || path unless .delete(:no_wrapper) return content_tag(tag, ) do link_to(link_text, path, ) end else return link_to(link_text, path, ) end end |
#links_to_edit_and_delete_file_attachment(file_attachment, wrapper_options = {}, link_options = {}) ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/helpers/file_share/application_helper.rb', line 22 def (, ={}, ={}) return unless (:update, ) || (:delete, ) content_tag :p do () + " " + () end end |