Class: DcSimpleMenu
- Inherits:
-
Object
- Object
- DcSimpleMenu
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- app/models/dc_simple_menu.rb
Overview
Schema information
Collection name: dc_simple_menu : Simple menus
_id BSON::ObjectId _id
created_at Time created_at
updated_at Time updated_at
name String Menu name
description String Short description of
div_name String Div id name around area
link_prepend String Link field usually holds direct link to document. Prepand field holds data, that has to be prepanded to the link.
css String CSS for this
active Mongoid::Boolean Active
created_by BSON::ObjectId created_by
updated_by BSON::ObjectId updated_by
Embedded:DcSimpleMenuItem Menu items
Simple menus were first menu system developed for DRG CMS. They can be only two menu levels deep. Menus are described in dc_simple_menu_items embedded documents.
Class Method Summary collapse
-
.choices4_menu(site) ⇒ Object
Will return all top level menu items of specified menu.
Class Method Details
.choices4_menu(site) ⇒ Object
Will return all top level menu items of specified menu. Used in DcPage document for selecting top level selected menu, when document displayed in browser.
Called from DcApplicationHelper :dc_choices4_menu: method.
Parameters:
- Site
-
DcSite document. Site for which menu belongs to. If site is not specified
all current menus in collection will be returned.
Returns: Array. Of choices prepared for select input field.
77 78 79 80 81 82 83 84 85 86 87 |
# File 'app/models/dc_simple_menu.rb', line 77 def self.(site) rez = [] = (site..blank? ? all : where(name: site.)).to_a .each do || rez << [.name, nil] ..where(active: true).order_by(:order => 1).each do || rez << ['-- ' + .caption, ._id] end end rez end |