diff options
Diffstat (limited to 'client/src/app/shared/misc')
-rw-r--r-- | client/src/app/shared/misc/help.component.html | 5 | ||||
-rw-r--r-- | client/src/app/shared/misc/help.component.scss | 43 | ||||
-rw-r--r-- | client/src/app/shared/misc/help.component.ts | 2 | ||||
-rw-r--r-- | client/src/app/shared/misc/utils.ts | 13 |
4 files changed, 42 insertions, 21 deletions
diff --git a/client/src/app/shared/misc/help.component.html b/client/src/app/shared/misc/help.component.html index 28ccb1e26..444425c9f 100644 --- a/client/src/app/shared/misc/help.component.html +++ b/client/src/app/shared/misc/help.component.html | |||
@@ -18,10 +18,13 @@ | |||
18 | container="body" | 18 | container="body" |
19 | title="Get help" | 19 | title="Get help" |
20 | i18n-title | 20 | i18n-title |
21 | popoverClass="help-popover" | ||
21 | [attr.aria-pressed]="isPopoverOpened" | 22 | [attr.aria-pressed]="isPopoverOpened" |
22 | [ngbPopover]="tooltipTemplate" | 23 | [ngbPopover]="tooltipTemplate" |
23 | [placement]="tooltipPlacement" | 24 | [placement]="tooltipPlacement" |
24 | [autoClose]="true" | 25 | [autoClose]="true" |
25 | (onHidden)="onPopoverHidden()" | 26 | (onHidden)="onPopoverHidden()" |
26 | (onShown)="onPopoverShown()" | 27 | (onShown)="onPopoverShown()" |
27 | ></span> | 28 | > |
29 | <my-global-icon iconName="help"></my-global-icon> | ||
30 | </span> | ||
diff --git a/client/src/app/shared/misc/help.component.scss b/client/src/app/shared/misc/help.component.scss index 5c73a8031..3898f3cda 100644 --- a/client/src/app/shared/misc/help.component.scss +++ b/client/src/app/shared/misc/help.component.scss | |||
@@ -2,29 +2,40 @@ | |||
2 | @import '_mixins'; | 2 | @import '_mixins'; |
3 | 3 | ||
4 | .help-tooltip-button { | 4 | .help-tooltip-button { |
5 | @include icon(17px); | 5 | cursor: pointer; |
6 | |||
7 | position: relative; | ||
8 | top: -2px; | ||
9 | background-image: url('../../../assets/images/global/help.svg'); | ||
10 | border: none; | 6 | border: none; |
11 | margin: 5px; | 7 | |
8 | my-global-icon { | ||
9 | width: 17px; | ||
10 | position: relative; | ||
11 | top: -2px; | ||
12 | margin: 5px; | ||
13 | |||
14 | @include apply-svg-color(var(--mainForegroundColor)) | ||
15 | } | ||
12 | } | 16 | } |
13 | 17 | ||
14 | /deep/ { | 18 | /deep/ { |
15 | .popover-body { | 19 | .help-popover { |
16 | text-align: left; | ||
17 | padding: 10px; | ||
18 | max-width: 300px; | 20 | max-width: 300px; |
19 | 21 | ||
20 | font-size: 13px; | 22 | .popover-body { |
21 | font-family: $main-fonts; | 23 | font-family: $main-fonts; |
22 | background-color: #fff; | 24 | text-align: left; |
23 | color: #000; | 25 | padding: 10px; |
24 | box-shadow: 0 0 6px rgba(0, 0, 0, 0.5); | 26 | font-size: 13px; |
27 | background-color: var(--mainBackgroundColor); | ||
28 | color: var(--mainForegroundColor); | ||
29 | box-shadow: 0 0 6px rgba(0, 0, 0, 0.5); | ||
30 | |||
31 | p { | ||
32 | margin-bottom: 0; | ||
33 | } | ||
25 | 34 | ||
26 | ul { | 35 | ul { |
27 | padding-left: 20px; | 36 | padding-left: 20px; |
37 | margin-bottom: 0; | ||
38 | } | ||
28 | } | 39 | } |
29 | } | 40 | } |
30 | } | 41 | } |
diff --git a/client/src/app/shared/misc/help.component.ts b/client/src/app/shared/misc/help.component.ts index ba0452e77..f3426f70f 100644 --- a/client/src/app/shared/misc/help.component.ts +++ b/client/src/app/shared/misc/help.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, Input, OnChanges, OnInit } from '@angular/core' | 1 | import { Component, Input, OnChanges, OnInit } from '@angular/core' |
2 | import { MarkdownService } from '@app/videos/shared' | ||
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | 2 | import { I18n } from '@ngx-translate/i18n-polyfill' |
3 | import { MarkdownService } from '@app/shared/renderer' | ||
4 | 4 | ||
5 | @Component({ | 5 | @Component({ |
6 | selector: 'my-help', | 6 | selector: 'my-help', |
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts index 78e8e9682..7cc6055c2 100644 --- a/client/src/app/shared/misc/utils.ts +++ b/client/src/app/shared/misc/utils.ts | |||
@@ -102,12 +102,18 @@ function objectToFormData (obj: any, form?: FormData, namespace?: string) { | |||
102 | return fd | 102 | return fd |
103 | } | 103 | } |
104 | 104 | ||
105 | function lineFeedToHtml (obj: any, keyToNormalize: string) { | 105 | function objectLineFeedToHtml (obj: any, keyToNormalize: string) { |
106 | return immutableAssign(obj, { | 106 | return immutableAssign(obj, { |
107 | [keyToNormalize]: obj[keyToNormalize].replace(/\r?\n|\r/g, '<br />') | 107 | [keyToNormalize]: lineFeedToHtml(obj[keyToNormalize]) |
108 | }) | 108 | }) |
109 | } | 109 | } |
110 | 110 | ||
111 | function lineFeedToHtml (text: string) { | ||
112 | if (!text) return text | ||
113 | |||
114 | return text.replace(/\r?\n|\r/g, '<br />') | ||
115 | } | ||
116 | |||
111 | function removeElementFromArray <T> (arr: T[], elem: T) { | 117 | function removeElementFromArray <T> (arr: T[], elem: T) { |
112 | const index = arr.indexOf(elem) | 118 | const index = arr.indexOf(elem) |
113 | if (index !== -1) arr.splice(index, 1) | 119 | if (index !== -1) arr.splice(index, 1) |
@@ -131,6 +137,7 @@ function scrollToTop () { | |||
131 | export { | 137 | export { |
132 | sortBy, | 138 | sortBy, |
133 | durationToString, | 139 | durationToString, |
140 | lineFeedToHtml, | ||
134 | objectToUrlEncoded, | 141 | objectToUrlEncoded, |
135 | getParameterByName, | 142 | getParameterByName, |
136 | populateAsyncUserVideoChannels, | 143 | populateAsyncUserVideoChannels, |
@@ -138,7 +145,7 @@ export { | |||
138 | dateToHuman, | 145 | dateToHuman, |
139 | immutableAssign, | 146 | immutableAssign, |
140 | objectToFormData, | 147 | objectToFormData, |
141 | lineFeedToHtml, | 148 | objectLineFeedToHtml, |
142 | removeElementFromArray, | 149 | removeElementFromArray, |
143 | scrollToTop | 150 | scrollToTop |
144 | } | 151 | } |