Module: Rad::Face::CiViewHelper
- Defined in:
- lib/face/ci_view_helper.rb
Instance Method Summary collapse
-
#attachments_tag(name, value = [], options = {}) ⇒ Object
Attachments.
- #cancel_button(text = t(:cancel)) ⇒ Object
-
#ok_button(text = t(:ok)) ⇒ Object
Form Buttons.
-
#tag_cloud(tags, classes, &block) ⇒ Object
Custom.
Instance Method Details
#attachments_tag(name, value = [], options = {}) ⇒ Object
Attachments
31 32 33 34 |
# File 'lib/face/ci_view_helper.rb', line 31 def name, value = [], = {} value = value.collect{|h| h.to_openobject} render '/face/attachments_tag', object: .merge(name: name, value: value).to_openobject end |
#cancel_button(text = t(:cancel)) ⇒ Object
9 10 11 |
# File 'lib/face/ci_view_helper.rb', line 9 def text = t(:cancel) link_to text, :back, class: 'm_redirect_back_or_close_dialog' end |
#ok_button(text = t(:ok)) ⇒ Object
Form Buttons
5 6 7 |
# File 'lib/face/ci_view_helper.rb', line 5 def text = t(:ok) submit_tag text, class: 'm_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/face/ci_view_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 |