Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into feature/57405-use-prim…
Browse files Browse the repository at this point in the history
…ers-pageheader-component-on-the-workpackage-list-view
  • Loading branch information
HDinger committed Oct 23, 2024
2 parents 0a6aa62 + f5e85b2 commit 644206f
Show file tree
Hide file tree
Showing 320 changed files with 12,789 additions and 2,361 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ RSpec/DescribeMethod:
# to match the exact file name
RSpec/SpecFilePathFormat:
CustomTransform:
OpenIDConnect: openid_connect
OAuthClients: oauth_clients
IgnoreMethods: true

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ gem "rack-protection", "~> 3.2.0"
gem "rack-attack", "~> 6.7.0"

# CSP headers
gem "secure_headers", "~> 6.5.0"
gem "secure_headers", "~> 6.7.0"

# Browser detection for incompatibility checks
gem "browser", "~> 6.0.0"
Expand Down
38 changes: 20 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -342,30 +342,32 @@ GEM
activerecord (>= 4.0.0, < 8.0)
awrence (1.2.1)
aws-eventstream (1.3.0)
aws-partitions (1.991.0)
aws-sdk-core (3.209.1)
aws-partitions (1.992.0)
aws-sdk-core (3.211.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.94.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sdk-kms (1.95.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.168.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sdk-s3 (1.169.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sdk-sns (1.88.0)
aws-sdk-core (~> 3, >= 3.207.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.10.0)
aws-sigv4 (1.10.1)
aws-eventstream (~> 1, >= 1.0.2)
axe-core-api (4.10.0)
axe-core-api (4.10.1)
dumb_delegator
ostruct
virtus
axe-core-rspec (4.10.0)
axe-core-api (= 4.10.0)
axe-core-rspec (4.10.1)
axe-core-api (= 4.10.1)
dumb_delegator
ostruct
virtus
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
Expand All @@ -384,7 +386,7 @@ GEM
bindata (2.5.0)
bootsnap (1.18.4)
msgpack (~> 1.2)
brakeman (6.2.1)
brakeman (6.2.2)
racc
browser (6.0.0)
builder (3.3.0)
Expand Down Expand Up @@ -701,7 +703,7 @@ GEM
launchy (3.0.1)
addressable (~> 2.8)
childprocess (~> 5.0)
lefthook (1.7.18)
lefthook (1.7.22)
letter_opener (1.10.0)
launchy (>= 2.2, < 4)
letter_opener_web (3.0.0)
Expand Down Expand Up @@ -1022,7 +1024,7 @@ GEM
rubocop (~> 1.41)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-openproject (0.1.0)
rubocop-openproject (0.2.0)
rubocop
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
Expand All @@ -1042,7 +1044,7 @@ GEM
i18n
iso8601
ruby-ole (1.2.13.1)
ruby-prof (1.7.0)
ruby-prof (1.7.1)
ruby-progressbar (1.13.0)
ruby-rc4 (0.1.5)
ruby-saml (1.17.0)
Expand All @@ -1057,7 +1059,7 @@ GEM
sanitize (6.1.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
secure_headers (6.5.0)
secure_headers (6.7.0)
selenium-devtools (0.129.0)
selenium-webdriver (~> 4.2)
selenium-webdriver (4.25.0)
Expand Down Expand Up @@ -1145,7 +1147,7 @@ GEM
public_suffix
vcr (6.3.1)
base64
view_component (3.17.0)
view_component (3.18.0)
activesupport (>= 5.2.0, < 8.0)
concurrent-ruby (~> 1.0)
method_source (~> 1.0)
Expand Down Expand Up @@ -1365,7 +1367,7 @@ DEPENDENCIES
ruby-progressbar (~> 1.13.0)
rubytree (~> 2.1.0)
sanitize (~> 6.1.0)
secure_headers (~> 6.5.0)
secure_headers (~> 6.7.0)
selenium-devtools
selenium-webdriver (~> 4.20)
semantic (~> 1.6.1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def columns
def sortable?
false
end

def use_quick_action_table_headers?
false
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) the OpenProject GmbH
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
<%=
render(Primer::Alpha::Dialog.new(id: DIALOG_ID, title: "Delete item")) do |dialog|
dialog.with_header(variant: :large)
dialog.with_body do
"Are you sure you want to delete this item from the current hierarchy level?"
end

dialog.with_footer do
concat(render(Primer::ButtonComponent.new(data: { "close-dialog-id": DIALOG_ID })) do
I18n.t(:button_cancel)
end)

concat(primer_form_with(
model: @custom_field,
url: custom_field_item_path(custom_field_id: @custom_field.id, id: @hierarchy_item.id),
method: :delete,
data: { turbo: true }
) do
render(Primer::ButtonComponent.new(scheme: :danger,
type: :submit,
data: { "close-dialog-id": DIALOG_ID })) do
I18n.t(:button_delete)
end
end)
end
end
%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++

module Admin
module CustomFields
module Hierarchy
class DeleteItemDialogComponent < ApplicationComponent
include OpTurbo::Streamable

DIALOG_ID = "op-hierarchy-item--deletion-confirmation"

def initialize(custom_field:, hierarchy_item:)
super
@custom_field = custom_field
@hierarchy_item = hierarchy_item
end
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ See COPYRIGHT and LICENSE files for more details.

# Actions
item_container.with_column do
render(Primer::Beta::IconButton.new(scheme: :default,
icon: "kebab-horizontal",
"aria-label": I18n.t("custom_fields.admin.items.more_actions")))
render(Primer::Alpha::ActionMenu.new(data: { test_selector: "op-hierarchy-item--action-menu" })) do |menu|
menu.with_show_button(icon: "kebab-horizontal",
scheme: :invisible,
"aria-label": I18n.t("custom_fields.admin.items.actions"))
deletion_action_item(menu)
end
end
end
end
Expand Down
16 changes: 15 additions & 1 deletion app/components/admin/custom_fields/hierarchy/item_component.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down Expand Up @@ -33,14 +35,26 @@ class ItemComponent < ApplicationComponent
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers

def initialize(hierarchy_item:)
def initialize(custom_field:, hierarchy_item:)
super
@custom_field = custom_field
@hierarchy_item = hierarchy_item
end

def short_text
"(#{@hierarchy_item.short})"
end

def deletion_action_item(menu)
menu.with_item(label: I18n.t(:button_delete),
scheme: :danger,
tag: :a,
href: deletion_dialog_custom_field_item_path(custom_field_id: @custom_field.id,
id: @hierarchy_item.id),
content_arguments: { data: { controller: "async-dialog" } }) do |item|
item.with_leading_visual_icon(icon: :trash)
end
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ See COPYRIGHT and LICENSE files for more details.
item_box.with_header { @custom_field.name }

items.each do |item|
item_box.with_row { render Admin::CustomFields::Hierarchy::ItemComponent.new(hierarchy_item: item) }
item_box.with_row do
render Admin::CustomFields::Hierarchy::ItemComponent.new(custom_field: @custom_field,
hierarchy_item: item)
end
end

if show_new_item_form?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= render(Primer::OpenProject::PageHeader.new) do |header|
header.with_title { page_title }
header.with_breadcrumbs(breadcrumb_items)
header.with_breadcrumbs(breadcrumb_items, selected_item_font_weight: current_breadcrumb_element == page_title ? :bold : :normal)

header.with_action_button(tag: :a,
mobile_icon: :gear,
Expand Down
35 changes: 30 additions & 5 deletions app/components/notifications/index_page_header_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,41 @@ def initialize(project: nil)
end

def page_title
I18n.t("js.notifications.title")
if current_item.present?
current_item.title
else
I18n.t("notifications.menu.inbox")
end
end

def breadcrumb_items
[parent_element,
page_title]
[{ href: home_path, text: helpers.organization_name },
{ href: notifications_path, text: I18n.t("js.notifications.title") },
current_breadcrumb_element]
end

def parent_element
{ href: home_path, text: helpers.organization_name }
def current_breadcrumb_element
if current_section && current_section.header.present?
I18n.t("menus.breadcrumb.nested_element", section_header: current_section.header, title: page_title).html_safe
else
page_title
end
end

def current_section
return @current_section if defined?(@current_section)

@current_section = Notifications::Menu
.new(params:, current_user: User.current)
.selected_menu_group
end

def current_item
return @current_item if defined?(@current_item)

@current_item = Notifications::Menu
.new(params:, current_user: User.current)
.selected_menu_item
end
end
end
10 changes: 5 additions & 5 deletions app/components/op_primer/border_box_table_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ See COPYRIGHT and LICENSE files for more details.

if rows.empty?
component.with_row(scheme: :default) { render_blank_slate }
end

rows.each do |row|
component.with_row(scheme: :default) do
render(row_class.new(row:, table: self))
else
rows.each do |row|
component.with_row(scheme: :default) do
render(row_class.new(row:, table: self))
end
end
end
end
Expand Down
Loading

0 comments on commit 644206f

Please sign in to comment.