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

[#42158] replace custom button with standard button

Eric Schubertcdf718800fac
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
index 7cfb6d816df..0b47d445074 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
@@ -23,7 +23,7 @@
class="op-tab-content--tab-section"
>
<div class=op-tab-content--header>
- <span class="spot-icon spot-icon_nextcloud-circle op-files-tab--color-blue-deep"></span>
+ <span class="spot-icon spot-icon_nextcloud-circle"></span>
<span class="op-tab-content--header-text" [textContent]="storage.name"></span>
</div>
diff --git a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list-item-icon.factory.ts b/frontend/src/app/shared/components/file-links/file-link-icons/file-link-list-item-icon.factory.ts
similarity index 55%
rename from frontend/src/app/shared/components/file-links/file-link-list/file-link-list-item-icon.factory.ts
rename to frontend/src/app/shared/components/file-links/file-link-icons/file-link-list-item-icon.factory.ts
index 920910d8dc3..1adad793648 100644
--- a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list-item-icon.factory.ts
+++ b/frontend/src/app/shared/components/file-links/file-link-icons/file-link-list-item-icon.factory.ts
@@ -26,30 +26,15 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-export interface IFileLinkListItemIcon {
- icon:'image1'|'movie'|'file-text'|'export-pdf-descr'|'file-doc'|'file-sheet'|'file-presentation'|'folder'|'ticket'
- clazz:'pdf'|'img'|'txt'|'doc'|'sheet'|'presentation'|'form'|'dir'|'default'
-}
-
-const mimeTypeIconMap:{ [mimeType:string]:IFileLinkListItemIcon; } = {
- 'image/*': { icon: 'image1', clazz: 'img' },
- 'text/plain': { icon: 'file-text', clazz: 'txt' },
- 'application/pdf': { icon: 'export-pdf-descr', clazz: 'pdf' },
- 'application/vnd.oasis.opendocument.text': { icon: 'file-doc', clazz: 'doc' },
- 'application/vnd.oasis.opendocument.spreadsheet': { icon: 'file-sheet', clazz: 'sheet' },
- 'application/vnd.oasis.opendocument.presentation': { icon: 'file-presentation', clazz: 'presentation' },
- 'application/x-op-directory': { icon: 'folder', clazz: 'dir' },
- default: { icon: 'ticket', clazz: 'default' },
-};
+import {
+ fileIconMappings,
+ IFileLinkListItemIcon,
+} from 'core-app/shared/components/file-links/file-link-icons/icon-mappings';
export function getIconForMimeType(mimeType?:string):IFileLinkListItemIcon {
- if (mimeType?.startsWith('image/')) {
- return mimeTypeIconMap['image/*'];
- }
-
- if (mimeType && mimeTypeIconMap[mimeType]) {
- return mimeTypeIconMap[mimeType];
+ if (mimeType && fileIconMappings[mimeType]) {
+ return fileIconMappings[mimeType];
}
- return mimeTypeIconMap.default;
+ return fileIconMappings.default;
}
diff --git a/frontend/src/app/shared/components/file-links/file-link-icons/icon-mappings.ts b/frontend/src/app/shared/components/file-links/file-link-icons/icon-mappings.ts
new file mode 100644
index 00000000000..705d5fc59b5
--- /dev/null
+++ b/frontend/src/app/shared/components/file-links/file-link-icons/icon-mappings.ts
@@ -0,0 +1,102 @@
+// -- 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.
+//++
+
+export interface IFileLinkListItemIcon {
+ icon:'image1'|'movie'|'file-text'|'export-pdf-descr'|'file-doc'|'file-sheet'|'file-presentation'|'folder'|'ticket'
+ clazz:'pdf'|'img'|'txt'|'doc'|'sheet'|'presentation'|'form'|'dir'|'mov'|'default'
+}
+
+export const fileIconMappings:Record<string, IFileLinkListItemIcon> = {
+ 'application/pdf': { icon: 'export-pdf-descr', clazz: 'pdf' },
+
+ 'image/jpeg': { icon: 'image1', clazz: 'img' },
+ 'image/png': { icon: 'image1', clazz: 'img' },
+ 'image/gif': { icon: 'image1', clazz: 'img' },
+ 'image/svg+xml': { icon: 'image1', clazz: 'img' },
+ 'image/tiff': { icon: 'image1', clazz: 'img' },
+ 'image/bmp': { icon: 'image1', clazz: 'img' },
+ 'image/webp': { icon: 'image1', clazz: 'img' },
+ 'image/heic': { icon: 'image1', clazz: 'img' },
+ 'image/heif': { icon: 'image1', clazz: 'img' },
+ 'image/avif': { icon: 'image1', clazz: 'img' },
+ 'image/cgm': { icon: 'image1', clazz: 'img' },
+
+ 'text/plain': { icon: 'file-text', clazz: 'txt' },
+ 'text/html': { icon: 'file-text', clazz: 'txt' },
+ 'application/rtf': { icon: 'file-text', clazz: 'txt' },
+ 'application/xml': { icon: 'file-text', clazz: 'txt' },
+ 'application/xhtml+xml': { icon: 'file-text', clazz: 'txt' },
+ 'application/x-tex': { icon: 'file-text', clazz: 'txt' },
+
+ 'application/vnd.oasis.opendocument.text': { icon: 'file-doc', clazz: 'doc' },
+ 'application/vnd.oasis.opendocument.text-template': { icon: 'file-doc', clazz: 'doc' },
+ 'application/msword': { icon: 'file-doc', clazz: 'doc' },
+ 'application/vnd.apple.pages': { icon: 'file-doc', clazz: 'doc' },
+ 'application/vnd.stardivision.writer': { icon: 'file-doc', clazz: 'doc' },
+ 'application/x-abiword': { icon: 'file-doc', clazz: 'doc' },
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': { icon: 'file-doc', clazz: 'doc' },
+ 'font/otf': { icon: 'file-doc', clazz: 'doc' },
+
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': { icon: 'file-sheet', clazz: 'sheet' },
+ 'application/vnd.oasis.opendocument.spreadsheet': { icon: 'file-sheet', clazz: 'sheet' },
+ 'application/vnd.oasis.opendocument.spreadsheet-template': { icon: 'file-sheet', clazz: 'sheet' },
+ 'application/vnd.ms-excel': { icon: 'file-sheet', clazz: 'sheet' },
+ 'application/vnd.stardivision.calc': { icon: 'file-sheet', clazz: 'sheet' },
+ 'application/vnd.apple.numbers': { icon: 'file-sheet', clazz: 'sheet' },
+ 'application/x-starcalc': { icon: 'file-sheet', clazz: 'sheet' },
+ 'application/x-quattro-pro': { icon: 'file-sheet', clazz: 'sheet' },
+ 'application/csv': { icon: 'file-sheet', clazz: 'sheet' },
+
+ 'application/vnd.oasis.opendocument.presentation': { icon: 'file-presentation', clazz: 'presentation' },
+ 'application/vnd.oasis.opendocument.presentation-template': { icon: 'file-presentation', clazz: 'presentation' },
+ 'application/vnd.apple.keynote': { icon: 'file-presentation', clazz: 'presentation' },
+ 'application/vnd.ms-powerpoint': { icon: 'file-presentation', clazz: 'presentation' },
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': {
+ icon: 'file-presentation',
+ clazz: 'presentation',
+ },
+ 'application/vnd.stardivision.impress': { icon: 'file-presentation', clazz: 'presentation' },
+ 'application/mathematica': { icon: 'file-presentation', clazz: 'presentation' },
+
+ 'video/mp4': { icon: 'movie', clazz: 'mov' },
+ 'video/x-m4v': { icon: 'movie', clazz: 'mov' },
+ 'video/avi': { icon: 'movie', clazz: 'mov' },
+ 'video/quicktime': { icon: 'movie', clazz: 'mov' },
+ 'video/webm': { icon: 'movie', clazz: 'mov' },
+ 'video/mpg': { icon: 'movie', clazz: 'mov' },
+ 'video/x-matroska': { icon: 'movie', clazz: 'mov' },
+ 'video/mp1s': { icon: 'movie', clazz: 'mov' },
+ 'video/mp2p': { icon: 'movie', clazz: 'mov' },
+ 'video/3gpp': { icon: 'movie', clazz: 'mov' },
+ 'video/3gpp-tt': { icon: 'movie', clazz: 'mov' },
+ 'video/3gpp-2': { icon: 'movie', clazz: 'mov' },
+
+ 'application/x-op-directory': { icon: 'folder', clazz: 'dir' },
+
+ default: { icon: 'ticket', clazz: 'default' },
+};
diff --git a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list-item.component.ts b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list-item.component.ts
index 0fae347bd4e..d57c4aaad52 100644
--- a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list-item.component.ts
+++ b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list-item.component.ts
@@ -41,11 +41,11 @@ import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import { IFileLink, IFileLinkOriginData } from 'core-app/core/state/file-links/file-link.model';
import {
getIconForMimeType,
- IFileLinkListItemIcon,
-} from 'core-app/shared/components/file-links/file-link-list/file-link-list-item-icon.factory';
+} from 'core-app/shared/components/file-links/file-link-icons/file-link-list-item-icon.factory';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { PrincipalRendererService } from 'core-app/shared/components/principal/principal-renderer.service';
+import { IFileLinkListItemIcon } from 'core-app/shared/components/file-links/file-link-icons/icon-mappings';
@Component({
// eslint-disable-next-line @angular-eslint/component-selector
diff --git a/frontend/src/app/shared/components/file-links/file-link-list/storage-information.html b/frontend/src/app/shared/components/file-links/file-link-list/storage-information.html
index 03fdcc4bba3..77c4ab81ff4 100644
--- a/frontend/src/app/shared/components/file-links/file-link-list/storage-information.html
+++ b/frontend/src/app/shared/components/file-links/file-link-list/storage-information.html
@@ -18,11 +18,10 @@
<div
class="button-box"
>
- <button
- class="action-button"
- (click)="buttonClickEventEmitter.emit()"
- >
- <span class="spot-icon with-text spot-icon_external-link"></span>
- <span [textContent]="buttonText"></span>
+ <button class="button">
+ <op-icon icon-classes="button--icon spot-icon spot-icon_external-link" class="op-icon--wrapper">
+ <i class="button--icon spot-icon spot-icon_external-link"></i>
+ </op-icon>
+ <span class="button--text">Open Nextcloud</span>
</button>
</div>
diff --git a/frontend/src/global_styles/content/work_packages/tabs/_files.sass b/frontend/src/global_styles/content/work_packages/tabs/_files.sass
index 851d0dd7367..72a8171d1d2 100644
--- a/frontend/src/global_styles/content/work_packages/tabs/_files.sass
+++ b/frontend/src/global_styles/content/work_packages/tabs/_files.sass
@@ -98,16 +98,6 @@
display: flex
justify-content: end
- .action-button
- @include spot-body-small()
-
- padding: $spot-spacing-0-25 $spot-spacing-0-75
-
- .spot-icon
- margin-right: $spot-spacing-0-5
- width: $spot-spacing-1-5
- height: $spot-spacing-1-5
-
&--icon
&_pdf
color: #B93A33
@@ -115,6 +105,9 @@
&_img
color: #0081C7
+ &_mov
+ color: #7C006E
+
&_txt
color: #9A9A9A
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 ce4eee36a4f..942252c2516 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
@@ -54,3 +54,4 @@
width: $spot-spacing-1_5
height: $spot-spacing-1_5
margin-right: $spot-spacing-0-5
+ color: #1A67A3