2009-08-02 18:42:52 +02:00
|
|
|
class Foodcoop::WorkgroupsController < ApplicationController
|
2019-10-28 21:11:35 +01:00
|
|
|
before_action :authenticate_membership_or_admin,
|
2023-05-12 13:01:12 +02:00
|
|
|
except: [:index]
|
2009-08-02 18:42:52 +02:00
|
|
|
|
|
|
|
def index
|
2023-05-12 13:01:12 +02:00
|
|
|
@workgroups = Workgroup.order('name')
|
2009-08-02 18:42:52 +02:00
|
|
|
end
|
2021-03-01 15:27:26 +01:00
|
|
|
|
2009-08-02 18:42:52 +02:00
|
|
|
def edit
|
|
|
|
@workgroup = Workgroup.find(params[:id])
|
|
|
|
end
|
2021-03-01 15:27:26 +01:00
|
|
|
|
2009-08-02 18:42:52 +02:00
|
|
|
def update
|
|
|
|
@workgroup = Workgroup.find(params[:id])
|
2022-10-13 18:25:52 +02:00
|
|
|
if @workgroup.update(params[:workgroup])
|
2023-05-12 13:01:12 +02:00
|
|
|
redirect_to foodcoop_workgroups_url, notice: I18n.t('workgroups.update.notice')
|
2009-08-02 18:42:52 +02:00
|
|
|
else
|
2023-05-12 13:01:12 +02:00
|
|
|
render action: 'edit'
|
2009-08-02 18:42:52 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|