diff --git a/app/controllers/admin/communication/extranets_controller.rb b/app/controllers/admin/communication/extranets_controller.rb index 57d2bbedbcd0e5afc0803e35ffc1af2b55353ece..b9e807a79fba5d54a0d17563696414b035a038d3 100644 --- a/app/controllers/admin/communication/extranets_controller.rb +++ b/app/controllers/admin/communication/extranets_controller.rb @@ -66,6 +66,7 @@ class Admin::Communication::ExtranetsController < Admin::Communication::Applicat params.require(:communication_extranet) .permit(:name, :host, :about_type, :about_id, :registration_contact, :logo, :logo_delete, + :terms, :privacy_policy, :cookies_policy, :color, :has_sso, :sso_target_url, :sso_cert, :sso_name_identifier_format, :sso_mapping ) end diff --git a/app/models/communication/extranet.rb b/app/models/communication/extranet.rb index 692c53fc233bf08b6aa2cd2094b80c754b67cad3..8437a8e4de243e1083e9a209d091d2ba8e92d7f8 100644 --- a/app/models/communication/extranet.rb +++ b/app/models/communication/extranet.rb @@ -4,15 +4,19 @@ # # id :uuid not null, primary key # about_type :string indexed => [about_id] +# color :string +# cookies_policy :text # has_sso :boolean default(FALSE) # host :string # name :string +# privacy_policy :text # registration_contact :string # sso_cert :text # sso_mapping :jsonb # sso_name_identifier_format :string # sso_provider :integer default("saml") # sso_target_url :string +# terms :text # created_at :datetime not null # updated_at :datetime not null # about_id :uuid indexed => [about_type] diff --git a/app/views/admin/communication/extranets/_form.html.erb b/app/views/admin/communication/extranets/_form.html.erb index a1ed7ea3a6fbdf5391a235d6ca4c6ce97bae9730..db051c124f6adb141133f2d9c95cdd39caa99093 100644 --- a/app/views/admin/communication/extranets/_form.html.erb +++ b/app/views/admin/communication/extranets/_form.html.erb @@ -3,7 +3,7 @@ <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> <div class="row"> - <div class="col-md-4"> + <div class="col-md-6"> <div class="card flex-fill w-100"> <div class="card-header"> <h5 class="card-title mb-0"><%= t('metadata') %></h5> @@ -15,11 +15,9 @@ <%= f.input :registration_contact %> </div> </div> - </div> - <div class="col-md-4"> <div class="card flex-fill w-100"> <div class="card-header"> - <h5 class="card-title mb-0"><%= t('logo') %></h5> + <h5 class="card-title mb-0"><%= t('look_feel') %></h5> </div> <div class="card-body"> <%= f.input :logo, @@ -27,26 +25,41 @@ input_html: { accept: '.jpg,.jpeg,.png,.svg' }, preview: 200, direct_upload: true %> + <%= f.input :color, as: :color %> </div> </div> </div> - <h3 class="mt-5"><%= t('university.sso') %></h3> - <div class="row"> - <div class="col-md-6"> - <%= f.input :has_sso %> - <div class="sso-inputs"> - <%= f.input :sso_target_url, required: true %> - <%= f.input :sso_cert, required: true %> - <%= f.input :sso_name_identifier_format, required: true %> + <div class="col-md-6"> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('legal') %></h5> + </div> + <div class="card-body"> + <%= f.input :terms, as: :summernote %> + <%= f.input :privacy_policy, as: :summernote %> + <%= f.input :cookies_policy, as: :summernote %> </div> </div> - <div class="col-md-6 sso-inputs"> - <h4 class="mb-4"><%= University.human_attribute_name('sso_mapping') %></h4> - <%= f.error_notification message: f.object.errors[:sso_mapping].to_sentence if f.object.errors[:sso_mapping].present? %> - <%= render 'server/universities/sso_mapping', object: extranet %> + </div> + </div> + + <h3 class="mt-5"><%= t('university.sso') %></h3> + <div class="row"> + <div class="col-md-6"> + <%= f.input :has_sso %> + <div class="sso-inputs"> + <%= f.input :sso_target_url, required: true %> + <%= f.input :sso_cert, required: true %> + <%= f.input :sso_name_identifier_format, required: true %> </div> </div> + <div class="col-md-6 sso-inputs"> + <h4 class="mb-4"><%= University.human_attribute_name('sso_mapping') %></h4> + <%= f.error_notification message: f.object.errors[:sso_mapping].to_sentence if f.object.errors[:sso_mapping].present? %> + <%= render 'server/universities/sso_mapping', object: extranet %> + </div> </div> + <% content_for :action_bar_right do %> <%= submit f %> <% end %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 04d9ced40c8075a89ad8e86c560cac0228ab72f4..bb3df98a30b71e14eff8b072fa4176ba623f0d2a 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -48,6 +48,10 @@ en: about_Research::Journal: Journal extranet about_Research::Laboratory: Laboratory extranet about_type: About + color: Couleur + cookies_policy: Cookies policy + privacy_policy: Privacy policy + terms: Terms of service has_sso: Has SSO? host: Domain name: Name diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 0aa0ff1be20480fb4a0849d5eddf42f088bea147..131983d4dd56bf485cbe5661661102de90ddc615 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -48,15 +48,19 @@ fr: about_Research::Journal: Extranet d'une revue scientifique about_Research::Laboratory: Extranet d'un laboratoire about_type: Type d'extranet + color: Couleur + cookies_policy: Politique de cookies has_sso: A un SSO ? host: Domaine name: Nom + privacy_policy: Politique de confidentialité registration_contact: Mail de contact pour les problèmes d'inscription sso_cert: Certificat sso_inherit_from_university: SSO hérité de l'Université sso_mapping: Mapping sso_name_identifier_format: Name Identifier Format sso_target_url: URL cible + terms: Conditions d'utilisation communication/website: about: Sujet du site about_: Site indépendant diff --git a/config/locales/en.yml b/config/locales/en.yml index 48d8ed57db87a97f4234ccc923aa30166f99c1f3..a4dd9890f0d3ac23c76d2822c999d22b0d1e9d61 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -205,6 +205,7 @@ en: languages: en: English fr: French + legal: Legal loading: Loading... login: already_registered: Already registered? @@ -214,6 +215,7 @@ en: sign_in_with_credentials: Sign in with credentials sign_in_with_sso: Sign in through SSO subtitle: Sign in to your account to continue + look_feel: Look & feel mailers: notifications: import: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index eef4b496b89a948a97e1aa5d5101f0a57e89b42e..b8696c31a261e655dba27d87d4cc3acbeca77b11 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -205,6 +205,7 @@ fr: languages: en: Anglais fr: Français + legal: Légal loading: Chargement... login: already_registered: Déjà inscrit ? @@ -214,6 +215,7 @@ fr: sign_in_with_credentials: Se connecter avec ses identifiants sign_in_with_sso: Se connecter en SSO subtitle: Vous devez être authentifié pour continuer + look_feel: Look & feel mailers: notifications: import: diff --git a/db/migrate/20221024145323_add_legal_texts_to_communication_extranets.rb b/db/migrate/20221024145323_add_legal_texts_to_communication_extranets.rb new file mode 100644 index 0000000000000000000000000000000000000000..5846d437dc7a423d7bb8a9e2115e2909813bd2bc --- /dev/null +++ b/db/migrate/20221024145323_add_legal_texts_to_communication_extranets.rb @@ -0,0 +1,7 @@ +class AddLegalTextsToCommunicationExtranets < ActiveRecord::Migration[6.1] + def change + add_column :communication_extranets, :terms, :text + add_column :communication_extranets, :privacy_policy, :text + add_column :communication_extranets, :cookies_policy, :text + end +end diff --git a/db/migrate/20221024145426_add_color_to_communication_extranets.rb b/db/migrate/20221024145426_add_color_to_communication_extranets.rb new file mode 100644 index 0000000000000000000000000000000000000000..e383bcd6950c39c42f4e4ee13aa95f057b9a7090 --- /dev/null +++ b/db/migrate/20221024145426_add_color_to_communication_extranets.rb @@ -0,0 +1,5 @@ +class AddColorToCommunicationExtranets < ActiveRecord::Migration[6.1] + def change + add_column :communication_extranets, :color, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 35be76a1c3a946de043491d4c0da19d25bbac126..0495bd6359a3b52426ae717442456c4dc28f174e 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_20_141837) do +ActiveRecord::Schema.define(version: 2022_10_24_145426) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -109,6 +109,10 @@ ActiveRecord::Schema.define(version: 2022_10_20_141837) do t.string "sso_name_identifier_format" t.integer "sso_provider", default: 0 t.string "sso_target_url" + t.text "terms" + t.text "privacy_policy" + t.text "cookies_policy" + t.string "color" 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 17a4285e934248ccdf5fcadd637383732a21a04a..096e5b66c1bd77ea1abe94d2063174daa49f8763 100644 --- a/test/fixtures/communication/extranets.yml +++ b/test/fixtures/communication/extranets.yml @@ -4,15 +4,19 @@ # # id :uuid not null, primary key # about_type :string indexed => [about_id] +# color :string +# cookies_policy :text # has_sso :boolean default(FALSE) # host :string # name :string +# privacy_policy :text # registration_contact :string # sso_cert :text # sso_mapping :jsonb # sso_name_identifier_format :string # sso_provider :integer default("saml") # sso_target_url :string +# terms :text # created_at :datetime not null # updated_at :datetime not null # about_id :uuid indexed => [about_type] diff --git a/test/models/communication/extranet_test.rb b/test/models/communication/extranet_test.rb index 42c081ff34dd8dc65bbfad49921faa61f40b5fa4..69be8d1cd6fe3afbadbecda1a9572a0cfb3e3eef 100644 --- a/test/models/communication/extranet_test.rb +++ b/test/models/communication/extranet_test.rb @@ -4,15 +4,19 @@ # # id :uuid not null, primary key # about_type :string indexed => [about_id] +# color :string +# cookies_policy :text # has_sso :boolean default(FALSE) # host :string # name :string +# privacy_policy :text # registration_contact :string # sso_cert :text # sso_mapping :jsonb # sso_name_identifier_format :string # sso_provider :integer default("saml") # sso_target_url :string +# terms :text # created_at :datetime not null # updated_at :datetime not null # about_id :uuid indexed => [about_type]