From 3e6023f19a17af909da7126e5d4205310800b602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Mon, 10 Jan 2022 17:23:20 +0100 Subject: [PATCH] is administrative to is administration --- app/controllers/admin/university/people_controller.rb | 2 +- app/models/university/person.rb | 4 ++-- app/models/university/person/administrator.rb | 4 ++-- app/models/university/person/author.rb | 2 +- app/models/university/person/researcher.rb | 2 +- app/models/university/person/teacher.rb | 2 +- .../admin/education/school/administrators/_form.html.erb | 2 +- app/views/admin/university/people/_form.html.erb | 2 +- config/locales/university/en.yml | 4 ++-- config/locales/university/fr.yml | 4 ++-- ...10162001_rename_is_administration_in_university_people.rb | 5 +++++ db/schema.rb | 4 ++-- 12 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 db/migrate/20220110162001_rename_is_administration_in_university_people.rb diff --git a/app/controllers/admin/university/people_controller.rb b/app/controllers/admin/university/people_controller.rb index f838541bb..31e4032de 100644 --- a/app/controllers/admin/university/people_controller.rb +++ b/app/controllers/admin/university/people_controller.rb @@ -57,7 +57,7 @@ class Admin::University::PeopleController < Admin::University::ApplicationContro def person_params params.require(:university_person) .permit(:first_name, :last_name, :email, :phone, :biography, :slug, :user_id, - :is_author, :is_researcher, :is_teacher, :is_administrative) + :is_author, :is_researcher, :is_teacher, :is_administration) .merge(university_id: current_university.id) end end diff --git a/app/models/university/person.rb b/app/models/university/person.rb index ae11eb93d..ade0a1670 100644 --- a/app/models/university/person.rb +++ b/app/models/university/person.rb @@ -5,7 +5,7 @@ # id :uuid not null, primary key # email :string # first_name :string -# is_administrative :boolean +# is_administration :boolean # is_author :boolean # is_researcher :boolean # is_teacher :boolean @@ -86,7 +86,7 @@ class University::Person < ApplicationRecord before_validation :sanitize_email scope :ordered, -> { order(:last_name, :first_name) } - scope :administratives, -> { where(is_administrative: true) } + scope :administration, -> { where(is_administration: true) } scope :authors, -> { where(is_author: true) } scope :teachers, -> { where(is_teacher: true) } scope :researchers, -> { where(is_researcher: true) } diff --git a/app/models/university/person/administrator.rb b/app/models/university/person/administrator.rb index 6ff6a2952..3ec493978 100644 --- a/app/models/university/person/administrator.rb +++ b/app/models/university/person/administrator.rb @@ -5,7 +5,7 @@ # id :uuid not null, primary key # email :string # first_name :string -# is_administrative :boolean +# is_administration :boolean # is_author :boolean # is_researcher :boolean # is_teacher :boolean @@ -38,6 +38,6 @@ class University::Person::Administrator < University::Person def for_website?(website) # TODO - is_administrative + is_administration end end diff --git a/app/models/university/person/author.rb b/app/models/university/person/author.rb index 05aec96f7..3353e96cb 100644 --- a/app/models/university/person/author.rb +++ b/app/models/university/person/author.rb @@ -5,7 +5,7 @@ # id :uuid not null, primary key # email :string # first_name :string -# is_administrative :boolean +# is_administration :boolean # is_author :boolean # is_researcher :boolean # is_teacher :boolean diff --git a/app/models/university/person/researcher.rb b/app/models/university/person/researcher.rb index c7357faaf..bf8096a9f 100644 --- a/app/models/university/person/researcher.rb +++ b/app/models/university/person/researcher.rb @@ -5,7 +5,7 @@ # id :uuid not null, primary key # email :string # first_name :string -# is_administrative :boolean +# is_administration :boolean # is_author :boolean # is_researcher :boolean # is_teacher :boolean diff --git a/app/models/university/person/teacher.rb b/app/models/university/person/teacher.rb index b3aa5b759..63f7af282 100644 --- a/app/models/university/person/teacher.rb +++ b/app/models/university/person/teacher.rb @@ -5,7 +5,7 @@ # id :uuid not null, primary key # email :string # first_name :string -# is_administrative :boolean +# is_administration :boolean # is_author :boolean # is_researcher :boolean # is_teacher :boolean diff --git a/app/views/admin/education/school/administrators/_form.html.erb b/app/views/admin/education/school/administrators/_form.html.erb index b5bedea8c..42c01254a 100644 --- a/app/views/admin/education/school/administrators/_form.html.erb +++ b/app/views/admin/education/school/administrators/_form.html.erb @@ -7,7 +7,7 @@ <div class="row"> <div class="col-md-6"> <% used_administrator_ids = @school.administrators.where.not(id: administrator.id).pluck(:person_id) %> - <%= f.association :person, collection: current_university.people.administratives.where.not(id: used_administrator_ids).ordered %> + <%= f.association :person, collection: current_university.people.administration.where.not(id: used_administrator_ids).ordered %> </div> <div class="col-md-6"> <%= f.input :description, as: :string %> diff --git a/app/views/admin/university/people/_form.html.erb b/app/views/admin/university/people/_form.html.erb index 9c725da98..2a083df90 100644 --- a/app/views/admin/university/people/_form.html.erb +++ b/app/views/admin/university/people/_form.html.erb @@ -49,7 +49,7 @@ <%= f.input :is_author %> <%= f.input :is_teacher %> <%= f.input :is_researcher %> - <%= f.input :is_administrative %> + <%= f.input :is_administration %> </div> </div> </div> diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml index da4c0ba45..ef74dc7e0 100644 --- a/config/locales/university/en.yml +++ b/config/locales/university/en.yml @@ -21,7 +21,7 @@ en: education_programs: Programs email: Email first_name: First name - is_administrative: Administrative staff + is_administration: Administrative staff is_author: Author is_researcher: Researcher is_teacher: Teacher @@ -43,7 +43,7 @@ en: university: sms_sender_name: "11 characters max." university_person: - is_administrative: "Is part of administrative staff for a school." + is_administration: "Is part of administrative staff for a school." is_author: "Writes posts for websites." is_researcher: "Writes articles for journals." is_teacher: "Teaches in Schools." diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml index 415db01cd..56e561bb6 100644 --- a/config/locales/university/fr.yml +++ b/config/locales/university/fr.yml @@ -21,7 +21,7 @@ fr: education_programs: Formations email: Email first_name: Prénom - is_administrative: Personnel administratif + is_administration: Personnel administratif is_author: Auteur·rice is_researcher: Chercheur·se is_teacher: Enseignant·e @@ -43,7 +43,7 @@ fr: university: sms_sender_name: "11 caractères maximum." university_person: - is_administrative: "Fait partie du personnel administratif d'une école." + is_administration: "Fait partie du personnel administratif d'une école." is_author: "Écrit des articles pour les sites." is_researcher: "Écrit des articles dans des revues scientifiques." is_teacher: "Enseigne dans des formations." diff --git a/db/migrate/20220110162001_rename_is_administration_in_university_people.rb b/db/migrate/20220110162001_rename_is_administration_in_university_people.rb new file mode 100644 index 000000000..aa8717502 --- /dev/null +++ b/db/migrate/20220110162001_rename_is_administration_in_university_people.rb @@ -0,0 +1,5 @@ +class RenameIsAdministrationInUniversityPeople < ActiveRecord::Migration[6.1] + def change + rename_column :university_people, :is_administrative, :is_administration + end +end diff --git a/db/schema.rb b/db/schema.rb index 0fd499575..9a2421980 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_01_10_135442) do +ActiveRecord::Schema.define(version: 2022_01_10_162001) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -515,7 +515,7 @@ ActiveRecord::Schema.define(version: 2022_01_10_135442) do t.boolean "is_author" t.boolean "is_researcher" t.boolean "is_teacher" - t.boolean "is_administrative" + t.boolean "is_administration" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.string "phone" -- GitLab