Class: Spud::Admin::TemplatesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Spud::Admin::TemplatesController
- Defined in:
- app/controllers/spud/admin/templates_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/spud/admin/templates_controller.rb', line 20 def create "New", :new_spud_admin_template_path @template = SpudTemplate.new(params[:spud_template]) flash[:notice] = "Template created successfully!" if @template.save respond_with @template, :location => spud_admin_templates_url end |
#destroy ⇒ Object
44 45 46 47 48 49 |
# File 'app/controllers/spud/admin/templates_controller.rb', line 44 def destroy flash[:notice] = "Template removed" if @template.destroy respond_with @template, :location => spud_admin_templates_url end |
#edit ⇒ Object
30 31 32 33 |
# File 'app/controllers/spud/admin/templates_controller.rb', line 30 def edit "Edit #{@template.name}", :edit_spud_admin_template_path respond_with @template end |
#index ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/spud/admin/templates_controller.rb', line 8 def index flash.now[:warning] = "Templates are an advanced way to create modified pages and require some experience in HTML and Ruby." @templates = SpudTemplate.order(:name).paginate :page => params[:page] respond_with @templates end |
#new ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/spud/admin/templates_controller.rb', line 14 def new "New", :new_spud_admin_template_path @template = SpudTemplate.new(:base_layout => Spud::Cms.default_page_layout,:page_parts => Spud::Cms.default_page_parts.join(",")) respond_with @template end |
#update ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/controllers/spud/admin/templates_controller.rb', line 35 def update "Edit #{@template.name}", :edit_spud_admin_template_path flash[:notice] = "Template updated successfully" if @template.update_attributes(params[:spud_template]) respond_with @template, :location => spud_admin_templates_url end |