From 36e764a5d9c3f466c2c74f1fe550d81370899d24 Mon Sep 17 00:00:00 2001 From: Andreas Pfohl Date: Mon, 11 Jul 2022 15:30:51 +0200 Subject: [PATCH] [#43153] Fix storage admin breadcrumbs https://community.openproject.org/work_packages/43153 --- config/locales/en.yml | 1 + .../storages/admin/oauth_clients_controller.rb | 2 +- .../storages/admin/storages_controller.rb | 2 +- .../storages/oauth_applications/create_service.rb | 2 +- .../admin/storages/new_oauth_client.html.erb | 7 +++++-- .../app/views/storages/admin/storages/show.html.erb | 12 ++++++++++-- .../admin/storages/show_oauth_application.html.erb | 7 +++++-- modules/storages/config/locales/en.yml | 3 +++ 8 files changed, 27 insertions(+), 9 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 8cf3251c0b..93ed016ec3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2460,6 +2460,7 @@ en: update_timeout: "Keep the last required disk space information for a repository for N minutes.\nAs counting the required disk space of a repository may be costly, increase this value to reduce performance impact." oauth_application_details: "The client secret value will not be accessible again after you close this window. Please copy these values into the Nextcloud OpenProject Integration settings:" oauth_application_details_link_text: "Go to settings page" + show_warning_details: "To use this file storage remember to activate the module and the specific storage in the project settings of each desired project." subversion: existing_title: "Existing Subversion repository" existing_introduction: "If you have an existing Subversion repository, you can link it with OpenProject to access it from within the application." diff --git a/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb b/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb index d200392997..5970ae9000 100644 --- a/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb +++ b/modules/storages/app/controllers/storages/admin/oauth_clients_controller.rb @@ -74,7 +74,7 @@ class Storages::Admin::OAuthClientsController < ApplicationController # Breadcrumbs is something like OpenProject > Admin > Storages. # This returns the name of the last part (Storages admin page) def default_breadcrumb - ActionController::Base.helpers.link_to(t('storages.label_oauth_client_details'), admin_settings_storage_oauth_client_path) + ActionController::Base.helpers.link_to(t(:project_module_storages), admin_settings_storages_path) end # See: default_breadcrumb above diff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rb index e47321ee49..58427dd1ba 100644 --- a/modules/storages/app/controllers/storages/admin/storages_controller.rb +++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb @@ -152,7 +152,7 @@ class Storages::Admin::StoragesController < ApplicationController # Breadcrumbs is something like OpenProject > Admin > Storages. # This returns the name of the last part (Storages admin page) def default_breadcrumb - if action_name == :index + if action_name == 'index' t(:project_module_storages) else ActionController::Base.helpers.link_to(t(:project_module_storages), admin_settings_storages_path) diff --git a/modules/storages/app/services/storages/oauth_applications/create_service.rb b/modules/storages/app/services/storages/oauth_applications/create_service.rb index 0314e3fd0b..9bbc6afe5f 100644 --- a/modules/storages/app/services/storages/oauth_applications/create_service.rb +++ b/modules/storages/app/services/storages/oauth_applications/create_service.rb @@ -46,7 +46,7 @@ module Storages::OAuthApplications ::OAuth::PersistApplicationService .new(::Doorkeeper::Application.new, user:) .call({ - name: "#{storage.name} (#{I18n.t("storages.provider_types.#{storage.provider_type}")})", + name: "#{storage.name} (#{I18n.t("storages.provider_types.#{storage.provider_type}.name")})", redirect_uri: File.join(storage.host, "apps/integration_openproject/oauth-redirect"), scopes: 'api_v3', confidential: true, diff --git a/modules/storages/app/views/storages/admin/storages/new_oauth_client.html.erb b/modules/storages/app/views/storages/admin/storages/new_oauth_client.html.erb index b6fc6d8a04..37ce9928d7 100644 --- a/modules/storages/app/views/storages/admin/storages/new_oauth_client.html.erb +++ b/modules/storages/app/views/storages/admin/storages/new_oauth_client.html.erb @@ -1,6 +1,9 @@ <% html_title t(:label_administration), t("project_module_storages"), @storage.name, "#{t("storages.provider_types.#{@storage.provider_type}.name")} #{t("storages.label_oauth_client_details")}" %> -<% local_assigns[:additional_breadcrumb] = "#{t("storages.provider_types.#{@storage.provider_type}.name")} #{t("storages.label_oauth_client_details")}" %> +<% local_assigns[:additional_breadcrumb] = [ + link_to(@storage.name, admin_settings_storage_path(@storage)), + t("storages.label_oauth_breadcrumb.#{@storage.provider_type}") +] %> <%= toolbar title: "#{t("storages.provider_types.#{@storage.provider_type}.name")} #{t("storages.label_oauth_client_details")}" %> <%= labelled_tabular_form_for @oauth_client, url: admin_settings_storage_oauth_client_path do |f| -%> @@ -27,7 +30,7 @@ <%= "#{t("storages.instructions.copy_from")}: " %> <%= link_to "#{t("storages.instructions.#{@storage.provider_type}.integration")}", URI::join(@storage.host, "settings/admin/openproject").to_s, - target: "blank"%> + target: "blank" %> <% if @storage.oauth_client %> diff --git a/modules/storages/app/views/storages/admin/storages/show.html.erb b/modules/storages/app/views/storages/admin/storages/show.html.erb index ae312f614d..f1e15c439d 100644 --- a/modules/storages/app/views/storages/admin/storages/show.html.erb +++ b/modules/storages/app/views/storages/admin/storages/show.html.erb @@ -30,7 +30,7 @@ See COPYRIGHT and LICENSE files for more details. <% html_title t(:label_administration), t('project_module_storages'), t(@object.name) -%> <% local_assigns[:additional_breadcrumb] = @object.name %> -<%= toolbar title: "#{t('project_module_storages')} - #{@object.name}", +<%= toolbar title: @object.name, title_class: 'no-padding-bottom' do %>
  • <%= link_to edit_admin_settings_storage_path(@object), @@ -50,6 +50,14 @@ See COPYRIGHT and LICENSE files for more details.
  • <% end %> +
    +
    +

    + <%= t('repositories.storage.show_warning_details') %> +

    +
    +
    +
    @@ -66,7 +74,7 @@ See COPYRIGHT and LICENSE files for more details.
    <%= t(:'storages.label_provider_type') %>
    - <%= t(:"storages.provider_types.#{@object.provider_type}") %> + <%= t(:"storages.provider_types.#{@object.provider_type}.name") %>
    diff --git a/modules/storages/app/views/storages/admin/storages/show_oauth_application.html.erb b/modules/storages/app/views/storages/admin/storages/show_oauth_application.html.erb index 19bdf44a9e..4d9b622715 100644 --- a/modules/storages/app/views/storages/admin/storages/show_oauth_application.html.erb +++ b/modules/storages/app/views/storages/admin/storages/show_oauth_application.html.erb @@ -1,7 +1,10 @@ <% html_title t(:label_administration), t("project_module_storages"), @object.name, "#{t("storages.provider_types.#{@object.provider_type}.name")} #{t("storages.label_oauth_application_details")}" %> -<% local_assigns[:additional_breadcrumb] = "#{t("storages.provider_types.#{@object.provider_type}.name")} #{t("storages.label_oauth_application_details")}" %> -<%= toolbar title: "#{t("storages.provider_types.#{@object.provider_type}.name")} #{t("storages.label_oauth_application_details")}" %> +<% local_assigns[:additional_breadcrumb] = [ + link_to(@object.name, admin_settings_storage_path(@object)), + t("storages.label_oauth_breadcrumb.openproject") +] %> +<%= toolbar title: "OpenProject #{t("storages.label_oauth_application_details")}" %>
    diff --git a/modules/storages/config/locales/en.yml b/modules/storages/config/locales/en.yml index fe78a9b915..1b334f45c2 100644 --- a/modules/storages/config/locales/en.yml +++ b/modules/storages/config/locales/en.yml @@ -73,6 +73,9 @@ en: label_file_links: "File links" label_name: "Name" label_host: "Host" + label_oauth_breadcrumb: + openproject: "OpenProject OAuth" + nextcloud: "Nextcloud OAuth" label_oauth_application_details: "OAuth application details" label_oauth_client_details: "OAuth client details" label_provider_type: "Provider type"