Module: Groseillier::GroseillierHelper
- Defined in:
- app/helpers/groseillier/groseillier_helper.rb
Instance Method Summary collapse
- #actions ⇒ Object
- #full_page_class ⇒ Object
- #javascripts(&block) ⇒ Object
- #page_content(&block) ⇒ Object
- #page_footer(&block) ⇒ Object
- #page_header(title) ⇒ Object
- #render_flash_messages ⇒ Object
- #stylesheets(&block) ⇒ Object
Instance Method Details
#actions ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/helpers/groseillier/groseillier_helper.rb', line 19 def actions content_for(:action_bar) do capture_haml do yield end end end |
#full_page_class ⇒ Object
50 51 52 53 54 |
# File 'app/helpers/groseillier/groseillier_helper.rb', line 50 def full_page_class classes = controller.class.name.underscore.split('/') classes.map! { |c| c.chomp('_controller')} classes << controller.action_name end |
#javascripts(&block) ⇒ Object
31 32 33 |
# File 'app/helpers/groseillier/groseillier_helper.rb', line 31 def javascripts(&block) content_for(:javascripts, &block) end |
#page_content(&block) ⇒ Object
11 12 13 |
# File 'app/helpers/groseillier/groseillier_helper.rb', line 11 def page_content(&block) content_for(:page_content, &block) end |
#page_footer(&block) ⇒ Object
15 16 17 |
# File 'app/helpers/groseillier/groseillier_helper.rb', line 15 def (&block) content_for(:page_footer, &block) end |
#page_header(title) ⇒ Object
5 6 7 8 9 |
# File 'app/helpers/groseillier/groseillier_helper.rb', line 5 def page_header(title) content_for :page_header do content_tag :h1, truncate(title, length: 50, omission: '…') end end |
#render_flash_messages ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/helpers/groseillier/groseillier_helper.rb', line 35 def capture_haml do flash.each do |name, msg| haml_tag "p.flash.#{name}" do haml_concat image_tag("groseillier/icons/interactions/#{name}.png") haml_tag :strong do haml_concat t("flash.names.#{name}") end haml_concat " : #{msg}" end end end end |
#stylesheets(&block) ⇒ Object
27 28 29 |
# File 'app/helpers/groseillier/groseillier_helper.rb', line 27 def stylesheets(&block) content_for(:stylesheets, &block) end |