socialforge/app/controllers/web_footer_companies_contro...

49 lines
1.2 KiB
Ruby

class WebFooterCompaniesController < ApplicationController
layout 'admin'
menu_item :projects, :only => :projects
menu_item :plugins, :only => :plugins
menu_item :info, :only => :info
before_filter :require_admin
def index
@companys = WebFooterCompany.all
end
def new
@company = WebFooterCompany.new
end
def create
@company = WebFooterCompany.new(params[:web_footer_company])
if @company.save
flash[:notice] = l(:notice_successful_create)
redirect_to web_footer_companies_path
else
flash[:error] = "#{l :web_footer_company_create_fail}: #{@company.errors.full_messages[0]}"
render :action => 'new'
end
end
def destroy
@company = WebFooterCompany.find(params[:id])
@company.destroy
redirect_to web_footer_companies_path
end
def edit
@company = WebFooterCompany.find(params[:id])
end
def update
@company = WebFooterCompany.find(params[:id])
if @company.update_attributes(params[:web_footer_company])
flash[:notice] = l(:notice_successful_update)
redirect_to web_footer_companies_path
else
flash[:error] = "#{l :web_footer_company_update_fail}: #{@company.errors.full_messages[0]}"
render :action => 'edit'
end
end
end