Class: Gluttonberg::Admin::Settings::StylesheetsController

Inherits:
BaseController show all
Defined in:
app/controllers/gluttonberg/admin/settings/stylesheets_controller.rb

Overview

CMS based stylesheets management

Instance Method Summary collapse

Instance Method Details

#createObject



22
23
24
25
26
27
28
# File 'app/controllers/gluttonberg/admin/settings/stylesheets_controller.rb', line 22

def create
  @stylesheet = Stylesheet.new(params[:gluttonberg_stylesheet])
  generic_create(@stylesheet, {
    :name => "stylesheet",
    :success_path => admin_stylesheets_path
  })
end

#deleteObject



45
46
47
48
49
50
51
52
# File 'app/controllers/gluttonberg/admin/settings/stylesheets_controller.rb', line 45

def delete
  display_delete_confirmation(
    :title      => "Delete Stylesheet '#{@stylesheet.name}'?",
    :url        => admin_stylesheet_path(@stylesheet),
    :return_url => admin_stylesheets_path,
    :warning    => ""
  )
end

#destroyObject



54
55
56
57
58
59
60
# File 'app/controllers/gluttonberg/admin/settings/stylesheets_controller.rb', line 54

def destroy
  generic_destroy(@stylesheet, {
    :name => "stylesheet",
    :success_path => admin_stylesheets_path,
    :failure_path => admin_stylesheets_path
  })
end

#editObject



30
31
32
33
34
35
# File 'app/controllers/gluttonberg/admin/settings/stylesheets_controller.rb', line 30

def edit
  unless params[:version].blank?
    @version = params[:version]
    @stylesheet.revert_to(@version)
  end
end

#indexObject



14
15
16
# File 'app/controllers/gluttonberg/admin/settings/stylesheets_controller.rb', line 14

def index
  @stylesheets = Stylesheet.order("position ASC")
end

#newObject



18
19
20
# File 'app/controllers/gluttonberg/admin/settings/stylesheets_controller.rb', line 18

def new
  @stylesheet = Stylesheet.new
end

#updateObject



37
38
39
40
41
42
43
# File 'app/controllers/gluttonberg/admin/settings/stylesheets_controller.rb', line 37

def update
  @stylesheet.assign_attributes(params[:gluttonberg_stylesheet])
  generic_update(@stylesheet, {
    :name => "stylesheet",
    :success_path => admin_stylesheets_path
  })
end