Skip to content

Commit

Permalink
Allow the duplication of phases and committees, and fix duplication o…
Browse files Browse the repository at this point in the history
…f admission processes
  • Loading branch information
JoaoFelipe committed Dec 11, 2023
1 parent 7724804 commit 4d680d7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/admissions/admission_committees_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ class Admissions::AdmissionCommitteesController < ApplicationController
config.columns[:members].show_blank_record = false
config.columns[:form_conditions].show_blank_record = false

config.actions << :duplicate
config.duplicate.link.label = "
<i title='#{I18n.t("active_scaffold.duplicate")}' class='fa fa-copy'></i>
".html_safe
config.duplicate.link.method = :get
config.duplicate.link.position = :after
config.actions.exclude :deleted_records
end
record_select(
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/admissions/admission_phases_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ class Admissions::AdmissionPhasesController < ApplicationController
}
config.columns[:consolidation_form].clear_link

config.actions << :duplicate
config.duplicate.link.label = "
<i title='#{I18n.t("active_scaffold.duplicate")}' class='fa fa-copy'></i>
".html_safe
config.duplicate.link.method = :get
config.duplicate.link.position = :after
config.actions.exclude :deleted_records
end
record_select(
Expand Down
6 changes: 6 additions & 0 deletions app/models/admissions/admission_committee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@ class Admissions::AdmissionCommittee < ActiveRecord::Base
def to_label
self.name
end

def initialize_dup(other)
super
self.members = other.members.map(&:dup)
self.form_conditions = other.form_conditions.map(&:dup)
end
end
6 changes: 6 additions & 0 deletions app/models/admissions/admission_phase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ def to_label
"#{self.name}"
end

def initialize_dup(other)
super
self.admission_phase_committees = other.admission_phase_committees.map(&:dup)
self.form_conditions = other.form_conditions.map(&:dup)
end

def committee_users_for_candidate(candidate, should_raise: nil)
users = {}
self.admission_committees.each do |committee|
Expand Down
5 changes: 5 additions & 0 deletions app/models/admissions/admission_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class Admissions::AdmissionProcess < ActiveRecord::Base
validate :max_greater_than_min_letters
validate :simple_url_is_unique_while_open

def initialize_dup(other)
super
self.phases = other.phases.map(&:dup)
end

def max_edit_date
return self.end_date if self.edit_date.nil?
self.edit_date
Expand Down

0 comments on commit 4d680d7

Please sign in to comment.