diff --git a/app/controllers/admin/university/organizations_controller.rb b/app/controllers/admin/university/organizations_controller.rb index 3f56e50328a8d0a8952682f20049316c13b00157..853399ad3c9204edf4904c332fbd41f3b06d90f6 100644 --- a/app/controllers/admin/university/organizations_controller.rb +++ b/app/controllers/admin/university/organizations_controller.rb @@ -70,7 +70,7 @@ class Admin::University::OrganizationsController < Admin::University::Applicatio params.require(:university_organization) .permit( :name, :long_name, :slug, :meta_description, :summary, :active, :siren, :kind, - :address, :zipcode, :city, :country, :text, + :address, :address_name, :address_additional, :zipcode, :city, :country, :text, :url, :phone, :email, :linkedin, :twitter, :mastodon, :logo, :logo_delete, :logo_infos, :logo_on_dark_background, :logo_on_dark_background_delete, :logo_on_dark_background_infos, diff --git a/app/models/university/organization.rb b/app/models/university/organization.rb index 142c0c8c7eb69517cc7007f57953b76af735c8e1..26ec7059d1f864b72ae4e27ff8894ce0e799b61a 100644 --- a/app/models/university/organization.rb +++ b/app/models/university/organization.rb @@ -2,32 +2,34 @@ # # Table name: university_organizations # -# id :uuid not null, primary key -# active :boolean default(TRUE) -# address :string -# city :string -# country :string -# email :string -# kind :integer default("company") -# latitude :float -# linkedin :string -# long_name :string -# longitude :float -# mastodon :string -# meta_description :text -# name :string -# nic :string -# phone :string -# siren :string -# slug :string -# summary :text -# text :text -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# active :boolean default(TRUE) +# address :string +# address_additional :string +# address_name :string +# city :string +# country :string +# email :string +# kind :integer default("company") +# latitude :float +# linkedin :string +# long_name :string +# longitude :float +# mastodon :string +# meta_description :text +# name :string +# nic :string +# phone :string +# siren :string +# slug :string +# summary :text +# text :text +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/views/admin/university/organizations/_form.html.erb b/app/views/admin/university/organizations/_form.html.erb index 213edbf4319c8f3b4b005f949c44c5e56e6eb019..fd52c9d8d69016727929ec7fc05f723be3e9d6db 100644 --- a/app/views/admin/university/organizations/_form.html.erb +++ b/app/views/admin/university/organizations/_form.html.erb @@ -13,20 +13,22 @@ data: { 'summernote-config' => 'mini-list' } } %> <% end %> - <%= osuny_panel University::Organization.human_attribute_name('contact') do %> + <%= osuny_panel University::Organization.human_attribute_name('physical') do %> <div class="row pure__row--small"> <div class="col-xl-6"> + <%= f.input :address_name %> <%= f.input :address %> + <%= f.input :address_additional %> </div> <div class="col-xl-6"> <%= f.input :zipcode %> - </div> - <div class="col-xl-6"> <%= f.input :city %> - </div> - <div class="col-xl-6"> <%= f.input :country, input_html: { class: 'form-select' } %> </div> + </div> + <% end %> + <%= osuny_panel University::Organization.human_attribute_name('digital') do %> + <div class="row pure__row--small"> <div class="col-xl-6"> <%= f.input :url %> </div> diff --git a/app/views/admin/university/organizations/show.html.erb b/app/views/admin/university/organizations/show.html.erb index ca48b6993f9cde4f5d61b0c5e076117a83e3374f..5454b724f81da5f38f0b7b4dcc97649f68077917 100644 --- a/app/views/admin/university/organizations/show.html.erb +++ b/app/views/admin/university/organizations/show.html.erb @@ -7,21 +7,36 @@ <%= @organization.text.to_s.html_safe %> <% end if strip_tags(@organization.text.to_s).present? %> - <%= osuny_panel University::Organization.human_attribute_name('contact') do %> + <%= osuny_panel University::Organization.human_attribute_name('physical') do %> <div class="row pure__row--small"> - <% [ - :address, + <div class="col-xxl-6"> + <% [ + :address_name, + :address, + :address_additional, + ].each do |property| %> + <% value = @organization.send property %> + <% next if value.blank? %> + <%= osuny_label University::Organization.human_attribute_name(property) %> + <p><%= value %></p> + <% end %> + </div> + <div class="col-xxl-6"> + <% [ :zipcode, :city, - :country + :country, ].each do |property| %> - <% value = @organization.send property %> - <% next if value.blank? %> - <div class="col-xxl-6"> - <%= osuny_label University::Organization.human_attribute_name(property) %> - <p><%= value %></p> - </div> - <% end %> + <% value = @organization.send property %> + <% next if value.blank? %> + <%= osuny_label University::Organization.human_attribute_name(property) %> + <p><%= value %></p> + <% end %> + </div> + </div> + <% end %> + <%= osuny_panel University::Organization.human_attribute_name('digital') do %> + <div class="row pure__row--small"> <% unless @organization.url.blank? %> <div class="col-xxl-6"> <%= osuny_label University::Organization.human_attribute_name('url') %> @@ -47,6 +62,7 @@ </div> <% end %> + <%= osuny_panel University::Organization.human_attribute_name('legal') do %> <div class="row pure__row--small"> <div class="col-xxl-6"> diff --git a/app/views/admin/university/organizations/static.html.erb b/app/views/admin/university/organizations/static.html.erb index d5dfa7df56673c1eeab9a2531df5b28da1df3518..60054f0d4fbeacd0eb5c737974fdfedd7db117d9 100644 --- a/app/views/admin/university/organizations/static.html.erb +++ b/app/views/admin/university/organizations/static.html.erb @@ -10,7 +10,9 @@ kind: [ :long_name, :siren, + :address_name, :address, + :address_additional, :zipcode, :city, :country, diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml index e379782d10e5dcad662ac08e502acabb48e37bbc..fe0f1837a2e62dab6835db1f1cfd4a7ec72e502b 100644 --- a/config/locales/university/en.yml +++ b/config/locales/university/en.yml @@ -85,11 +85,13 @@ en: target_id: '' university/organization: address: Address + address_name: Address name + address_additional: Additional address city: City - contact: Contact information country: Country - email: Email description: Personne morale liée à une université, une composante, un laboratoire, etc. + digital: Digital contact + email: Email kind: Kind legal: Legal information linkedin: LinkedIn @@ -98,6 +100,7 @@ en: long_name: Long name name: Name phone: Telephone + physical: Contact information siren: Legal identification number text: Text twitter: Twitter @@ -140,9 +143,15 @@ en: sms_sender_name: "11 characters max. Only alphanumeric chars ([A-Z][a-z][0-9])." sso_button_label: "Default: Sign in via SSO" university_organization: + address: 'This field is used for geolocation. Ex: 3 rue de la Poste' + address_name: 'This field is not used for geolocation. Ex: Hôtel du Département' + address_additional: 'This field is not used for geolocation. Ex: Bureau 508' + city: 'This field is used for geolocation. Ex: Cenon' + country: 'This field is used for geolocation. Ex: France' description: If this field is empty the main text's begining will be used. logo: This logo should contrast properly on a light bacgkground (white or pale grey) logo_on_dark_background: This logo should contrast on a dark background (black or dark grey) + zipcode: 'This field is used for geolocation. Ex: 33150' university_person: description: If this field is empty, "short description" field will be used. If also emty the main text's begining will be used. habilitation: "Possesses an accreditation to supervise research." diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml index e27af33f636acd2ce38a7bd662c4108628ab29a1..00e6aa77c29a083deb905d3114caa9949e73379c 100644 --- a/config/locales/university/fr.yml +++ b/config/locales/university/fr.yml @@ -85,10 +85,12 @@ fr: target_id: '' university/organization: address: Adresse + address_name: Nom de l'adresse + address_additional: Complément d'adresse city: Ville - contact: Informations de contact country: Pays description: Personne morale liée à une université, une composante, un laboratoire, etc. + digital: Coordonnées numériques email: Email kind: Type legal: Informations légales @@ -98,6 +100,7 @@ fr: long_name: Nom complet name: Nom phone: Téléphone + physical: Coordonnées physiques siren: Numéro de SIREN text: Texte twitter: Twitter @@ -140,9 +143,15 @@ fr: sms_sender_name: "11 caractères maximum. Que des caractères alphadécimaux ([A-Z][a-z][0-9])." sso_button_label: "Par défaut : Se connecter en SSO" university_organization: + address: 'Ce champ est utilisé pour géolocaliser. Ex: 3 rue de la Poste' + address_name: 'Ce champ est ignoré dans la géolocalisation. Ex: Hôtel du Département' + address_additional: 'Ce champ est ignoré dans la géolocalisation. Ex: Bureau 508' + city: 'Ce champ est utilisé pour géolocaliser. Ex: Cenon' + country: 'Ce champ est utilisé pour géolocaliser. Ex: France' description: Si ce champ est vide le début du texte principal sera utilisé. logo: Ce logo doit contraster sur un fond clair (blanc ou gris pâle) logo_on_dark_background: Ce logo doit contraster sur un fond sombre (noir ou gris sombre). + zipcode: 'Ce champ est utilisé pour géolocaliser. Ex: 33150' university_person: description: Si ce champ est vide la "description courte" sera utilisée. Si elle est également vide le début du texte principal sera utilisé. habilitation: "Détient une Habilitation à Diriger des Recherches (HDR)." diff --git a/db/migrate/20230308101244_add_fields_to_organizations.rb b/db/migrate/20230308101244_add_fields_to_organizations.rb new file mode 100644 index 0000000000000000000000000000000000000000..4d60c93a1c48e9035c2ecb02b5af0f4b271e3a00 --- /dev/null +++ b/db/migrate/20230308101244_add_fields_to_organizations.rb @@ -0,0 +1,6 @@ +class AddFieldsToOrganizations < ActiveRecord::Migration[7.0] + def change + add_column :university_organizations, :address_name, :string + add_column :university_organizations, :address_additional, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 3fbf22adfbfa782184974342422b24cd86280793..16edb2ff493c8c49a1285d238ff36fde0fd3d623 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[7.0].define(version: 2023_03_07_145748) do +ActiveRecord::Schema[7.0].define(version: 2023_03_08_101244) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -847,6 +847,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_03_07_145748) do t.string "mastodon" t.float "latitude" t.float "longitude" + t.string "address_name" + t.string "address_additional" t.index ["university_id"], name: "index_university_organizations_on_university_id" end diff --git a/test/fixtures/university/organizations.yml b/test/fixtures/university/organizations.yml index fb69b56e39737260f1e867d432a547c1d89b405a..ecf596addfc3eec3eec8dde25ca316f82fdd2a90 100644 --- a/test/fixtures/university/organizations.yml +++ b/test/fixtures/university/organizations.yml @@ -2,32 +2,34 @@ # # Table name: university_organizations # -# id :uuid not null, primary key -# active :boolean default(TRUE) -# address :string -# city :string -# country :string -# email :string -# kind :integer default("company") -# latitude :float -# linkedin :string -# long_name :string -# longitude :float -# mastodon :string -# meta_description :text -# name :string -# nic :string -# phone :string -# siren :string -# slug :string -# summary :text -# text :text -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# active :boolean default(TRUE) +# address :string +# address_additional :string +# address_name :string +# city :string +# country :string +# email :string +# kind :integer default("company") +# latitude :float +# linkedin :string +# long_name :string +# longitude :float +# mastodon :string +# meta_description :text +# name :string +# nic :string +# phone :string +# siren :string +# slug :string +# summary :text +# text :text +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed # # Indexes # diff --git a/test/models/university/organization_test.rb b/test/models/university/organization_test.rb index 3a0b94b80e731d45da8c2a723999d4e8efe1b7ef..b358e842fff8fafabf0dc9309c869d602b8870b8 100644 --- a/test/models/university/organization_test.rb +++ b/test/models/university/organization_test.rb @@ -2,32 +2,34 @@ # # Table name: university_organizations # -# id :uuid not null, primary key -# active :boolean default(TRUE) -# address :string -# city :string -# country :string -# email :string -# kind :integer default("company") -# latitude :float -# linkedin :string -# long_name :string -# longitude :float -# mastodon :string -# meta_description :text -# name :string -# nic :string -# phone :string -# siren :string -# slug :string -# summary :text -# text :text -# twitter :string -# url :string -# zipcode :string -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# active :boolean default(TRUE) +# address :string +# address_additional :string +# address_name :string +# city :string +# country :string +# email :string +# kind :integer default("company") +# latitude :float +# linkedin :string +# long_name :string +# longitude :float +# mastodon :string +# meta_description :text +# name :string +# nic :string +# phone :string +# siren :string +# slug :string +# summary :text +# text :text +# twitter :string +# url :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed # # Indexes #