Sha256: 5d356d26a4c6399b17d1057caef86356b81ab5e86b4e01c58990c8b0d167382e

Contents?: true

Size: 673 Bytes

Versions: 1

Compression:

Stored size: 673 Bytes

Contents

require_dependency "geri/application_controller"

module Geri
  class Admin::EditorController < ApplicationController
    include Geri::Admin::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

1 entries across 1 versions & 1 rubygems

Version Path
geri-0.0.1 app/controllers/geri/admin/editor_controller.rb