Module: Adminpanel::ApplicationHelper
- Includes:
- SessionsHelper
- Defined in:
- app/helpers/adminpanel/application_helper.rb
Instance Method Summary collapse
- #breadcrumb_add(title, url) ⇒ Object
- #custom_form_for(name, *args, &block) ⇒ Object
- #full_title(page_title) ⇒ Object
- #initialize_breadcrumb ⇒ Object
- #is_current_section?(*controller) ⇒ Boolean
- #link_to_add_fields(name, f, association, model_name) ⇒ Object
- #render_breadcrumb(divider) ⇒ Object
- #section_is_login(section_name) ⇒ Object
Methods included from SessionsHelper
#current_user, #current_user=, #sign_in, #sign_out, #signed_in?
Instance Method Details
#breadcrumb_add(title, url) ⇒ Object
44 45 46 |
# File 'app/helpers/adminpanel/application_helper.rb', line 44 def (title, url) << { :title => title, :url => url } end |
#custom_form_for(name, *args, &block) ⇒ Object
4 5 6 7 8 9 |
# File 'app/helpers/adminpanel/application_helper.rb', line 4 def custom_form_for(name, *args, &block) = args. .reverse_merge! :builder => CustomFormBuilder, :html => { :class => "form-horizontal" } form_for(name, *(args << ), &block) end |
#full_title(page_title) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/helpers/adminpanel/application_helper.rb', line 11 def full_title(page_title) base_title = t("Panel title") if page_title.empty? base_title else "#{page_title} | #{base_title}" end end |
#initialize_breadcrumb ⇒ Object
40 41 42 |
# File 'app/helpers/adminpanel/application_helper.rb', line 40 def @breadcrumb ||= [:title => 'Inicio', :url => root_url] end |
#is_current_section?(*controller) ⇒ Boolean
20 21 22 |
# File 'app/helpers/adminpanel/application_helper.rb', line 20 def is_current_section?(*controller) controller.include?(params[:controller]) ? 'active' : nil end |
#link_to_add_fields(name, f, association, model_name) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/helpers/adminpanel/application_helper.rb', line 28 def link_to_add_fields(name, f, association, model_name) new_object = f.object.send(association).klass.new id = new_object.object_id fields = f.fields_for(association, new_object, :child_index => id) do |builder| render(association.to_s.singularize + "_fields", :f => builder, :model_name => model_name) end link_to(content_tag(:div, content_tag(:button, content_tag(:h6, name, :id => "add-estimate-button"), :class => "btn btn-success btn-mini"), :class => "mws-form-row"), '#', :class => "add_fields", :data => {:id => id, :fields => fields.gsub("\n", "")}) end |
#render_breadcrumb(divider) ⇒ Object
48 49 50 |
# File 'app/helpers/adminpanel/application_helper.rb', line 48 def (divider) render :partial => 'shared/breadcrumb', :locals => { :nav => , :divider => divider } end |
#section_is_login(section_name) ⇒ Object
24 25 26 |
# File 'app/helpers/adminpanel/application_helper.rb', line 24 def section_is_login(section_name) section_name.downcase == 'login' end |