Sha256: 3264500f0e1da73fd21fdab99da1267bd8c356cc16e9a70a5031dfef3decc440
Contents?: true
Size: 1.27 KB
Versions: 9
Compression:
Stored size: 1.27 KB
Contents
module Pageflow module Editor class EntryPublicationsController < Pageflow::ApplicationController respond_to :json before_filter :authenticate_user! def create entry = Entry.find(params[:entry_id]) authorize!(:publish, entry) verify_edit_lock!(entry) @entry_publication = build_entry_publication(entry) @entry_publication.save! render(action: :check) rescue Quota::ExceededError render(action: :check, status: :forbidden) rescue Entry::PasswordMissingError head(:bad_request) end def check entry = Entry.find(params[:entry_id]) authorize!(:publish, entry) @entry_publication = build_entry_publication(entry) end private def build_entry_publication(entry) EntryPublication.new(entry, entry_publication_params, published_entries_quota, current_user) end def entry_publication_params params.fetch(:entry_publication, {}).permit(:published_until, :password, :password_protected) end def published_entries_quota Pageflow.config.quotas.get(:published_entries, current_user.account) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems