Sha256: 078a962898dea62e782d46f564e952d306800c0e6c70ceff6a4b29d660b05d7a
Contents?: true
Size: 1.18 KB
Versions: 12
Compression:
Stored size: 1.18 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) 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) end def published_entries_quota Pageflow.config.quotas.get(:published_entries, current_user.account) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems