diff --git a/app/controllers/admin/research/laboratories_controller.rb b/app/controllers/admin/research/laboratories_controller.rb index 9ac81b7de3f90b5ba93c4091232af45d5e30baf4..8fecfbe5e9367631065f903009844ab1ef367b6f 100644 --- a/app/controllers/admin/research/laboratories_controller.rb +++ b/app/controllers/admin/research/laboratories_controller.rb @@ -15,6 +15,11 @@ class Admin::Research::LaboratoriesController < Admin::Research::ApplicationCont breadcrumb end + def static + @about = @laboratory + render_as_plain_text + end + def new breadcrumb end @@ -58,7 +63,7 @@ class Admin::Research::LaboratoriesController < Admin::Research::ApplicationCont def laboratory_params params.require(:research_laboratory) - .permit(:name, :address, :zipcode, :city, :country) + .permit(:name, :address, :address_name, :address_additional, :zipcode, :city, :country) .merge(university_id: current_university.id) end end diff --git a/app/models/research/laboratory.rb b/app/models/research/laboratory.rb index 29eebf3199adc39ff69660f02616466bf7c2a252..ec5f2b3ce32ca07a6abb32406f56434e0a4bf503 100644 --- a/app/models/research/laboratory.rb +++ b/app/models/research/laboratory.rb @@ -2,15 +2,17 @@ # # Table name: research_laboratories # -# id :uuid not null, primary key -# address :string -# city :string -# country :string -# name :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 +# address :string +# address_additional :string +# address_name :string +# city :string +# country :string +# name :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/research/laboratories/_form.html.erb b/app/views/admin/research/laboratories/_form.html.erb index 8270d310c83714d484892f0f48bf641ffefccd1c..332f5fe9b84cd7bc55c5b5b6e22316e2ad4561b8 100644 --- a/app/views/admin/research/laboratories/_form.html.erb +++ b/app/views/admin/research/laboratories/_form.html.erb @@ -3,9 +3,13 @@ <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> <div class="row"> - <div class="col-md-6"> + <div class="col-lg-6"> <%= f.input :name %> + </div> + <div class="col-lg-6"> + <%= f.input :address_name %> <%= f.input :address %> + <%= f.input :address_additional %> <%= f.input :zipcode %> <%= f.input :city %> <%= f.input :country, input_html: { class: 'form-select' } %> diff --git a/app/views/admin/research/laboratories/show.html.erb b/app/views/admin/research/laboratories/show.html.erb index cc7823ae62a01c6a7555d02a84478910c459f076..519cffda27642698b4c562b15c4c0ae2f12344f5 100644 --- a/app/views/admin/research/laboratories/show.html.erb +++ b/app/views/admin/research/laboratories/show.html.erb @@ -22,6 +22,7 @@ <% content_for :action_bar_left do %> <%= destroy_link @laboratory %> + <%= static_link static_admin_research_laboratory_path(@laboratory) %> <% end %> <% content_for :action_bar_right do %> diff --git a/app/views/admin/research/laboratories/static.html.erb b/app/views/admin/research/laboratories/static.html.erb index e294a824d91ba5419a878940eb7eeca6960545fe..9555527a22ae44d31e965b942f136e965e020266 100644 --- a/app/views/admin/research/laboratories/static.html.erb +++ b/app/views/admin/research/laboratories/static.html.erb @@ -1,12 +1,16 @@ --- name: > - <%= @about.name %> + <%= prepare_text_for_static @about.name %> +address_name: > + <%= prepare_text_for_static @about.address_name %> address: > - <%= @about.address %> + <%= prepare_text_for_static @about.address %> +address_additional: > + <%= prepare_text_for_static @about.address_additional %> zipcode: > - <%= @about.zipcode %> + <%= prepare_text_for_static @about.zipcode %> city: > - <%= @about.city %> + <%= prepare_text_for_static @about.city %> country: > <%= @about.country_common_name %> --- diff --git a/config/locales/research/en.yml b/config/locales/research/en.yml index 6ccfd688e5bb396599df064e880f5afd37ba84eb..504760a10acb7cbfc3d33a2afc8a523431690902 100644 --- a/config/locales/research/en.yml +++ b/config/locales/research/en.yml @@ -74,6 +74,8 @@ en: title: Title research/laboratory: address: Address + address_additional: Additional address + address_name: Address name city: City country: Country name: Name @@ -157,3 +159,10 @@ en: research_journal_paper: authors_list: Type the authors list directly in this field if you don't want to use the checkboxes above doi: "You can type the DOI identifier without https://, for example “10.19182/perspective/31918â€" + research_laboratory: + 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' + zipcode: 'This field is used for geolocation. Ex: 33150' diff --git a/config/locales/research/fr.yml b/config/locales/research/fr.yml index 841f696bd7fd8458985780f5ed8636c49600fefa..98098aa89937e1b2e6b7fbce288ddff04b725e9a 100644 --- a/config/locales/research/fr.yml +++ b/config/locales/research/fr.yml @@ -74,6 +74,8 @@ fr: title: Titre research/laboratory: address: Adresse + address_additional: Complément d'adresse + address_name: Nom de l'adresse city: Ville country: Pays name: Nom @@ -156,3 +158,10 @@ fr: research_journal_paper: authors_list: Tapez la liste des auteurs si vous n'utilisez pas les cases à cocher “Auteur·e·s†ci-dessus doi: "Vous pouvez saisir l'identifiant DOI sans https://, par exemple “10.19182/perspective/31918â€" + research_laboratory: + 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' + zipcode: 'Ce champ est utilisé pour géolocaliser. Ex: 33150' \ No newline at end of file diff --git a/config/routes/admin/research.rb b/config/routes/admin/research.rb index 7dbfd99d0ec92b1dfcfd2c0f9dc30c74ea68dacb..4978ac1deb2f0fdb617ea989a1adabbc9d07f619 100644 --- a/config/routes/admin/research.rb +++ b/config/routes/admin/research.rb @@ -39,6 +39,9 @@ namespace :research do end end resources :laboratories do + member do + get :static + end resources :axes, controller: 'laboratories/axes' do collection do post :reorder diff --git a/db/migrate/20240207085338_add_additional_address_to_research_laboratories.rb b/db/migrate/20240207085338_add_additional_address_to_research_laboratories.rb new file mode 100644 index 0000000000000000000000000000000000000000..b75fc0d66f7e54ed85388681dcb5466fd3ad7837 --- /dev/null +++ b/db/migrate/20240207085338_add_additional_address_to_research_laboratories.rb @@ -0,0 +1,6 @@ +class AddAdditionalAddressToResearchLaboratories < ActiveRecord::Migration[7.1] + def change + add_column :research_laboratories, :address_name, :string + add_column :research_laboratories, :address_additional, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 840cf18f37ce393411362b8c082bb413bab08a60..45971753fbd63fb9768c3a1ace8791f91fa28b26 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.1].define(version: 2024_01_31_081040) do +ActiveRecord::Schema[7.1].define(version: 2024_02_07_085338) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -874,6 +874,8 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_31_081040) do t.string "country" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "address_name" + t.string "address_additional" t.index ["university_id"], name: "index_research_laboratories_on_university_id" end