2011-07-12 08:02:41 +00:00
|
|
|
class Admin::DesignsController < ApplicationController
|
|
|
|
layout "admin"
|
2011-07-22 07:54:38 +00:00
|
|
|
before_filter :authenticate_user!
|
|
|
|
before_filter :is_admin?
|
2011-07-12 08:02:41 +00:00
|
|
|
|
2011-07-19 10:31:53 +00:00
|
|
|
|
2011-07-12 08:02:41 +00:00
|
|
|
def index
|
|
|
|
@designs = Design.all.entries
|
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
2011-07-14 00:48:42 +00:00
|
|
|
@design = Design.new
|
2011-07-12 08:02:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
params[:design][:existing_task_attributes] ||= {}
|
|
|
|
@design = Design.find(params[:id])
|
|
|
|
if @design.update_attributes(params[:design])
|
|
|
|
flash[:notice] = "Successfully updated design and tasks."
|
|
|
|
redirect_to admin_designs_path(@design)
|
|
|
|
else
|
|
|
|
render :action => 'edit'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-07-26 10:22:17 +00:00
|
|
|
def file_edit
|
|
|
|
@design = Design.find(params[:id])
|
|
|
|
debugger
|
|
|
|
end
|
|
|
|
|
2011-07-12 08:02:41 +00:00
|
|
|
def edit
|
|
|
|
@design = Design.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2011-07-22 07:54:38 +00:00
|
|
|
@design = Design.find(params[:id])
|
|
|
|
@design.destroy
|
|
|
|
redirect_to admin_designs_url
|
2011-07-12 08:02:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@design = Design.new(params[:design])
|
|
|
|
if @design.save
|
|
|
|
flash[:notice] = "Successfully created design and tasks."
|
|
|
|
redirect_to admin_designs_path
|
|
|
|
else
|
|
|
|
render :action => 'new'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|