Sha256: 97adbc8e6666688aa5f0fc08c5c47f24695d8670faf000dcae87b88b88d43a17

Contents?: true

Size: 1.31 KB

Versions: 15

Compression:

Stored size: 1.31 KB

Contents

class Admin::LayoutsController < AdminController

  def index
    @layouts = Layout.sys(_sid).order(:name).page(params[:page]).per(50)

    @layout = Layout.new
  end

  def create
    @layout = Layout.new(params[:layout])
    @layout.locale = 'en'
    @layout.handler = 'haml'
    @layout.format = 'html'
    @layout.path = '.'
    @layout.partial = 0
    @layout.system_id = _sid
    @layout.body = <<DOC
!!!
/ Layout: #{@layout.name}
%html
  %head
    = render :partial=>"layouts/kit_header"
    %style(type="text/css")
      div#edit_link { top:30px; }
  %body
    = yield
DOC
    @layout.user_id = current_user.id
    @layout.save
    Activity.add(_sid, "Created layout '#{@layout.name}'", current_user.id, "Layout")
    redirect_to "/admin/layouts"
  end

  def show 
    @layout = Layout.find_sys_id(_sid, params[:id])
  end

  def update 
    @layout = Layout.find_sys_id(_sid, params[:id])
    if @layout.update_attributes(params[:layout])
      Activity.add(_sid, "Updated layout '#{@layout.name}'", current_user.id, "Layout")
      redirect_to "/admin/layouts"
    else
      render "show"
    end
  end

  def destroy
    @layout = Layout.find_sys_id(_sid, params[:id])
    Activity.add(_sid, "Deleted layout '#{@layout.name}'", current_user.id, "Layout")
    Layout.destroy(params[:id])
    redirect_to "/admin/layouts"
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kit_cms-2.3.22 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.20 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.19 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.18 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.17 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.16 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.15 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.14 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.13 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.11 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.10 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.9 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.8 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.7 app/controllers/admin/layouts_controller.rb
kit_cms-2.3.6 app/controllers/admin/layouts_controller.rb