demarches-normaliennes/app/controllers/champs/repetition_controller.rb

19 lines
518 B
Ruby
Raw Normal View History

2019-01-30 16:14:15 +01:00
class Champs::RepetitionController < ApplicationController
before_action :authenticate_logged_user!
def show
2019-06-27 16:26:07 +02:00
@champ = policy_scope(Champ).find(params[:champ_id])
2019-01-30 16:14:15 +01:00
@position = params[:position]
row = (@champ.champs.empty? ? 0 : @champ.champs.last.row) + 1
@champ.add_row(row)
if @champ.private?
@attribute = "dossier[champs_private_attributes][#{@position}][champs_attributes]"
else
@attribute = "dossier[champs_attributes][#{@position}][champs_attributes]"
end
end
end