From a70bf3bd3337406704af5907a015ba385df0483d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 10 Jun 2022 15:58:38 +0200 Subject: Rename input toggle hidden to input text It's more than just an hidden toggle --- .../users/user-edit/user-edit.component.html | 4 +- .../users/user-edit/user-edit.component.scss | 2 +- client/src/app/+login/login.component.html | 4 +- .../my-account-applications.component.html | 4 +- .../my-account-change-email.component.html | 4 +- .../my-account-change-email.component.scss | 2 +- .../my-account-change-password.component.html | 12 ++-- .../my-account-change-password.component.scss | 4 +- .../+reset-password/reset-password.component.html | 8 +-- .../+register/register-step-user.component.html | 4 +- .../+video-edit/shared/video-edit.component.html | 6 +- .../shared-forms/dynamic-form-field.component.html | 2 +- client/src/app/shared/shared-forms/index.ts | 2 +- .../shared/shared-forms/input-text.component.html | 19 ++++++ .../shared/shared-forms/input-text.component.scss | 22 +++++++ .../shared/shared-forms/input-text.component.ts | 67 ++++++++++++++++++++++ .../input-toggle-hidden.component.html | 19 ------ .../input-toggle-hidden.component.scss | 22 ------- .../shared-forms/input-toggle-hidden.component.ts | 67 ---------------------- .../app/shared/shared-forms/shared-form.module.ts | 6 +- .../shared-share-modal/video-share.component.html | 12 ++-- .../shared-share-modal/video-share.component.scss | 2 +- .../live-stream-information.component.html | 6 +- .../video-download.component.html | 8 +-- client/src/sass/application.scss | 2 +- 25 files changed, 155 insertions(+), 155 deletions(-) create mode 100644 client/src/app/shared/shared-forms/input-text.component.html create mode 100644 client/src/app/shared/shared-forms/input-text.component.scss create mode 100644 client/src/app/shared/shared-forms/input-text.component.ts delete mode 100644 client/src/app/shared/shared-forms/input-toggle-hidden.component.html delete mode 100644 client/src/app/shared/shared-forms/input-toggle-hidden.component.scss delete mode 100644 client/src/app/shared/shared-forms/input-toggle-hidden.component.ts (limited to 'client/src') diff --git a/client/src/app/+admin/overview/users/user-edit/user-edit.component.html b/client/src/app/+admin/overview/users/user-edit/user-edit.component.html index 7e0eaf280..bfa414164 100644 --- a/client/src/app/+admin/overview/users/user-edit/user-edit.component.html +++ b/client/src/app/+admin/overview/users/user-edit/user-edit.component.html @@ -123,9 +123,9 @@ - + >
{{ formErrors.password }} diff --git a/client/src/app/+admin/overview/users/user-edit/user-edit.component.scss b/client/src/app/+admin/overview/users/user-edit/user-edit.component.scss index d7932154b..f9f4474a2 100644 --- a/client/src/app/+admin/overview/users/user-edit/user-edit.component.scss +++ b/client/src/app/+admin/overview/users/user-edit/user-edit.component.scss @@ -22,7 +22,7 @@ input:not([type=submit]) { display: block; } -my-input-toggle-hidden { +my-input-text { @include responsive-width($form-base-input-width); display: block; diff --git a/client/src/app/+login/login.component.html b/client/src/app/+login/login.component.html index dc74354d8..a2d8dae2a 100644 --- a/client/src/app/+login/login.component.html +++ b/client/src/app/+login/login.component.html @@ -36,10 +36,10 @@
- + autocomplete="current-password" [tabindex]="2">
{{ formErrors.password }}
diff --git a/client/src/app/+my-account/my-account-applications/my-account-applications.component.html b/client/src/app/+my-account/my-account-applications/my-account-applications.component.html index 8f3a55be5..2fc691707 100644 --- a/client/src/app/+my-account/my-account-applications/my-account-applications.component.html +++ b/client/src/app/+my-account/my-account-applications/my-account-applications.component.html @@ -17,12 +17,12 @@
- +
- +
⚠️ Never share your feed token with anyone.
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html index 6d2d7d46e..b0a9dbb38 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html @@ -23,11 +23,11 @@
- + autocomplete="current-password">
{{ formErrors['password'] }}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.scss b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.scss index 788db02ad..9be9056b8 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.scss +++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.scss @@ -6,7 +6,7 @@ label { font-size: 100%; } -my-input-toggle-hidden { +my-input-text { width: 340px; display: block; } diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html index 43facb7ed..f1deb4273 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html @@ -3,29 +3,29 @@
- + autocomplete="current-password">
{{ formErrors['current-password'] }}
- + autocomplete="new-password">
{{ formErrors['new-password'] }}
- + autocomplete="new-password">
{{ formErrors['new-confirmed-password'] }}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.scss b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.scss index c46aae266..ab6a43b57 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.scss +++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.scss @@ -6,12 +6,12 @@ label { font-size: 100%; } -my-input-toggle-hidden { +my-input-text { width: 340px; display: block; } -my-input-toggle-hidden + my-input-toggle-hidden { +my-input-text + my-input-text { margin-top: 15px; } diff --git a/client/src/app/+reset-password/reset-password.component.html b/client/src/app/+reset-password/reset-password.component.html index 143f426ec..1910ebd15 100644 --- a/client/src/app/+reset-password/reset-password.component.html +++ b/client/src/app/+reset-password/reset-password.component.html @@ -6,10 +6,10 @@
- + autocomplete="new-password">
{{ formErrors.password }}
@@ -17,10 +17,10 @@
- + autocomplete="new-password">
{{ formErrors['password-confirm'] }}
diff --git a/client/src/app/+signup/+register/register-step-user.component.html b/client/src/app/+signup/+register/register-step-user.component.html index 745b37c10..6e367b4c7 100644 --- a/client/src/app/+signup/+register/register-step-user.component.html +++ b/client/src/app/+signup/+register/register-step-user.component.html @@ -52,10 +52,10 @@
- + autocomplete="new-password">
{{ formErrors.password }}
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.html index 44004eb21..26bfaa583 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html @@ -243,17 +243,17 @@
- +
- +
- +
⚠️ Never share your stream key with anyone.
diff --git a/client/src/app/shared/shared-forms/dynamic-form-field.component.html b/client/src/app/shared/shared-forms/dynamic-form-field.component.html index 2ef61ecfc..2ec436ac6 100644 --- a/client/src/app/shared/shared-forms/dynamic-form-field.component.html +++ b/client/src/app/shared/shared-forms/dynamic-form-field.component.html @@ -18,7 +18,7 @@
- + diff --git a/client/src/app/shared/shared-forms/index.ts b/client/src/app/shared/shared-forms/index.ts index 727416a40..495785e7b 100644 --- a/client/src/app/shared/shared-forms/index.ts +++ b/client/src/app/shared/shared-forms/index.ts @@ -3,7 +3,7 @@ export * from './form-reactive' export * from './form-validator.service' export * from './form-validator.service' export * from './input-switch.component' -export * from './input-toggle-hidden.component' +export * from './input-text.component' export * from './markdown-textarea.component' export * from './peertube-checkbox.component' export * from './preview-upload.component' diff --git a/client/src/app/shared/shared-forms/input-text.component.html b/client/src/app/shared/shared-forms/input-text.component.html new file mode 100644 index 000000000..f7f9ce403 --- /dev/null +++ b/client/src/app/shared/shared-forms/input-text.component.html @@ -0,0 +1,19 @@ +
+ + + + + +
diff --git a/client/src/app/shared/shared-forms/input-text.component.scss b/client/src/app/shared/shared-forms/input-text.component.scss new file mode 100644 index 000000000..cc1646a69 --- /dev/null +++ b/client/src/app/shared/shared-forms/input-text.component.scss @@ -0,0 +1,22 @@ +@use '_variables' as *; +@use '_mixins' as *; + +input { + @include peertube-input-text(auto); + @include padding-left(15px !important); + @include padding-right(15px !important); +} + +.btn { + font-size: 15px; +} + +my-global-icon { + width: 18px; +} + +.copy-text { + font-size: 14px; + margin-left: 5px; + vertical-align: top; +} diff --git a/client/src/app/shared/shared-forms/input-text.component.ts b/client/src/app/shared/shared-forms/input-text.component.ts new file mode 100644 index 000000000..ed4637c17 --- /dev/null +++ b/client/src/app/shared/shared-forms/input-text.component.ts @@ -0,0 +1,67 @@ +import { Component, forwardRef, Input } from '@angular/core' +import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' +import { Notifier } from '@app/core' + +@Component({ + selector: 'my-input-text', + templateUrl: './input-text.component.html', + styleUrls: [ './input-text.component.scss' ], + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => InputTextComponent), + multi: true + } + ] +}) +export class InputTextComponent implements ControlValueAccessor { + @Input() inputId = Math.random().toString(11).slice(2, 8) // id cannot be left empty or undefined + @Input() value = '' + @Input() autocomplete = 'off' + @Input() placeholder = '' + @Input() tabindex = 0 + @Input() withToggle = true + @Input() withCopy = false + @Input() readonly = false + @Input() show = false + + constructor (private notifier: Notifier) { } + + get inputType () { + return this.show + ? 'text' + : 'password' + } + + get toggleTitle () { + return this.show + ? $localize`Hide` + : $localize`Show` + } + + toggle () { + this.show = !this.show + } + + activateCopiedMessage () { + this.notifier.success($localize`Copied`) + } + + propagateChange = (_: any) => { /* empty */ } + + writeValue (value: string) { + this.value = value + } + + registerOnChange (fn: (_: any) => void) { + this.propagateChange = fn + } + + registerOnTouched () { + // Unused + } + + update () { + this.propagateChange(this.value) + } +} diff --git a/client/src/app/shared/shared-forms/input-toggle-hidden.component.html b/client/src/app/shared/shared-forms/input-toggle-hidden.component.html deleted file mode 100644 index f7f9ce403..000000000 --- a/client/src/app/shared/shared-forms/input-toggle-hidden.component.html +++ /dev/null @@ -1,19 +0,0 @@ -
- - - - - -
diff --git a/client/src/app/shared/shared-forms/input-toggle-hidden.component.scss b/client/src/app/shared/shared-forms/input-toggle-hidden.component.scss deleted file mode 100644 index cc1646a69..000000000 --- a/client/src/app/shared/shared-forms/input-toggle-hidden.component.scss +++ /dev/null @@ -1,22 +0,0 @@ -@use '_variables' as *; -@use '_mixins' as *; - -input { - @include peertube-input-text(auto); - @include padding-left(15px !important); - @include padding-right(15px !important); -} - -.btn { - font-size: 15px; -} - -my-global-icon { - width: 18px; -} - -.copy-text { - font-size: 14px; - margin-left: 5px; - vertical-align: top; -} diff --git a/client/src/app/shared/shared-forms/input-toggle-hidden.component.ts b/client/src/app/shared/shared-forms/input-toggle-hidden.component.ts deleted file mode 100644 index e03353fe1..000000000 --- a/client/src/app/shared/shared-forms/input-toggle-hidden.component.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Component, forwardRef, Input } from '@angular/core' -import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' -import { Notifier } from '@app/core' - -@Component({ - selector: 'my-input-toggle-hidden', - templateUrl: './input-toggle-hidden.component.html', - styleUrls: [ './input-toggle-hidden.component.scss' ], - providers: [ - { - provide: NG_VALUE_ACCESSOR, - useExisting: forwardRef(() => InputToggleHiddenComponent), - multi: true - } - ] -}) -export class InputToggleHiddenComponent implements ControlValueAccessor { - @Input() inputId = Math.random().toString(11).slice(2, 8) // id cannot be left empty or undefined - @Input() value = '' - @Input() autocomplete = 'off' - @Input() placeholder = '' - @Input() tabindex = 0 - @Input() withToggle = true - @Input() withCopy = false - @Input() readonly = false - @Input() show = false - - constructor (private notifier: Notifier) { } - - get inputType () { - return this.show - ? 'text' - : 'password' - } - - get toggleTitle () { - return this.show - ? $localize`Hide` - : $localize`Show` - } - - toggle () { - this.show = !this.show - } - - activateCopiedMessage () { - this.notifier.success($localize`Copied`) - } - - propagateChange = (_: any) => { /* empty */ } - - writeValue (value: string) { - this.value = value - } - - registerOnChange (fn: (_: any) => void) { - this.propagateChange = fn - } - - registerOnTouched () { - // Unused - } - - update () { - this.propagateChange(this.value) - } -} diff --git a/client/src/app/shared/shared-forms/shared-form.module.ts b/client/src/app/shared/shared-forms/shared-form.module.ts index 60c2f66ae..81f076db6 100644 --- a/client/src/app/shared/shared-forms/shared-form.module.ts +++ b/client/src/app/shared/shared-forms/shared-form.module.ts @@ -9,7 +9,7 @@ import { AdvancedInputFilterComponent } from './advanced-input-filter.component' import { DynamicFormFieldComponent } from './dynamic-form-field.component' import { FormValidatorService } from './form-validator.service' import { InputSwitchComponent } from './input-switch.component' -import { InputToggleHiddenComponent } from './input-toggle-hidden.component' +import { InputTextComponent } from './input-text.component' import { MarkdownTextareaComponent } from './markdown-textarea.component' import { PeertubeCheckboxComponent } from './peertube-checkbox.component' import { PreviewUploadComponent } from './preview-upload.component' @@ -40,7 +40,7 @@ import { TimestampInputComponent } from './timestamp-input.component' ], declarations: [ - InputToggleHiddenComponent, + InputTextComponent, MarkdownTextareaComponent, PeertubeCheckboxComponent, PreviewUploadComponent, @@ -71,7 +71,7 @@ import { TimestampInputComponent } from './timestamp-input.component' InputMaskModule, NgSelectModule, - InputToggleHiddenComponent, + InputTextComponent, MarkdownTextareaComponent, PeertubeCheckboxComponent, PreviewUploadComponent, diff --git a/client/src/app/shared/shared-share-modal/video-share.component.html b/client/src/app/shared/shared-share-modal/video-share.component.html index 572c03129..0658ae962 100644 --- a/client/src/app/shared/shared-share-modal/video-share.component.html +++ b/client/src/app/shared/shared-share-modal/video-share.component.html @@ -25,7 +25,7 @@ @@ -45,10 +45,10 @@