diff --git a/app/controllers/admin/communication/extranets_controller.rb b/app/controllers/admin/communication/extranets_controller.rb index 2d11a63183ae2d2ca3c8c34dd9c5850fb30f2dd3..04eb9d8323631c5ed012c7fbd9c7927141e81e06 100644 --- a/app/controllers/admin/communication/extranets_controller.rb +++ b/app/controllers/admin/communication/extranets_controller.rb @@ -64,6 +64,6 @@ class Admin::Communication::ExtranetsController < Admin::Communication::Applicat def extranet_params params.require(:communication_extranet) - .permit(:name, :domain, :about_type, :about_id, :logo, :logo_delete) + .permit(:name, :domain, :about_type, :about_id, :registration_contact, :logo, :logo_delete) end end diff --git a/app/models/communication/extranet.rb b/app/models/communication/extranet.rb index 75b8c1a0dcac4cc3b9e9973ce2de01aa0f4b4dea..eb5cb55bc2e7118e02a8876b08110473fd7243df 100644 --- a/app/models/communication/extranet.rb +++ b/app/models/communication/extranet.rb @@ -2,14 +2,15 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# domain :string -# name :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# domain :string +# name :string +# registration_contact :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes # diff --git a/app/models/user/with_extranet.rb b/app/models/user/with_extranet.rb index 07e27b975bf84d82e58d7324d2af3fe6bbcd96f4..0e647a92d447bbe646255188f49ff0b73dee2610 100644 --- a/app/models/user/with_extranet.rb +++ b/app/models/user/with_extranet.rb @@ -11,7 +11,11 @@ module User::WithExtranet def extranet_access # do extranet_to_validate alumni include current email? # TODO - # errors.add :email, 'n est pas autorisé' + # if extranet_to_validate.registration_contact.present? + # errors.add :email, I18n.t('extranet.errors.email_not_allowed_with_contact', contact: extranet_to_validate.registration_contact) + # else + # errors.add :email, I18n.t('extranet.errors.email_not_allowed') + # end end end diff --git a/app/views/admin/communication/extranets/_form.html.erb b/app/views/admin/communication/extranets/_form.html.erb index 0f75c225c965a8915f72fea1943b72003c36426e..b6c8ab18278cf26aa54bd7a49e8a20c8563be1b8 100644 --- a/app/views/admin/communication/extranets/_form.html.erb +++ b/app/views/admin/communication/extranets/_form.html.erb @@ -12,6 +12,7 @@ <%= f.input :name %> <%= f.input :domain %> <%= render 'admin/communication/abouts', f: f, i18n_key: 'activerecord.attributes.communication/extranet.about_' %> + <%= f.input :registration_contact %> </div> </div> </div> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index a9cf0e144eef102be62d20cd72219640c6689399..85bef999dfc312be8327d9ac9a90836edf45599f 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -48,8 +48,9 @@ en: about_Research::Journal: Journal extranet about_Research::Laboratory: Laboratory extranet about_type: About - title: Title domain: Domain + name: Name + registration_contact: Contact mail for registrations problems communication/website: about: About about_: Independent website @@ -216,23 +217,23 @@ en: label: Description placeholder: Enter description here element: - title: + title: label: Day placeholder: Enter the day or period time_slot_morning: label: Morning (if necessary) time_slot_afternoon: label: Afternoon (or full day) - name: + name: label: Name (person, organization...) placeholder: Enter the text zipcode: label: Zipcode placeholder: Enter the zipcode - mails: + mails: label: Mails placeholder: Enter the mail - phones: + phones: label: Telephone numbers placeholder: Enter the number slots: Opening times @@ -357,11 +358,11 @@ en: options: children: Main page and children selection: A specific selection of pages - show_main_description: + show_main_description: label: Show main page short description - show_description: + show_description: label: Show pages short descriptions - show_image: + show_image: label: Show pages images main_page: title: Main page @@ -382,7 +383,7 @@ en: add_partner: Add partner remove_partner: Remove partner element: - id: + id: label: Partner placeholder: Choose organization unregistered: Unregistered organization @@ -465,7 +466,7 @@ en: label: Video url placeholder: Enter video's url hint: > - Ex: + Ex: https://vimeo.com/732180675, https://www.youtube.com/watch?v=lAYhfCPelO0 video_title: @@ -648,6 +649,6 @@ en: communication_website_page: breadcrumb_title: If the field is empty, page title will be used in breadcrumbs. description: If this field is empty, the "lead text" field will be used. If also emty the main text's begining will be used. - full_width: On large screens, a full width page uses all available space for the content. This is good for landing pages, or to make them spectacular. If the page is not full width, the content column will be smaller to make reading easier. The unused space might be used for a table of contents. + full_width: On large screens, a full width page uses all available space for the content. This is good for landing pages, or to make them spectacular. If the page is not full width, the content column will be smaller to make reading easier. The unused space might be used for a table of contents. communication_website_post: description: If this field is empty, the "lead text" field will be used. If also emty the main text's begining will be used. diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 5897adc44b102159a9350c5af03a08d29f2ac0f4..bf7a104bc2176085c18d511a8903c1f5981d1b57 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -48,8 +48,9 @@ fr: about_Research::Journal: Extranet d'une revue scientifique about_Research::Laboratory: Extranet d'un laboratoire about_type: Type d'extranet - name: Nom domain: Domaine + name: Nom + registration_contact: Mail de contact pour les problèmes d'inscription communication/website: about: Sujet du site about_: Site indépendant @@ -217,26 +218,26 @@ fr: label: Description placeholder: Entrer la description element: - title: + title: label: Jour placeholder: Entrer le jour ou la période time_slot_morning: label: Matin (si nécessaire) time_slot_afternoon: label: Après-midi (ou jour complet) - name: + name: label: Nom (personne, établissement...) placeholder: Entrer le texte zipcode: label: Code postal placeholder: Entrer le code postal - mails: + mails: label: Mails placeholder: Entrer le mail - phones: + phones: label: Téléphones placeholder: Entrer le numéro - slots: Horaires + slots: Horaires datatable: description: Un tableau de données, aussi responsive et accessible que possible. edit: @@ -470,7 +471,7 @@ fr: label: Url de la vidéo placeholder: Entrer l'url de la vidéo hint: > - Ex: + Ex: https://vimeo.com/732180675, https://www.youtube.com/watch?v=lAYhfCPelO0 video_title: diff --git a/config/locales/extranet/en.yml b/config/locales/extranet/en.yml index a71ded4f915ebe3cccbcaac513083f5d4b7fc47c..0311a59b03224c55d0871cc6620a9a61a3886229 100644 --- a/config/locales/extranet/en.yml +++ b/config/locales/extranet/en.yml @@ -1,7 +1,9 @@ en: extranet: - account: + account: my: My account edit: Edit updated: Updated logout: Log out + experiences: + new: Add experience diff --git a/config/locales/extranet/fr.yml b/config/locales/extranet/fr.yml index 4c4347226ba279c169357b181e615faf20f443f7..91e718ba30fa6c7bbb038dfd3c05589112b0442d 100644 --- a/config/locales/extranet/fr.yml +++ b/config/locales/extranet/fr.yml @@ -1,9 +1,12 @@ fr: extranet: - experiences: - new: Ajouter une expérience - account: + account: my: Mon compte edit: Modifier updated: Mise à jour effectuée logout: Déconnexion + errors: + email_not_allowed: n'est pas autorisé à accéder à cet extranet. + email_not_allowed_with_contact: n'est pas autorisé à accéder à cet extranet. Contactez %{contact} pour en savoir plus. + experiences: + new: Ajouter une expérience diff --git a/db/migrate/20221017142108_add_registration_contact_to_communication_extranets.rb b/db/migrate/20221017142108_add_registration_contact_to_communication_extranets.rb new file mode 100644 index 0000000000000000000000000000000000000000..da34f0cde40a67f87c3c6926387aff6fc1db9b4f --- /dev/null +++ b/db/migrate/20221017142108_add_registration_contact_to_communication_extranets.rb @@ -0,0 +1,5 @@ +class AddRegistrationContactToCommunicationExtranets < ActiveRecord::Migration[6.1] + def change + add_column :communication_extranets, :registration_contact, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 7762689058578b09ed9655acfe8fcdfe07b422b7..5876144fc09cc72e8bd75c8c7df197b98fa4bcbc 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_10_11_070402) do +ActiveRecord::Schema.define(version: 2022_10_17_142108) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -102,6 +102,7 @@ ActiveRecord::Schema.define(version: 2022_10_11_070402) do t.datetime "updated_at", precision: 6, null: false t.string "about_type" t.uuid "about_id" + t.string "registration_contact" t.index ["about_type", "about_id"], name: "index_communication_extranets_on_about" t.index ["university_id"], name: "index_communication_extranets_on_university_id" end diff --git a/test/fixtures/communication/extranets.yml b/test/fixtures/communication/extranets.yml index 67008e68b84634849c8a0ed42ded99acb00fbab4..cba2a17eda7606bd17481d5311fa0331ad2df607 100644 --- a/test/fixtures/communication/extranets.yml +++ b/test/fixtures/communication/extranets.yml @@ -2,14 +2,15 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# domain :string -# name :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# domain :string +# name :string +# registration_contact :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes # diff --git a/test/models/communication/extranet_test.rb b/test/models/communication/extranet_test.rb index 54e7cf1a80e1fe893549cc7327a91a469e705468..c51aec18a360bb6303f0c7a0ac9a91ea92e3445d 100644 --- a/test/models/communication/extranet_test.rb +++ b/test/models/communication/extranet_test.rb @@ -2,14 +2,15 @@ # # Table name: communication_extranets # -# id :uuid not null, primary key -# about_type :string indexed => [about_id] -# domain :string -# name :string -# created_at :datetime not null -# updated_at :datetime not null -# about_id :uuid indexed => [about_type] -# university_id :uuid not null, indexed +# id :uuid not null, primary key +# about_type :string indexed => [about_id] +# domain :string +# name :string +# registration_contact :string +# created_at :datetime not null +# updated_at :datetime not null +# about_id :uuid indexed => [about_type] +# university_id :uuid not null, indexed # # Indexes #