Sha256: c06039be6dc512cce76fbf291bdb91100c6f3a922390c4c88517fa01eac7cdb2

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 KB

Contents

<%= content_tag :ul, :id => :menu, :class => :menu_links do %>
  <%= content_tag :li, nil, :class => :placeholder unless local_assigns[:root] %>

  <% prev_level = -1 %>

  <% category_class.each_with_level(categories) do |category, level| %>
    <%=raw '</ul></li>' if level <= prev_level %>
    <%=raw '</ul>' * (prev_level - level) if level < prev_level %>

    <li id="category_<%= category.id %>" class="category">
      <%= render :partial => 'sortable_nested_set/category', :object => category %>

      <ul id="subcategories_<%= category.id %>" class="sub_menu_links">
        <%= content_tag :li, :class => :placeholder do %>
          <%= content_tag :span, nil, :class => :handle %>
        <% end %>

    <% prev_level = level %>
  <% end %>

  <%=raw '</ul></li>' if prev_level != -1 %>
<% end %>

<% unless categories.empty? %>
  <% for category_id in sortable_ids %>
    <%= sortable_element_reporting_target "items_#{category_id}",
                                          :moved,
                                          :containment => sortable_ids.collect { |cid| "items_#{cid}" },
                                          :dropOnEmpty => true,
                                          :method => :put,
                                          :tag => :div,
                                          :url => sns_sort_items_categories_path %>
  <% end %>

  <%= sortable_element_reporting_target   :menu,
                                          :moved,
                                          :ghosting => true,
                                          :handle => :handle,
                                          :hoverclass => "'hovered'",
                                          :method => :put,
                                          :only => [ :category, :placeholder ],
                                          :tree => true,
                                          :url => sns_sort_categories_categories_path(:root => root) %>
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sortable_nested_set-0.1.23 app/views/sortable_nested_set/_tree.html.erb