Class: Admin::LogosController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/logos_controller.rb

Overview

COPYRIGHT:

Copyright (c) 2005-2009 North Carolina State University
Developed with funding for the National eXtension Initiative.

LICENSE:

see LICENSE file

Instance Method Summary (collapse)

Instance Method Details

- (Object) create



23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/admin/logos_controller.rb', line 23

def create
  @logo = Logo.new(params[:logo])
  @logo.logotype = Logo::SPONSOR

  if @logo.save
    flash[:notice] = 'Logo was successfully uploaded.'
    AdminLog.log_event(current_person, AdminLog::CREATE_LOGO,{:logo_id => @logo.id, :logo_filename => @logo.filename})      
    redirect_to(admin_logos_url)
  else
    render(:action => "new")
  end
end

- (Object) destroy



36
37
38
39
40
41
# File 'app/controllers/admin/logos_controller.rb', line 36

def destroy
  @logo = Logo.find(params[:id])
  AdminLog.log_event(current_person, AdminLog::DELETE_LOGO,{:logo_id => @logo.id, :logo_filename => @logo.filename})
  @logo.destroy
  redirect_to(admin_logos_url)
end

- (Object) index



14
15
16
17
# File 'app/controllers/admin/logos_controller.rb', line 14

def index
  set_title('Manage Logos - Pubsite Admin')
  @logos = Logo.sponsorlogos.find(:all, :conditions => { :parent_id => nil }, :order => 'created_at DESC')
end

- (Object) new



19
20
21
# File 'app/controllers/admin/logos_controller.rb', line 19

def new
  @logo = Logo.new
end