Chris's first commit at Fri Jan 28 2011 10:14:32 GMT+0800 (CST)

This commit is contained in:
ihower committed 2011-04-13 18:19:51 +08:00
1 parent 554aa0a95d
commit 19a7d51e60
145 files changed
+12742 -893

No files matched your search

+10 -6
View File
@@ -3,6 +3,7 @@ class Admin::LinksController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :find_parent_item
before_filter :is_admin?
def show
#TODO
@@ -11,19 +12,22 @@ class Admin::LinksController < ApplicationController
def new
@link = Link.new
@link.is_published = true
@link.parent_name = @parent_item.name
@link.parent_id = @parent_item.id rescue nil
session[:last_page] = get_go_back || admin_links_url
end
def edit
@link = Link.find(params[:id])
@i18n_variable = @link.i18n_variable
session[:last_page] = get_go_back || admin_links_url
end
def create
@link = Link.new(params[:link])
if @link.save
flash[:notice] = 'Link was successfully created.'
redirect_to admin_items_url( :parent_name => @link.parent_name )
flash[:notice] = t('admin.create_success_link')
redirect_to admin_items_url( :parent_id => @link.parent_id )
else
render :action => "new"
end
@@ -33,8 +37,8 @@ class Admin::LinksController < ApplicationController
@link = Link.find(params[:id])
if @link.update_attributes(params[:link])
flash[:notice] = 'Link was successfully updated.'
redirect_to admin_items_url( :parent_name => @link.parent_name )
flash[:notice] = t('admin.update_success_link')
redirect_to admin_items_url( :parent_id => @link.parent_id )
else
render :action => "edit"
end
@@ -44,7 +48,7 @@ class Admin::LinksController < ApplicationController
@link = Link.find(params[:id])
@link.destroy
redirect_to admin_items_url( :parent_name => @link.parent_name )
redirect_to admin_items_url( :parent_id => @link.parent_id )
end
end