From 1b80f8117c752cd268ee549f0eeba57eaa98b183 Mon Sep 17 00:00:00 2001 From: Klaus Zanders Date: Fri, 29 Nov 2024 16:34:52 +0100 Subject: [PATCH] do not show temp links in overviews in tests --- .../views/overviews/overviews/show.html.erb | 131 ++++++++++-------- 1 file changed, 77 insertions(+), 54 deletions(-) diff --git a/modules/overviews/app/views/overviews/overviews/show.html.erb b/modules/overviews/app/views/overviews/overviews/show.html.erb index 14a7e02f0adb..54d027b60f25 100644 --- a/modules/overviews/app/views/overviews/overviews/show.html.erb +++ b/modules/overviews/app/views/overviews/overviews/show.html.erb @@ -2,66 +2,89 @@ <% end -%> -<%= - render(Primer::OpenProject::PageHeader.new( +<%= render( + Primer::OpenProject::PageHeader.new( data: { - 'controller': 'overview-header', - 'application-target': 'dynamic', - turbo: true - } - )) do |header| - header.with_title(variant: :medium) { t("overviews.label") } - header.with_breadcrumbs( - [ - { href: project_path(@project), text: @project.name }, - t("overviews.label") - ] - ) - favored = @project.favored_by?(User.current) - header.with_action_icon_button( - icon: favored ? "star-fill" : "star", - mobile_icon: favored ? "star-fill" : "star", - size: :medium, - tag: :a, - href: build_favorite_path(@project, format: :html), - data: { method: favored ? :delete : :post }, - classes: favored ? "op-primer--star-icon" : "", + controller: "overview-header", + "application-target": "dynamic", + turbo: true, + }, + ), +) do |header| + header.with_title(variant: :medium) { t("overviews.label") } + header.with_breadcrumbs( + [ + { href: project_path(@project), text: @project.name }, + t("overviews.label"), + ], + ) + favored = @project.favored_by?(User.current) + header.with_action_icon_button( + icon: favored ? "star-fill" : "star", + mobile_icon: favored ? "star-fill" : "star", + size: :medium, + tag: :a, + href: build_favorite_path(@project, format: :html), + data: { + method: favored ? :delete : :post, + }, + classes: favored ? "op-primer--star-icon" : "", + label: favored ? I18n.t(:button_unfavorite) : I18n.t(:button_favorite), + aria: { label: favored ? I18n.t(:button_unfavorite) : I18n.t(:button_favorite), - aria: { label: favored ? I18n.t(:button_unfavorite) : I18n.t(:button_favorite) }, - test_selector: 'project-favorite-button' - ) - - header.with_action_menu(menu_arguments: { anchor_align: :end }, - button_arguments: { icon: "op-kebab-vertical", "aria-label": t(:label_menu) }) do |menu| + }, + test_selector: "project-favorite-button", + ) - if User.current.allowed_in_project?(:select_project_custom_fields, @project) - menu.with_item( - label: t(:label_project_attribute_manage_link), - href: project_settings_project_custom_fields_path(@project), - data: { turbo: false } - ) do |item| - item.with_leading_visual_icon(icon: :pencil) - end - end - - if User.current.allowed_in_project?(:archive_project, @project) - menu.with_item( - label: t(:label_archive_project), - href: project_archive_path(@project, status: '', name: @project.name), - content_arguments: { - data: { method: :post, turbo: false, confirm: t('project.archive.are_you_sure', name: @project.name) }, - } - ) do |item| - item.with_leading_visual_icon(icon: :lock) - end - end + header.with_action_menu( + menu_arguments: { + anchor_align: :end, + }, + button_arguments: { + icon: "op-kebab-vertical", + "aria-label": t(:label_menu), + }, + ) do |menu| + if User.current.allowed_in_project?(:select_project_custom_fields, @project) + menu.with_item( + label: t(:label_project_attribute_manage_link), + href: project_settings_project_custom_fields_path(@project), + data: { + turbo: false, + }, + ) { |item| item.with_leading_visual_icon(icon: :pencil) } + end + if User.current.allowed_in_project?(:archive_project, @project) + menu.with_item( + label: t(:label_archive_project), + href: project_archive_path(@project, status: "", name: @project.name), + content_arguments: { + data: { + method: :post, + turbo: false, + confirm: t("project.archive.are_you_sure", name: @project.name), + }, + }, + ) { |item| item.with_leading_visual_icon(icon: :lock) } end end -%> +end %> -<%# TEMPORARY #%> -<%= link_to "log time", dialog_project_time_entries_path(@project), data: { controller: "async-dialog", test_selector: "toggle-log-time-dialog-button" } %> -<%= link_to "edit log time", dialog_project_time_entries_path(@project, time_entry_id: TimeEntry.first.id), data: { controller: "async-dialog", test_selector: "toggle-log-time-dialog-button" } %> +<%# TEMPORARY # %> +<%- if Rails.env.development? %> + <%= link_to "log time", + dialog_project_time_entries_path(@project), + data: { + controller: "async-dialog", + test_selector: "toggle-log-time-dialog-button", + } %> + <%= link_to "edit log time", + dialog_project_time_entries_path(@project, time_entry_id: TimeEntry.first.id), + data: { + controller: "async-dialog", + test_selector: "toggle-log-time-dialog-button", + } %> +<% end %>