From 121a722be7a7be640c9eba967a140cb47a6ccce5 Mon Sep 17 00:00:00 2001 From: ChapsJust <2238424@carrefour.cegepvicto.ca> Date: Fri, 27 Feb 2026 12:19:36 -0500 Subject: [PATCH] Refonte --- .gitattributes | 1 + Dockerfile | 2 +- app/controllers/application_controller.rb | 13 +++-- .../submission_form/verification_step.vue | 2 +- app/javascript/template_builder/logo.vue | 15 ++--- app/models/user.rb | 4 +- .../_default_signature_row.html.erb | 1 + app/views/layouts/application.html.erb | 2 +- .../_reminder_placeholder.html.erb | 1 + .../_logo_placeholder.html.erb | 1 + app/views/shared/_settings_nav.html.erb | 2 +- app/views/sms_settings/_placeholder.html.erb | 1 + app/views/sso_settings/_placeholder.html.erb | 1 + .../_bulk_send_placeholder.html.erb | 1 + .../submissions/_send_sms_button.html.erb | 1 + .../_placeholder.html.erb | 1 + app/views/users/_role_select.html.erb | 18 +++--- config/locales/whitelabel.yml | 55 ++++++++++++++++++- config/whitelabel.yml | 11 ++++ lib/ability.rb | 48 ++++++++++++++++ lib/accounts.rb | 2 +- lib/whitelabel.rb | 12 ++++ 22 files changed, 162 insertions(+), 33 deletions(-) diff --git a/.gitattributes b/.gitattributes index 28cee3ff..c1f3ae47 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ *.html linguist-detectable=false +bin/* text eol=lf diff --git a/Dockerfile b/Dockerfile index b1341fcf..3b5e35d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ COPY ./tailwind.application.config.js ./tailwind.application.config.js COPY ./app/javascript ./app/javascript COPY ./app/views ./app/views -RUN echo "gem 'shakapacker'" > Gemfile && ./bin/shakapacker +RUN echo "gem 'shakapacker'" > Gemfile && sed -i 's/\r$//' bin/shakapacker && ./bin/shakapacker FROM ruby:4.0.1-alpine AS app diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 323e8f23..5fa236c1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -39,7 +39,7 @@ class ApplicationController < ActionController::Base rescue_from CanCan::AccessDenied do |e| Rollbar.warning(e) if defined?(Rollbar) - redirect_to root_path, alert: e.message + redirect_to root_path, alert: I18n.t('unauthorized.default', locale: current_account&.locale) end end @@ -67,12 +67,13 @@ class ApplicationController < ActionController::Base private def with_locale(&) - return yield unless current_account + locale = if current_account + (params[:lang].presence if Rails.env.development?) || current_account.locale + else + request.env['HTTP_ACCEPT_LANGUAGE'].to_s[BROWSER_LOCALE_REGEXP].to_s.split('-').first.presence + end - locale = params[:lang].presence if Rails.env.development? - locale ||= current_account.locale - - I18n.with_locale(locale, &) + I18n.with_locale(locale || I18n.default_locale, &) end def with_browser_locale(&) diff --git a/app/javascript/submission_form/verification_step.vue b/app/javascript/submission_form/verification_step.vue index 29b3b590..cd17e179 100644 --- a/app/javascript/submission_form/verification_step.vue +++ b/app/javascript/submission_form/verification_step.vue @@ -119,7 +119,7 @@ export default { docId: this.eidEasyData.doc_id, language: this.locale, countryCode: this.countryCode, - sandbox: ['demo.docuseal.tech'].includes(location.host), + sandbox: false, enabledMethods: { signature: this.eidEasyData.available_methods }, diff --git a/app/javascript/template_builder/logo.vue b/app/javascript/template_builder/logo.vue index 8f878e14..d0c3534b 100644 --- a/app/javascript/template_builder/logo.vue +++ b/app/javascript/template_builder/logo.vue @@ -1,20 +1,13 @@ diff --git a/app/models/user.rb b/app/models/user.rb index 7eabb059..2950aeec 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -48,7 +48,9 @@ # class User < ApplicationRecord ROLES = [ - ADMIN_ROLE = 'admin' + ADMIN_ROLE = 'admin', + GESTIONNAIRE_ROLE = 'gestionnaire', + USER_ROLE = 'user' ].freeze EMAIL_REGEXP = /[^@;,<>\s]+@[^@;,<>\s]+/ diff --git a/app/views/esign_settings/_default_signature_row.html.erb b/app/views/esign_settings/_default_signature_row.html.erb index 899f99b3..f42a5733 100644 --- a/app/views/esign_settings/_default_signature_row.html.erb +++ b/app/views/esign_settings/_default_signature_row.html.erb @@ -1,3 +1,4 @@ +<% return unless Whitelabel.show_pro_upsells? %>