Module: Admin::NodeHelper
- Included in:
- PagesHelper
- Defined in:
- app/helpers/admin/node_helper.rb
Instance Method Summary collapse
- #children_class ⇒ Object
- #expanded ⇒ Object
- #expanded_rows ⇒ Object
- #expander(level) ⇒ Object
- #icon ⇒ Object
- #node_title ⇒ Object
- #padding_left(level) ⇒ Object
- #page_type ⇒ Object
- #render_node(page, locals = {}) ⇒ Object
- #show_all? ⇒ Boolean
- #spinner ⇒ Object
- #virtual_class ⇒ Object
Instance Method Details
#children_class ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/helpers/admin/node_helper.rb', line 37 def children_class unless @current_node.children.empty? if " children_visible" else " children_hidden" end else " no_children" end end |
#expanded ⇒ Object
29 30 31 |
# File 'app/helpers/admin/node_helper.rb', line 29 def show_all? || .include?(@current_node.id) end |
#expanded_rows ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/admin/node_helper.rb', line 13 def unless @expanded_rows @expanded_rows = case when rows = [:expanded_rows] rows.split(',').map { |x| Integer(x) rescue nil }.compact else [] end if homepage and !@expanded_rows.include?(homepage.id) @expanded_rows << homepage.id end end @expanded_rows end |
#expander(level) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'app/helpers/admin/node_helper.rb', line 53 def (level) unless @current_node.children.empty? or level == 0 image(( ? "collapse" : "expand"), :class => "expander", :alt => 'toggle children', :title => '') else "" end end |
#icon ⇒ Object
63 64 65 66 |
# File 'app/helpers/admin/node_helper.rb', line 63 def icon icon_name = @current_node.virtual? ? 'virtual_page' : 'page' image(icon_name, :class => "icon", :alt => '', :title => '') end |
#node_title ⇒ Object
68 69 70 |
# File 'app/helpers/admin/node_helper.rb', line 68 def node_title %{<span class="title">#{ h(@current_node.title) }</span>} end |
#padding_left(level) ⇒ Object
33 34 35 |
# File 'app/helpers/admin/node_helper.rb', line 33 def padding_left(level) (level * 23) + 9 end |
#page_type ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'app/helpers/admin/node_helper.rb', line 72 def page_type display_name = @current_node.class.display_name if display_name == 'Page' "" else %{<span class="info">(#{ h(display_name) })</span>} end end |
#render_node(page, locals = {}) ⇒ Object
3 4 5 6 7 |
# File 'app/helpers/admin/node_helper.rb', line 3 def render_node(page, locals = {}) @current_node = page locals.reverse_merge!(:level => 0, :simple => false).merge!(:page => page) render :partial => 'node', :locals => locals end |
#show_all? ⇒ Boolean
9 10 11 |
# File 'app/helpers/admin/node_helper.rb', line 9 def show_all? @controller.action_name == 'remove' end |
#spinner ⇒ Object
81 82 83 84 85 86 |
# File 'app/helpers/admin/node_helper.rb', line 81 def spinner image('spinner.gif', :class => 'busy', :id => "busy_#{@current_node.id}", :alt => "", :title => "", :style => 'display: none;') end |
#virtual_class ⇒ Object
49 50 51 |
# File 'app/helpers/admin/node_helper.rb', line 49 def virtual_class @current_node.virtual? ? " virtual": "" end |