Class: Udongo::Pages::TreeNode
- Inherits:
-
Object
- Object
- Udongo::Pages::TreeNode
- Defined in:
- lib/udongo/pages/tree_node.rb
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(context, page) ⇒ TreeNode
constructor
Context should contain accessible routes.
- #list_attributes ⇒ Object
- #state ⇒ Object
Constructor Details
#initialize(context, page) ⇒ TreeNode
Context should contain accessible routes.
4 5 6 7 |
# File 'lib/udongo/pages/tree_node.rb', line 4 def initialize(context, page) @context = context @page = page end |
Instance Method Details
#data ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/udongo/pages/tree_node.rb', line 9 def data { text: @page.description, type: :file, li_attr: list_attributes, data: { id: @page.id, url: @context.edit_translation_backend_page_path(@page, Udongo.config.i18n.app.default_locale), delete_url: @context.backend_page_path(@page, format: :json), deletable: @page.deletable?, draggable: @page.draggable?, update_position_url: @context.tree_drag_and_drop_backend_page_path(@page), visible: @page.visible?, toggle_visibility_url: @context.toggle_visibility_backend_page_path(@page, format: :json) }, children: [] # This gets filled through Udongo::Pages::Tree } end |
#list_attributes ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/udongo/pages/tree_node.rb', line 28 def list_attributes return if @page.visible? { class: 'jstree-node-invisible', title: I18n.t('b.msg.pages.invisible') } end |
#state ⇒ Object
37 38 39 40 41 |
# File 'lib/udongo/pages/tree_node.rb', line 37 def state { selected: false } end |