Verified Commit 1ace82a6 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻
Browse files

add routes actions and view for termination initiation form

parent e2295be4
class GroupOffersController < ApplicationController
include GroupAssignmentsAttributes
before_action :set_group_offer, only: [:show, :edit, :update, :destroy, :change_active_state]
before_action :set_group_offer, except: [:index, :search, :new, :create]
before_action :set_volunteer_collection
before_action :set_department_manager_collection
......@@ -77,6 +77,10 @@ class GroupOffersController < ApplicationController
end
end
def initiate_termination; end
def submit_initiate_termination; end
private
def set_group_offer
......
......@@ -16,15 +16,19 @@ class GroupOfferPolicy < ApplicationPolicy
end
# controller action policies
alias_method :index?, :superadmin_or_department_manager_is_responsible?
alias_method :search?, :superadmin_or_department_manager_is_responsible?
alias_method :new?, :superadmin_or_department_manager_is_responsible?
alias_method :create?, :superadmin_or_department_manager_is_responsible?
alias_method :show?, :superadmin_or_departments_offer_or_volunteer_included?
alias_method :edit?, :superadmin_or_department_manager_offer?
alias_method :update?, :superadmin_or_department_manager_offer?
alias_method :change_active_state?, :superadmin_or_department_manager_offer?
alias_method :index?, :superadmin_or_department_manager_is_responsible?
alias_method :search?, :superadmin_or_department_manager_is_responsible?
alias_method :new?, :superadmin_or_department_manager_is_responsible?
alias_method :create?, :superadmin_or_department_manager_is_responsible?
alias_method :show?, :superadmin_or_departments_offer_or_volunteer_included?
alias_method :edit?, :superadmin_or_department_manager_offer?
alias_method :update?, :superadmin_or_department_manager_offer?
alias_method :change_active_state?, :superadmin_or_department_manager_offer?
alias_method :initiate_termination?, :superadmin_or_department_manager_offer?
alias_method :submit_initiate_termination?, :superadmin_or_department_manager_offer?
alias_method :destroy?, :superadmin?
# supplemental policies
......
......@@ -85,13 +85,15 @@ table.table.table-striped
br
td= link_to offer.group_offer_category.category_name, url_for(q: search_parameters.merge(group_offer_category_id_eq: offer.group_offer_category.id))
td.index-action-cell.hidden-print
span= link_to t_action(:show), group_offer_path(offer)
span= link_to t('download'), group_offer_path(offer, format: :pdf)
span= link_to t_action(:edit), edit_group_offer_path(offer)
= link_to t_action(:show), group_offer_path(offer)
= link_to t('download'), group_offer_path(offer, format: :pdf)
= link_to t_action(:edit), edit_group_offer_path(offer)
- if policy(GroupOffer).destroy?
span= link_to t_action(:delete), group_offer_path(offer), confirm_deleting(offer)
span= link_to "#{ offer.active? ? t('.deactivate') : t('.activate') }",
= link_to t_action(:delete), group_offer_path(offer), confirm_deleting(offer)
= link_to "#{ offer.active? ? t('.deactivate') : t('.activate') }",
change_active_state_group_offer_path(offer), method: :put, remote: :true
= link_to_if(policy(GroupOffer).initiate_termination?, 'Beenden', initiate_termination_group_offer_path(offer)) { '' }
nav.navbar.section-navigation
ul.list-inline
......
h1 Gruppenangebot Beenden
= simple_form_for(@group_offer, url: initiate_termination_group_offer_path(@group_offer)) do |f|
= f.input :period_end, as: :date_picker
......@@ -68,6 +68,8 @@ Rails.application.routes.draw do
resources :group_offers, concerns: :search do
put :change_active_state, on: :member
get :initiate_termination, on: :member
put :initiate_termination, on: :member, to: 'group_offers#submit_initiate_termination'
end
get 'list_responses/hours', to: 'list_responses#hours'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment