Module: Protozoa::Editable
- Included in:
- Views::Create, Views::Edit
- Defined in:
- lib/amiba/frontend/views/editable.rb
Instance Method Summary collapse
Instance Method Details
#categories ⇒ Object
def formats(selected = @page.format)
Gollum::Page::FORMAT_NAMES.map do |key, val|
{ :name => val,
:id => key.to_s,
:selected => selected == key}
end.sort do |a, b|
a[:name].downcase <=> b[:name].downcase
end
end
12 13 14 15 16 17 18 19 |
# File 'lib/amiba/frontend/views/editable.rb', line 12 def categories Dir.glob("entries/*").map do |ef| _, category = ef.split("/") {id: category, name: category.singularize.titleize } end.sort do |a, b| a[:name].downcase <=> b[:name].downcase end end |