Sha256: 22991111220bd78ba7eefa56d44bde6f2122fb3849849a9978822e8af9c2cdf6

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require_dependency 'nuntius/application_admin_controller'

module Nuntius
  module Admin
    class LayoutsController < ApplicationAdminController
      def index
        @layouts = Nuntius::Layout.visible.order(:name)
      end

      def new
        @layout = Nuntius::Layout.new
        render :edit
      end

      def create
        @layout = Nuntius::Layout.new(layout_params)
        @layout.save
        respond_with :admin, @layout
      end

      def edit
        @layout = Nuntius::Layout.visible.find(params[:id])
      end

      def show
        redirect_to :edit_admin_layout, status: :see_other
      end

      def update
        @layout = Nuntius::Layout.visible.find(params[:id])
        @layout.update(layout_params)
        respond_with :admin, @layout
      end

      def destroy
        @layout = Nuntius::Layout.visible.find(params[:id])
        @layout.destroy
        respond_with @layout
      end

      private

      def layout_params
        params.require(:layout).permit(:name, :data, :metadata_yaml)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nuntius-1.0.27 app/controllers/nuntius/admin/layouts_controller.rb