diff options
Diffstat (limited to 'client/src/app/shared')
4 files changed, 36 insertions, 0 deletions
diff --git a/client/src/app/shared/forms/input-readonly-copy.component.html b/client/src/app/shared/forms/input-readonly-copy.component.html new file mode 100644 index 000000000..27571b63f --- /dev/null +++ b/client/src/app/shared/forms/input-readonly-copy.component.html | |||
@@ -0,0 +1,9 @@ | |||
1 | <div class="input-group"> | ||
2 | <input #urlInput (click)="urlInput.select()" type="text" class="form-control readonly" readonly [value]="value" /> | ||
3 | |||
4 | <div class="input-group-append"> | ||
5 | <button [ngxClipboard]="urlInput" (click)="activateCopiedMessage()" type="button" class="btn btn-outline-secondary"> | ||
6 | <span class="glyphicon glyphicon-copy"></span> | ||
7 | </button> | ||
8 | </div> | ||
9 | </div> | ||
diff --git a/client/src/app/shared/forms/input-readonly-copy.component.scss b/client/src/app/shared/forms/input-readonly-copy.component.scss new file mode 100644 index 000000000..8dc4f113c --- /dev/null +++ b/client/src/app/shared/forms/input-readonly-copy.component.scss | |||
@@ -0,0 +1,3 @@ | |||
1 | input.readonly { | ||
2 | font-size: 15px; | ||
3 | } | ||
diff --git a/client/src/app/shared/forms/input-readonly-copy.component.ts b/client/src/app/shared/forms/input-readonly-copy.component.ts new file mode 100644 index 000000000..7528fb7a1 --- /dev/null +++ b/client/src/app/shared/forms/input-readonly-copy.component.ts | |||
@@ -0,0 +1,21 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { Notifier } from '@app/core' | ||
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
4 | |||
5 | @Component({ | ||
6 | selector: 'my-input-readonly-copy', | ||
7 | templateUrl: './input-readonly-copy.component.html', | ||
8 | styleUrls: [ './input-readonly-copy.component.scss' ] | ||
9 | }) | ||
10 | export class InputReadonlyCopyComponent { | ||
11 | @Input() value = '' | ||
12 | |||
13 | constructor ( | ||
14 | private notifier: Notifier, | ||
15 | private i18n: I18n | ||
16 | ) { } | ||
17 | |||
18 | activateCopiedMessage () { | ||
19 | this.notifier.success(this.i18n('Copied')) | ||
20 | } | ||
21 | } | ||
diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts index 8cbb15bfa..29ddf7b81 100644 --- a/client/src/app/shared/shared.module.ts +++ b/client/src/app/shared/shared.module.ts | |||
@@ -95,6 +95,7 @@ import { ClipboardModule } from 'ngx-clipboard' | |||
95 | import { FollowService } from '@app/shared/instance/follow.service' | 95 | import { FollowService } from '@app/shared/instance/follow.service' |
96 | import { MultiSelectModule } from 'primeng/multiselect' | 96 | import { MultiSelectModule } from 'primeng/multiselect' |
97 | import { FeatureBooleanComponent } from '@app/shared/instance/feature-boolean.component' | 97 | import { FeatureBooleanComponent } from '@app/shared/instance/feature-boolean.component' |
98 | import { InputReadonlyCopyComponent } from '@app/shared/forms/input-readonly-copy.component' | ||
98 | 99 | ||
99 | @NgModule({ | 100 | @NgModule({ |
100 | imports: [ | 101 | imports: [ |
@@ -155,6 +156,7 @@ import { FeatureBooleanComponent } from '@app/shared/instance/feature-boolean.co | |||
155 | ReactiveFileComponent, | 156 | ReactiveFileComponent, |
156 | PeertubeCheckboxComponent, | 157 | PeertubeCheckboxComponent, |
157 | TimestampInputComponent, | 158 | TimestampInputComponent, |
159 | InputReadonlyCopyComponent, | ||
158 | 160 | ||
159 | SubscribeButtonComponent, | 161 | SubscribeButtonComponent, |
160 | RemoteSubscribeComponent, | 162 | RemoteSubscribeComponent, |
@@ -220,6 +222,7 @@ import { FeatureBooleanComponent } from '@app/shared/instance/feature-boolean.co | |||
220 | InfiniteScrollerDirective, | 222 | InfiniteScrollerDirective, |
221 | TextareaAutoResizeDirective, | 223 | TextareaAutoResizeDirective, |
222 | HelpComponent, | 224 | HelpComponent, |
225 | InputReadonlyCopyComponent, | ||
223 | 226 | ||
224 | ReactiveFileComponent, | 227 | ReactiveFileComponent, |
225 | PeertubeCheckboxComponent, | 228 | PeertubeCheckboxComponent, |