Module: StandardView::FormattingHelper

Defined in:
app/helpers/standard_view/formatting_helper.rb

Instance Method Summary collapse

Instance Method Details

#color_square(color, size: "24px") ⇒ Object



17
18
19
# File 'app/helpers/standard_view/formatting_helper.rb', line 17

def color_square(color, size: "24px")
  (:div, "", title: color, style: "width: #{size}; height: #{size}; background: #{color}")
end

#heading_for_model(model) ⇒ Object



13
14
15
# File 'app/helpers/standard_view/formatting_helper.rb', line 13

def heading_for_model(model)
  model.model_name.human.titleize
end

#title_for_collection(collection) ⇒ Object



5
6
7
# File 'app/helpers/standard_view/formatting_helper.rb', line 5

def title_for_collection(collection)
  title_for_model(collection.model)
end

#title_for_model(model) ⇒ Object



9
10
11
# File 'app/helpers/standard_view/formatting_helper.rb', line 9

def title_for_model(model)
  heading_for_model(model).pluralize
end