mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
fixing share modal
This commit is contained in:
parent
7bd7928664
commit
c08a2b35ba
@ -1,111 +1,103 @@
|
|||||||
<button id="shareButton" class="nav-link btn btn-default btn-link"
|
<button id="shareButton" class="nav-link btn btn-default btn-link"
|
||||||
type="button" [disabled]="!enabled" (click)="showModal()">
|
type="button" [disabled]="!enabled" (click)="openModal(shareModal)">
|
||||||
<span class="oi oi-share"></span>
|
<span class="oi oi-share"></span>
|
||||||
<ng-container i18n>Share</ng-container>
|
<ng-container i18n>Share</ng-container>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- sharing Modal-->
|
<ng-template #shareModal>
|
||||||
<div bsModal #shareModal="bs-modal"
|
<!-- sharing Modal-->
|
||||||
class="modal fade" id="shareModal"
|
<div class="modal-header">
|
||||||
tabindex="-1" role="dialog" aria-labelledby="shareModalLabel"
|
<h5 class="modal-title" i18n>Share</h5>
|
||||||
[config]="{ backdrop: false }"
|
<button type="button" class="close" (click)="hideModal()" data-dismiss="modal" aria-label="Close">
|
||||||
aria-hidden="true">
|
<span aria-hidden="true">×</span>
|
||||||
<div class="modal-dialog" role="document">
|
</button>
|
||||||
<div class="modal-content">
|
</div>
|
||||||
<div class="modal-header">
|
<div class="modal-body">
|
||||||
<h5 class="modal-title" id="shareModalLabel" i18n>Share</h5>
|
<div class="row">
|
||||||
<button type="button" class="close" (click)="hideModal()" data-dismiss="modal" aria-label="Close">
|
<div class="col-7 col-sm-9">
|
||||||
<span aria-hidden="true">×</span>
|
<input id="shareLink"
|
||||||
|
name="shareLink"
|
||||||
|
placeholder="link"
|
||||||
|
class="form-control input-md"
|
||||||
|
type="text"
|
||||||
|
[ngModel]="url">
|
||||||
|
</div>
|
||||||
|
<div class="col-5 col-sm-3">
|
||||||
|
<button id="copyButton" name="copyButton"
|
||||||
|
ngxClipboard [cbContent]="url"
|
||||||
|
(cbOnSuccess)="onCopy()"
|
||||||
|
class="btn btn-primary btn-block" i18n>Copy
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
</div>
|
||||||
<div class="row">
|
<hr/>
|
||||||
<div class="col-7 col-sm-9">
|
<div class="row">
|
||||||
<input id="shareLink"
|
<div class="col-4">
|
||||||
name="shareLink"
|
<label class="control-label" i18n>Sharing:</label>
|
||||||
placeholder="link"
|
</div>
|
||||||
class="form-control input-md"
|
<div class="col-8">
|
||||||
type="text"
|
<input disabled type="text"
|
||||||
[ngModel]="url">
|
class="full-width form-control"
|
||||||
</div>
|
[ngModel]="currentDir">
|
||||||
<div class="col-5 col-sm-3">
|
</div>
|
||||||
<button id="copyButton" name="copyButton"
|
</div>
|
||||||
ngxClipboard [cbContent]="url"
|
|
||||||
(cbOnSuccess)="onCopy()"
|
|
||||||
class="btn btn-primary btn-block" i18n>Copy
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr/>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">
|
|
||||||
<label class="control-label" i18n>Sharing:</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-8">
|
|
||||||
<input disabled type="text"
|
|
||||||
class="full-width form-control"
|
|
||||||
[ngModel]="currentDir">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<label class="control-label" i18n>Include subfolders:</label>
|
<label class="control-label" i18n>Include subfolders:</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<bSwitch
|
<bSwitch
|
||||||
class="switch"
|
class="switch"
|
||||||
name="includeSubfolders"
|
name="includeSubfolders"
|
||||||
[switch-on-color]="'success'"
|
[switch-on-color]="'success'"
|
||||||
[switch-inverse]="'inverse'"
|
[switch-inverse]="'inverse'"
|
||||||
[switch-off-text]="text.No"
|
[switch-off-text]="text.No"
|
||||||
[switch-on-text]="text.Yes"
|
[switch-on-text]="text.Yes"
|
||||||
[switch-handle-width]="'100'"
|
[switch-handle-width]="'100'"
|
||||||
[switch-label-width]="'20'"
|
[switch-label-width]="'20'"
|
||||||
(change)="update()"
|
(change)="update()"
|
||||||
[(ngModel)]="input.includeSubfolders">
|
[(ngModel)]="input.includeSubfolders">
|
||||||
</bSwitch>
|
</bSwitch>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<label class="control-label">
|
<label class="control-label">
|
||||||
<ng-container i18n>Password</ng-container>
|
<ng-container i18n>Password</ng-container>
|
||||||
:
|
:
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<input id="password"
|
<input id="password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
type="password"
|
type="password"
|
||||||
(change)="update()"
|
(change)="update()"
|
||||||
[(ngModel)]="input.password"
|
[(ngModel)]="input.password"
|
||||||
i18n-placeholder
|
i18n-placeholder
|
||||||
placeholder="Password">
|
placeholder="Password">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<label class="control-label" i18n>Valid:</label>
|
<label class="control-label" i18n>Valid:</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4" style="padding-right: 1px">
|
<div class="col-4" style="padding-right: 1px">
|
||||||
<input class="form-control" [(ngModel)]="input.valid.amount" (change)="update()"
|
<input class="form-control" [(ngModel)]="input.valid.amount" (change)="update()"
|
||||||
name="validAmount"
|
name="validAmount"
|
||||||
type="number" min="0" step="1"/>
|
type="number" min="0" step="1"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4" style="padding-left: 1px">
|
<div class="col-4" style="padding-left: 1px">
|
||||||
<select class="form-control" [(ngModel)]="input.valid.type" (change)="update()" name="validType"
|
<select class="form-control" [(ngModel)]="input.valid.type" (change)="update()" name="validType"
|
||||||
required>
|
required>
|
||||||
<option [ngValue]="ValidityTypes.Minutes" i18n>Minutes</option>
|
<option [ngValue]="ValidityTypes.Minutes" i18n>Minutes</option>
|
||||||
<option [ngValue]="ValidityTypes.Hours" i18n>Hours</option>
|
<option [ngValue]="ValidityTypes.Hours" i18n>Hours</option>
|
||||||
<option [ngValue]="ValidityTypes.Days" i18n>Days</option>
|
<option [ngValue]="ValidityTypes.Days" i18n>Days</option>
|
||||||
<option [ngValue]="ValidityTypes.Months" i18n>Months</option>
|
<option [ngValue]="ValidityTypes.Months" i18n>Months</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</ng-template>
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
import {Component, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
import {Component, OnDestroy, OnInit, TemplateRef} from '@angular/core';
|
||||||
import {Utils} from '../../../../common/Utils';
|
import {Utils} from '../../../../common/Utils';
|
||||||
import {ShareService} from '../share.service';
|
import {ShareService} from '../share.service';
|
||||||
import {GalleryService} from '../gallery.service';
|
import {GalleryService} from '../gallery.service';
|
||||||
import {ContentWrapper} from '../../../../common/entities/ConentWrapper';
|
import {ContentWrapper} from '../../../../common/entities/ConentWrapper';
|
||||||
import {SharingDTO} from '../../../../common/entities/SharingDTO';
|
import {SharingDTO} from '../../../../common/entities/SharingDTO';
|
||||||
import {ModalDirective} from 'ngx-bootstrap/modal';
|
|
||||||
import {Config} from '../../../../common/config/public/Config';
|
import {Config} from '../../../../common/config/public/Config';
|
||||||
import {NotificationService} from '../../model/notification.service';
|
import {NotificationService} from '../../model/notification.service';
|
||||||
import {DirectoryDTO} from '../../../../common/entities/DirectoryDTO';
|
import {DirectoryDTO} from '../../../../common/entities/DirectoryDTO';
|
||||||
import {I18n} from '@ngx-translate/i18n-polyfill';
|
import {I18n} from '@ngx-translate/i18n-polyfill';
|
||||||
|
import {BsModalService} from 'ngx-bootstrap/modal';
|
||||||
|
import {BsModalRef} from 'ngx-bootstrap/modal/bs-modal-ref.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -17,7 +18,6 @@ import {I18n} from '@ngx-translate/i18n-polyfill';
|
|||||||
styleUrls: ['./share.gallery.component.css'],
|
styleUrls: ['./share.gallery.component.css'],
|
||||||
})
|
})
|
||||||
export class GalleryShareComponent implements OnInit, OnDestroy {
|
export class GalleryShareComponent implements OnInit, OnDestroy {
|
||||||
@ViewChild('shareModal') public childModal: ModalDirective;
|
|
||||||
|
|
||||||
enabled = true;
|
enabled = true;
|
||||||
url = '';
|
url = '';
|
||||||
@ -36,6 +36,8 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
|
|||||||
passwordProtection = false;
|
passwordProtection = false;
|
||||||
ValidityTypes: any;
|
ValidityTypes: any;
|
||||||
|
|
||||||
|
modalRef: BsModalRef;
|
||||||
|
|
||||||
text = {
|
text = {
|
||||||
Yes: 'Yes',
|
Yes: 'Yes',
|
||||||
No: 'No'
|
No: 'No'
|
||||||
@ -44,7 +46,8 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
|
|||||||
constructor(private _sharingService: ShareService,
|
constructor(private _sharingService: ShareService,
|
||||||
public _galleryService: GalleryService,
|
public _galleryService: GalleryService,
|
||||||
private _notification: NotificationService,
|
private _notification: NotificationService,
|
||||||
public i18n: I18n) {
|
public i18n: I18n,
|
||||||
|
private modalService: BsModalService) {
|
||||||
this.ValidityTypes = ValidityTypes;
|
this.ValidityTypes = ValidityTypes;
|
||||||
|
|
||||||
this.text.Yes = i18n('Yes');
|
this.text.Yes = i18n('Yes');
|
||||||
@ -99,10 +102,13 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
|
|||||||
this.url = Config.Client.publicUrl + '/share/' + this.sharing.sharingKey;
|
this.url = Config.Client.publicUrl + '/share/' + this.sharing.sharingKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
async showModal() {
|
async openModal(template: TemplateRef<any>) {
|
||||||
await this.get();
|
await this.get();
|
||||||
this.input.password = '';
|
this.input.password = '';
|
||||||
this.childModal.show();
|
if (this.modalRef) {
|
||||||
|
this.modalRef.hide();
|
||||||
|
}
|
||||||
|
this.modalRef = this.modalService.show(template);
|
||||||
document.body.style.paddingRight = '0px';
|
document.body.style.paddingRight = '0px';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +117,8 @@ export class GalleryShareComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public hideModal() {
|
public hideModal() {
|
||||||
this.childModal.hide();
|
this.modalRef.hide();
|
||||||
|
this.modalRef = null;
|
||||||
this.sharing = null;
|
this.sharing = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user