diff --git a/app/assets/javascripts/admin/notyf.js b/app/assets/javascripts/admin/notyf.js index a70f7aa75bfbf3fa12b6bb773485c4d8ab6be41d..8045fe7b85613921250445c45b829b74fa71777a 100644 --- a/app/assets/javascripts/admin/notyf.js +++ b/app/assets/javascripts/admin/notyf.js @@ -10,7 +10,7 @@ if (notyfAlerts.length > 0) { x: 'right', y: 'top' }, - message: notyfAlerts[0].innerHTML, + message: notyfAlerts[0].innerText, duration: 9000, ripple: true, dismissible: true @@ -23,7 +23,7 @@ if (notyfNotices.length > 0) { x: 'right', y: 'top' }, - message: notyfNotices[0].innerHTML, + message: notyfNotices[0].innerText, duration: 9000, ripple: true, dismissible: true diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index 0f8d0dcd161b49f86a28216c3158bae71378ef7c..0f004a7487b42dd693e61e3ee6c28f88bf0394a4 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -7,19 +7,19 @@ class Admin::ApplicationController < ApplicationController protected def breadcrumb - add_breadcrumb t('dashboard'), :admin_root_path + add_breadcrumb t('admin.dashboard'), :admin_root_path end def short_breadcrumb @menu_collapsed = true - add_breadcrumb t('dashboard'), :admin_root_path + add_breadcrumb t('admin.dashboard'), :admin_root_path add_breadcrumb '...' end def breadcrumb_for(object, **options) return unless object object.persisted? ? add_breadcrumb(object, [:admin, object, options]) - : add_breadcrumb('Créer') + : add_breadcrumb(t('create')) end def switch_locale(&action) diff --git a/app/controllers/admin/communication/website/pages_controller.rb b/app/controllers/admin/communication/website/pages_controller.rb index d3a2194cfbb1bbdfc79992edff916ac25da96406..4e29babb1dee0d5f74c06ac72bad86d134ed3600 100644 --- a/app/controllers/admin/communication/website/pages_controller.rb +++ b/app/controllers/admin/communication/website/pages_controller.rb @@ -24,7 +24,7 @@ class Admin::Communication::Website::PagesController < Admin::Communication::Web @page.university = current_university @page.website = @website if @page.save - redirect_to admin_communication_website_page_path(@page), notice: "Page was successfully created." + redirect_to admin_communication_website_page_path(@page), notice: t('admin.successfully_created_html', model: @page.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -33,15 +33,16 @@ class Admin::Communication::Website::PagesController < Admin::Communication::Web def update if @page.update(page_params) - redirect_to admin_communication_website_page_path(@page), notice: "Page was successfully updated." + redirect_to admin_communication_website_page_path(@page), notice: t('admin.successfully_updated_html', model: @page.to_s) else breadcrumb + add_breadcrumb t('edit') render :edit, status: :unprocessable_entity end end def destroy - redirect_to admin_communication_website_url, notice: "Page was successfully destroyed." + redirect_to admin_communication_website_url, notice: t('admin.successfully_destroyed_html', model: @page.to_s) end protected diff --git a/app/controllers/admin/communication/website/posts_controller.rb b/app/controllers/admin/communication/website/posts_controller.rb index 69fe0c76000521e6fd13ffd4f7b8c181f7224a6c..30ad908702dd63df9d421bfa3609d2db311b6862 100644 --- a/app/controllers/admin/communication/website/posts_controller.rb +++ b/app/controllers/admin/communication/website/posts_controller.rb @@ -24,7 +24,7 @@ class Admin::Communication::Website::PostsController < Admin::Communication::Web @post.university = current_university @post.website = @website if @post.save - redirect_to admin_communication_website_post_path(@post), notice: "Post was successfully created." + redirect_to admin_communication_website_post_path(@post), notice: t('admin.successfully_created_html', model: @post.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -33,16 +33,17 @@ class Admin::Communication::Website::PostsController < Admin::Communication::Web def update if @post.update(post_params) - redirect_to admin_communication_website_post_path(@post), notice: "Post was successfully updated." + redirect_to admin_communication_website_post_path(@post), notice: t('admin.successfully_updated_html', model: @post.to_s) else breadcrumb + add_breadcrumb t('edit') render :edit, status: :unprocessable_entity end end def destroy @communication_website_post.destroy - redirect_to admin_communication_website_posts_url, notice: "Post was successfully destroyed." + redirect_to admin_communication_website_posts_url, notice: t('admin.successfully_destroyed_html', model: @post.to_s) end protected diff --git a/app/controllers/admin/communication/websites_controller.rb b/app/controllers/admin/communication/websites_controller.rb index dd413263c032cbd7f7d0dd08e03bfdcdfae8e7a8..261658aac5c20eeb5b14493bf8569830d6be25e7 100644 --- a/app/controllers/admin/communication/websites_controller.rb +++ b/app/controllers/admin/communication/websites_controller.rb @@ -34,7 +34,7 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati def create @website.university = current_university if @website.save - redirect_to [:admin, @website], notice: "Site was successfully created." + redirect_to [:admin, @website], notice: t('admin.successfully_created_html', model: @website.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -43,16 +43,17 @@ class Admin::Communication::WebsitesController < Admin::Communication::Applicati def update if @website.update(website_params) - redirect_to [:admin, @website], notice: "Site was successfully updated." + redirect_to [:admin, @website], notice: t('admin.successfully_updated_html', model: @website.to_s) else breadcrumb + add_breadcrumb t('edit') render :edit, status: :unprocessable_entity end end def destroy @website.destroy - redirect_to admin_communication_websites_url, notice: "Site was successfully destroyed." + redirect_to admin_communication_websites_url, notice: t('admin.successfully_destroyed_html', model: @website.to_s) end protected diff --git a/app/controllers/admin/education/programs_controller.rb b/app/controllers/admin/education/programs_controller.rb index 827626d8b105e2e31a7ceff9f3e55b0bca81c99d..58c92919cc08ca47e7ef3cae1e3460f2e7aa4d09 100644 --- a/app/controllers/admin/education/programs_controller.rb +++ b/app/controllers/admin/education/programs_controller.rb @@ -22,7 +22,7 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro def create @program.university = current_university if @program.save - redirect_to [:admin, @program], notice: "Program was successfully created." + redirect_to [:admin, @program], notice: t('admin.successfully_created_html', model: @program.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -31,7 +31,7 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro def update if @program.update(program_params) - redirect_to [:admin, @program], notice: "Program was successfully updated." + redirect_to [:admin, @program], notice: t('admin.successfully_updated_html', model: @program.to_s) else breadcrumb add_breadcrumb t('edit') @@ -41,7 +41,7 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro def destroy @program.destroy - redirect_to admin_education_programs_url, notice: "Program was successfully destroyed." + redirect_to admin_education_programs_url, notice: t('admin.successfully_destroyed_html', model: @program.to_s) end protected diff --git a/app/controllers/admin/research/journal/articles_controller.rb b/app/controllers/admin/research/journal/articles_controller.rb index 2a859c5d48b975506e3c049ee2ed33359bcacf19..6e4a0d61453c8b99ccb1bb5073f880043088fd18 100644 --- a/app/controllers/admin/research/journal/articles_controller.rb +++ b/app/controllers/admin/research/journal/articles_controller.rb @@ -24,7 +24,7 @@ class Admin::Research::Journal::ArticlesController < Admin::Research::Journal::A @article.university = @journal.university @article.updated_by = current_user if @article.save - redirect_to admin_research_journal_article_path(@article), notice: "Article was successfully created." + redirect_to admin_research_journal_article_path(@article), notice: t('admin.successfully_created_html', model: @article.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -34,9 +34,10 @@ class Admin::Research::Journal::ArticlesController < Admin::Research::Journal::A def update @article.updated_by = current_user if @article.update(article_params) - redirect_to admin_research_journal_article_path(@article), notice: "Article was successfully updated." + redirect_to admin_research_journal_article_path(@article), notice: t('admin.successfully_updated_html', model: @article.to_s) else breadcrumb + add_breadcrumb t('edit') render :edit, status: :unprocessable_entity end end @@ -44,7 +45,7 @@ class Admin::Research::Journal::ArticlesController < Admin::Research::Journal::A def destroy @journal = @article.journal @article.destroy - redirect_to admin_research_journal_path(@journal), notice: "Article was successfully destroyed." + redirect_to admin_research_journal_path(@journal), notice: t('admin.successfully_destroyed_html', model: @article.to_s) end private diff --git a/app/controllers/admin/research/journal/volumes_controller.rb b/app/controllers/admin/research/journal/volumes_controller.rb index 2c983673198d57a9b6f9fc8b7e29cfd3c6e6da79..40137d6d1c7c1004cd46698bc3b6298e83940fcf 100644 --- a/app/controllers/admin/research/journal/volumes_controller.rb +++ b/app/controllers/admin/research/journal/volumes_controller.rb @@ -24,7 +24,7 @@ class Admin::Research::Journal::VolumesController < Admin::Research::Journal::Ap @volume.journal = @journal @volume.university = @journal.university if @volume.save - redirect_to admin_research_journal_volume_path(@volume), notice: "Volume was successfully created." + redirect_to admin_research_journal_volume_path(@volume), notice: t('admin.successfully_created_html', model: @volume.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -33,17 +33,18 @@ class Admin::Research::Journal::VolumesController < Admin::Research::Journal::Ap def update if @volume.update(volume_params) - redirect_to admin_research_journal_volume_path(@volume), notice: "Volume was successfully updated." + redirect_to admin_research_journal_volume_path(@volume), notice: t('admin.successfully_updated_html', model: @volume.to_s) else breadcrumb render :edit, status: :unprocessable_entity + add_breadcrumb t('edit') end end def destroy @journal = @volume.journal @volume.destroy - redirect_to admin_research_journal_path(@journal), notice: "Volume was successfully destroyed." + redirect_to admin_research_journal_path(@journal), notice: t('admin.successfully_destroyed_html', model: @volume.to_s) end private diff --git a/app/controllers/admin/research/journals_controller.rb b/app/controllers/admin/research/journals_controller.rb index 26bb67f185a763b3c6d0a0a22114cda9aa118676..8c9a16327a6aaaa441e886845789009fb78930b4 100644 --- a/app/controllers/admin/research/journals_controller.rb +++ b/app/controllers/admin/research/journals_controller.rb @@ -21,7 +21,7 @@ class Admin::Research::JournalsController < Admin::Research::ApplicationControll def create @journal.university = current_university if @journal.save - redirect_to [:admin, @journal], notice: "Journal was successfully created." + redirect_to [:admin, @journal], notice: t('admin.successfully_created_html', model: @journal.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -30,7 +30,7 @@ class Admin::Research::JournalsController < Admin::Research::ApplicationControll def update if @journal.update(journal_params) - redirect_to [:admin, @journal], notice: "Journal was successfully updated." + redirect_to [:admin, @journal], notice: t('admin.successfully_updated_html', model: @journal.to_s) else breadcrumb add_breadcrumb t('edit') @@ -40,7 +40,7 @@ class Admin::Research::JournalsController < Admin::Research::ApplicationControll def destroy @journal.destroy - redirect_to admin_research_journals_url, notice: "Journal was successfully destroyed." + redirect_to admin_research_journals_url, notice: t('admin.successfully_destroyed_html', model: @journal.to_s) end protected diff --git a/app/controllers/admin/research/researchers_controller.rb b/app/controllers/admin/research/researchers_controller.rb index 96580a1a041c332e33b4cde4e8cc3a95623d7289..4a6b53681d6331db661b53ddd7f7f836e2971222 100644 --- a/app/controllers/admin/research/researchers_controller.rb +++ b/app/controllers/admin/research/researchers_controller.rb @@ -20,7 +20,7 @@ class Admin::Research::ResearchersController < Admin::Research::ApplicationContr def create if @researcher.save - redirect_to [:admin, @researcher], notice: "Researcher was successfully created." + redirect_to [:admin, @researcher], notice: t('admin.successfully_created_html', model: @researcher.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -29,7 +29,7 @@ class Admin::Research::ResearchersController < Admin::Research::ApplicationContr def update if @researcher.update(researcher_params) - redirect_to [:admin, @researcher], notice: "Researcher was successfully updated." + redirect_to [:admin, @researcher], notice: t('admin.successfully_updated_html', model: @researcher.to_s) else breadcrumb add_breadcrumb t('edit') @@ -39,7 +39,7 @@ class Admin::Research::ResearchersController < Admin::Research::ApplicationContr def destroy @researcher.destroy - redirect_to admin_research_researchers_url, notice: "Researcher was successfully destroyed." + redirect_to admin_research_researchers_url, notice: t('admin.successfully_destroyed_html', model: @researcher.to_s) end protected diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 53946ee7cd328d0ac8423642bc6eb4461ae9692d..ddc06c1838114c32f39a46db851c715662067851 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -2,7 +2,7 @@ class Admin::UsersController < Admin::ApplicationController load_and_authorize_resource def index - @users = current_university.users + @users = current_university.users.ordered breadcrumb end @@ -16,12 +16,12 @@ class Admin::UsersController < Admin::ApplicationController def edit breadcrumb - add_breadcrumb 'Modifier' + add_breadcrumb t('edit') end def create if @user.save - redirect_to [:admin, @user], notice: "User was successfully created." + redirect_to [:admin, @user], notice: t('admin.successfully_created_html', model: @user.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -31,10 +31,10 @@ class Admin::UsersController < Admin::ApplicationController def update @user.modified_by = current_user if @user.update(user_params) - redirect_to [:admin, @user], notice: "User was successfully updated." + redirect_to [:admin, @user], notice: t('admin.successfully_updated_html', model: @user.to_s) else breadcrumb - add_breadcrumb 'Modifier' + add_breadcrumb t('edit') render :edit, status: :unprocessable_entity end end @@ -43,15 +43,15 @@ class Admin::UsersController < Admin::ApplicationController if @user.access_locked? || @user.max_login_attempts? @user.unlock_access! @user.unlock_mfa! - redirect_back(fallback_location: [:admin, @user], notice: 'User account was successfully unlocked.') + redirect_back(fallback_location: [:admin, @user], notice: t('admin.users_alerts.successfully_unlocked_html', model: @user.to_s)) else - redirect_back(fallback_location: [:admin, @user], alert: 'User account was not locked.') + redirect_back(fallback_location: [:admin, @user], alert: t('admin.users_alerts.not_locked_html', model: @user.to_s)) end end def destroy @user.destroy - redirect_to admin_users_url, notice: "User was successfully destroyed." + redirect_to admin_users_url, notice: t('admin.successfully_destroyed_html', model: @user.to_s) end protected @@ -63,7 +63,7 @@ class Admin::UsersController < Admin::ApplicationController if @user.persisted? add_breadcrumb @user, [:admin, @user] else - add_breadcrumb 'Créer' + add_breadcrumb t('create') end end end diff --git a/app/controllers/server/application_controller.rb b/app/controllers/server/application_controller.rb index b85c0802f779691a2dcf4eb5036c2126bbffb43d..b6a2a5b819a02011c3538b5ef02877b57e51ed6c 100644 --- a/app/controllers/server/application_controller.rb +++ b/app/controllers/server/application_controller.rb @@ -6,7 +6,7 @@ class Server::ApplicationController < ApplicationController protected def breadcrumb - add_breadcrumb 'Tableau de bord', :server_root_path + add_breadcrumb t('admin.dashboard'), :server_root_path end def ensure_user_if_server_admin diff --git a/app/controllers/server/dashboard_controller.rb b/app/controllers/server/dashboard_controller.rb index b25fd5c2f4bda62395b8b7ab27e4d9f3d5d94a8a..d8d4d4fa6a3c5bfc0abed36be2552b99b7b2df67 100644 --- a/app/controllers/server/dashboard_controller.rb +++ b/app/controllers/server/dashboard_controller.rb @@ -1,6 +1,5 @@ class Server::DashboardController < Server::ApplicationController def index - @universities = University.all.ordered breadcrumb end end diff --git a/app/controllers/server/languages_controller.rb b/app/controllers/server/languages_controller.rb index 8ff556c0b6ab71e4de43163e9f72902b4ceff650..471c53269c27a2a90cc2732ec67627319c20efcc 100644 --- a/app/controllers/server/languages_controller.rb +++ b/app/controllers/server/languages_controller.rb @@ -15,12 +15,12 @@ class Server::LanguagesController < Server::ApplicationController def edit breadcrumb - add_breadcrumb 'Modifier' + add_breadcrumb t('edit') end def create if @language.save - redirect_to [:server, @language], notice: "Language was successfully created." + redirect_to [:server, @language], notice: t('admin.successfully_created_html', model: @language.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -29,17 +29,17 @@ class Server::LanguagesController < Server::ApplicationController def update if @language.update(language_params) - redirect_to [:server, @language], notice: "Language was successfully updated." + redirect_to [:server, @language], notice: t('admin.successfully_updated_html', model: @language.to_s) else breadcrumb - add_breadcrumb 'Modifier' + add_breadcrumb t('edit') render :edit, status: :unprocessable_entity end end def destroy @language.destroy - redirect_to server_languages_url, notice: "Language was successfully destroyed." + redirect_to server_languages_url, notice: t('admin.successfully_destroyed_html', model: @language.to_s) end protected @@ -51,7 +51,7 @@ class Server::LanguagesController < Server::ApplicationController if @language.persisted? add_breadcrumb @language, [:server, @language] else - add_breadcrumb 'Créer' + add_breadcrumb t('create') end end end diff --git a/app/controllers/server/universities_controller.rb b/app/controllers/server/universities_controller.rb index 233d9c288e0638d73d1703999de7df8f9d870398..9c0d352207cbb272306c99d1ee17a97bcab72a4a 100644 --- a/app/controllers/server/universities_controller.rb +++ b/app/controllers/server/universities_controller.rb @@ -15,12 +15,12 @@ class Server::UniversitiesController < Server::ApplicationController def edit breadcrumb - add_breadcrumb 'Modifier' + add_breadcrumb t('edit') end def create if @university.save - redirect_to [:server, @university], notice: "University was successfully created." + redirect_to [:server, @university], notice: t('admin.successfully_created_html', model: @university.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -29,17 +29,17 @@ class Server::UniversitiesController < Server::ApplicationController def update if @university.update(university_params) - redirect_to [:server, @university], notice: "University was successfully updated." + redirect_to [:server, @university], notice: t('admin.successfully_updated_html', model: @university.to_s) else breadcrumb - add_breadcrumb 'Modifier' + add_breadcrumb t('edit') render :edit, status: :unprocessable_entity end end def destroy @university.destroy - redirect_to server_universities_url, notice: "University was successfully destroyed." + redirect_to server_universities_url, notice: t('admin.successfully_destroyed_html', model: @university.to_s) end protected @@ -51,7 +51,7 @@ class Server::UniversitiesController < Server::ApplicationController if @university.persisted? add_breadcrumb @university, [:server, @university] else - add_breadcrumb 'Créer' + add_breadcrumb t('create') end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index d3541c0fd440e28f211a4ed6b074955b4c3ded0e..0c146dd09c0492939508dea5339135713749d805 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -36,9 +36,15 @@ en: one: User other: Users admin: + dashboard: Dashboard infos: Infos + successfully_created_html: "<i>%{model}</i> was successfully created." + successfully_destroyed_html: "<i>%{model}</i> was successfully destroyed." + successfully_updated_html: "<i>%{model}</i> was successfully updated." + users_alerts: + not_locked_html: '<i>%{model}</i> was not locked.' + successfully_unlocked_html: "<i>%{model}</i> was successfully unlocked." create: Create - dashboard: Dashboard delete: Delete devise: failure: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index b0eea52c68d9349ccc7c14b3177e074bbf365c7b..7dc96a2190d568890f47dffd4fd9baa9eaa5f185 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -36,9 +36,15 @@ fr: one: Utilisateur other: Utilisateurs admin: + dashboard: Tableau de bord infos: Infos + successfully_created_html: "<i>%{model}</i> a bien été créé(e)." + successfully_destroyed_html: "<i>%{model}</i> a bien été détruit(e)." + successfully_updated_html: "<i>%{model}</i> a bien été mis(e) à jour." + users_alerts: + not_locked_html: "<i>%{model}</i> n'était pas verrouillé(e)." + successfully_unlocked_html: "<i>%{model}</i> a bien été déverrouillé(e)." create: Créer - dashboard: Tableau de bord delete: Supprimer devise: failure: diff --git a/config/server_navigation.rb b/config/server_navigation.rb index 49e8a3f8f5f2fdab6db7442a73f33149d07d6643..4881a4db1b6b8f287c52d8ece930ed2d8fb7abc2 100644 --- a/config/server_navigation.rb +++ b/config/server_navigation.rb @@ -4,7 +4,7 @@ SimpleNavigation::Configuration.run do |navigation| navigation.highlight_on_subpath = true navigation.selected_class = 'active' navigation.items do |primary| - primary.item :dashboard, t('dashboard'), server_root_path, { icon: 'tachometer-alt', highlights_on: %r{adminserver$} } + primary.item :dashboard, t('dashboard'), server_root_path, { icon: 'tachometer-alt', highlights_on: %r{server$} } primary.item :universities, University.model_name.human(count: 2), server_universities_path, { icon: 'university' } if can?(:read, University) primary.item :languages, Language.model_name.human(count: 2), server_languages_path, { icon: 'flag' } if can?(:read, Language) end