Module: RenderSortableTreeHelper::Render
- Defined in:
- app/helpers/render_sortable_tree_helper.rb
Class Attribute Summary collapse
-
.h ⇒ Object
Returns the value of attribute h.
-
.options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
- .children ⇒ Object
- .controls ⇒ Object
- .handler ⇒ Object
- .render_node(h, options) ⇒ Object
- .show_link ⇒ Object
Class Attribute Details
.h ⇒ Object
Returns the value of attribute h.
12 13 14 |
# File 'app/helpers/render_sortable_tree_helper.rb', line 12 def h @h end |
.options ⇒ Object
Returns the value of attribute options.
12 13 14 |
# File 'app/helpers/render_sortable_tree_helper.rb', line 12 def end |
Class Method Details
.children ⇒ Object
71 72 73 74 75 |
# File 'app/helpers/render_sortable_tree_helper.rb', line 71 def children unless [:children].blank? "<ol class='the_sortable_tree-nested_set'>#{ options[:children] }</ol>" end end |
.controls ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'app/helpers/render_sortable_tree_helper.rb', line 58 def controls node = [:node] edit_path = h.url_for(:controller => [:klass].pluralize, :action => :edit, :id => node) destroy_path = h.url_for(:controller => [:klass].pluralize, :action => :destroy, :id => node) " <a href='#{ edit_path }'> <i class='fa fa-edit fs20'></i> </a> " end |
.handler ⇒ Object
41 42 43 44 45 |
# File 'app/helpers/render_sortable_tree_helper.rb', line 41 def handler "<div class='the_sortable_tree-handler p5'> <i class='fa fa-arrows fs16'></i> </div>" end |
.render_node(h, options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/render_sortable_tree_helper.rb', line 14 def render_node(h, ) @h, = h, node = [:node] " <li data-node-id='#{ node.id }' class='the_sortable_tree-item'> <div class='ptz_table w100p p5 the_sortable_tree-item_content'> <div class='ptz_tr'> <div class='ptz_td vam w30'> #{ handler } </div> <div class='ptz_td vam'> #{ show_link } </div> <div class='ptz_td vam br-off w10 pr5'> #{ controls } </div> </div> </div> #{ children } </li> " end |
.show_link ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'app/helpers/render_sortable_tree_helper.rb', line 47 def show_link node = [:node] ns = [:namespace] url = h.url_for(:controller => [:klass].pluralize, :action => :show, :id => node) title_field = [:title] "<div class='fs15'> #{ h.link_to(node.send(title_field), url) } </div>" end |