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

21 lines
554 B
Ruby
Raw Normal View History

class Champs::RepetitionController < Champs::ChampController
def add
row = @champ.add_row(@champ.dossier.revision)
@first_champ_id = row.map(&:focusable_input_id).compact.first
@row_id = row.first&.row_id
@row_number = @row_id.nil? ? 0 : @champ.row_ids.find_index(@row_id) + 1
2019-01-30 16:14:15 +01:00
end
def remove
@champ.remove_row(params[:row_id])
@to_remove = "safe-row-selector-#{params[:row_id]}"
@to_focus = @champ.focusable_input_id || helpers.dom_id(@champ, :create_repetition)
end
private
def params_row_id
nil
end
2019-01-30 16:14:15 +01:00
end