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
- #homepage ⇒ 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
46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/helpers/admin/node_helper.rb', line 46 def children_class unless @current_node.children.empty? if " children_visible" else " children_hidden" end else " no_children" end end |
#expanded ⇒ Object
38 39 40 |
# File 'app/helpers/admin/node_helper.rb', line 38 def show_all? || .include?(@current_node.id) end |
#expanded_rows ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/admin/node_helper.rb', line 22 def unless = case when rows = [:expanded_rows] rows.split(',').map { |x| Integer(x) rescue nil }.compact else [] end if homepage and !.include?(homepage.id) << homepage.id end end end |
#expander(level) ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'app/helpers/admin/node_helper.rb', line 62 def (level) unless @current_node.children.empty? or level == 0 image(( ? "collapse" : "expand"), :class => "expander", :alt => 'toggle children', :title => '') else "" end end |
#homepage ⇒ Object
14 15 16 |
# File 'app/helpers/admin/node_helper.rb', line 14 def homepage @homepage ||= Page.find_by_parent_id(nil) end |
#icon ⇒ Object
72 73 74 75 |
# File 'app/helpers/admin/node_helper.rb', line 72 def icon icon_name = @current_node.virtual? ? 'virtual_page' : 'page' image(icon_name, :class => "icon", :alt => '', :title => '') end |
#node_title ⇒ Object
77 78 79 |
# File 'app/helpers/admin/node_helper.rb', line 77 def node_title %{<span class="title">#{ h(@current_node.title) }</span>} end |
#padding_left(level) ⇒ Object
42 43 44 |
# File 'app/helpers/admin/node_helper.rb', line 42 def padding_left(level) (level * 23) + 9 end |
#page_type ⇒ Object
81 82 83 84 85 86 87 88 |
# File 'app/helpers/admin/node_helper.rb', line 81 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 8 9 10 11 12 |
# File 'app/helpers/admin/node_helper.rb', line 3 def render_node(page, locals = {}) @current_node = page page.extend MenuRenderer page.view = self if page. page.extend(*page.) end locals.reverse_merge!(:level => 0, :simple => false).merge!(:page => page) render :partial => 'admin/pages/node', :locals => locals end |
#show_all? ⇒ Boolean
18 19 20 |
# File 'app/helpers/admin/node_helper.rb', line 18 def show_all? @controller.action_name == 'remove' end |
#spinner ⇒ Object
90 91 92 93 94 95 |
# File 'app/helpers/admin/node_helper.rb', line 90 def spinner image('spinner.gif', :class => 'busy', :id => "busy_#{@current_node.id}", :alt => "", :title => "", :style => 'display: none;') end |
#virtual_class ⇒ Object
58 59 60 |
# File 'app/helpers/admin/node_helper.rb', line 58 def virtual_class @current_node.virtual? ? " virtual": "" end |