import {EgPermService} from '@eg/core/perm';
import {EgPcrudService} from '@eg/core/pcrud';
import {EgOrgService} from '@eg/core/org';
-import {EgOrgSelectComponent} from '@eg/share/org-select.component';
-import {EgConfirmDialogComponent} from '@eg/share/confirm-dialog.component';
@NgModule({
declarations: [
- EgOrgSelectComponent,
- EgConfirmDialogComponent
],
imports: [
CommonModule,
exports: [
CommonModule,
NgbModule,
- FormsModule,
- EgOrgSelectComponent,
- EgConfirmDialogComponent
+ FormsModule
]
})
import {EgPcrudService} from '@eg/core/pcrud';
import {EgOrgService} from '@eg/core/org';
+// Downgraded components
+//import {EgConfirmDialogComponent} from '@eg/share/confirm-dialog.component';
+import {EgHelloWorldComponent} from '@eg/share/hello-world.component';
+
declare var angular: any;
@NgModule({
NgbModule.forRoot(),
CookieModule.forRoot(),
EgCommonModule.forRoot()
+ ],
+ declarations: [EgHelloWorldComponent],
+ entryComponents: [
+ EgHelloWorldComponent,
+ //EgConfirmDialogComponent // declared in EgCommonModule
]
})
.factory('eg2Pcrud', downgradeInjectable(EgPcrudService))
.factory('eg2Org', downgradeInjectable(EgOrgService))
.factory('ng2Title', downgradeInjectable(Title))
+ .directive('eg2HelloWorld',
+ downgradeComponent({component: EgHelloWorldComponent}))
+
;
this.upgrade.bootstrap(document.body, [myWin.ang1PageApp]);
+++ /dev/null
-import {Component, Input, ViewChild, TemplateRef} from '@angular/core';
-import {NgbModal, NgbModalRef} from '@ng-bootstrap/ng-bootstrap';
-
-// TODO: DOCS
-
-@Component({
- selector: 'eg-confirm-dialog',
- template: `
- <ng-template #dialogContent>
- <div class="modal-header bg-info">
- <h4 class="modal-title">{{dialogTitle}}</h4>
- <button type="button" class="close"
- i18n-aria-label aria-label="Close"
- (click)="dismiss('cross_click')">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body"><p>{{dialogBody}}</p></div>
- <div class="modal-footer">
- <button type="button" class="btn btn-success"
- (click)="close('confirmed')" i18n>Confirm</button>
- <button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
- </div>
- </ng-template>
- `
-})
-export class EgConfirmDialogComponent {
-
- // We need a reference to our template so we can pass it
- // off to the modal service open() call.
- @ViewChild('dialogContent')
- private dialogContent: TemplateRef<any>;
-
- // The modalRef allows direct control of the modal instance.
- private modalRef: NgbModalRef = null;
-
- @Input() public dialogTitle: string;
- @Input() public dialogBody: string;
-
- constructor(private modalService: NgbModal) {}
-
- open(): Promise<void> {
- return new Promise((resolve, reject) => {
-
- if (this.modalRef !== null) {
- console.error('Dismissing existing EgConfirmDialog!');
- this.dismiss();
- }
-
- this.modalRef = this.modalService.open(this.dialogContent);
- this.modalRef.result.then(
- resolved => resolve(),
- rejected => reject()
- )
- });
- }
-
- close(): void {
- this.modalRef.close();
- this.modalRef = null;
- }
-
- dismiss(): void {
- this.modalRef.dismiss();
- this.modalRef = null;
- }
-
-}
-
-
--- /dev/null
+<ng-template #dialogContent>
+ <div class="modal-header bg-info">
+ <h4 class="modal-title">{{dialogTitle}}</h4>
+ <button type="button" class="close"
+ i18n-aria-label aria-label="Close"
+ (click)="dismiss('cross_click')">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body"><p>{{dialogBody}}</p></div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-success"
+ (click)="close('confirmed')" i18n>Confirm</button>
+ <button type="button" class="btn btn-warning"
+ (click)="dismiss('canceled')" i18n>Cancel</button>
+ </div>
+</ng-template>
--- /dev/null
+import {Component, Input, ViewChild, TemplateRef} from '@angular/core';
+import {EgDialogComponent} from '@eg/share/dialog/dialog.component';
+
+@Component({
+ selector: 'eg-confirm-dialog',
+ templateUrl: './confirm.component.html'
+})
+
+/**
+ * Confirmation dialog that asks a yes/no question.
+ */
+export class EgConfirmDialogComponent extends EgDialogComponent {
+ // What question are we asking?
+ @Input() public dialogBody: string;
+}
+
+
--- /dev/null
+import {Component, Input, ViewChild, TemplateRef} from '@angular/core';
+import {NgbModal, NgbModalRef} from '@ng-bootstrap/ng-bootstrap';
+
+/**
+ * Dialog base class. Handles the ngbModal logic.
+ * Sub-classed component templates must have a #dialogContent selector
+ * at the root of the template (see EgConfirmDialogComponent).
+ */
+
+@Component({
+ selector: 'eg-component',
+ template: '<ng-template></ng-template>'
+})
+export class EgDialogComponent {
+
+ // Assume all dialogs support a title attribute.
+ @Input() public dialogTitle: string;
+
+ // Pointer to the dialog content template.
+ @ViewChild('dialogContent')
+ private dialogContent: TemplateRef<any>;
+
+ // The modalRef allows direct control of the modal instance.
+ private modalRef: NgbModalRef = null;
+
+ constructor(private modalService: NgbModal) {}
+
+ open(): Promise<any> {
+
+ if (this.modalRef !== null) {
+ console.error('Dismissing existing dialog!');
+ this.dismiss();
+ }
+
+ this.modalRef = this.modalService.open(this.dialogContent);
+ return this.modalRef.result;
+ }
+
+ close(reason?: any): void {
+ this.modalRef.close(reason);
+ this.modalRef = null;
+ }
+
+ dismiss(reason?: any): void {
+ this.modalRef.dismiss(reason);
+ this.modalRef = null;
+ }
+}
+
+
import {EgAuthService} from '@eg/core/auth';
import {EgOrgService} from '@eg/core/org';
import {EgEventService} from '@eg/core/event';
-import {EgConfirmDialogComponent} from '@eg/share/confirm-dialog.component';
+import {EgConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
// Slim version of the WS that's stored in the cache.
interface Workstation {
confirmed => {
this.registerWorkstationApi(true).then(
wsId => resolve(wsId),
- notOk => reject()
+ notOk => reject(notOk)
)
},
- dismissed => reject()
+ dismissed => reject(dismissed)
)
});
}
Created {{bibSummary.create_date | date:'shortDate'}} by
<!-- creator if fleshed after the initial data set is loaded -->
<a *ngIf="bibSummary.creator.usrname" target="_self"
- href="./staff/circ/patron/{{bibSummary.creator.id()}}/checkout">
+ href="/eg/staff/circ/patron/{{bibSummary.creator.id()}}/checkout">
{{bibSummary.creator.usrname()}}
</a>
<!-- add a spacer pending data to reduce page shuffle -->
<div class="float-right small-text-1">
Edited {{bibSummary.edit_date | date:'shortDate'}} by
<a *ngIf="bibSummary.editor.usrname" target="_self"
- href="./staff/circ/patron/{{bibSummary.editor.id()}}/checkout">
+ href="/eg/staff/circ/patron/{{bibSummary.editor.id()}}/checkout">
{{bibSummary.editor.usrname()}}
</a>
<span *ngIf="!bibSummary.editor.usrname"> ... </span>
import {NgModule, ModuleWithProviders} from '@angular/core';
import {EgCommonModule} from '@eg/common.module';
import {EgStaffBannerComponent} from './share/staff-banner.component';
-import {EgConfirmDialogComponent} from '@eg/share/confirm-dialog.component';
+import {EgOrgSelectComponent} from '@eg/share/org-select.component';
+import {EgDialogComponent} from '@eg/share/dialog/dialog.component';
+import {EgConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
/**
* Imports the EG common modules and adds modules common to all staff UI's.
@NgModule({
declarations: [
EgStaffBannerComponent,
+ EgOrgSelectComponent,
+ EgDialogComponent,
+ EgConfirmDialogComponent
],
imports: [
EgCommonModule
],
exports: [
EgCommonModule,
- EgStaffBannerComponent
+ EgStaffBannerComponent,
+ EgOrgSelectComponent,
+ EgDialogComponent,
+ EgConfirmDialogComponent
]
})
return {
ngModule: EgStaffCommonModule,
providers: [
- /* placeholder for exporting staff-only services */
+ /* placeholder for exporting staff-wide services */
]
};
}
</div>
</div>
+<!--
+<eg2-confirm-dialog
+ #testDialog
+ dialogTitle="Test Dialog"
+ dialogBody='Test Dialog Body'>
+</eg2-confirm-dialog>
+-->
+
+<eg2-hello-world #testHello message="Look out, I'm testing here!"></eg2-hello-world>
+
<div class="row">
<div class="col-md-12">
<div ng-if="is_backdate()" class="alert-danger pad-all-min">
ng2Title.setTitle('Checkin'); // TODO: TESTING
+ var testDialog = angular.element(document.querySelector('testHello'));
+ //var testDialog = angular.element();
+ //console.log(testDialog);
+ //console.log(testDialog.controller());
+ console.log(testDialog.controller());
+ console.log(testDialog.controller('eg2HelloWorld'));
+ //testDialog.controller('eg2ConfirmDialog').open();
+ //testDialog.controller('egConfirmDialog').open();
+
$scope.focusMe = true;
$scope.checkins = checkinSvc.checkins;
var today = new Date();