Add Item, Page, Component, Link inheritanced models

This commit is contained in:
Wen-Tien Chang committed 2010-01-14 18:30:53 +08:00
1 parent cd21cadfe7
commit e1440a79d8
38 files changed
+417 -175

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
class Admin::LinksController < ApplicationController
layout "admin"
before_filter :find_parent_item
def show
#TODO
end
def new
@link = Link.new
@link.is_published = true
@link.parent_item_name = @parent_item.name
end
def edit
@link = Link.find(params[:id])
end
def create
@link = Link.new(params[:link])
if @link.save
flash[:notice] = 'Link was successfully created.'
redirect_to admin_items_url( :parent_item_name => @link.parent_item_name )
else
render :action => "new"
end
end
def update
@link = Link.find(params[:id])
if @link.update_attributes(params[:link])
flash[:notice] = 'Link was successfully updated.'
redirect_to admin_items_url( :parent_item_name => @link.parent_item_name )
else
render :action => "edit"
end
end
def destroy
@link = Link.find(params[:id])
@link.destroy
redirect_to admin_items_url( :parent_item_name => @link.parent_item_name )
end
end