Sha256: c63951b6ec147fa86b2081fc3f1dc31193164247b5962e2efa45c8d877048018

Contents?: true

Size: 666 Bytes

Versions: 4

Compression:

Stored size: 666 Bytes

Contents

require_dependency "geri/application_controller"

module Geri
  class Admin::EditorController < ApplicationController
    include Geri::PagesHelper
    skip_before_action :verify_authenticity_token, only: [:update_contents]


    def index
      redirect_to '/'
    end

    def template
      render 'template', layout: false
    end

    def update_contents
      content_params.each do |name, content|
        Content.find_or_initialize_by(name: name).tap do |c|
          c.body = geri_sanitize(content)
        end.save!
      end
      render json: {sucess: true}
    end

    private

    def content_params
      params.require(:contents)
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geri-0.1.4 app/controllers/geri/admin/editor_controller.rb
geri-0.1.3 app/controllers/geri/admin/editor_controller.rb
geri-0.1.1 app/controllers/geri/admin/editor_controller.rb
geri-0.1.0 app/controllers/geri/admin/editor_controller.rb