Skip to content

Commit

Permalink
Issue #448 - Change of the name of the "level program" on the configu…
Browse files Browse the repository at this point in the history
…ration screen, removal of the affiliation nested in teacher, in addition to the end and start dates in the program level show, update and create.
  • Loading branch information
IgorMonardez committed Sep 24, 2024
1 parent cec3b6e commit bbbc249
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 27 deletions.
3 changes: 1 addition & 2 deletions app/controllers/professors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class ProfessorsController < ApplicationController
config.columns[:civil_status].options = {
options: [["Solteiro(a)", "solteiro"], ["Casado(a)", "casado"]]
}
config.nested.add_link(:affiliations)
config.columns[:sex].form_ui = :select
config.columns[:sex].options = { options: [["Masculino", "M"],
["Feminino", "F"]] }
Expand Down Expand Up @@ -64,7 +63,7 @@ class ProfessorsController < ApplicationController
config.show.columns = [
:name, :email, :cpf, :birthdate, :address, :birthdate, :civil_status,
:identity_expedition_date, :identity_issuing_body, :identity_number,
:neighborhood, :sex, :enrollment_number, :siape,
:neighborhood, :sex, :enrollment_number, :siape, :institutions,
:telephone1, :telephone2, :zip_code, :scholarships,
:advisement_authorizations, :advisements_with_points,
:academic_title_level, :academic_title_institution,
Expand Down
26 changes: 9 additions & 17 deletions app/controllers/program_levels_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
class ProgramLevelsController < ApplicationController
authorize_resource
active_scaffold :program_level do |config|
config.create.columns = [:level]
config.update.columns = [:level]
config.create.columns = [:level, :start_date, :end_date]
config.update.columns = [:level, :start_date, :end_date]
config.show.columns = [:level, :start_date, :end_date]
config.list.columns = [:level, :start_date]
config.list.columns = [:level, :start_date, :end_date]

config.actions.swap :search, :field_search
config.columns.add :active
config.field_search.columns = [:active]

config.actions.exclude :deleted_records
end

protected

def do_update
# BEFORE UPDATE
# cria o histórico
Expand All @@ -31,17 +36,4 @@ def do_update
pl = ProgramLevel.last
pl.update!(start_date: pl.updated_at)
end

def do_create
super
# AFTER CREATE
# Coloca a data de início com a mesma do created_at

pl = ProgramLevel.last
pl.update!(start_date: pl.created_at)
end

def conditions_for_collection
["end_date is null"]
end
end
4 changes: 2 additions & 2 deletions app/models/professor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class Professor < ApplicationRecord
dependent: :restrict_with_exception
has_many :thesis_defense_committee_enrollments,
source: :enrollment, through: :thesis_defense_committee_participations
has_many :affiliations, dependent: :restrict_with_exception
has_many :institutions, through: :affiliations, dependent: :restrict_with_exception
has_many :affiliations
has_many :institutions, through: :affiliations
accepts_nested_attributes_for :affiliations, allow_destroy: true, reject_if: :all_blank

belongs_to :city, optional: true
Expand Down
2 changes: 1 addition & 1 deletion config/locales/navigation.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pt-BR:
notification_log: Notificações Enviadas
custom_variable: Variáveis
report_configuration: Configurações de Relatório
program_level: Nível
program_level: Conceito CAPES

logout:
label: 'Logout'
4 changes: 1 addition & 3 deletions config/locales/professor.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ pt-BR:
identity_issuing_place: "Local de Expedição"
identity_number: "Número da identidade"
affiliations: "Afiliações"
institution:
one: "Instituição"
other: "Instituições"
institutions: "Instituições"
name: "Nome"
neighborhood: "Bairro"
professor_research_areas: "Áreas de Pesquisa"
Expand Down
5 changes: 3 additions & 2 deletions config/locales/program_level.pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ pt-BR:
activerecord:
attributes:
program_level:
active: Ativo?
level: Nível
start_date: Data de início
end_date: Data de fim

models:
program_level:
one: Nível
other: Níveis
one: Conceito CAPES
other: Conceito CAPES

0 comments on commit bbbc249

Please sign in to comment.