Skip to content

Commit

Permalink
do not show temp links in overviews in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
klaustopher committed Dec 3, 2024
1 parent ce3accc commit c1fe43b
Showing 1 changed file with 77 additions and 54 deletions.
131 changes: 77 additions & 54 deletions modules/overviews/app/views/overviews/overviews/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,89 @@
<meta name="sidebar_enabled" data-enabled="<%= @sidebar_enabled %>">
<% 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 %>

<openproject-base></openproject-base>

0 comments on commit c1fe43b

Please sign in to comment.