Add Item list interface, but acts_as_list can not used
This commit is contained in:
parent
f9b1618ac7
commit
93169b1098
|
@ -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>
|
||||
|
||||
|
|
|
@ -15,4 +15,6 @@ zh_tw:
|
|||
new_layout: 新增樣板
|
||||
announcement: 公告管理
|
||||
asset: 資產管理
|
||||
new_asset: 新增資產
|
||||
new_asset: 新增資產
|
||||
move_up: 往上移
|
||||
move_down: 往下移
|
|
@ -3,7 +3,7 @@ ActionController::Routing::Routes.draw do |map|
|
|||
map.resources :announcements
|
||||
|
||||
map.namespace :admin do |admin|
|
||||
admin.resources :items
|
||||
admin.resources :items, :member => { :up => :put, :down => :put }
|
||||
admin.resources :pages
|
||||
admin.resources :links
|
||||
admin.resources :components
|
||||
|
|
Loading…
Reference in New Issue