OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Make expandable list button text more specific
Christophe Bliard0afa7675aea2
diff --git a/app/components/op_primer/expandable_list_component.html.erb b/app/components/op_primer/expandable_list_component.html.erbindex 87153c2d77a..54584982f41 100644--- a/app/components/op_primer/expandable_list_component.html.erb+++ b/app/components/op_primer/expandable_list_component.html.erb@@ -2,7 +2,7 @@component_wrapper(data: wrapper_data_attributes) doif elements.count == 0render(Primer::Beta::Text.new(color: :subtle)) { t("label_meeting_no_participants") }- elsif elements.count <= @cutoff_limit+ elsif @cutoff_limit.nil? || elements.count <= @cutoff_limitflex_layout do |list|elements.each do |item|list.with_row(mt: 1) { item.to_s }@@ -16,20 +16,25 @@list.with_row doflex_layout do |flex|- flex.with_row(display: :none, data: { 'expandable-list-target': "hiddenElements" }) do+ flex.with_row(display: :none, data: { "expandable-list-target": "hiddenElements" }) doflex_layout do |hidden_user_list|elements[@cutoff_limit..].each do |item|hidden_user_list.with_row(mt: 1) { item.to_s }end+ hidden_user_list.with_row(mt: 2) do+ render(Primer::Beta::Button.new(+ scheme: :link,+ data: { action: "expandable-list#hideElements" }+ )) { I18n.t("label_hide_n_items", count: elements.count - @cutoff_limit) }+ endendend- flex.with_row(mt: 1) do+ flex.with_row(mt: 2) dorender(Primer::Beta::Button.new(- scheme: :link,- data: { 'expandable-list-target': "showHideButton",- action: 'click->expandable-list#showhiddenElements keydown.enter->expandable-list#showhiddenElements'- }- )) { I18n.t('label_show_hide_n_items', count: elements.count - @cutoff_limit) }+ scheme: :link,+ data: { "expandable-list-target": "showButton",+ action: "expandable-list#showElements" }+ )) { I18n.t("label_show_n_items", count: elements.count - @cutoff_limit) }endendenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 97c02d8aeb1..b65e0a0b44e 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -2255,6 +2255,9 @@ en:label_home: "Home"label_subject_or_id: "Subject or ID"label_calendar_subscriptions: "Calendar subscriptions"+ label_hide_n_items:+ one: "Hide %{count} item"+ other: "Hide %{count} items"label_identifier: "Identifier"label_in: "in"label_in_less_than: "in less than"@@ -2276,7 +2279,9 @@ en:label_share_project_list: "Share project list"label_share_work_package: "Share work package"label_show_hide: "Show/hide"- label_show_hide_n_items: "Show/hide %{count} items"+ label_show_n_items:+ one: "Show %{count} item"+ other: "Show %{count} items"label_show_all_registered_users: "Show all registered users"label_journal: "Journal"label_journal_diff: "Description Comparison"diff --git a/frontend/src/stimulus/controllers/dynamic/expandable-list.controller.ts b/frontend/src/stimulus/controllers/dynamic/expandable-list.controller.tsindex f4a779d3b6a..021775b0eb7 100644--- a/frontend/src/stimulus/controllers/dynamic/expandable-list.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/expandable-list.controller.ts@@ -31,14 +31,17 @@import { Controller } from '@hotwired/stimulus';export default class ExxpandableListController extends Controller {- static targets = ['showHideButton', 'hiddenElements'];+ static targets = ['hiddenElements', 'showButton'];declare readonly hiddenElementsTarget:HTMLElement;+ declare readonly showButtonTarget:HTMLElement;- showhiddenElements():void {- if (this.hiddenElementsTarget.classList.contains('d-none')) {- this.hiddenElementsTarget.classList.remove('d-none');- } else {- this.hiddenElementsTarget.classList.add('d-none');- }+ showElements():void {+ this.hiddenElementsTarget.classList.remove('d-none');+ this.showButtonTarget.classList.add('d-none');+ }++ hideElements():void {+ this.hiddenElementsTarget.classList.add('d-none');+ this.showButtonTarget.classList.remove('d-none');}}