Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to primer_view_components 0.28.1 and update PageHeaders in Core #15129

Merged
merged 43 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
12c3fd3
update core with new primer view components and update page header co…
bsatarnejad Mar 27, 2024
24d9a42
update page header in project attributes page
bsatarnejad Mar 27, 2024
8f2b9f2
update page header in projects index page
bsatarnejad Mar 27, 2024
2b21ffe
update page header in virus scanning page
bsatarnejad Mar 27, 2024
9ad93c7
update page header in Quarantined attachments page
bsatarnejad Mar 27, 2024
108490d
use one breadcrumb in virus scanning page
bsatarnejad Mar 28, 2024
6a91890
use one breadcrumb in quarantined attachments page
bsatarnejad Mar 28, 2024
555b141
show breadcrumb in project attributes page
bsatarnejad Mar 28, 2024
cf7bf7c
show breadcrumb in project attributes edit page
bsatarnejad Mar 28, 2024
e152956
show breadcrumb in header component of project attributes page
bsatarnejad Mar 28, 2024
0c6ae6f
show correct breadcrumb in members and projects pages
bsatarnejad Mar 28, 2024
82364e1
show correct breadcrumb in form header component of projects custom f…
bsatarnejad Mar 28, 2024
c662b50
show correct breadcrumb in create a new storage page
bsatarnejad Mar 28, 2024
fb3c6a7
(not complete we should discuss) there is no action type for renderin…
bsatarnejad Mar 28, 2024
051a53f
project attribute edit header update with new breadcrumb
bsatarnejad Mar 28, 2024
eecae54
change order of buttons in members page header
bsatarnejad Mar 28, 2024
522ab3f
commit gemfile.lock and package-lock.json
bsatarnejad Apr 3, 2024
d622636
use double quotation marks for string
bsatarnejad Apr 3, 2024
0ca05da
remove unnecessary system arguments
bsatarnejad Apr 3, 2024
1f6185f
Wrap form around the PageHeader in order for the submit button to wor…
HDinger Apr 3, 2024
978006b
Replace invisble button with a link as it matches the requirements be…
HDinger Apr 3, 2024
991be14
fix string definition in projects list
bsatarnejad Apr 3, 2024
aab2443
update primer view component version to 0.26.0
bsatarnejad Apr 3, 2024
49a06fa
Extract menu logic of projects page into a helper to be able to acces…
HDinger Apr 3, 2024
b70ddc5
update breadcrumb in edit form of project attribute
bsatarnejad Apr 3, 2024
17996f1
Merge branch 'implementation-update-page-header-in-core' of https://g…
bsatarnejad Apr 3, 2024
338000b
update breadcrumb in edit form of project attribute
bsatarnejad Apr 3, 2024
a7ebc43
remove show default breadcrumb method in some components
bsatarnejad Apr 3, 2024
ba91ed8
Add breadcrumb to edit state of the project list page header
HDinger Apr 4, 2024
bbf0a01
Add required breadcrumb elements to Storages and Project attribute page
HDinger Apr 4, 2024
735e5ef
Update primer to 0.27.0 so that we can use the Dialog slot on the pro…
HDinger Apr 4, 2024
b1c3932
Reflect the sidebar hierarchy in the breadcrumbs of the Members page
HDinger Apr 4, 2024
7bdcfdd
Merge remote-tracking branch 'origin/dev' into implementation-update-…
HDinger Apr 4, 2024
15d619b
Fix breadcrumb and page title for the members page
HDinger Apr 5, 2024
4ffa2ff
Add label for zen mode (used by Primer::OpenProject::ZenModeButton)
HDinger Apr 5, 2024
eea6bf8
Remove NewStorageButtonComponent as it does not work outside a header…
HDinger Apr 5, 2024
b110240
Add old breadcrumb methods again for super class compliance && fix tests
HDinger Apr 5, 2024
ac68ad8
Add correct breadcrumb element for the project settings page of proje…
HDinger Apr 5, 2024
1a5581b
Merge branch 'dev' into implementation-update-page-header-in-core
HDinger Apr 8, 2024
c60c150
Change order of buttons back until we have decided on how we want to …
HDinger Apr 10, 2024
90f0721
Merge remote-tracking branch 'origin/dev' into implementation-update-…
HDinger Apr 10, 2024
2ece709
Extract header into separate components for separation of concerns
HDinger Apr 10, 2024
1a1a3f6
Bump to primer version 0.28.1
HDinger Apr 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,4 @@ end

gem "openproject-octicons", "~>19.8.0"
gem "openproject-octicons_helper", "~>19.8.0"
gem "openproject-primer_view_components", "~>0.23.0"
HDinger marked this conversation as resolved.
Show resolved Hide resolved
gem "openproject-primer_view_components", "~>0.25.0"
50 changes: 19 additions & 31 deletions app/components/members/index_page_header_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
<%=
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { t(:label_member_plural) }
header.with_breadcrumbs(breadcrumb_items)

header.with_actions do
flex_layout do |actions|
if User.current.allowed_in_project?(:manage_members, @project)
actions.with_column(mr: BUTTON_MARGIN_RIGHT) do
render(
Primer::Beta::Button.new(
scheme: :primary,
size: :medium,
aria: { label: I18n.t(:button_add_member) },
title: I18n.t(:button_add_member),
id: 'add-member-button',
data: add_button_data_attributes
)
) do |button|
button.with_leading_visual_icon(icon: :plus)
t('activerecord.models.member')
end
end
end
header.with_action_icon_button(mobile_icon: "filter",
scheme: :default,
icon: 'filter',
HDinger marked this conversation as resolved.
Show resolved Hide resolved
label: I18n.t(:description_filter),
id: 'filter-member-button',
aria: { label: I18n.t(:description_filter) },
class: 'toggle-member-filter-link',
data: filter_button_data_attributes)

actions.with_column do
render(
Primer::Beta::IconButton.new(
icon: 'filter',
id: 'filter-member-button',
aria: { label: I18n.t(:description_filter) },
class: 'toggle-member-filter-link',
data: filter_button_data_attributes
)
)
end
end
header.with_action_button(scheme: :primary,
mobile_icon: :plus,
mobile_label: t('activerecord.models.member'),
size: :medium,
aria: { label: I18n.t(:button_add_member) },
title: I18n.t(:button_add_member),
id: 'add-member-button',
data: add_button_data_attributes) do |button|
button.with_leading_visual_icon(icon: :plus)
t('activerecord.models.member')
HDinger marked this conversation as resolved.
Show resolved Hide resolved
end
end
%>
6 changes: 4 additions & 2 deletions app/components/members/index_page_header_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class Members::IndexPageHeaderComponent < ApplicationComponent
include OpPrimer::ComponentHelpers
include ApplicationHelper

BUTTON_MARGIN_RIGHT = 2

def initialize(project: nil)
super
@project = project
Expand All @@ -57,4 +55,8 @@ def filter_button_data_attributes
action: "members-form#toggleMemberFilter"
}
end

def breadcrumb_items
[{ href: project_overview_path(@project.id), text: @project.name }, t(:label_member_plural)]
end
end
169 changes: 81 additions & 88 deletions app/components/projects/index_page_header_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,115 +1,108 @@
<%= render(Primer::OpenProject::PageHeader.new) do |header| %>
<% if show_state? %>
<% header.with_title(data: { 'test-selector': 'project-query-name'}) { page_title } %>
<% header.with_breadcrumbs(breadcrumb_items)%>

<% header.with_actions do %>
<% if query_saveable? %>
<%= render(
Primer::Beta::Text.new(tag: :span,
mr: BUTTON_MARGIN_RIGHT,
color: :muted)) do
t('lists.can_be_saved_as')
end
%>
<% if query_saveable? %>
<% header.with_action_text(tag: :span,
mr: BUTTON_MARGIN_RIGHT,
color: :muted) { t('lists.can_be_saved_as') } %>
HDinger marked this conversation as resolved.
Show resolved Hide resolved

<%= render(
Primer::Beta::Button.new(scheme: :invisible,
size: :medium,
mr: BUTTON_MARGIN_RIGHT,
tag: :a,
href: new_projects_query_path,
data: {
controller: "params-from-query",
'application-target': "dynamic",
'params-from-query-allowed-value': '["filters", "columns"]'
},
classes: 'Button--invisibleOP')) do |button|
button.with_leading_visual_icon(icon: :'op-save')

t('button_save_as')
end %>
<% header.with_action_button(mobile_icon: "op-save", mobile_label: t('button_save_as'),
HDinger marked this conversation as resolved.
Show resolved Hide resolved
scheme: :invisible,
size: :medium,
mr: BUTTON_MARGIN_RIGHT,
HDinger marked this conversation as resolved.
Show resolved Hide resolved
tag: :a,
href: new_projects_query_path,
data: {
controller: "params-from-query",
'application-target': "dynamic",
'params-from-query-allowed-value': '["filters", "columns"]'
},
classes: 'Button--invisibleOP') do |button|%>
<% button.with_leading_visual_icon(icon: "op-save") %>
t('button_save_as')
HDinger marked this conversation as resolved.
Show resolved Hide resolved
HDinger marked this conversation as resolved.
Show resolved Hide resolved
<% end %>

<%= render(Primer::Alpha::ActionMenu.new) do |menu|
menu.with_show_button(icon: 'op-kebab-vertical', 'aria-label': t(:label_more), data: { 'test-selector': 'project-more-dropdown-menu' })

if gantt_portfolio_project_ids.any?
menu.with_item(
tag: :a,
label: t('projects.index.open_as_gantt'),
href: gantt_portfolio_query_link,
id: 'projects-index-open-as-gantt',
content_arguments: { target: '_blank' }
) do |item|
item.with_leading_visual_icon(icon: 'op-view-timeline')
end
end
<% end %>

<%= header.with_action_menu(menu_arguments: { anchor_align: :end }, button_arguments: { icon: "op-kebab-vertical", "aria-label": t(:label_more), data: { 'test-selector': 'project-more-dropdown-menu' } }) do |menu, button|
HDinger marked this conversation as resolved.
Show resolved Hide resolved
if gantt_portfolio_project_ids.any?
menu.with_item(
tag: :a,
label: t(:label_overall_activity),
href: activities_path
label: t('projects.index.open_as_gantt'),
href: gantt_portfolio_query_link,
id: 'projects-index-open-as-gantt',
content_arguments: { target: '_blank' }
) do |item|
item.with_leading_visual_icon(icon: 'tasklist')
item.with_leading_visual_icon(icon: 'op-view-timeline')
end
end

if query_saveable?
menu.with_item(
label: t('button_save_as'),
href: new_projects_query_path,
content_arguments: {
data: {
controller: "params-from-query",
'application-target': "dynamic",
'params-from-query-allowed-value': '["filters", "columns"]'
}
}
) do |item|
item.with_leading_visual_icon(icon: :'op-save')
end
end
menu.with_item(
tag: :a,
label: t(:label_overall_activity),
href: activities_path
) do |item|
item.with_leading_visual_icon(icon: 'tasklist')
end

if query_saveable?
menu.with_item(
label: t('js.label_export'),
content_arguments: { 'data-show-dialog-id': Projects::ExportListModalComponent::MODAL_ID }
label: t('button_save_as'),
href: new_projects_query_path,
content_arguments: {
data: {
controller: "params-from-query",
'application-target': "dynamic",
'params-from-query-allowed-value': '["filters", "columns"]'
}
}
) do |item|
item.with_leading_visual_icon(icon: 'sign-out')
item.with_leading_visual_icon(icon: :'op-save')
end
end

menu.with_item(
label: t('js.label_export'),
content_arguments: { 'data-show-dialog-id': Projects::ExportListModalComponent::MODAL_ID }
) do |item|
item.with_leading_visual_icon(icon: 'sign-out')
end

menu.with_item(
label: t(:'queries.configure_view.heading'),
content_arguments: { 'data-show-dialog-id': Projects::ConfigureViewModalComponent::MODAL_ID }
) do |item|
item.with_leading_visual_icon(icon: :gear)
end

if query.persisted?
menu.with_item(
label: t(:'queries.configure_view.heading'),
content_arguments: { 'data-show-dialog-id': Projects::ConfigureViewModalComponent::MODAL_ID }
label: t(:button_delete),
scheme: :danger,
content_arguments: { 'data-show-dialog-id': Projects::DeleteListModalComponent::MODAL_ID }
) do |item|
item.with_leading_visual_icon(icon: :gear)
end

if query.persisted?
menu.with_item(
label: t(:button_delete),
scheme: :danger,
content_arguments: { 'data-show-dialog-id': Projects::DeleteListModalComponent::MODAL_ID }
) do |item|
item.with_leading_visual_icon(icon: 'trash')
end
item.with_leading_visual_icon(icon: 'trash')
end
end
%>
<% end %>
end
%>

<% else %>
<% header.with_title(mt: 2, mb: 2, data: { 'test-selector': 'project-query-name'}) do
primer_form_with(model: query,
url: projects_queries_path,
scope: 'query',
data: {
controller: "params-from-query",
'application-target': "dynamic",
'params-from-query-allowed-value': '["filters", "columns"]'
},
id: 'project-save-form') do |f|
render(Queries::Projects::Create.new(f))
end
end %>
<% header.with_title(mt: 2, mb: 2, data: { 'test-selector': 'project-query-name'}) do
primer_form_with(model: query,
url: projects_queries_path,
scope: 'query',
data: {
controller: "params-from-query",
'application-target': "dynamic",
'params-from-query-allowed-value': '["filters", "columns"]'
},
id: 'project-save-form') do |f|
render(Queries::Projects::Create.new(f))
end
end %>
<% end %>
<% end %>

Expand Down
5 changes: 4 additions & 1 deletion app/components/projects/index_page_header_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ def gantt_portfolio_project_ids
def page_title
query.name || t(:label_project_plural)
end

HDinger marked this conversation as resolved.
Show resolved Hide resolved
def query_saveable?
current_user.logged? && query.name.blank?
end

def show_state?
state == :show
end

HDinger marked this conversation as resolved.
Show resolved Hide resolved
def breadcrumb_items
[{ href: projects_path, text: t("en.types.edit.projects") }, page_title]
HDinger marked this conversation as resolved.
Show resolved Hide resolved
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
<%=
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title(variant: :medium) { @custom_field.name }
header.with_description { t('settings.project_attributes.edit.description') }
header.with_parent_link(href: admin_settings_project_custom_fields_path, 'aria-label': I18n.t("button_back")) do
t('settings.project_attributes.heading')
end
header.with_back_button(href: admin_settings_project_custom_fields_path, 'aria-label': t('button_back'))
header.with_description { t("settings.project_attributes.edit.description") }
header.with_breadcrumbs(breadcrumbs_items)
end
%>
%>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def initialize(custom_field:)

@custom_field = custom_field
end

def breadcrumbs_items
[{ href: admin_settings_project_custom_fields_path, text: t("label_administration") },
HDinger marked this conversation as resolved.
Show resolved Hide resolved
t("settings.project_attributes.heading")]
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,29 @@
render Primer::OpenProject::PageHeader.new do |header|
header.with_title(variant: :default) { t('settings.project_attributes.heading') }
header.with_description { t('settings.project_attributes.heading_description') }
header.with_actions do
flex_layout(justify_content: :space_between, align_items: :center) do |action_buttons_container|
action_buttons_container.with_column(mr: 2) do
render(Primer::Beta::Button.new(
tag: :a,
href: new_admin_settings_project_custom_field_path(type: "ProjectCustomField"),
scheme: :primary,
data: { turbo: "false", qa_selector: "new-project-custom-field-button" }
)) do |button|
button.with_leading_visual_icon(icon: :plus)
t('settings.project_attributes.label_new_attribute')
end
header.with_breadcrumbs(breadcrumbs_items)
flex_layout(justify_content: :space_between, align_items: :center) do |action_buttons_container|
HDinger marked this conversation as resolved.
Show resolved Hide resolved
action_buttons_container.with_column(mr: 2) do
header.with_action_button(tag: :a,
href: new_admin_settings_project_custom_field_path(type: "ProjectCustomField"),
scheme: :primary,
data: { turbo: "false", qa_selector: "new-project-custom-field-button" },
mobile_icon: 'plus',
mobile_label: t('settings.project_attributes.label_new_attribute')) do |button|
button.with_leading_visual_icon(icon: :plus)
t('settings.project_attributes.label_new_attribute')
end
action_buttons_container.with_column do
render(Primer::Alpha::Dialog.new(
id: "project-custom-field-section-dialog", title: t('settings.project_attributes.label_new_section'),
size: :medium_portrait
)) do |dialog|
dialog.with_show_button('aria-label': t('settings.project_attributes.label_new_section'), scheme: :default) do |button|
button.with_leading_visual_icon(icon: :plus)
t('settings.project_attributes.label_new_section')
end
render(Settings::ProjectCustomFieldSections::DialogBodyFormComponent.new())
end
action_buttons_container.with_column do
render(Primer::Alpha::Dialog.new(
id: "project-custom-field-section-dialog", title: t('settings.project_attributes.label_new_section'),
size: :medium_portrait
)) do |dialog|
dialog.with_show_button('aria-label': t('settings.project_attributes.label_new_section'), scheme: :default) do |button|
button.with_leading_visual_icon(icon: :plus)
t('settings.project_attributes.label_new_section')
end
render(Settings::ProjectCustomFieldSections::DialogBodyFormComponent.new())
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class HeaderComponent < ApplicationComponent
include ApplicationHelper
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable
def breadcrumbs_items
HDinger marked this conversation as resolved.
Show resolved Hide resolved
[{ href: admin_index_path, text: t("label_administration") },
HDinger marked this conversation as resolved.
Show resolved Hide resolved
t("settings.project_attributes.heading")]
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ See COPYRIGHT and LICENSE files for more details.
render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title(variant: :medium) { t('settings.project_attributes.new.heading') }
header.with_description { t('settings.project_attributes.new.description') }
header.with_parent_link(href: admin_settings_project_custom_fields_path, 'aria-label': I18n.t("button_back")) do
t('settings.project_attributes.heading')
end
header.with_back_button(href: admin_settings_project_custom_fields_path, 'aria-label': t('button_back'))
header.with_breadcrumbs(breadcrumb_items)
end
%>
Loading
Loading