Skip to content

Commit fc93b78

Browse files
authored
Style tutorial (#4)
* Add style guide tutorials * Bump to SDK 0.21; bug fixes
1 parent 4c03f1d commit fc93b78

22 files changed

+1001
-765
lines changed

cloudapp/src/app/app-routing.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { TranslateComponent } from './translate/translate.component';
1313
import { ConfigurationComponent, ConfigurationGuard } from './configuration/configuration.component';
1414
import { MultiSelectComponent } from './multi-select/multi-select.component';
1515
import { ErrorComponent } from './static/error.component';
16+
import { StyleComponent } from './style/style.component';
1617

1718
const routes: Routes = [
1819
{ path: '', component: MainComponent },
@@ -27,6 +28,7 @@ const routes: Routes = [
2728
{ path: 'translate', component: TranslateComponent },
2829
{ path: 'multi-select', component: MultiSelectComponent },
2930
{ path: 'configuration', component: ConfigurationComponent, canActivate: [ConfigurationGuard] },
31+
{ path: 'style', component: StyleComponent },
3032
{ path: 'error', component: ErrorComponent }
3133
];
3234

cloudapp/src/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { Component, OnInit, OnDestroy } from '@angular/core';
1+
import { Component } from '@angular/core';
22
import { AppService } from './app.service';
33

44
@Component({
55
selector: 'app-root',
6-
template: '<router-outlet></router-outlet>'
6+
template: '<cloudapp-alert></cloudapp-alert><router-outlet></router-outlet>'
77
})
88
export class AppComponent {
99

cloudapp/src/app/app.module.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { NgModule } from '@angular/core';
22
import { HttpClientModule } from '@angular/common/http';
33
import { BrowserModule, Title } from '@angular/platform-browser';
44
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
5-
import { MaterialModule, getTranslateModule } from '@exlibris/exl-cloudapp-angular-lib';
6-
import { ToastrModule } from 'ngx-toastr';
5+
import { MaterialModule, getTranslateModule, AlertModule } from '@exlibris/exl-cloudapp-angular-lib';
76
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
87

98
import { AppComponent } from './app.component';
@@ -24,16 +23,10 @@ import { MultiSelectComponent } from './multi-select/multi-select.component';
2423
import { SelectEntitiesComponent } from './multi-select/select-entities/select-entities.component';
2524
import { LightboxComponent } from './external/lightbox/lightbox.component'
2625
import { ErrorComponent } from './static/error.component';
27-
28-
export function getToastrModule() {
29-
return ToastrModule.forRoot({
30-
positionClass: 'toast-top-right',
31-
timeOut: 2000
32-
});
33-
}
26+
import { ConfirmationDialog, StyleComponent } from './style/style.component';
3427

3528
@NgModule({
36-
declarations: [
29+
declarations: [
3730
AppComponent,
3831
MainComponent,
3932
TopmenuComponent,
@@ -50,7 +43,9 @@ export function getToastrModule() {
5043
MultiSelectComponent,
5144
SelectEntitiesComponent,
5245
LightboxComponent,
53-
ErrorComponent
46+
ErrorComponent,
47+
StyleComponent,
48+
ConfirmationDialog,
5449
],
5550
imports: [
5651
MaterialModule,
@@ -61,13 +56,16 @@ export function getToastrModule() {
6156
FormsModule,
6257
ReactiveFormsModule,
6358
getTranslateModule(),
64-
getToastrModule()
59+
AlertModule,
6560
],
6661
providers: [
6762
Title
6863
],
6964
bootstrap: [
7065
AppComponent
66+
],
67+
entryComponents: [
68+
ConfirmationDialog
7169
]
7270
})
7371
export class AppModule { }

cloudapp/src/app/bind/bind.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { Component, OnInit, OnDestroy } from '@angular/core';
22
import { AppService } from '../app.service';
33
import { FormGroup } from '@angular/forms';
4-
import { CloudAppRestService, CloudAppEventsService, PageInfo, HttpMethod, FormGroupUtil } from '@exlibris/exl-cloudapp-angular-lib';
4+
import { CloudAppRestService, CloudAppEventsService, PageInfo, HttpMethod, FormGroupUtil, AlertService } from '@exlibris/exl-cloudapp-angular-lib';
55
import { Subscription } from 'rxjs';
66
import { finalize, switchMap, tap } from 'rxjs/operators';
7-
import { ToastrService } from 'ngx-toastr';
87

98
@Component({
109
selector: 'app-bind',
@@ -20,7 +19,7 @@ export class BindComponent implements OnInit, OnDestroy {
2019
private appService: AppService,
2120
private restService: CloudAppRestService,
2221
private eventsService: CloudAppEventsService,
23-
private toastr: ToastrService
22+
private alert: AlertService
2423
) { }
2524

2625
ngOnInit() {
@@ -48,11 +47,11 @@ export class BindComponent implements OnInit, OnDestroy {
4847
method: HttpMethod.PUT
4948
}).pipe(
5049
switchMap(res => this.eventsService.refreshPage()),
51-
tap(() => this.toastr.success('Item updated')),
50+
tap(() => this.alert.success('Item updated')),
5251
finalize(() => this.saving=false)
5352
)
5453
.subscribe({
55-
error: e => this.toastr.error(e.message)
54+
error: e => this.alert.error(e.message)
5655
});
5756
}
5857
}

cloudapp/src/app/configuration/configuration.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Component, OnInit, Injectable } from '@angular/core';
22
import { AppService } from '../app.service';
33
import { FormBuilder, FormGroup } from '@angular/forms';
4-
import { CloudAppConfigService, CloudAppEventsService, CloudAppRestService, InitData } from '@exlibris/exl-cloudapp-angular-lib';
5-
import { ToastrService } from 'ngx-toastr';
4+
import { CloudAppConfigService, CloudAppEventsService, CloudAppRestService, InitData, AlertService } from '@exlibris/exl-cloudapp-angular-lib';
65
import { CanActivate, Router } from '@angular/router';
76
import { Observable, iif, of } from 'rxjs';
87
import { map, switchMap } from 'rxjs/operators';
@@ -21,7 +20,7 @@ export class ConfigurationComponent implements OnInit {
2120
private appService: AppService,
2221
private fb: FormBuilder,
2322
private configService: CloudAppConfigService,
24-
private toastr: ToastrService
23+
private alert: AlertService
2524
) { }
2625

2726
ngOnInit() {
@@ -44,10 +43,10 @@ export class ConfigurationComponent implements OnInit {
4443
this.saving = true;
4544
this.configService.set(this.form.value).subscribe(
4645
() => {
47-
this.toastr.success('Configuration successfully saved.');
46+
this.alert.success('Configuration successfully saved.');
4847
this.form.markAsPristine();
4948
},
50-
err => this.toastr.error(err.message),
49+
err => this.alert.error(err.message),
5150
() => this.saving = false
5251
);
5352
}

cloudapp/src/app/external/external.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import { Component, OnInit, ViewChild } from '@angular/core';
22
import { AppService } from '../app.service';
33
import { HttpClient } from '@angular/common/http';
44
import { map, finalize } from 'rxjs/operators';
5-
import { ToastrService } from 'ngx-toastr';
65
import { environment } from '../../environments/environment';
76
import { LightboxComponent } from './lightbox/lightbox.component';
8-
import { CloudAppEventsService } from '@exlibris/exl-cloudapp-angular-lib';
7+
import { CloudAppEventsService, AlertService } from '@exlibris/exl-cloudapp-angular-lib';
98

109
@Component({
1110
selector: 'app-external',
@@ -23,7 +22,7 @@ export class ExternalComponent implements OnInit {
2322
private appService: AppService,
2423
private eventsService: CloudAppEventsService,
2524
private http: HttpClient,
26-
private toastr: ToastrService
25+
private alert: AlertService
2726
) { }
2827

2928
ngOnInit() {
@@ -49,7 +48,7 @@ export class ExternalComponent implements OnInit {
4948
)
5049
.subscribe({
5150
next: resp => this.record = resp,
52-
error: e => this.toastr.error(e.message)
51+
error: e => this.alert.error(e.message)
5352
});
5453
}
5554

@@ -67,7 +66,7 @@ export class ExternalComponent implements OnInit {
6766
finalize(() => this.running = false)
6867
).subscribe({
6968
next: resp => this.images = resp,
70-
error: e => this.toastr.error(e.message)
69+
error: e => this.alert.error(e.message)
7170
})
7271
}
7372

cloudapp/src/app/main/main.component.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<section>
2-
<h1>
3-
Cloud App Tutorials
4-
</h1>
52
<p>This app includes all of the code referenced in the <a href="https://developers.exlibrisgroup.com/cloudapps/tutorials" target="_blank">tutorials section of the Cloud Apps documentation</a>. The following menu will lead you to the component referenced in the corresponding tutorial:</p>
63
<ul>
74
<li><a [routerLink]="['newroute']">Adding additional routes</a></li>
@@ -15,5 +12,6 @@ <h1>
1512
<li><a [routerLink]="['translate']">Translating your app</a></li>
1613
<li><a [routerLink]="['multi-select']">Selecting multiple entities</a></li>
1714
<li><a [routerLink]="['configuration']">Using the Configuration Service</a></li>
15+
<li><a [routerLink]="['style']">Following the Style Guide</a></li>
1816
</ul>
1917
</section>
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +0,0 @@
1-
.mat-checkbox-label {
2-
white-space: normal !important;
3-
line-height: unset !important;
4-
}
5-
6-
mat-list-item {
7-
height: unset !important;
8-
padding-bottom: 10px !important;
9-
}

cloudapp/src/app/settings/settings.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<div *ngIf="form">
1010
<form [formGroup]="form">
1111
<section class="settings-section">
12-
<mat-checkbox labelPosition="before" formControlName="showValue">Show Value</mat-checkbox>
12+
<mat-checkbox labelPosition="before" formControlName="showValue">Show Value:</mat-checkbox>
1313
</section>
1414
<section class="settings-section">
15-
<label class="example-margin">Align:</label>
15+
<label class="example-margin">Page Size:</label>
1616
<mat-radio-group formControlName="pageSize">
1717
<mat-radio-button class="settings-control" [value]="5">5</mat-radio-button>
1818
<mat-radio-button class="settings-control" [value]="10">10</mat-radio-button>

cloudapp/src/app/settings/settings.component.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@
77

88
.settings-control {
99
margin: 0 10px;
10-
}
10+
}
11+
12+
.full-width {
13+
width: 100%;
14+
}

0 commit comments

Comments
 (0)