Sha256: 94846e8c297a318222718cd975b0a0e81ee7b4886ecbf32b0d368ff3ac28b7c1
Contents?: true
Size: 1.28 KB
Versions: 19
Compression:
Stored size: 1.28 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(entry), current_user) end def entry_publication_params params.fetch(:entry_publication, {}).permit(:published_until, :password, :password_protected) end def published_entries_quota(entry) Pageflow.config.quotas.get(:published_entries, entry.account) end end end end
Version data entries
19 entries across 19 versions & 1 rubygems