Sha256: 427e8f161a326b8c83459ce3003d4026f232be93751f1bd4387a387e14f939be

Contents?: true

Size: 769 Bytes

Versions: 6

Compression:

Stored size: 769 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|
        result.push(["#{'--'*i.level} #{i.name}", i.id, ({'data-full_url' => i.full_url} if full_url) ])
      end
      result
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
constructor-pages-0.8.5 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.4 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.3 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.2 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.1 app/helpers/constructor_pages/treeview_helper.rb
constructor-pages-0.8.0 app/helpers/constructor_pages/treeview_helper.rb