Sha256: dfd5d7495c551dd59ae86737158abf351f9d1641345dbc8323bbdfdeb409e563

Contents?: true

Size: 798 Bytes

Versions: 15

Compression:

Stored size: 798 Bytes

Contents

module ConstructorPages
  module TreeviewHelper
    def arrow_buttons_for(item)
      output = "<div class='btn-group'>"

      {down: :right, up: :left}.each_pair do |a, b|
        sibling = item.send(b.to_s+'_sibling')
        if sibling and item.move_possible?(sibling)
          output += link_to("<i class='icon-arrow-#{a}'></i>".html_safe, "/admin/#{item.class.to_s.demodulize.downcase.pluralize}/move/#{a}/#{item.id}", class: 'btn btn-mini')
        end
      end

      output += "</div>"
      output.html_safe
    end

    def for_select(items, full_url = false)
      result = []
      items && items.each do |i|
        arr = ["#{'--'*i.level} #{i.name}", i.id]
        arr << {'data-full_url' => i.full_url} if full_url
        result.push(arr)
      end
      result
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
constructor-pages-0.9.1 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.9.0 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.19 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.18 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.17 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.16 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.15 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.14 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.13 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.12 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.11 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.10 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.8 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.7 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.6 app/helpers/constructor_pages/treeview_helper.rb