Sha256: 967ec168536bb0ad64365310a13ef060acd5fd56122c1c3c7def8f38fb8ed0bc
Contents?: true
Size: 895 Bytes
Versions: 6
Compression:
Stored size: 895 Bytes
Contents
module Pageflow module Editor class WidgetsController < Pageflow::ApplicationController respond_to :json before_action :authenticate_user! def index subject = find_subject authorize!(:edit, subject.to_model) @widgets = subject.resolve_widgets(include_placeholders: true) respond_with(@widgets) end def batch subject = find_subject authorize!(:edit, subject.to_model) subject.widgets.batch_update!(widget_batch_params) render(json: {}) end private def widget_batch_params params.permit(widgets: [:role, :type_name]).fetch(:widgets, []) end def find_subject if params[:collection_name] == 'entries' DraftEntry.find(params[:subject_id]) else Theming.find(params[:subject_id]) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems