From ad61e59593d0f05821cd5c6dc493710705ac0f57 Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Fri, 5 Feb 2021 11:04:58 +0100 Subject: [PATCH] Change the title Projects to folder/subfolder title [SCI-5456] --- app/assets/javascripts/projects/index.js | 1 + app/controllers/projects_controller.rb | 2 ++ app/views/projects/index.html.erb | 2 +- app/views/projects/index/_header.html.erb | 7 +++++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/projects/index.js b/app/assets/javascripts/projects/index.js index f6bb51855..722074c03 100644 --- a/app/assets/javascripts/projects/index.js +++ b/app/assets/javascripts/projects/index.js @@ -495,6 +495,7 @@ }, success: function(data) { $('#breadcrumbsWrapper').html(data.breadcrumbs_html); + $(projectsWrapper).find('.projects-title').html(data.title); $(toolbarWrapper).html(data.toolbar_html); viewContainer.data('projects-cards-url', data.projects_cards_url); viewContainer.removeClass('no-results'); diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index bb9981a79..8eb09c4ab 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -31,6 +31,7 @@ class ProjectsController < ApplicationController def cards overview_service = ProjectsOverviewService.new(current_team, current_user, current_folder, params) + title = params[:view_mode] == 'archived' ? t('projects.index.head_title_archived') : t('projects.index.head_title') if filters_included? render json: { @@ -44,6 +45,7 @@ class ProjectsController < ApplicationController render json: { projects_cards_url: current_folder ? project_folder_cards_url(current_folder) : cards_projects_url, breadcrumbs_html: current_folder ? render_to_string(partial: 'projects/index/breadcrumbs.html.erb') : '', + title: current_folder ? current_folder&.name : title, toolbar_html: render_to_string(partial: 'projects/index/toolbar.html.erb'), cards_html: render_to_string( partial: 'projects/index/team_projects.html.erb', diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index d60791634..6d97fa0ac 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -11,7 +11,7 @@ <% end %>
- <%= render partial: 'projects/index/header' %> + <%= render partial: 'projects/index/header', locals: { current_folder: current_folder} %> diff --git a/app/views/projects/index/_header.html.erb b/app/views/projects/index/_header.html.erb index 766e8ee10..f98accc39 100644 --- a/app/views/projects/index/_header.html.erb +++ b/app/views/projects/index/_header.html.erb @@ -1,7 +1,10 @@