Module: Adminpanel::ApplicationHelper

Includes:
BreadcrumbsHelper, PluralizationsHelper, SessionsHelper, SharedPagesHelper
Defined in:
app/helpers/adminpanel/application_helper.rb

Instance Method Summary collapse

Methods included from PluralizationsHelper

#pluralize_es

Methods included from SharedPagesHelper

#active_tab, #class_name_downcase, #demodulize_class, #parent_object_name, #pluralize_model, #relationship_ids

Methods included from BreadcrumbsHelper

#breadcrumb_add, #initialize_breadcrumb, #render_breadcrumb

Methods included from SessionsHelper

#current_user, #current_user=, #sign_in, #sign_out, #signed_in?

Instance Method Details

#custom_form_for(name, *args, &block) ⇒ Object



8
9
10
11
12
13
# File 'app/helpers/adminpanel/application_helper.rb', line 8

def custom_form_for(name, *args, &block)
  options = args.extract_options!
  options.reverse_merge! :builder => Adminpanel::CustomFormBuilder, :html => { :class => "form-horizontal" }

  form_for(name, *(args << options), &block)
end

#full_title(page_title) ⇒ Object



15
16
17
18
19
20
21
22
# File 'app/helpers/adminpanel/application_helper.rb', line 15

def full_title(page_title)
  base_title = t("Panel title")
  if page_title.empty?
    base_title
  else
    "#{page_title} | #{base_title}"
  end
end

#is_current_section?(controller_name) ⇒ Boolean



24
25
26
# File 'app/helpers/adminpanel/application_helper.rb', line 24

def is_current_section?(controller_name)
  "adminpanel/#{controller_name.downcase.pluralize}".include?(params[:controller]) ? 'active' : nil
end


32
33
34
35
36
37
38
39
40
41
42
# File 'app/helpers/adminpanel/application_helper.rb', line 32

def link_to_add_fields(name, f, association)
  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("shared/image_fields", :f => builder)
  end
  link_to((:div, (:button,
        (:h6, name, :id => "add-image-button"),
         :class => "btn btn-success btn-mini"), :class => "mws-form-row"),
  '#', :class => "add_fields", :data => {:id => id, :fields => fields.gsub("\n", "")})
end

#main_root_pathObject



48
49
50
51
52
53
54
# File 'app/helpers/adminpanel/application_helper.rb', line 48

def main_root_path
  if main_app.respond_to?(root_path)
    main_app.root_path
  else
    "/"
  end
end

#route_symbol(model_name) ⇒ Object



44
45
46
# File 'app/helpers/adminpanel/application_helper.rb', line 44

def route_symbol(model_name)
  model_name.downcase.pluralize.downcase
end

#section_is_login(section_name) ⇒ Object



28
29
30
# File 'app/helpers/adminpanel/application_helper.rb', line 28

def (section_name)
  section_name.downcase == 'login'
end