Module: ApplicationHelper
- Includes:
- TagsHelper
- Defined in:
- app/helpers/application_helper.rb
Overview
Methods added to this helper will be available to all templates in the application.
Instance Method Summary collapse
- #add_error_message ⇒ Object
-
#breadcrumbs ⇒ Object
See a breadcrumbs in page of gallery.
-
#flash_notice ⇒ Object
Display the notice in class Notice in paragraph if there are one.
-
#link_gallery_with_number(gallery) ⇒ Object
Get the link of Gallery with name and the number of picture in this gallery.
-
#page_title ⇒ Object
Define the title of page.
-
#parent_breadcrumbs_gallery(gallery) ⇒ Object
Generate the parent breadcrumb with recusive.
-
#status_value(status) ⇒ Object
Return the status of a boolean.
-
#tree_gallery(gallery) ⇒ Object
Generate the list by tree of Gallery in sidebar.
Instance Method Details
#add_error_message ⇒ Object
85 86 |
# File 'app/helpers/application_helper.rb', line 85 def end |
#breadcrumbs ⇒ Object
See a breadcrumbs in page of gallery
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/helpers/application_helper.rb', line 30 def = link_to this_webapp.webapp_name, root_path, :class => 'first-breadcrumb' unless @breadcrumb.nil? += content_tag(:label, " > ") if @breadcrumb.kind_of? Picture picture = @breadcrumb @breadcrumb = @breadcrumb.gallery end += (@breadcrumb) unless picture.nil? += content_tag(:label, " > ") += content_tag(:label, picture.title, :class => 'end-breadcrumb') end end if @finish_breadcrumb + " > " + @finish_breadcrumb else end end |
#flash_notice ⇒ Object
Display the notice in class Notice in paragraph if there are one
22 23 24 25 26 27 |
# File 'app/helpers/application_helper.rb', line 22 def flash_notice return '' unless flash[:notice] content_tag 'p', :class => 'notice' do flash[:notice] end end |
#link_gallery_with_number(gallery) ⇒ Object
Get the link of Gallery with name and the number of picture in this gallery
65 66 67 |
# File 'app/helpers/application_helper.rb', line 65 def link_gallery_with_number(gallery) link_to "#{gallery.title} [#{gallery.pictures.count}]", gallery_path(gallery), :class => ('current_gallery' if gallery == @gallery) end |
#page_title ⇒ Object
Define the title of page
16 17 18 19 |
# File 'app/helpers/application_helper.rb', line 16 def page_title return "#{this_webapp.webapp_name} - #{@page_title}" if @page_title return "#{this_webapp.webapp_name}" end |
#parent_breadcrumbs_gallery(gallery) ⇒ Object
Generate the parent breadcrumb with recusive
53 54 55 56 57 58 59 60 61 |
# File 'app/helpers/application_helper.rb', line 53 def (gallery) = "" unless gallery.parent.nil? += (gallery.parent) += content_tag(:label, " > ") end += link_to(gallery.name, gallery_path(gallery), :class => (@breadcrumb == gallery ? 'end-breadcrumb' : 'middle-breadcrumb')) end |
#status_value(status) ⇒ Object
Return the status of a boolean
7 8 9 10 11 12 13 |
# File 'app/helpers/application_helper.rb', line 7 def status_value(status) if status "Active" else "Disabled" end end |
#tree_gallery(gallery) ⇒ Object
Generate the list by tree of Gallery in sidebar
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/helpers/application_helper.rb', line 70 def tree_gallery(gallery) str = "" if @gallery == gallery || @gallery.ancestors.include?(gallery) str = "<ul>" gallery.children.each do |gallery_child| str += "<li>" str += link_gallery_with_number(gallery_child) str += tree_gallery(gallery_child) str += "</li>" end str += "</ul>" end str end |