Sha256: 6b59b97c38c884e376e42f4e91cb17d6f16bd4d1f7c1c8a485070099e89d5b33

Contents?: true

Size: 917 Bytes

Versions: 12

Compression:

Stored size: 917 Bytes

Contents

module Admin
  class PartialsController < Admin::ApplicationController

    def index
      @partials = Admin::Partial.page(params[:page]).per(params[:per_page])

      respond_to do |format|
        format.js
        format.html
      end
    end

    def new
      @partial = Admin::Partial.new
    end

    def edit
      @partial = Admin::Partial.find(params[:id].to_i)
    end

    def create
      @partial = Admin::Partial.create(partial_params)
      respond_to do |format|
        format.html do
          redirect_to edit_admin_partial_path(@partial)
        end
      end
    end

    def update
      @partial = Admin::Partial.find(params[:id].to_i)
      @partial.update(partial_params)
      redirect_to edit_admin_partial_path(@partial) and return
    end

    protected

    def partial_params
      params.require(:admin_partial).permit(:title, :content, :javascript, :stylesheet)
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ecrire-0.26.2 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.26.1 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.26.0 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.25.2 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.25.1 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.25.0 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.24.1 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.24.0 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.23.0 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.22.1 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.21.0 lib/ecrire/app/controllers/admin/partials_controller.rb
ecrire-0.20.0 lib/ecrire/app/controllers/admin/partials_controller.rb