Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c008076
Add the labels administration page
akabiru Sep 16, 2026
e1dab49
Align the labels administration with the epic
akabiru Sep 16, 2026
bac1df3
Cover the labels administration with a feature spec
akabiru Sep 16, 2026
4fbcd7d
Tighten the labels administration after review
akabiru Sep 16, 2026
5bc97fe
Wait for the network instead of a turbo event in the labels search spec
akabiru Sep 17, 2026
c617406
Cap the label chip width with a Primer system argument
akabiru Sep 17, 2026
80ce9f7
Show only the blank slate when no labels are listed
akabiru Sep 17, 2026
654a177
Let the label model compute the page a label sorts on
akabiru Sep 17, 2026
84826ec
Word the label delete dialog as designed
akabiru Sep 17, 2026
27f4064
Remove unspecified divider
akabiru Sep 17, 2026
d94dff5
Assert the labels admin components through accessible selectors
akabiru Sep 17, 2026
06493a1
Redirect a renamed label to the page it sorts on
akabiru Sep 17, 2026
f2574d4
Derive the label dialog mode from the record
akabiru Sep 17, 2026
e018919
Assert the labels menu entry through the sidebar links
akabiru Sep 17, 2026
17065d2
Drop the blank-name check from the label creation feature spec
akabiru Sep 17, 2026
a400e8f
Clear the labels search through the clear button in the feature spec
akabiru Sep 17, 2026
a7e99d1
Trim the labels request spec to what the feature spec cannot cover
akabiru Sep 17, 2026
7789dfb
Document the async dialog trigger selector
akabiru Sep 17, 2026
790e264
Keep the async dialog matcher docs to usage notes
akabiru Sep 17, 2026
b09d3f2
Merge branch 'dev' into implementation/comms-1025-label-admin-listing
akabiru Sep 22, 2026
8ff1f49
Keep the label table headers above the blank slate
akabiru Sep 22, 2026
53d9b18
Count the labels sorting before a label with plain SQL
akabiru Sep 22, 2026
6c70c00
Drop the unused admin fixture from the labels list component spec
akabiru Sep 22, 2026
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
47 changes: 47 additions & 0 deletions app/components/admin/labels/delete_dialog_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<%#-- 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::OpenProject::DangerDialog.new(
title: t(".title"),
confirm_button_text: t(:button_delete),
cancel_button_text: t(:button_close),
form_arguments:,
test_selector: TEST_SELECTOR
)
) do |dialog|
dialog.with_confirmation_message do |message|
message.with_heading(tag: :h2) { t(".heading") }
message.with_description_content(t(".description_html", name: label.name))
Comment thread
akabiru marked this conversation as resolved.
end

dialog.with_confirmation_check_box_content(t(".confirmation"))
end
%>
48 changes: 48 additions & 0 deletions app/components/admin/labels/delete_dialog_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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 Labels
class DeleteDialogComponent < ApplicationComponent
include OpTurbo::Streamable

alias_method :label, :model

TEST_SELECTOR = "op-labels--delete-dialog"

def form_arguments
{
action: admin_label_path(label),
method: :delete
}
end
end
end
end
60 changes: 60 additions & 0 deletions app/components/admin/labels/dialog_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<%#-- 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(
title:,
size: :medium,
id: DIALOG_ID
)
) do |d|
d.with_header(variant: :large)

d.with_body do
render(Admin::Labels::FormComponent.new(label:))
end

d.with_footer do
component_collection do |buttons|
buttons.with_component(
Primer::Beta::Button.new(data: { close_dialog_id: DIALOG_ID })
) do
t(:button_cancel)
end

buttons.with_component(
Primer::Beta::Button.new(scheme: :primary, form: Admin::Labels::FormComponent::FORM_ID, type: :submit)
) do
button_caption
end
end
end
end
%>
58 changes: 58 additions & 0 deletions app/components/admin/labels/dialog_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# 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 Labels
class DialogComponent < ApplicationComponent
include OpTurbo::Streamable
include OpPrimer::ComponentHelpers

DIALOG_ID = "admin-label-dialog"

attr_reader :label

def initialize(label:)
super()

@label = label
end

private

def title
label.persisted? ? t(".rename_title", name: label.name) : t(".create_title")
end

def button_caption
label.persisted? ? t(:button_rename) : t(:button_create)
end
end
end
end
43 changes: 43 additions & 0 deletions app/components/admin/labels/form_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<%#-- 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.

++#%>

<%=
component_wrapper do
primer_form_with(
id: FORM_ID,
model:,
scope: :label,
url: form_url,
method: http_method,
data: { turbo: true }
) do |f|
render(Admin::Labels::Form.new(f))
end
end
%>
56 changes: 56 additions & 0 deletions app/components/admin/labels/form_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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 Labels
class FormComponent < ApplicationComponent
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable

FORM_ID = "admin-label-form"

# A `label` reader here would shadow ActionView::Helpers::FormHelper#label
# inside the primer_form_with block, so the record stays `model`.
def initialize(label:)
super(label)
end

private

def http_method
model.persisted? ? :patch : :post
end

def form_url
model.persisted? ? admin_label_path(model) : admin_labels_path
end
end
end
end
34 changes: 34 additions & 0 deletions app/components/admin/labels/list_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<%#-- 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.

++#%>

<%=
component_wrapper do
render(Admin::Labels::TableComponent.new(rows: labels, query:))
end
%>
42 changes: 42 additions & 0 deletions app/components/admin/labels/list_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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 Labels
class ListComponent < ApplicationComponent
include OpPrimer::ComponentHelpers
include OpTurbo::Streamable

alias_method :labels, :model

options :query
end
end
end
Loading
Loading