Module: Comatose::AdminHelper
- Defined in:
- app/helpers/comatose/admin_helper.rb
Instance Method Summary collapse
-
#collection_from_child_for_select(node, level, hide, options = []) ⇒ Object
Called by collection_from_node_for_select.
-
#collection_from_node_for_select(nodes, hide = nil, label = "Parent", add_initial = false) ⇒ Object
Used in the Page Form to build an indented drop-down list of pages.
-
#comatose_admin_javascripts(*names) ⇒ Object
TODO - broken.
-
#comatose_admin_stylesheets(*names) ⇒ Object
TODO - broken.
- #select_from_node(nodes, selected = nil, hide = nil, html_options = {}) ⇒ Object
-
#show_field?(key) ⇒ Boolean
Checks the hidden_meta_fields class variable for a specified field name…
Instance Method Details
#collection_from_child_for_select(node, level, hide, options = []) ⇒ Object
Called by collection_from_node_for_select
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/helpers/comatose/admin_helper.rb', line 62 def collection_from_child_for_select(node, level, hide, =[]) padding = " " * level * 4 padding += '* ' unless level == 0 hide_values = Array.new hide_values << hide if hide unless hide_values.include?(node.id) << ["#{padding}#{node.title}", node.id] node.children.each do |child| collection_from_child_for_select(child, level + 1, hide, ) end end return end |
#collection_from_node_for_select(nodes, hide = nil, label = "Parent", add_initial = false) ⇒ Object
Used in the Page Form to build an indented drop-down list of pages
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/helpers/comatose/admin_helper.rb', line 46 def collection_from_node_for_select(nodes, hide=nil, label="Parent", add_initial=false) level = 0 = [] if add_initial << ["No #{label}", 0] end nodes.each do |node| collection_from_child_for_select(node, level, hide, ) end return end |
#comatose_admin_javascripts(*names) ⇒ Object
TODO - broken
17 18 19 20 21 22 23 24 |
# File 'app/helpers/comatose/admin_helper.rb', line 17 def comatose_admin_javascripts(*names) strings = [] names ||= ['comatose_admin'] names.each do |name| strings << javascript_include_tag(name) end strings end |
#comatose_admin_stylesheets(*names) ⇒ Object
TODO - broken
5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/comatose/admin_helper.rb', line 5 def comatose_admin_stylesheets(*names) strings = [] names ||= ['comatose_admin'] names.each do |name| Comatose.logger.debug("[**Comatose**]: stylesheet tag for: #{name}") strings << stylesheet_link_tag(name) end strings.join("\n") end |
#select_from_node(nodes, selected = nil, hide = nil, html_options = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'app/helpers/comatose/admin_helper.rb', line 33 def select_from_node(nodes, selected=nil, hide=nil, ={}) [:tabindex] ||= 9 [:label] ||= "Parent" [:name] ||= "page[parent_id]" [:id] ||= "page_parent" [:blank] ||= false = (collection_from_node_for_select(nodes, hide, [:label], [:blank]), selected) select_tag [:name], , :id => [:id], :tabindex => [:tabindex] end |