Skip to content

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

Extracted new style-block for op-file-list

Andreas Pfohl1b4e0ac3e417
diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.html b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.html
index 9f0fc88b374..8e83c118fef 100644
--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.html
+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.html
@@ -1,6 +1,6 @@
-<div class="spot-list--item-floating-wrapper op-files-tab--file-list-item-floating-wrapper">
+<div class="spot-list--item-floating-wrapper op-file-list--item-floating-wrapper">
<a
- class="spot-list--item-action spot-list--item-action_link op-files-tab--file-list-item-action"
+ class="spot-list--item-action spot-list--item-action_link op-file-list--item-action"
[href]="attachment._links.staticDownloadLocation.href"
target="_blank"
(dragstart)="setDragData($event)"
@@ -12,23 +12,23 @@
<span
[textContent]="attachment.fileName"
[title]="attachment.fileName"
- class="spot-list--item-title op-files-tab--file-list-item-title"
+ class="spot-list--item-title op-file-list--item-title"
data-qa-selector="op-files-tab--file-list-item-title"
></span>
<span
- class="op-files-tab--file-list-item-text"
+ class="op-file-list--item-text"
[textContent]="timestampText"
></span>
<div
#avatar
- class="op-files-tab--file-list-item-avatar"
+ class="op-file-list--item-avatar"
></div>
</a>
<div
*ngIf="!!this.attachment._links.delete"
- class="spot-list--item-floating-actions op-files-tab--file-list-item-floating-actions hidden-for-mobile"
+ class="spot-list--item-floating-actions op-file-list--item-floating-actions hidden-for-mobile"
>
<button
class="spot-link"
diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.html b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.html
index 7233231acb3..848d29ef1a8 100644
--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.html
+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list.html
@@ -3,11 +3,11 @@
>
<ul
*ngIf="attachments.length > 0"
- class="spot-list spot-list_compact op-files-tab--file-list">
+ class="spot-list spot-list_compact op-file-list">
<li
*ngFor="let attachment of attachments; let i = index;"
op-attachment-list-item
- class="spot-list--item op-files-tab--file-list-item"
+ class="spot-list--item op-file-list--item"
data-qa-selector="op-attachment-list-item"
[attachment]="attachment"
[index]="i"
diff --git a/frontend/src/app/shared/components/file-links/file-link-list-item/file-link-list-item.html b/frontend/src/app/shared/components/file-links/file-link-list-item/file-link-list-item.html
index ec48bb6949b..dcd4e9eb86a 100644
--- a/frontend/src/app/shared/components/file-links/file-link-list-item/file-link-list-item.html
+++ b/frontend/src/app/shared/components/file-links/file-link-list-item/file-link-list-item.html
@@ -1,8 +1,8 @@
<spot-tooltip
[disabled]="!disabled"
[alignment]="tooltipAllignment"
- class="spot-list--item-floating-wrapper op-files-tab--file-list-item-floating-wrapper"
- [ngClass]="{ 'spot-list--item-floating-wrapper__disabled op-files-tab--file-list-item-floating-wrapper__disabled': disabled }"
+ class="spot-list--item-floating-wrapper op-file-list--item-floating-wrapper"
+ [ngClass]="{ 'spot-list--item-floating-wrapper__disabled op-file-list--item-floating-wrapper__disabled': disabled }"
>
<p
slot="body"
@@ -13,7 +13,7 @@
slot="trigger"
>
<a
- class="spot-list--item-action spot-list--item-action_link op-files-tab--file-list-item-action"
+ class="spot-list--item-action spot-list--item-action_link op-file-list--item-action"
[ngClass]="{ 'disabled': disabled, 'view-not-allowed': !viewAllowed }"
[href]="fileLink._links.staticOriginOpen.href"
[title]="fileLink.originData.name"
@@ -26,22 +26,22 @@
<span
[textContent]="fileLink.originData.name"
[title]="fileLink.originData.name"
- class="spot-list--item-title op-files-tab--file-list-item-title"
+ class="spot-list--item-title op-file-list--item-title"
></span>
<span
- class="op-files-tab--file-list-item-text"
+ class="op-file-list--item-text"
[textContent]="infoTimestampText"
></span>
<div
#avatar
- class="op-files-tab--file-list-item-avatar"
+ class="op-file-list--item-avatar"
></div>
</a>
<div
*ngIf="!disabled && viewAllowed"
- class="spot-list--item-floating-actions op-files-tab--file-list-item-floating-actions hidden-for-mobile"
+ class="spot-list--item-floating-actions op-file-list--item-floating-actions hidden-for-mobile"
>
<a
*ngIf="downloadAllowed"
@@ -70,9 +70,9 @@
</div>
<div
*ngIf="!disabled && !viewAllowed"
- class="spot-list--item-floating-actions op-files-tab--file-list-item-floating-text hidden-for-mobile"
+ class="spot-list--item-floating-actions op-file-list--item-floating-text hidden-for-mobile"
>
- <span class="spot-icon spot-icon_info2 op-files-tab--icon op-files-tab--file-list-item-floating-text-icon"></span>
+ <span class="spot-icon spot-icon_info2 op-files-tab--icon op-file-list--item-floating-text-icon"></span>
<span [textContent]="text.floatingText.noViewPermission"></span>
</div>
</ng-container>
diff --git a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html
index 307014c0356..96e7ad96109 100644
--- a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html
+++ b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html
@@ -9,13 +9,13 @@
></op-storage-information>
<ul
- class="spot-list spot-list_compact op-files-tab--file-list"
- data-qa-selector="op-files-tab--file-list"
+ class="spot-list spot-list_compact op-file-list"
+ data-qa-selector="file-list"
>
<li
*ngFor="let fileLink of fileLinks$ | async; let i = index;"
- class="spot-list--item op-files-tab--file-list-item"
- data-qa-selector="op-files-tab--file-list-item"
+ class="spot-list--item op-file-list--item"
+ data-qa-selector="file-list--item"
op-file-link-list-item
[fileLink]="fileLink"
[disabled]="disabled"
@@ -26,11 +26,11 @@
<p
*ngIf="showLinkFilesAction | async"
- class="spot-body-small op-files-tab--file-list-actions"
+ class="spot-body-small op-file-list--actions"
>
<button
type="button"
- class="spot-link op-files-tab--file-list-action-button"
+ class="spot-link op-file-list--action-button"
(click)="openStorageLocation()"
>
<span class="spot-icon spot-icon_external-link"></span>
@@ -38,7 +38,7 @@
</button>
<button
type="button"
- class="spot-link op-files-tab--file-list-action-button"
+ class="spot-link op-file-list--action-button"
(click)="openLinkFilesDialog()"
>
<span class="spot-icon spot-icon_add-link"></span>
diff --git a/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.html b/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.html
index 3df8a081477..bbdb7159670 100644
--- a/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.html
+++ b/frontend/src/app/shared/components/file-links/file-picker-modal/file-picker-modal.html
@@ -18,13 +18,13 @@
<div class="spot-modal--body spot-container">
<ng-container *ngIf="(loading$ | async) === false; else loadingTemplate">
<ul
- class="spot-list spot-list_compact op-files-tab--file-list"
+ class="spot-list spot-list_compact op-file-list"
data-qa-selector="op-files-picker-modal--file-list"
>
<li
*ngFor="let file of storageFiles$ | async | sortFiles; let i = index;"
- class="spot-list--item op-files-tab--file-list-item"
- data-qa-selector="op-files-tab--file-list-item"
+ class="spot-list--item op-file-list--item"
+ data-qa-selector="op-file-list--item"
op-storage-file-list-item
[storageFile]="file"
(changeSelection)="changeSelection(file)"
diff --git a/frontend/src/app/shared/components/file-links/storage-file-list-item/storage-file-list-item.html b/frontend/src/app/shared/components/file-links/storage-file-list-item/storage-file-list-item.html
index b3245f096fa..8b42533ce8f 100644
--- a/frontend/src/app/shared/components/file-links/storage-file-list-item/storage-file-list-item.html
+++ b/frontend/src/app/shared/components/file-links/storage-file-list-item/storage-file-list-item.html
@@ -12,18 +12,18 @@
<span
[textContent]="storageFile.name"
[title]="storageFile.name"
- class="spot-list--item-title op-files-tab--file-list-item-title"
+ class="spot-list--item-title op-file-list--item-title"
></span>
<span
*ngIf="showDetails"
- class="op-files-tab--file-list-item-text"
+ class="op-file-list--item-text"
[textContent]="infoTimestampText"
></span>
<div
#avatar
*ngIf="showDetails"
- class="op-files-tab--file-list-item-avatar"
+ class="op-file-list--item-avatar"
></div>
</label>
diff --git a/frontend/src/global_styles/content/_work_packages.sass b/frontend/src/global_styles/content/_work_packages.sass
index 14e611ae1fd..5f6f7e201b3 100644
--- a/frontend/src/global_styles/content/_work_packages.sass
+++ b/frontend/src/global_styles/content/_work_packages.sass
@@ -55,9 +55,12 @@
// Tabs
@import work_packages/tabs/activities
@import work_packages/tabs/relations
-@import work_packages/tabs/files
+@import work_packages/tabs/files_tab
@import work_packages/tabs/tab_content
+// Shared
+@import work_packages/shared/file_list
+
// Table configuration
@import work_packages/table_configuration_modal
diff --git a/frontend/src/global_styles/content/work_packages/shared/_file_list.sass b/frontend/src/global_styles/content/work_packages/shared/_file_list.sass
new file mode 100644
index 00000000000..57a2edce62a
--- /dev/null
+++ b/frontend/src/global_styles/content/work_packages/shared/_file_list.sass
@@ -0,0 +1,96 @@
+//-- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) 2012-2022 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.
+//++
+
+.op-file-list
+ margin-bottom: $spot-spacing-0-75
+
+ &--item
+ &-action
+ text-decoration: none
+
+ &.view-not-allowed
+ opacity: 0.5
+
+ &.disabled
+ color: $spot-color-basic-gray-3
+ opacity: 0.5
+ pointer-events: none
+
+ .op-files-tab--icon
+ color: $spot-color-basic-gray-3
+
+ &:hover
+ .op-file-list--item-title
+ text-decoration: underline
+
+ &-title
+ @include spot-body-small
+
+ line-height: $spot-spacing-1-5
+ word-break: normal
+ @include text-shortener
+ padding-right: $spot_spacing-0-5
+
+ &-text
+ @include spot-caption()
+
+ line-height: 1.5rem
+ color: $spot-color-basic-gray-3
+ flex-shrink: 0
+
+ &:not(:last-child)
+ margin-right: $spot-spacing-0-5
+
+ &-avatar
+ width: $spot-spacing-1-5
+ height: $spot-spacing-1-5
+ display: inline-block
+
+ &-floating-wrapper:not(&-floating-wrapper__disabled):hover &-text,
+ &-floating-wrapper:not(&-floating-wrapper__disabled):hover &-avatar
+ visibility: hidden
+
+ &-floating-text
+ @include spot-body-small()
+
+ padding-right: $spot-spacing-0-25
+ overflow: hidden
+ color: var(--primary-color)
+
+ &-icon
+ margin-right: $spot-spacing-0-25
+
+ & &--item &--item-floating-actions
+ padding-right: 0
+
+ & &--item &--item-floating-text
+ padding-right: $spot-spacing-0-5
+
+ & &--item &--item-action
+ padding-left: 0
+ padding-right: 0
diff --git a/frontend/src/global_styles/content/work_packages/tabs/_files.sass b/frontend/src/global_styles/content/work_packages/tabs/_files_tab.sass
similarity index 60%
rename from frontend/src/global_styles/content/work_packages/tabs/_files.sass
rename to frontend/src/global_styles/content/work_packages/tabs/_files_tab.sass
index 21b6c3bd9db..7df6a0f4d7b 100644
--- a/frontend/src/global_styles/content/work_packages/tabs/_files.sass
+++ b/frontend/src/global_styles/content/work_packages/tabs/_files_tab.sass
@@ -30,75 +30,6 @@
&--file-upload
margin-top: $spot-spacing-0-75
- &--file-list
- margin-bottom: $spot-spacing-0-75
-
- &-item
- &-action
- text-decoration: none
-
- &.view-not-allowed
- opacity: 0.5
-
- &.disabled
- color: $spot-color-basic-gray-3
- opacity: 0.5
- pointer-events: none
-
- .op-files-tab--icon
- color: $spot-color-basic-gray-3
-
- &:hover
- .op-files-tab--file-list-item-title
- text-decoration: underline
-
- &-title
- @include spot-body-small
-
- line-height: $spot-spacing-1-5
- word-break: normal
- @include text-shortener
- padding-right: $spot_spacing-0-5
-
- &-text
- @include spot-caption()
-
- line-height: 1.5rem
- color: $spot-color-basic-gray-3
- flex-shrink: 0
-
- &:not(:last-child)
- margin-right: $spot-spacing-0-5
-
- &-avatar
- width: $spot-spacing-1-5
- height: $spot-spacing-1-5
- display: inline-block
-
- &-floating-wrapper:not(&-floating-wrapper__disabled):hover &-text,
- &-floating-wrapper:not(&-floating-wrapper__disabled):hover &-avatar
- visibility: hidden
-
- &-floating-text
- @include spot-body-small()
-
- padding-right: $spot-spacing-0-25
- overflow: hidden
- color: var(--primary-color)
-
- &-icon
- margin-right: $spot-spacing-0-25
-
- &--file-list &--file-list-item &--file-list-item-floating-actions
- padding-right: 0
-
- &--file-list &--file-list-item &--file-list-item-floating-text
- padding-right: $spot-spacing-0-5
-
- &--file-list &--file-list-item &--file-list-item-action
- padding-left: 0
- padding-right: 0
-
&--storage-info-box
margin-top: 0.875rem
display: grid
diff --git a/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass b/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass
index f6afba0789d..2134ebe8f56 100644
--- a/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass
+++ b/frontend/src/global_styles/content/work_packages/tabs/_tab_content.sass
@@ -31,16 +31,16 @@
margin-bottom: $spot-spacing-2
&_no-header
- .op-files-tab--file-list .op-files-tab--file-list-item:first-child
+ .op-file-list .op-file-list--item:first-child
margin-top: 0
.op-files-tab--storage-info-box:not(:last-child)
margin-bottom: $spot-spacing-1
- .op-files-tab--file-list-actions
+ .op-file-list--actions
margin-top: $spot-spacing-0_75
- > .op-files-tab--file-list-action-button:not(:first-child)
+ > .op-file-list--action-button:not(:first-child)
margin-left: $spot-spacing-1
&--header
diff --git a/modules/storages/spec/features/show_file_links_spec.rb b/modules/storages/spec/features/show_file_links_spec.rb
index eb003343742..5c3b210abdf 100644
--- a/modules/storages/spec/features/show_file_links_spec.rb
+++ b/modules/storages/spec/features/show_file_links_spec.rb
@@ -75,8 +75,8 @@ describe 'Showing of file links in work package', type: :feature, js: true do
context 'if work package has associated file links' do
it "must show associated file links" do
expect(page).to have_selector('[data-qa-selector="op-tab-content--tab-section"]', count: 2)
- expect(page.find('[data-qa-selector="op-files-tab--file-list"]'))
- .to have_selector('[data-qa-selector="op-files-tab--file-list-item"]', text: file_link.origin_name, count: 1)
+ expect(page.find('[data-qa-selector="file-list"]'))
+ .to have_selector('[data-qa-selector="file-list--item"]', text: file_link.origin_name, count: 1)
end
end