Module: KuppayamHelper
- Included in:
- Kuppayam::BaseController
- Defined in:
- app/helpers/kuppayam_helper.rb
Instance Method Summary collapse
-
#fa_icon(icon_text, size = "") ⇒ Object
fa_icon('plus') theme_fa_icon('plus', 'lg') .
-
#paginate_kuppayam(collection, **options) ⇒ Object
Example paginate_kuppayam(@projects, false).
-
#search_form_kuppayam(cls, url, **options) ⇒ Object
theme_search_form is a helper to create a form to filter the results by entering a search query.
Instance Method Details
#fa_icon(icon_text, size = "") ⇒ Object
fa_icon('plus') theme_fa_icon('plus', 'lg')
7 8 9 10 |
# File 'app/helpers/kuppayam_helper.rb', line 7 def fa_icon(icon_text, size="") size_class = %w{lg 2x 3x 4x 5x}.include?(size.strip) ? " fa-#{size.strip}" : "" "<i class='fa fa-#{icon_text}#{size_class}'></i>" end |
#paginate_kuppayam(collection, **options) ⇒ Object
Example paginate_kuppayam(@projects, false)
is equivalent to:
<% if @projects.any? %> <%= content_tag :div, :class=>"pull-right" do %> <%= paginate @projects, :remote => true %> <% end %> <% end %> paginate @meta_tags , params: { controller: "dhatu/meta_tags", action: 'index', page_id: @page.id }, remote: true ---------------------------
26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/kuppayam_helper.rb', line 26 def paginate_kuppayam(collection, **) .reverse_merge!( remote: true ) return "" if collection.empty? clear_tag(10) + content_tag(:div, :class=>"pull-right") do paginate(collection, ) end + clear_tag(10) end |
#search_form_kuppayam(cls, url, **options) ⇒ Object
theme_search_form is a helper to create a form to filter the results by entering a search query
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/helpers/kuppayam_helper.rb', line 39 def search_form_kuppayam(cls, url, **) .reverse_merge!( method: :get, remote: true, text: "", param_name: "q", placeholder: "Search ...", button_text: "Search!", form_html: { :class=>"pull-right", :style=>"margin-bottom:0px;width:100%;"}, div_html: {:class=>"input-group"}, button_class: "btn btn-primary", text_class: "btn-text hidden-sm hidden-xs" ) form_for cls.new, :url => url, :method => [:method], :remote=>[:remote], :html=>[:form_html] do |f| content_tag :div, [:div_html] do text_field_tag([:param_name], [:text], :class => 'form-control', :placeholder => [:placeholder]) + content_tag(:span, class: "input-group-btn") do (type: 'submit', class: [:button_class]) do raw(fa_icon('search') + content_tag(:span, class: [:text_class]) do " " + [:button_text] end) end end end end end |