Add Item list interface, but acts_as_list can not used
This commit is contained in:
1 parent
f9b1618ac7
commit
93169b1098
7 files changed
+30
-14
No files matched your search
@@ -9,6 +9,18 @@ class Admin::ItemsController < ApplicationController
|
||||
@items.unshift Item.find_by_name("root") if @parent_item.name == 'root'
|
||||
end
|
||||
|
||||
def up
|
||||
@item = Item.find(params[:id])
|
||||
@item.move_higher
|
||||
redirect_to admin_items_url( :parent_name => @item.parent_name )
|
||||
end
|
||||
|
||||
def down
|
||||
@item = Item.find(params[:id])
|
||||
@item.move_lower
|
||||
redirect_to admin_items_url( :parent_name => @item.parent_name )
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def find_snippets
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<tr>
|
||||
<td><%= item.class %></td>
|
||||
|
||||
<td><%= item.class %></td>
|
||||
<td><%= link_to item.name, admin_items_path(:parent_name => item.name) %></td>
|
||||
<td><%=h item.title %>
|
||||
<td><%= item.position %></td>
|
||||
@@ -8,5 +8,4 @@
|
||||
<%= link_to t(:show), item.url %> |
|
||||
<%= link_to t(:edit), edit_admin_component_path(item) %> |
|
||||
<%= link_to t(:delete), admin_component_path(item), :confirm => 'Are you sure?', :method => :delete %>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
@@ -1,4 +1,4 @@
|
||||
<tr>
|
||||
|
||||
<td><%= item.class %></td>
|
||||
<td><%= link_to item.name, admin_items_path(:parent_name => item.name) %></td>
|
||||
<td><%=h item.title %>
|
||||
@@ -8,5 +8,4 @@
|
||||
<%= link_to t(:show), item.url %> |
|
||||
<%= link_to t(:edit), edit_admin_link_path(item) %> |
|
||||
<%= link_to t(:delete), admin_link_path(item), :confirm => 'Are you sure?', :method => :delete %>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
@@ -1,5 +1,5 @@
|
||||
<tr>
|
||||
<td><%= item.class %></td>
|
||||
|
||||
<td><%= item.class %></td>
|
||||
<td><%= link_to item.name, admin_items_path(:parent_name => item.name) %></td>
|
||||
<td><%=h item.title %>
|
||||
<td><%= item.position %></td>
|
||||
@@ -8,5 +8,4 @@
|
||||
<%= link_to t(:show), item.url %> |
|
||||
<%= link_to t(:edit), edit_admin_page_path(item) %> |
|
||||
<%= link_to t(:delete), admin_page_path(item), :confirm => 'Are you sure?', :method => :delete %>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
@@ -17,10 +17,15 @@
|
||||
<th>Position</th>
|
||||
<th>Published?</th>
|
||||
<th>Action</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @items.each do |item| %>
|
||||
<%= render :partial => item.class.to_s.downcase, :locals => { :item => item } %>
|
||||
<tr>
|
||||
<%= render :partial => item.class.to_s.downcase, :locals => { :item => item } %>
|
||||
<!--<td><%= link_to t(:move_up, :scope => :admin), up_admin_item_path(item), :method => :put %> |
|
||||
<%= link_to t(:move_down, :scope => :admin), down_admin_item_path(item), :method => :put %></td>-->
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
|
||||
Reference in new issue
Block a user