This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/controllers/admin/designs_controller.rb

52 lines
1.0 KiB
Ruby

class Admin::DesignsController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :is_admin?
def index
@designs = Design.all.entries
end
def new
@design = Design.new
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
def edit_file
@design = Design.find(params[:id])
# debugger
end
def edit
@design = Design.find(params[:id])
end
def destroy
@design = Design.find(params[:id])
@design.destroy
redirect_to admin_designs_url
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