Verified Commit 8f4a52f2 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider
Browse files

feat(semester-process-volunteer): add controller, routes, policies and basic...

feat(semester-process-volunteer): add controller, routes, policies and basic scaffold for views to the model
parent 7c43861c
class SemesterProcessVolunteersController < ApplicationController
before_action :set_semester_process_volunteer, only: [:show, :edit, :update]
def index
authorize SemesterProcessVolunteer
@semester_process = SemesterProcess.find(params[:semester_process_id])
@semester_process_volunteers = @semester_process.semester_process_volunteers
end
def show; end
def edit; end
def update
if @semester_process_volunteer.update(semester_process_params)
redirect_to @semester_process_volunteer, notice: 'Semester process was successfully updated.'
else
render :edit
end
end
private
def set_semester_process_volunteer
@semester_process_volunteer = SemesterProcess.find(params[:id])
authorize @semester_process_volunteer
@semester_process = @semester_process_volunteer.semester_process
@volunteer = @semester_process_volunteer.volunteer
end
def semester_process_volunteer_params
params.require(:semester_process_volunteer).permit(:semester)
end
end
......@@ -2,6 +2,7 @@ class SemesterProcessPolicy < ApplicationPolicy
class Scope < ApplicationScope
def resolve
return all if superadmin?
none
end
end
......
class SemesterProcessVolunteerPolicy < ApplicationPolicy
class Scope < ApplicationScope
def resolve
return all if superadmin?
none
end
end
# Actions
alias_method :index?, :superadmin?
alias_method :show?, :superadmin?
alias_method :update?, :superadmin?
alias_method :edit?, :superadmin?
end
h1= t_title(:edit)
= simple_form_for(@semester_process_volunteer) do |f|
= form_navigation_btn :show
h1= t_title(:show)
= form_navigation_btn :edit
......@@ -994,6 +994,7 @@ de:
simple_form:
error_notification:
default_message: 'Bitte überprüfen Sie folgende Probleme:'
head_error: Es sind Fehler aufgetreten. Bitte überprüfen Sie die rot markierten Felder.
labels:
assignment:
<<: *id-termination-feedback-quests
......
......@@ -96,7 +96,9 @@ Rails.application.routes.draw do
get :send_half_year, on: :member
end
resources :semester_processes
resources :semester_processes do
resources :semester_process_volunteers, only: [:index, :show, :update, :edit]
end
resources :volunteer_applications, only: [:new, :create] do
get :thanks, on: :collection
......
......@@ -284,7 +284,7 @@ ActiveRecord::Schema.define(version: 20181004163636) do
end
create_table "events", force: :cascade do |t|
t.integer "kind"
t.integer "kind", null: false
t.date "date"
t.time "start_time"
t.time "end_time"
......
Markdown is supported
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