From e12f11bc01fafdb016267daeb5dfb42808b9c68c Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Thu, 31 Oct 2024 11:56:45 +0100 Subject: [PATCH 001/136] update page header in project settings --- app/views/projects/_toolbar.html.erb | 147 ++++++++++++++++----------- 1 file changed, 87 insertions(+), 60 deletions(-) diff --git a/app/views/projects/_toolbar.html.erb b/app/views/projects/_toolbar.html.erb index 88047c9c6caf..ec29c5087e5f 100644 --- a/app/views/projects/_toolbar.html.erb +++ b/app/views/projects/_toolbar.html.erb @@ -27,63 +27,90 @@ See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: t(:label_information_plural) do %> - <% if User.current.allowed_in_project?(:add_subprojects, @project) %> -
  • - <%= link_to new_project_path(parent_id: @project.id), - { class: 'button -primary', - aria: {label: t(:label_subproject_new)}, - title: t(:label_subproject_new)} do %> - <%= op_icon('button--icon icon-add') %> - <%= t(:label_subproject) %> - <% end %> -
  • - <% end %> -
  • - <%= link_to project_identifier_path(@project), class: 'button' do %> - <%= op_icon('button--icon icon-edit') %> - <%= t('projects.settings.change_identifier') %> - <% end %> -
  • - <% if @project.copy_allowed? %> -
  • - <%= link_to copy_project_path(@project), class: 'button copy', accesskey: accesskey(:copy), data: { turbo: false } do %> - <%= op_icon('button--icon icon-copy') %> - <%= t(:button_copy) %> - <% end %> -
  • - <% end %> - <% if User.current.allowed_in_project?(:archive_project, @project) %> -
  • - <%= link_to(project_archive_path(@project, status: '', name: @project.name), - data: { confirm: t('project.archive.are_you_sure', name: @project.name) }, - method: :post, - title: t(:label_archive_project), - class: 'button') do %> - <%= op_icon('button--icon icon-locked') %> - <%= t(:button_archive) %> - <% end %> -
  • - <% end %> - <% if User.current.admin? %> -
  • - <% label = @project.templated ? 'remove_from_templates' : 'make_template' %> - <%= link_to(project_templated_path(@project), - method: @project.templated ? :delete : :post, - title: t("project.template.#{label}"), - class: 'button') do %> - <%= op_icon('button--icon icon-duplicate') unless @project.templated %> - <%= t("project.template.#{label}") %> - <% end %> -
  • -
  • - <%= link_to confirm_destroy_project_path(@project), - class: 'button delete', - title: t(:label_delete_project), - data: { turbo: false } do %> - <%= op_icon('button--icon icon-delete') %> - <%= t(:button_delete) %> - <% end %> -
  • - <% end %> -<% end %> +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_information_plural) } + header.with_breadcrumbs( [ + { href: project_overview_path(@project.id), text: @project.name }, + { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") }, + t(:label_information_plural) + ]) + + if User.current.allowed_in_project?(:add_subprojects, @project) + header.with_action_button(scheme: :primary, + mobile_icon: :plus, + mobile_label: t(:label_subproject_new), + aria: { label: t(:label_subproject_new) }, + title: t(:label_subproject_new), + tag: :a, + href: new_project_path(parent_id: @project.id)) do |button| + button.with_leading_visual_icon(icon: :plus) + t(:label_subproject) + end + end + + header.with_action_button(tag: :a, + mobile_icon: :pencil, + mobile_label: t('projects.settings.change_identifier'), + size: :medium, + href: project_identifier_path(@project), + aria: { label: t('projects.settings.change_identifier') }, + title: t('projects.settings.change_identifier')) do |button| + button.with_leading_visual_icon(icon: :pencil) + t('projects.settings.change_identifier') + end + + header.with_action_menu( + menu_arguments: { + anchor_align: :end + }, + button_arguments: { + icon: "op-kebab-vertical", + "aria-label": t(:label_more) + } + ) do |menu| + if @project.copy_allowed? + menu.with_item( + label:t(:button_copy), + href: copy_project_path(@project), + content_arguments: { data: { turbo: false }, }, + accesskey: accesskey(:copy), + ) do |item| + item.with_leading_visual_icon(icon: :copy) + end + end + + if User.current.allowed_in_project?(:archive_project, @project) + menu.with_item( + tag: :a, + label: t(:button_archive), + href: project_archive_path(@project, status: '', name: @project.name), + content_arguments: { data: { confirm: t('project.archive.are_you_sure', name: @project.name), method: :post, } } + ) do |item| + item.with_leading_visual_icon(icon: 'lock') + end + end + if User.current.admin? + label = @project.templated ? 'remove_from_templates' : 'make_template' + menu.with_item( + tag: :a, + label: t("project.template.#{label}"), + href: project_templated_path(@project), + content_arguments: { data: { confirm: t('project.archive.are_you_sure', name: @project.name), method: @project.templated ? :delete : :post, } } + ) do |item| + item.with_leading_visual_icon(icon: :duplicate) unless @project.templated + end + + menu.with_item( + tag: :a, + scheme: :danger, + label: t(:button_delete), + href: confirm_destroy_project_path(@project), + content_arguments: { data: { turbo: false } } + ) do |item| + item.with_leading_visual_icon(icon: :trash) + end + end + end + end +%> From 92c8bf913d8b2d1fb6b1410910d599209c356329 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Sat, 2 Nov 2024 09:35:59 +0100 Subject: [PATCH 002/136] remove confirmation from templated button --- app/views/projects/_toolbar.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/_toolbar.html.erb b/app/views/projects/_toolbar.html.erb index ec29c5087e5f..fca6b2ed69be 100644 --- a/app/views/projects/_toolbar.html.erb +++ b/app/views/projects/_toolbar.html.erb @@ -96,7 +96,7 @@ See COPYRIGHT and LICENSE files for more details. tag: :a, label: t("project.template.#{label}"), href: project_templated_path(@project), - content_arguments: { data: { confirm: t('project.archive.are_you_sure', name: @project.name), method: @project.templated ? :delete : :post, } } + content_arguments: { data: { method: @project.templated ? :delete : :post } } ) do |item| item.with_leading_visual_icon(icon: :duplicate) unless @project.templated end From 2a5450eb9ff6594e07896d4402879e5e221b0283 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Sat, 2 Nov 2024 10:13:35 +0100 Subject: [PATCH 003/136] add page header fo adding news --- app/views/news/new.html.erb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/news/new.html.erb b/app/views/news/new.html.erb index f031848d2b34..383750570f35 100644 --- a/app/views/news/new.html.erb +++ b/app/views/news/new.html.erb @@ -26,10 +26,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> - <% html_title t(:label_news_new) %> -<%= toolbar title: t(:label_news_new) %> +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_news_new) } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_news_index_path(@project), text: t(:label_news_plural)}, + t(:label_news_new)]) + end +%> <%= labelled_tabular_form_for [@project, @news], html: { id: 'news-form' } do |f| %> <%= render partial: 'news/form', locals: { f: f } %> From 6988b015c499d500df88c6a3bddfa58a1b0e1c74 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Mon, 4 Nov 2024 06:23:13 +0100 Subject: [PATCH 004/136] update page header in roadmap --- app/views/versions/index.html.erb | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index 8a7c9d84ff43..d80e65189e25 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -27,17 +27,24 @@ See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: t(:label_roadmap) do %> -
  • - <%= link_to_if_authorized({ controller: '/versions', action: 'new', project_id: @project }, - { class: 'button -primary', - aria: { label: t(:label_version_new) }, - title: t(:label_version_new) }) do %> - <%= op_icon('button--icon icon-add') %> - <%= t('activerecord.models.version') %> - <% end %> -
  • -<% end %> +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_roadmap) } + header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, + t(:label_roadmap) + ]) + header.with_action_button(scheme: :primary, + mobile_icon: :plus, + mobile_label: t(:label_version_new), + aria: { label: t(:label_version_new) }, + title: t(:label_version_new), + tag: :a, + href: url_for({ controller: '/versions', action: 'new', project_id: @project })) do |button| + button.with_leading_visual_icon(icon: :plus) + t('activerecord.models.version') + end + end +%> <% if @versions.empty? %> <%= no_results_box %> From 0199254e3178d466ec8d1e5ab7db702a7e0383b4 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Mon, 4 Nov 2024 06:38:35 +0100 Subject: [PATCH 005/136] update page header in new version page --- app/views/versions/new.html.erb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/versions/new.html.erb b/app/views/versions/new.html.erb index 611e08914928..5c881f226ac6 100644 --- a/app/views/versions/new.html.erb +++ b/app/views/versions/new.html.erb @@ -28,7 +28,15 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title t("label_version_new") %> -<%= toolbar title: t(:label_version_new) %> +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_version_new) } + header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") }, + { href: project_settings_versions_path(@project.id), text: I18n.t("label_version_plural") }, + t(:label_version_new) + ]) + end %> <%= labelled_tabular_form_for [@project, @version] do |f| %> From a2ed799e4f0a548df01dfd6081e5b9757b6395b7 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Mon, 4 Nov 2024 07:03:42 +0100 Subject: [PATCH 006/136] update page header in new versions page --- .../projects/settings/versions/show.html.erb | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/app/views/projects/settings/versions/show.html.erb b/app/views/projects/settings/versions/show.html.erb index aad2ca59bc90..a03e5462848d 100644 --- a/app/views/projects/settings/versions/show.html.erb +++ b/app/views/projects/settings/versions/show.html.erb @@ -27,19 +27,27 @@ See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: t(:label_version_plural) do %> - <% if current_user.allowed_in_project?(:manage_versions, @project) %> -
  • - <%= link_to_if_authorized({ controller: '/versions', action: 'new', project_id: @project }, - { class: 'button -primary', - aria: {label: t(:label_version_new)}, - title: t(:label_version_new)}) do %> - <%= op_icon('button--icon icon-add') %> - <%= t('activerecord.models.version') %> - <% end %> -
  • - <% end %> -<% end %> +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_version_plural) } + header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") }, + t(:label_version_plural) + ]) + if current_user.allowed_in_project?(:manage_versions, @project) + header.with_action_button(scheme: :primary, + mobile_icon: :plus, + mobile_label: t(:label_version_new), + aria: { label: t(:label_version_new) }, + title: t(:label_version_new), + tag: :a, + href: url_for({ controller: '/versions', action: 'new', project_id: @project })) do |button| + button.with_leading_visual_icon(icon: :plus) + t('activerecord.models.version') + end + end + end +%> <% if @versions.any? %> <%= render Versions::TableComponent.new(rows: @versions, project: @project) %> From ce34cf28eca6e6fc70da70b5996b608e7db20427 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Tue, 5 Nov 2024 08:29:07 +0100 Subject: [PATCH 007/136] update page header in forums --- app/views/forums/index.html.erb | 34 ++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 73a2c166a9a7..41be4ec33edd 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -27,19 +27,27 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title t(:label_forum_plural) %> -<%= toolbar title: t(:label_forum_plural) do %> - <% if User.current.allowed_in_project?(:manage_forums, @project) %> -
  • - <%= link_to(new_project_forum_path(@project), - { aria: { label: t(:label_forum_new) }, - title: t(:label_forum_new), - class: 'button -primary' }) do %> - <%= op_icon('button--icon icon-add') %> - <%= t('activerecord.models.forum') %> - <% end %> -
  • - <% end %> -<% end %> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_forum_plural) } + header.with_breadcrumbs( [ + { href: project_overview_path(@project.id), text: @project.name }, + t(:label_forum_plural) + ]) + if User.current.allowed_in_project?(:manage_forums, @project) + header.with_action_button(scheme: :primary, + mobile_icon: :plus, + mobile_label: t(:label_forum_new), + aria: { label: t(:label_forum_new) }, + title: t(:label_forum_new), + tag: :a, + href: new_project_forum_path(@project)) do |button| + button.with_leading_visual_icon(icon: :plus) + t('activerecord.models.forum') + end + end + end %> <% if @forums.empty? %> <%= no_results_box(action_url: new_project_forum_path(@project)) %> From 2da1820b0cb97da4a5884c9ef7e169fc84f41ae6 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Tue, 5 Nov 2024 08:34:30 +0100 Subject: [PATCH 008/136] update page header in new forum page --- app/views/forums/new.html.erb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/forums/new.html.erb b/app/views/forums/new.html.erb index 47c22c0fd526..97f41c0d1be0 100644 --- a/app/views/forums/new.html.erb +++ b/app/views/forums/new.html.erb @@ -27,8 +27,14 @@ See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: t(:label_forum_new) %> - +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_forum_new) } + header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_forums_path(@project.id), text: t(:label_forum_plural) }, + t(:label_forum_new) + ]) + end %> <%= labelled_tabular_form_for [@project, @forum] do |f| %> <%= render partial: 'form', locals: {f: f} %> <%= f.button t(:button_create), class: 'button -primary -with-icon icon-checkmark' %> From 400c3ccd5d31d3caf373167174c1076893bbe69a Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Tue, 5 Nov 2024 22:10:05 +0100 Subject: [PATCH 009/136] move create button form header to subheader in versions pages --- .../projects/settings/versions/show.html.erb | 26 +++++++++---------- app/views/versions/index.html.erb | 21 ++++++++------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/app/views/projects/settings/versions/show.html.erb b/app/views/projects/settings/versions/show.html.erb index a03e5462848d..7b97ddfe4640 100644 --- a/app/views/projects/settings/versions/show.html.erb +++ b/app/views/projects/settings/versions/show.html.erb @@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> - <%= render Primer::OpenProject::PageHeader.new do |header| header.with_title { t(:label_version_plural) } @@ -34,21 +33,22 @@ See COPYRIGHT and LICENSE files for more details. { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") }, t(:label_version_plural) ]) - if current_user.allowed_in_project?(:manage_versions, @project) - header.with_action_button(scheme: :primary, - mobile_icon: :plus, - mobile_label: t(:label_version_new), - aria: { label: t(:label_version_new) }, - title: t(:label_version_new), - tag: :a, - href: url_for({ controller: '/versions', action: 'new', project_id: @project })) do |button| - button.with_leading_visual_icon(icon: :plus) - t('activerecord.models.version') - end - end end %> +<% if current_user.allowed_in_project?(:manage_versions, @project) %> + <%= render(Primer::OpenProject::SubHeader.new) do |subheader| + subheader.with_action_button(scheme: :primary, + aria: { label: t(:label_version_new) }, + title: t(:label_version_new), + tag: :a, + href: url_for({ controller: '/versions', action: 'new', project_id: @project })) do |button| + button.with_leading_visual_icon(icon: :plus) + t('activerecord.models.version') + end + end %> +<% end %> + <% if @versions.any? %> <%= render Versions::TableComponent.new(rows: @versions, project: @project) %> diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index d80e65189e25..c7f84a0435f1 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -33,19 +33,20 @@ See COPYRIGHT and LICENSE files for more details. header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, t(:label_roadmap) ]) - header.with_action_button(scheme: :primary, - mobile_icon: :plus, - mobile_label: t(:label_version_new), - aria: { label: t(:label_version_new) }, - title: t(:label_version_new), - tag: :a, - href: url_for({ controller: '/versions', action: 'new', project_id: @project })) do |button| - button.with_leading_visual_icon(icon: :plus) - t('activerecord.models.version') - end end %> +<%= render(Primer::OpenProject::SubHeader.new) do |subheader| + subheader.with_action_button(scheme: :primary, + aria: { label: t(:label_version_new) }, + title: t(:label_version_new), + tag: :a, + href: url_for({ controller: '/versions', action: 'new', project_id: @project })) do |button| + button.with_leading_visual_icon(icon: :plus) + t('activerecord.models.version') + end +end %> + <% if @versions.empty? %> <%= no_results_box %> <% else %> From 723eb3388945bc9d9e1d01539cb16c90657ebbbe Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Tue, 5 Nov 2024 23:02:30 +0100 Subject: [PATCH 010/136] change header in new board page --- modules/boards/app/views/boards/boards/new.html.erb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/boards/app/views/boards/boards/new.html.erb b/modules/boards/app/views/boards/boards/new.html.erb index 5dbb76f8fd7a..1a30bb849136 100644 --- a/modules/boards/app/views/boards/boards/new.html.erb +++ b/modules/boards/app/views/boards/boards/new.html.erb @@ -28,7 +28,17 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title t('boards.label_create_new_board') %> -<%= toolbar title: t('boards.label_create_new_board') %> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t('boards.label_create_new_board') } + header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_work_package_boards_path(@project.id), text: t("boards.label_boards") }, + t('boards.label_create_new_board') + ]) + end +%> + <%= labelled_tabular_form_for @board_grid, url: { controller: '/boards/boards', action: 'create', project_id: @project }, :html => {:id => 'board-form'} do |f| -%> <%= render :partial => 'form', :locals => {:f => f} %> <%= styled_button_tag t(:button_create), class: '-primary' %> From c86bcc28781aabc78185b00bb38807bfe6b18163 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Tue, 5 Nov 2024 23:18:12 +0100 Subject: [PATCH 011/136] change header in backlogs page --- app/views/versions/index.html.erb | 2 +- .../views/rb_master_backlogs/index.html.erb | 30 ++++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index c7f84a0435f1..64c413f3777f 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -30,7 +30,7 @@ See COPYRIGHT and LICENSE files for more details. <%= render Primer::OpenProject::PageHeader.new do |header| header.with_title { t(:label_roadmap) } - header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, + header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, t(:label_roadmap) ]) end diff --git a/modules/backlogs/app/views/rb_master_backlogs/index.html.erb b/modules/backlogs/app/views/rb_master_backlogs/index.html.erb index ffce9b30930c..b52c34815882 100644 --- a/modules/backlogs/app/views/rb_master_backlogs/index.html.erb +++ b/modules/backlogs/app/views/rb_master_backlogs/index.html.erb @@ -30,17 +30,25 @@ See COPYRIGHT and LICENSE files for more details.
    <% html_title t(:label_backlogs) %> -<%= toolbar title: t(:label_backlogs) do %> -
  • - <%= link_to_if_authorized({ controller: '/versions', action: 'new', project_id: @project }, - { class: 'button -primary', - aria: { label: t(:label_version_new) }, - title: t(:label_version_new) }) do %> - <%= op_icon('button--icon icon-add') %> - <%= t('activerecord.models.version') %> - <% end %> -
  • -<% end %> +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_backlogs) } + header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, + t(:label_backlogs) + ]) + end +%> + +<%= render(Primer::OpenProject::SubHeader.new) do |subheader| + subheader.with_action_button(scheme: :primary, + aria: { label: t(:label_version_new) }, + title: t(:label_version_new), + tag: :a, + href: url_for({ controller: '/versions', action: 'new', project_id: @project })) do |button| + button.with_leading_visual_icon(icon: :plus) + t('activerecord.models.version') + end +end %> <% if (@owner_backlogs.empty? && @sprint_backlogs.empty?) %> <%= no_results_box action_url: new_project_version_path(@project), From 4b0805259ebd5095d6115948f90f6eb368642429 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 6 Nov 2024 08:50:08 +0100 Subject: [PATCH 012/136] change header in edit version page --- app/views/versions/edit.html.erb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/versions/edit.html.erb b/app/views/versions/edit.html.erb index a32dd511565d..7f6e7f7a5da6 100644 --- a/app/views/versions/edit.html.erb +++ b/app/views/versions/edit.html.erb @@ -28,7 +28,16 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title t("label_roadmap_edit", name: @version.name) %> -<%= toolbar title: Version.model_name.human %> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { @version.name } + header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_settings_versions_path(@project.id), text: I18n.t("label_version_plural")}, + @version.name + ]) + end +%> <%= labelled_tabular_form_for @version do |f| %> From b7ce95aa3c97ba04edc654091f6b383906ff3361 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 6 Nov 2024 14:17:50 +0100 Subject: [PATCH 013/136] change html title in edit version page --- app/views/versions/edit.html.erb | 2 +- config/locales/en.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/versions/edit.html.erb b/app/views/versions/edit.html.erb index 7f6e7f7a5da6..b4a5aa14b1ea 100644 --- a/app/views/versions/edit.html.erb +++ b/app/views/versions/edit.html.erb @@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details. ++#%> -<% html_title t("label_roadmap_edit", name: @version.name) %> +<% html_title( @version.name, t(:label_version_edit)) %> <%= render Primer::OpenProject::PageHeader.new do |header| diff --git a/config/locales/en.yml b/config/locales/en.yml index 50c86ac363c7..dd1489738568 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2658,6 +2658,7 @@ en: label_user_settings: "User settings" label_users_settings: "Users settings" label_version_new: "New version" + label_version_edit: "Edit version" label_version_plural: "Versions" label_version_sharing_descendants: "With subprojects" label_version_sharing_hierarchy: "With project hierarchy" From 45656dbd5e707dcb2b3693f49cbc8d7cbe6f125c Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Sun, 10 Nov 2024 21:48:15 +0100 Subject: [PATCH 014/136] change page header in budget page --- .../budgets/app/views/budgets/index.html.erb | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/modules/budgets/app/views/budgets/index.html.erb b/modules/budgets/app/views/budgets/index.html.erb index bba83f521578..346f910c4777 100644 --- a/modules/budgets/app/views/budgets/index.html.erb +++ b/modules/budgets/app/views/budgets/index.html.erb @@ -26,18 +26,28 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> - <% html_title(t(:label_budget_plural)) %> -<%= toolbar title: t(:label_budget_plural) do %> - <% if authorize_for(:budgets, :new) %> -
  • - - <%= op_icon('button--icon icon-add') %> - <%= t(:label_budget) %> - -
  • - <% end %> -<% end %> + +<%= + render(Primer::OpenProject::PageHeader.new) do |header| + header.with_title { t(:label_budget_plural) } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + t(:label_budget_plural)]) + end +%> +<%= + render(Primer::OpenProject::SubHeader.new) do |subheader| + subheader.with_action_button(scheme: :primary, + aria: { label: I18n.t(:button_add_budget) }, + title: I18n.t(:button_add_budget), + tag: :a, + href: new_projects_budget_path(@project)) do |button| + button.with_leading_visual_icon(icon: :plus) + t(:label_budget) + end + end +%> + <% if @budgets.empty? %> <%= no_results_box %> From 93a78fa247b52c21bb3ac23a92be765f0cb20011 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Mon, 11 Nov 2024 07:37:42 +0100 Subject: [PATCH 015/136] change page header in forum index page and change class of watcher link to look same as other primer buttons --- app/helpers/watchers_helper.rb | 2 +- app/views/forums/show.html.erb | 48 ++++++++++++------- .../budgets/app/views/budgets/index.html.erb | 1 - 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 22e7fb2743be..42c2cabf2983 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -42,7 +42,7 @@ def watcher_link(object, user, options = { replace: ".watcher_link", class: "wat path = send(:"#{(watched ? 'unwatch' : 'watch')}_path", object_type: object.class.to_s.underscore.pluralize, object_id: object.id, replace: options.delete("replace")) - html_options[:class] = html_options[:class].to_s + " button" + html_options[:class] = "#{html_options[:class]} Button--secondary Button" method = watched ? :delete : :post diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index cf7cc4615d4e..a4dc5faad6d8 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -46,24 +46,36 @@ See COPYRIGHT and LICENSE files for more details. <% end %> -<%= toolbar title: @forum.name, subtitle: format_text(@forum.description) do %> - <% if authorize_for(:messages, :new) %> -
  • - <%= link_to({controller: '/messages', action: 'new', forum_id: @forum}, - {class: 'add-message-button button -primary', - aria: {label: t(:label_message_new)}, - title: t(:label_message_new)}) do %> - <%= op_icon('button--icon icon-add') %> - <%= t(:label_message) %> - <% end %> - <% csp_onclick('jQuery("#add-message").show(); jQuery("#message_subject").focus();', '.add-message-button') %> -
  • - <% end %> - <% unless User.current.anonymous? %> -
  • - <%= watcher_link(@forum, User.current) %> -
  • - <% end %> +<%= + render(Primer::OpenProject::PageHeader.new) do |header| + header.with_title { @forum.name } + header.with_description { @forum.description } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_forums_path, text: t(:label_forum_plural) }, + @forum.name]) + end +%> +<% if authorize_for(:messages, :new) %> + <%= + render(Primer::OpenProject::SubHeader.new) do |subheader| + if authorize_for(:messages, :new) + subheader.with_action_button(scheme: :primary, + aria: { label: t(:label_message_new) }, + title: t(:label_message_new), + tag: :a, + class: 'add-message-button', + href: url_for({controller: '/messages', action: 'new', forum_id: @forum})) do |button| + button.with_leading_visual_icon(icon: :plus) + t(:label_message) + end + end + unless User.current.anonymous? + subheader.with_action_component do + watcher_link(@forum, User.current) + end + end + end + %> <% end %> <% if @topics.any? %> diff --git a/modules/budgets/app/views/budgets/index.html.erb b/modules/budgets/app/views/budgets/index.html.erb index 346f910c4777..818114a476f6 100644 --- a/modules/budgets/app/views/budgets/index.html.erb +++ b/modules/budgets/app/views/budgets/index.html.erb @@ -48,7 +48,6 @@ See COPYRIGHT and LICENSE files for more details. end %> - <% if @budgets.empty? %> <%= no_results_box %> <% else %> From e60dd4835251bc879d6dc51ac86c43f4e6d4d25d Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Mon, 11 Nov 2024 08:40:38 +0100 Subject: [PATCH 016/136] change page header in forum new message page --- app/views/forums/show.html.erb | 2 +- app/views/messages/new.html.erb | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index a4dc5faad6d8..be022da75b6f 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -51,7 +51,7 @@ See COPYRIGHT and LICENSE files for more details. header.with_title { @forum.name } header.with_description { @forum.description } header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, - { href: project_forums_path, text: t(:label_forum_plural) }, + { href: project_forums_path(@project), text: t(:label_forum_plural) }, @forum.name]) end %> diff --git a/app/views/messages/new.html.erb b/app/views/messages/new.html.erb index 7efd05da3ea7..9a278618e1c2 100644 --- a/app/views/messages/new.html.erb +++ b/app/views/messages/new.html.erb @@ -27,8 +27,15 @@ See COPYRIGHT and LICENSE files for more details. ++#%> -

    <%= link_to h(@forum.name), controller: '/forums', action: 'show', project_id: @project, id: @forum %> » <%= t(:label_message_new) %>

    - +<%= + render(Primer::OpenProject::PageHeader.new) do |header| + header.with_title { t(:label_message_new) } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_forums_path(@project), text: t(:label_forum_plural) }, + { href: url_for(controller: '/forums', action: 'show', project_id: @project, id: @forum), text: @forum.name }, + t(:label_message_new)]) + end +%> <%= labelled_tabular_form_for @message, url: forum_topics_path(@forum), html: { multipart: true, From a9637113143a632241f237eeb133a3e872200963 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Mon, 11 Nov 2024 23:16:35 +0100 Subject: [PATCH 017/136] update page header in budget new page --- modules/budgets/app/views/budgets/new.html.erb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/budgets/app/views/budgets/new.html.erb b/modules/budgets/app/views/budgets/new.html.erb index 7a4711af90bd..19c9ac07a75d 100644 --- a/modules/budgets/app/views/budgets/new.html.erb +++ b/modules/budgets/app/views/budgets/new.html.erb @@ -28,7 +28,15 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title(t(:label_budget_new)) %> -<%= toolbar title: t(:label_budget_new) %> + +<%= + render(Primer::OpenProject::PageHeader.new) do |header| + header.with_title { t(:label_budget_new) } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: projects_budgets_path(@project.id), text: t(:label_budget_plural) }, + t(:label_budget_new)]) + end +%> <%= labelled_tabular_form_for @budget, :url => projects_budgets_path(@project), From 4e7d69307ca0cca8a265d1f427fe2a6209640f36 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Mon, 11 Nov 2024 23:44:18 +0100 Subject: [PATCH 018/136] update page header in budget show page --- .../budgets/app/views/budgets/show.html.erb | 74 ++++++++++++------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/modules/budgets/app/views/budgets/show.html.erb b/modules/budgets/app/views/budgets/show.html.erb index 091bdfc329d4..ada6c333fb30 100644 --- a/modules/budgets/app/views/budgets/show.html.erb +++ b/modules/budgets/app/views/budgets/show.html.erb @@ -26,34 +26,54 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> - <% html_title "#{t(:label_budget_id, id: @budget.id)}: #{@budget.subject}" %> -<%= toolbar title: t(:label_budget_id, id: @budget.id) do %> - <% if authorize_for(:budgets, :edit) %> -
  • - <%= link_to({ controller: 'budgets', action: 'edit', id: @budget }, class: 'button', accesskey: accesskey(:edit)) do %> - <%= op_icon('button--icon icon-edit') %> - <%= t(:button_update) %> - <% end %> -
  • - <% end %> - <% if authorize_for(:budgets, :copy) %> -
  • - <%= link_to({ controller: 'budgets', action: 'copy', id: @budget }, class: 'button') do %> - <%= op_icon('button--icon icon-copy') %> - <%= t(:button_copy) %> - <% end %> -
  • - <% end %> - <% if authorize_for(:budgets, :destroy) %> -
  • - <%= link_to({ controller: 'budgets', action: 'destroy', id: @budget }, class: 'button', method: :delete) do %> - <%= op_icon('button--icon icon-delete') %> - <%= t(:button_delete) %> - <% end %> -
  • - <% end %> -<% end %> + +<%= + render(Primer::OpenProject::PageHeader.new) do |header| + header.with_title { t(:label_budget_id, id: @budget.id) } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: projects_budgets_path(@project.id), text: t(:label_budget_plural) }, + t(:label_budget_id, id: @budget.id)]) + + if authorize_for(:budgets, :edit) + header.with_action_button(tag: :a, + mobile_icon: :pencil, + mobile_label: t(:button_edit), + size: :medium, + href: url_for({ controller: 'budgets', action: 'edit', id: @budget }), + aria: { label: t(:button_update) }, + title: t(:button_update)) do |button| + button.with_leading_visual_icon(icon: :pencil) + t(:button_update) + end + end + if authorize_for(:budgets, :copy) + header.with_action_button(tag: :a, + mobile_icon: :copy, + mobile_label: t(:button_copy), + size: :medium, + href: url_for({ controller: 'budgets', action: 'copy', id: @budget }), + aria: { label: I18n.t(:button_copy) }, + title: I18n.t(:button_copy)) do |button| + button.with_leading_visual_icon(icon: :copy) + t(:button_copy) + end + end + if authorize_for(:budgets, :destroy) + header.with_action_button(tag: :a, + scheme: :danger, + mobile_icon: :trash, + mobile_label: t(:button_delete), + size: :medium, + href: url_for({ controller: 'budgets', action: 'destroy', id: @budget }), + aria: { label: I18n.t(:button_delete) }, + title: I18n.t(:button_delete)) do |button| + button.with_leading_visual_icon(icon: :trash) + t(:button_delete) + end + end + end +%>

    <%=h @budget.subject %>

    From d4b77174ef83eb84b7c6aab3423bcedbf788b263 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Mon, 11 Nov 2024 23:52:57 +0100 Subject: [PATCH 019/136] update page header in budget edit page --- modules/budgets/app/views/budgets/edit.html.erb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/budgets/app/views/budgets/edit.html.erb b/modules/budgets/app/views/budgets/edit.html.erb index 96f1923080c4..d8822528fa0b 100644 --- a/modules/budgets/app/views/budgets/edit.html.erb +++ b/modules/budgets/app/views/budgets/edit.html.erb @@ -28,6 +28,13 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title "#{t(:label_edit)} #{t(:label_budget_id, id: @budget.id)}: #{@budget.subject}" %> -<%= toolbar title: t(:label_budget_id, id: @budget.id) %> +<%= + render(Primer::OpenProject::PageHeader.new) do |header| + header.with_title { t(:label_budget_id, id: @budget.id) } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: projects_budgets_path(@project.id), text: t(:label_budget_plural) }, + t(:label_budget_id, id: @budget.id)]) + end +%> <%= render :partial => 'edit' %> From 8e7bb61c0f312bc2548e137f3afc5f0553ddb19a Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Tue, 12 Nov 2024 00:02:19 +0100 Subject: [PATCH 020/136] add a confirmation for delete method in budget form --- modules/budgets/app/views/budgets/show.html.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/budgets/app/views/budgets/show.html.erb b/modules/budgets/app/views/budgets/show.html.erb index ada6c333fb30..53dae027c229 100644 --- a/modules/budgets/app/views/budgets/show.html.erb +++ b/modules/budgets/app/views/budgets/show.html.erb @@ -67,6 +67,10 @@ See COPYRIGHT and LICENSE files for more details. size: :medium, href: url_for({ controller: 'budgets', action: 'destroy', id: @budget }), aria: { label: I18n.t(:button_delete) }, + data: { + confirm: I18n.t(:text_are_you_sure), + method: :delete + }, title: I18n.t(:button_delete)) do |button| button.with_leading_visual_icon(icon: :trash) t(:button_delete) From 3013dd14929420c7dc09cc9fd864eaf14c840bdf Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Tue, 12 Nov 2024 12:52:45 +0100 Subject: [PATCH 021/136] move header action to subheader in forums --- app/views/forums/index.html.erb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 41be4ec33edd..d8fb80516f89 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -35,20 +35,21 @@ See COPYRIGHT and LICENSE files for more details. { href: project_overview_path(@project.id), text: @project.name }, t(:label_forum_plural) ]) - if User.current.allowed_in_project?(:manage_forums, @project) - header.with_action_button(scheme: :primary, - mobile_icon: :plus, - mobile_label: t(:label_forum_new), - aria: { label: t(:label_forum_new) }, - title: t(:label_forum_new), - tag: :a, - href: new_project_forum_path(@project)) do |button| + end %> +<% if User.current.allowed_in_project?(:manage_forums, @project) %> + <%= + render(Primer::OpenProject::SubHeader.new) do |subheader| + subheader.with_action_button(scheme: :primary, + aria: { label: t(:label_forum_new) }, + title: t(:label_forum_new), + tag: :a, + href: new_project_forum_path(@project)) do |button| button.with_leading_visual_icon(icon: :plus) t('activerecord.models.forum') end end - end %> - + %> +<% end %> <% if @forums.empty? %> <%= no_results_box(action_url: new_project_forum_path(@project)) %> <% else %> From 989b8b453a9f09e91dda7acc7a8d0878649676da Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Tue, 12 Nov 2024 13:46:41 +0100 Subject: [PATCH 022/136] update page header in edit forum page --- app/views/forums/edit.html.erb | 8 +++++++- app/views/forums/index.html.erb | 7 +++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erb index 55eecad24ebf..db71092e464e 100644 --- a/app/views/forums/edit.html.erb +++ b/app/views/forums/edit.html.erb @@ -26,7 +26,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: Forum.model_name.human %> +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { @forum.name } + header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_forums_path(@project.id), text: t(:label_forum_plural) }, + @forum.name + ]) end %> <%= labelled_tabular_form_for [@project, @forum] do |f| %> <%= render partial: 'form', locals: { f: f } %> diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index d8fb80516f89..efca46174d54 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -31,11 +31,10 @@ See COPYRIGHT and LICENSE files for more details. <%= render Primer::OpenProject::PageHeader.new do |header| header.with_title { t(:label_forum_plural) } - header.with_breadcrumbs( [ - { href: project_overview_path(@project.id), text: @project.name }, + header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, t(:label_forum_plural) - ]) - end %> + ]) end %> + <% if User.current.allowed_in_project?(:manage_forums, @project) %> <%= render(Primer::OpenProject::SubHeader.new) do |subheader| From 567c40190f72a5f0326ee631afbcfd919302f4a2 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Tue, 12 Nov 2024 15:25:39 +0100 Subject: [PATCH 023/136] update page header in documents pages --- .../app/views/documents/index.html.erb | 34 ++++++++++++------- .../app/views/documents/new.html.erb | 11 +++++- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/modules/documents/app/views/documents/index.html.erb b/modules/documents/app/views/documents/index.html.erb index 61cfb2268def..842896b22362 100644 --- a/modules/documents/app/views/documents/index.html.erb +++ b/modules/documents/app/views/documents/index.html.erb @@ -27,20 +27,30 @@ See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: t(:label_document_plural) do %> - <% if authorize_for(:documents, :new) %> -
  • - <%= link_to({:controller => '/documents', :action => 'new', :project_id => @project}, - { class: 'button -primary', - aria: {label: t(:label_document_new)}, - title: t(:label_document_new)}) do %> - <%= op_icon('button--icon icon-add') %> - <%= t('activerecord.models.document') %> - <% end %> -
  • - <% end %> +<%= + render(Primer::OpenProject::PageHeader.new) do |header| + header.with_title { t(:label_document_plural) } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + t(:label_document_plural)]) + end +%> + +<% if authorize_for(:documents, :new) %> + <%= + render(Primer::OpenProject::SubHeader.new) do |subheader| + subheader.with_action_button(scheme: :primary, + aria: { label: t(:label_document_new) }, + title: t(:label_document_new), + tag: :a, + href: url_for({:controller => '/documents', :action => 'new', :project_id => @project})) do |button| + button.with_leading_visual_icon(icon: :plus) + t('activerecord.models.document') + end + end + %> <% end %> + <% if @grouped.empty? %> <%= no_results_box %> <% end %> diff --git a/modules/documents/app/views/documents/new.html.erb b/modules/documents/app/views/documents/new.html.erb index e6dd45fdd91b..2d8266a2cdf6 100644 --- a/modules/documents/app/views/documents/new.html.erb +++ b/modules/documents/app/views/documents/new.html.erb @@ -26,7 +26,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: t(:label_document_new) %> + +<%= + render(Primer::OpenProject::PageHeader.new) do |header| + header.with_title { t(:label_document_new) } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_documents_path(@project.id), text: t(:label_document_plural) }, + t(:label_document_new)]) + end +%> + <%= labelled_tabular_form_for @document, url: project_documents_path(@project), html: { multipart: true } do |f| -%> <%= render :partial => 'documents/form', locals: { f: f } %> From e397666c46148d7f2a12a21061106db3a979ef0f Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Tue, 12 Nov 2024 16:14:23 +0100 Subject: [PATCH 024/136] update page header in work package categories pages --- app/views/categories/edit.html.erb | 12 ++++++- app/views/categories/new.html.erb | 12 ++++++- .../settings/categories/show.html.erb | 34 ++++++++++++------- .../app/views/documents/new.html.erb | 1 - 4 files changed, 44 insertions(+), 15 deletions(-) diff --git a/app/views/categories/edit.html.erb b/app/views/categories/edit.html.erb index cd0a4711ef27..46f7b44b11d2 100644 --- a/app/views/categories/edit.html.erb +++ b/app/views/categories/edit.html.erb @@ -26,7 +26,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: Category.model_name.human %> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { @category.name } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") }, + { href: project_settings_categories_path(@project.id), text: t(:label_work_package_category_plural) }, + @category.name + ]) + end %> + <%= labelled_tabular_form_for @category, as: :category do |f| %> <%= render partial: 'categories/form', locals: { f: f } %> <%= f.button t(:button_save), class: 'button -primary -with-icon icon-checkmark' %> diff --git a/app/views/categories/new.html.erb b/app/views/categories/new.html.erb index f93042e60ecc..bcb04b11371c 100644 --- a/app/views/categories/new.html.erb +++ b/app/views/categories/new.html.erb @@ -26,7 +26,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: t(:label_work_package_category_new) %> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_work_package_category_new) } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") }, + { href: project_settings_categories_path(@project.id), text: t(:label_work_package_category_plural) }, + t(:label_work_package_category_new) + ]) + end %> + <%= labelled_tabular_form_for [@project, @category], as: :category do |f| %> <%= render partial: 'categories/form', locals: { f: f } %> <%= f.button t(:button_create), class: 'button -primary -with-icon icon-checkmark' %> diff --git a/app/views/projects/settings/categories/show.html.erb b/app/views/projects/settings/categories/show.html.erb index 8b8a000aaba6..b9056169ce41 100644 --- a/app/views/projects/settings/categories/show.html.erb +++ b/app/views/projects/settings/categories/show.html.erb @@ -26,19 +26,29 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_work_package_category_plural) } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") }, + t(:label_work_package_category_plural) + ]) + end %> -<%= toolbar title: t(:label_work_package_category_plural) do -%> - <% if current_user.allowed_in_project?(:manage_categories, @project) %> -
  • - <%= link_to_if_authorized({ controller: '/categories', action: 'new', project_id: @project }, - { aria: { label: t(:label_work_package_category_new) }, - title: t(:label_work_package_category_new), - class: 'button -primary'}) do %> - <%= op_icon('icon-add button--icon') %> - <%= t('activerecord.models.category') %> - <% end %> -
  • - <% end %> + +<% if current_user.allowed_in_project?(:manage_categories, @project) %> + <%= + render(Primer::OpenProject::SubHeader.new) do |subheader| + subheader.with_action_button(scheme: :primary, + aria: { label: t(:label_work_package_category_new) }, + title: t(:label_work_package_category_new), + tag: :a, + href: url_for({ controller: '/categories', action: 'new', project_id: @project })) do |button| + button.with_leading_visual_icon(icon: :plus) + t('activerecord.models.category') + end + end + %> <% end %> <% if @project.categories.any? %> diff --git a/modules/documents/app/views/documents/new.html.erb b/modules/documents/app/views/documents/new.html.erb index 2d8266a2cdf6..da9df9c9d7e3 100644 --- a/modules/documents/app/views/documents/new.html.erb +++ b/modules/documents/app/views/documents/new.html.erb @@ -36,7 +36,6 @@ See COPYRIGHT and LICENSE files for more details. end %> - <%= labelled_tabular_form_for @document, url: project_documents_path(@project), html: { multipart: true } do |f| -%> <%= render :partial => 'documents/form', locals: { f: f } %> <%= styled_button_tag t(:button_create), class: "-primary -with-icon icon-checkmark" %> From 18de94e67ec89b977f25889e188f37c6e408a86b Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 13 Nov 2024 07:41:02 +0100 Subject: [PATCH 025/136] update page header in boards pages --- .../app/views/team_planner/team_planner/new.html.erb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/team_planner/app/views/team_planner/team_planner/new.html.erb b/modules/team_planner/app/views/team_planner/team_planner/new.html.erb index e323ef21246d..6864cc7f6558 100644 --- a/modules/team_planner/app/views/team_planner/team_planner/new.html.erb +++ b/modules/team_planner/app/views/team_planner/team_planner/new.html.erb @@ -28,7 +28,15 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title t('team_planner.label_new_team_planner') %> -<%= toolbar title: t('team_planner.label_new_team_planner') %> +<%= + render(Primer::OpenProject::PageHeader.new) do |header| + header.with_title { t('team_planner.label_new_team_planner') } + header.with_breadcrumbs([*([ href: home_path, text: organization_name ] unless @project), + *([ href: project_overview_path(@project.id), text: @project.name ] if @project), + t('team_planner.label_new_team_planner')]) + end +%> + <%= labelled_tabular_form_for @view, url: { controller: '/team_planner/team_planner', action: 'create' }, :html => {:id => 'team-planner-form'} do |f| -%> <%= render :partial => 'form', :locals => {:f => f} %> <%= styled_button_tag t(:button_create), class: '-primary' %> From d814a0e910ce1f70573fce3f29114cccccd66002 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 13 Nov 2024 07:41:16 +0100 Subject: [PATCH 026/136] update page header in boards pages --- modules/boards/app/views/boards/boards/new.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/boards/app/views/boards/boards/new.html.erb b/modules/boards/app/views/boards/boards/new.html.erb index 1a30bb849136..9ee4af3a1a61 100644 --- a/modules/boards/app/views/boards/boards/new.html.erb +++ b/modules/boards/app/views/boards/boards/new.html.erb @@ -32,8 +32,9 @@ See COPYRIGHT and LICENSE files for more details. <%= render Primer::OpenProject::PageHeader.new do |header| header.with_title { t('boards.label_create_new_board') } - header.with_breadcrumbs( [{ href: project_overview_path(@project.id), text: @project.name }, - { href: project_work_package_boards_path(@project.id), text: t("boards.label_boards") }, + header.with_breadcrumbs( [*([ href: home_path, text: organization_name ] unless @project), + *([ href: project_overview_path(@project.id), text: @project.name ] if @project), + *([ href: project_work_package_boards_path(@project.id), text: t("boards.label_boards") ] if @project), t('boards.label_create_new_board') ]) end From e99ade610aa16756b4c89ef8d81371097f4b2033 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 13 Nov 2024 07:57:22 +0100 Subject: [PATCH 027/136] update page header in new calendar page --- .../app/views/calendar/calendars/new.html.erb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/calendar/app/views/calendar/calendars/new.html.erb b/modules/calendar/app/views/calendar/calendars/new.html.erb index cc40c710dfd1..d26aa576d874 100644 --- a/modules/calendar/app/views/calendar/calendars/new.html.erb +++ b/modules/calendar/app/views/calendar/calendars/new.html.erb @@ -28,7 +28,17 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title t(:label_new_calendar) %> -<%= toolbar title: t(:label_new_calendar) %> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { t(:label_new_calendar) } + header.with_breadcrumbs( [{ href: home_path, text: organization_name }, + { href: calendars_path, text: t(:label_calendar_plural) }, + t(:label_new_calendar) + ]) + end +%> + <%= labelled_tabular_form_for @view, url: { controller: '/calendar/calendars', action: 'create' }, :html => {:id => 'calendar-form'} do |f| -%> <%= render :partial => 'form', :locals => {:f => f} %> <%= styled_button_tag t(:button_create), class: '-primary' %> From ccbf1e619ba14fbf8cd3939b9c806943ed552148 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 13 Nov 2024 08:12:17 +0100 Subject: [PATCH 028/136] update page header in destroy category page --- app/views/categories/destroy.html.erb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/categories/destroy.html.erb b/app/views/categories/destroy.html.erb index ea75334d6a64..ec000ebaaea2 100644 --- a/app/views/categories/destroy.html.erb +++ b/app/views/categories/destroy.html.erb @@ -26,7 +26,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: "#{Category.model_name.human} #{@category.name}" %> + +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { @category.name } + header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, + { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") }, + { href: project_settings_categories_path(@project.id), text: t(:label_work_package_category_plural) }, + @category.name + ]) + end %> + <%= form_tag({}, {method: :delete, class: 'form'}) do %>

    <%= t(:text_work_package_category_destroy_question, count: @issue_count) %>

    From f39f61c987fe2916549c28210d08f8d1789b9747 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 13 Nov 2024 08:32:33 +0100 Subject: [PATCH 029/136] change page header breadcrumbs for edit and destroy categories --- app/views/categories/destroy.html.erb | 4 ++-- app/views/categories/edit.html.erb | 4 ++-- config/locales/en.yml | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/categories/destroy.html.erb b/app/views/categories/destroy.html.erb index ec000ebaaea2..f9a78d65bb97 100644 --- a/app/views/categories/destroy.html.erb +++ b/app/views/categories/destroy.html.erb @@ -33,8 +33,8 @@ See COPYRIGHT and LICENSE files for more details. header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") }, { href: project_settings_categories_path(@project.id), text: t(:label_work_package_category_plural) }, - @category.name - ]) + "#{@category.name}: #{t(:label_delete)}".html_safe + ], selected_item_font_weight: :normal) end %> <%= form_tag({}, {method: :delete, class: 'form'}) do %> diff --git a/app/views/categories/edit.html.erb b/app/views/categories/edit.html.erb index 46f7b44b11d2..18c0d969b129 100644 --- a/app/views/categories/edit.html.erb +++ b/app/views/categories/edit.html.erb @@ -33,8 +33,8 @@ See COPYRIGHT and LICENSE files for more details. header.with_breadcrumbs([{ href: project_overview_path(@project.id), text: @project.name }, { href: project_settings_general_path(@project.id), text: I18n.t("label_project_settings") }, { href: project_settings_categories_path(@project.id), text: t(:label_work_package_category_plural) }, - @category.name - ]) + "#{@category.name}: #{t(:label_edit)}".html_safe + ], selected_item_font_weight: :normal) end %> <%= labelled_tabular_form_for @category, as: :category do |f| %> diff --git a/config/locales/en.yml b/config/locales/en.yml index dd1489738568..0696904ef4f0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2240,6 +2240,7 @@ en: label_default: "Default" label_delete_user: "Delete user" label_delete_project: "Delete project" + label_delete: "Delete" label_deleted: "deleted" label_deleted_custom_field: "(deleted custom field)" label_deleted_custom_option: "(deleted option)" From 21178a2c0120b1a249eef5d155033dabedea4443 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 13 Nov 2024 14:28:24 +0100 Subject: [PATCH 030/136] change watcher helper that can be used in page header action buttons --- app/helpers/watchers_helper.rb | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 42c2cabf2983..4b9aa499533c 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -42,7 +42,7 @@ def watcher_link(object, user, options = { replace: ".watcher_link", class: "wat path = send(:"#{(watched ? 'unwatch' : 'watch')}_path", object_type: object.class.to_s.underscore.pluralize, object_id: object.id, replace: options.delete("replace")) - html_options[:class] = "#{html_options[:class]} Button--secondary Button" + html_options[:class] = "#{html_options[:class]} button" method = watched ? :delete : :post @@ -52,3 +52,28 @@ def watcher_link(object, user, options = { replace: ".watcher_link", class: "wat content_tag(:span, label, class: "button--text"), path, html_options.merge(method:)) end end + +def watcher_button_arguments(object, user) + return nil unless user&.logged? && object.respond_to?(:watched_by?) + + watched = object.watched_by?(user) + + path = send(:"#{(watched ? 'unwatch' : 'watch')}_path", object_type: object.class.to_s.underscore.pluralize, + object_id: object.id) + + method = watched ? :delete : :post + + label = watched ? I18n.t(:button_unwatch) : I18n.t(:button_watch) + + { + tag: :a, + href: path, + scheme: :default, + aria: { label: label }, + data: { + method: + }, + mobile_icon: watched ? "eye-closed" : "eye", + mobile_label: label + } +end From 63f7a2495bfa79ba3b650e842aa281471b7f2158 Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 13 Nov 2024 14:32:29 +0100 Subject: [PATCH 031/136] change watcher helper that can be used in page header action buttons --- app/helpers/watchers_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 4b9aa499533c..91264afaac71 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -58,7 +58,8 @@ def watcher_button_arguments(object, user) watched = object.watched_by?(user) - path = send(:"#{(watched ? 'unwatch' : 'watch')}_path", object_type: object.class.to_s.underscore.pluralize, + path = send(:"#{(watched ? 'unwatch' : 'watch')}_path", + object_type: object.class.to_s.underscore.pluralize, object_id: object.id) method = watched ? :delete : :post From 8e884141687eee600959f9e3bbd19089419e534b Mon Sep 17 00:00:00 2001 From: Behrokh Satarnejad Date: Wed, 13 Nov 2024 14:46:52 +0100 Subject: [PATCH 032/136] update page header in show and edit pages of news --- app/views/news/edit.html.erb | 11 ++++-- app/views/news/show.html.erb | 67 +++++++++++++++++++++--------------- 2 files changed, 49 insertions(+), 29 deletions(-) diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index dd8cadc3a921..ffb4536f5efd 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -28,8 +28,15 @@ See COPYRIGHT and LICENSE files for more details. ++#%> <% html_title t(:label_news_edit) %> -<%= toolbar title: News.model_name.human %> - +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title {@news.title } + header.with_breadcrumbs([*([ href: home_path, text: organization_name ] unless @project), + *([ href: project_overview_path(@project.id), text: @project.name ] if @project), + *([ href: project_news_index_path(@project.id), text: t(:label_news_plural) ] if @project), + "#{@news.title}: #{t(:label_edit)}".html_safe + ], selected_item_font_weight: :normal) + end %> <%= labelled_tabular_form_for @news, html: { id: 'news-form' } do |f| %> <%= render partial: 'form', locals: { f: f } %>
    diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb index 6e6820b3def3..317fc5b8a42e 100644 --- a/app/views/news/show.html.erb +++ b/app/views/news/show.html.erb @@ -27,33 +27,46 @@ See COPYRIGHT and LICENSE files for more details. ++#%> -<%= toolbar title: "#{avatar(@news.author)} #{h @news.title}".html_safe do %> - <% if User.current.allowed_in_project?(:manage_news, @project) %> -
  • - <%= link_to(edit_news_path(@news), - accesskey: accesskey(:edit), - class: 'button edit-news-button') do %> - <%= op_icon('button--icon icon-edit') %> - <%= t(:button_edit) %> - <% end %> - <% csp_onclick('jQuery("#edit-news").show()', '.edit-news-button') %> -
  • - <% end %> -
  • - <%= watcher_link(@news, User.current) %> -
  • - <% if User.current.allowed_in_project?(:manage_news, @project) %> -
  • - <%= link_to(news_path(@news), - data: { confirm: t(:text_are_you_sure) }, - method: :delete, - class: 'button') do %> - <%= op_icon('button--icon icon-delete') %> - <%= t(:button_delete) %> - <% end %> -
  • - <% end %> -<% end %> +<%= + render Primer::OpenProject::PageHeader.new do |header| + header.with_title { "#{avatar(@news.author)} #{h @news.title}".html_safe } + header.with_breadcrumbs([*([ href: home_path, text: organization_name ] unless @project), + *([ href: project_overview_path(@project.id), text: @project.name ] if @project), + *([ href: project_news_index_path(@project.id), text: t(:label_news_plural) ] if @project), + @news.title]) + if User.current.allowed_in_project?(:manage_news, @project) + header.with_action_button(tag: :a, + mobile_icon: :pencil, + mobile_label: t(:button_edit), + size: :medium, + href: edit_news_path(@news), + aria: { label: I18n.t(:button_edit) }, + title: I18n.t(:button_edit)) do |button| + csp_onclick('jQuery("#edit-news").show()', '.edit-news-button') + button.with_leading_visual_icon(icon: :pencil) + t(:button_edit) + end + end + watcher_button_args = watcher_button_arguments(@news, User.current) + header.with_action_button(**watcher_button_args) do |button| + button.with_leading_visual_icon(icon: watcher_button_args[:mobile_icon]) + watcher_button_args[:mobile_label] + end + if User.current.allowed_in_project?(:manage_news, @project) + header.with_action_button(scheme: :danger, + tag: :a, + href: news_path(@news), + mobile_icon: :trash, + mobile_label: I18n.t("button_delete"), + data: { confirm: t(:text_are_you_sure), method: :delete, }, + aria: { label: I18n.t("button_delete") }, + ) do |button| + button.with_leading_visual_icon(icon: :trash) + I18n.t("button_delete") + end + end + end +%> <% if authorize_for('news', 'edit') %>