forked from opf/openproject
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[52127] project list truncate long text fields and disable expand act…
…ion (opf#14838) * remove unnecessary code * remove column for collapsing in table * truncate project status description and add dialog to the end of it * change dialog title for project status description * change dialog title for custom fields of long text * add dialog and truncation for project description * add a test for it * change element for long text and add divider for modal header * show the expand link for the long text with table * move styes from table sass file to projects list style sheet * change class names * Update _table.sass * show expand button when there is a macro in a long text field * change size of modal to large * remove divider of modal header * create a separate component to be used for attribute dialog * create a new stimulus controller for cell changes * create a new component for showing a long text in a cell * remove unnecessary classes * use attribute component to show long text value on list * check if the attribute value is multi type then show a specific text for it * delete project controller * add more test cases * remove margin from text element * remove duplicated code * remove gear icon from table header * use targetConnected callback instead of connect
- Loading branch information
1 parent
0e3ef41
commit a5ee5ca
Showing
16 changed files
with
197 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@import "work_packages/share/modal_body_component" | ||
@import "work_packages/share/invite_user_form_component" | ||
@import "open_project/common/attribute_component" | ||
@import "filters_component" |
17 changes: 17 additions & 0 deletions
17
app/components/open_project/common/attribute_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div | ||
data-controller="attribute" | ||
data-application-target="dynamic" | ||
class="op-long-text-attribute"> | ||
<p | ||
data-attribute-target="descriptionText" | ||
class="op-long-text-attribute--text"> | ||
<%= @attr_value %> | ||
</p> | ||
|
||
<%= render(Primer::Alpha::Dialog.new(id: @id, title: @name, size: :large)) do |component| | ||
component.with_show_button(scheme: :link, display: (is_multi_type(@description) ? :block : :none), data: { 'attribute-target': 'expandButton' }) { I18n.t('js.label_expand') } | ||
component.with_body(mt: 2) { helpers.format_text(@description) } | ||
component.with_header | ||
end | ||
%> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#-- copyright | ||
# OpenProject is an open source project management software. | ||
# Copyright (C) 2012-2024 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. | ||
#++ | ||
require 'nokogiri' | ||
|
||
module OpenProject | ||
module Common | ||
class AttributeComponent < Primer::Component | ||
|
||
def initialize(id, name, description, **args) | ||
super | ||
@id = id | ||
@name = name | ||
@description = description | ||
@attr_value = is_multi_type(description) ? I18n.t('js.label_preview_not_available') : Nokogiri::HTML(description).text | ||
@system_arguments = args | ||
end | ||
|
||
private | ||
|
||
def is_multi_type(text) | ||
text.to_s.include?('figure') || text.to_s.include?('macro') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.op-long-text-attribute | ||
display: flex | ||
align-items: center | ||
&--text | ||
@include text-shortener | ||
margin: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
frontend/src/stimulus/controllers/dynamic/attribute.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* -- copyright | ||
* OpenProject is an open source project management software. | ||
* Copyright (C) 2023 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. | ||
* ++ | ||
* | ||
*/ | ||
|
||
import { Controller } from '@hotwired/stimulus'; | ||
|
||
export default class AttributeController extends Controller { | ||
static targets = [ | ||
'descriptionText', | ||
'expandButton', | ||
]; | ||
|
||
declare readonly descriptionTextTarget:HTMLParagraphElement; | ||
declare readonly expandButtonTarget:HTMLButtonElement; | ||
|
||
descriptionTextTargetConnected(element:HTMLParagraphElement) { | ||
if (this.isEllipssed(element)) { | ||
this.expandButtonTarget.classList.remove('d-none'); | ||
} | ||
} | ||
|
||
isEllipssed(e:HTMLElement) { | ||
return (e.offsetWidth < e.scrollWidth); | ||
} | ||
} |
74 changes: 0 additions & 74 deletions
74
frontend/src/stimulus/controllers/dynamic/project.controller.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.