Module: Adminpanel::ApplicationHelper
Instance Method Summary
collapse
#active_tab, #belong_to_object_name, #class_name_downcase, #demodulize_class, #get_oauth_link, #pluralize_model, #relationship_ids
#breadcrumb_add, #render_breadcrumb
#current_user, #current_user=, #sign_in, #sign_out, #signed_in?
Instance Method Details
7
8
9
10
11
12
|
# File 'app/helpers/adminpanel/application_helper.rb', line 7
def adminpanel_form_for(name, *args, &block)
options = args.
options.reverse_merge! :builder => Adminpanel::AdminpanelFormBuilder, :html => { :class => "form-horizontal" }
form_for(name, *(args << options), &block)
end
|
#full_title(page_title) ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'app/helpers/adminpanel/application_helper.rb', line 14
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?(display_name) ⇒ Boolean
23
24
25
|
# File 'app/helpers/adminpanel/application_helper.rb', line 23
def is_current_section?(display_name)
display_name == params[:controller].classify.constantize.display_name ? 'active' : nil
end
|
#link_to_add_fields(name, f, association) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/helpers/adminpanel/application_helper.rb', line 31
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(content_tag(:div, content_tag(:button,
content_tag(: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_path ⇒ Object
51
52
53
54
55
56
57
|
# File 'app/helpers/adminpanel/application_helper.rb', line 51
def main_root_path
if main_app.respond_to?(root_path)
main_app.root_path
else
"/"
end
end
|
#route_symbol(model_name) ⇒ Object
43
44
45
|
# File 'app/helpers/adminpanel/application_helper.rb', line 43
def route_symbol(model_name)
model_name.pluralize.downcase
end
|
#section_is_login(section_name) ⇒ Object
27
28
29
|
# File 'app/helpers/adminpanel/application_helper.rb', line 27
def section_is_login(section_name)
section_name.downcase == 'login'
end
|
#symbol_class(symbol_model) ⇒ Object
47
48
49
|
# File 'app/helpers/adminpanel/application_helper.rb', line 47
def symbol_class(symbol_model)
"adminpanel/#{symbol_model.to_s.singularize}".classify.constantize
end
|