Class: Decidim::Assemblies::Admin::AssemblyMembersController
- Inherits:
-
ApplicationController
- Object
- Decidim::Admin::ApplicationController
- ApplicationController
- Decidim::Assemblies::Admin::AssemblyMembersController
- Defined in:
- app/controllers/decidim/assemblies/admin/assembly_members_controller.rb
Overview
Controller that allows managing assembly members.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/decidim/assemblies/admin/assembly_members_controller.rb', line 22 def create :create, :assembly_member @form = form(AssemblyMemberForm).from_params(params) CreateAssemblyMember.call(@form) do on(:ok) do flash[:notice] = I18n.t("assembly_members.create.success", scope: "decidim.admin") redirect_to assembly_members_path(current_assembly) end on(:invalid) do flash[:alert] = I18n.t("assembly_members.create.error", scope: "decidim.admin") render :new end end end |
#destroy ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/decidim/assemblies/admin/assembly_members_controller.rb', line 63 def destroy @assembly_member = collection.find(params[:id]) :destroy, :assembly_member, member: @assembly_member DestroyAssemblyMember.call(@assembly_member, current_user) do on(:ok) do flash[:notice] = I18n.t("assembly_members.destroy.success", scope: "decidim.admin") redirect_to assembly_members_path(current_assembly) end end end |
#edit ⇒ Object
39 40 41 42 43 |
# File 'app/controllers/decidim/assemblies/admin/assembly_members_controller.rb', line 39 def edit @assembly_member = collection.find(params[:id]) :update, :assembly_member, member: @assembly_member @form = form(AssemblyMemberForm).from_model(@assembly_member) end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/decidim/assemblies/admin/assembly_members_controller.rb', line 12 def index :index, :assembly_member @assembly_members = filtered_collection end |
#new ⇒ Object
17 18 19 20 |
# File 'app/controllers/decidim/assemblies/admin/assembly_members_controller.rb', line 17 def new :create, :assembly_member @form = form(AssemblyMemberForm).instance end |
#update ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/decidim/assemblies/admin/assembly_members_controller.rb', line 45 def update @assembly_member = collection.find(params[:id]) :update, :assembly_member, member: @assembly_member @form = form(AssemblyMemberForm).from_params(params) UpdateAssemblyMember.call(@form, @assembly_member) do on(:ok) do flash[:notice] = I18n.t("assembly_members.update.success", scope: "decidim.admin") redirect_to assembly_members_path(current_assembly) end on(:invalid) do flash.now[:alert] = I18n.t("assembly_members.update.error", scope: "decidim.admin") render :edit end end end |