Class: Decidim::Meetings::Admin::AgendaController
  
  
  
Overview
  
    
Controller that allows managing the agendas for the given meeting
   
 
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  #maps_enabled?, #meetings
  
  
    Instance Method Details
    
      
  
  
    #create  ⇒ Object 
  
  
  
  
    
      
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 
     | 
    
      # File 'app/controllers/decidim/meetings/admin/agenda_controller.rb', line 17
def create
  enforce_permission_to(:create, :agenda, meeting:)
  @form = form(MeetingAgendaForm).from_params(params, meeting:)
  CreateAgenda.call(@form) do
    on(:ok) do
      flash[:notice] = I18n.t("agenda.create.success", scope: "decidim.meetings.admin")
      redirect_to meetings_path
    end
    on(:invalid) do
      flash.now[:alert] = I18n.t("agenda.create.invalid", scope: "decidim.meetings.admin")
      render action: "new"
    end
  end
end
     | 
  
 
    
      
  
  
    #edit  ⇒ Object 
  
  
  
  
    
      
35
36
37
38
39 
     | 
    
      # File 'app/controllers/decidim/meetings/admin/agenda_controller.rb', line 35
def edit
  enforce_permission_to(:update, :agenda, agenda:, meeting:)
  @form = form(MeetingAgendaForm).from_model(agenda)
end 
     | 
  
 
    
      
  
  
    #new  ⇒ Object 
  
  
  
  
    
      
11
12
13
14
15 
     | 
    
      # File 'app/controllers/decidim/meetings/admin/agenda_controller.rb', line 11
def new
  enforce_permission_to(:create, :agenda, meeting:)
  @form = form(MeetingAgendaForm).instance
end 
     | 
  
 
    
      
  
  
    #update  ⇒ Object 
  
  
  
  
    
      
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57 
     | 
    
      # File 'app/controllers/decidim/meetings/admin/agenda_controller.rb', line 41
def update
  enforce_permission_to(:update, :agenda, agenda:, meeting:)
  @form = form(MeetingAgendaForm).from_params(params, meeting:)
  UpdateAgenda.call(@form, agenda) do
    on(:ok) do
      flash[:notice] = I18n.t("agenda.update.success", scope: "decidim.meetings.admin")
      redirect_to meetings_path
    end
    on(:invalid) do
      flash.now[:alert] = I18n.t("agenda.update.invalid", scope: "decidim.meetings.admin")
      render action: "edit"
    end
  end
end
     |