Module: CommonInterfaceHelper
- Defined in:
- lib/common_interface/lib/common_interface_helper.rb
Instance Method Summary collapse
-
#build_files_uploader_for(params, opt) ⇒ Object
Folder.
- #cancel_button(text = t(:cancel)) ⇒ Object
-
#ok_button(text = t(:ok)) ⇒ Object
Form Buttons.
-
#tag_cloud(tags, classes, &block) ⇒ Object
Custom.
Instance Method Details
#build_files_uploader_for(params, opt) ⇒ Object
Folder
params =
:l => I18n.locale,
opt =
:upload_url => item_files_path(folder),
:view => 'folder_thumb',
:select_files => t(:select_files),
40 41 42 43 44 45 46 47 48 |
# File 'lib/common_interface/lib/common_interface_helper.rb', line 40 def build_files_uploader_for params, opt session_key = ActionController::Base.[:key] params = { session_key => [session_key] }.merge(params) "new FilesUpload(#{params.to_json}, #{opt.to_json});" end |
#cancel_button(text = t(:cancel)) ⇒ Object
9 10 11 |
# File 'lib/common_interface/lib/common_interface_helper.rb', line 9 def text = t(:cancel) link_to text, :back, :class => '_redirect_back_or_close_dialog' end |
#ok_button(text = t(:ok)) ⇒ Object
Form Buttons
5 6 7 |
# File 'lib/common_interface/lib/common_interface_helper.rb', line 5 def text = t(:ok) submit_tag text, :class => '_submit_form_or_ajax_form' end |
#tag_cloud(tags, classes, &block) ⇒ Object
Custom
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/common_interface/lib/common_interface_helper.rb', line 16 def tag_cloud , classes, &block return if .empty? max_count = .sort{|a, b| a.count <=> b.count}.last.count.to_f .sort{|a, b| a.name <=> b.name}.each do |tag| index = ((tag.count / max_count) * (classes.size - 1)).round block.call tag, classes[index] end end |