diff --git a/app/mobile-content/mobile-content.module.ts b/app/mobile-content/mobile-content.module.ts index e3cca725e..de2177ab0 100644 --- a/app/mobile-content/mobile-content.module.ts +++ b/app/mobile-content/mobile-content.module.ts @@ -57,6 +57,9 @@ import { EditAchievementsComponent } from './achievements/edit-achievements/edit import { ViewRouteComponent } from './routes/view-route/view-route.component'; import { MyExhibitsComponent } from './exhibits/my-exhibits/my-exhibits.component'; import { MyRoutesComponent } from './routes/my-routes/my-routes.component'; +import { SelectExhibitDialogComponent } from './routes/select-exhibit-dialog/select-exhibit-dialog.component'; +import { ReadMoreComponent } from './readmore/readmore.component'; +import { ChangeHistoryDetailedComponent } from './shared/change-history/change-history-detailed/change-history-detailed.component'; @NgModule({ imports: [ @@ -113,6 +116,7 @@ import { MyRoutesComponent } from './routes/my-routes/my-routes.component'; RatingComponent, RatingTableComponent, RoutesComponent, + SelectExhibitDialogComponent, SelectMediumDialogComponent, SelectPageDialogComponent, TagsComponent, @@ -123,6 +127,8 @@ import { MyRoutesComponent } from './routes/my-routes/my-routes.component'; EditAchievementsComponent, UploadMediumDialogComponent, ViewRouteComponent, + ReadMoreComponent, + ChangeHistoryDetailedComponent ], entryComponents: [ ConfirmDeleteDialogComponent, @@ -133,11 +139,13 @@ import { MyRoutesComponent } from './routes/my-routes/my-routes.component'; CreateTagDialogComponent, EditMediumDialogComponent, QuestionDialogComponent, + SelectExhibitDialogComponent, SelectMediumDialogComponent, SelectPageDialogComponent, UploadMediumDialogComponent, CreateAchievementsDialogComponent, - UploadMediumDialogComponent + UploadMediumDialogComponent, + ChangeHistoryDetailedComponent ], providers: [ AchievementApiService, diff --git a/app/mobile-content/readmore/readmore.component.css b/app/mobile-content/readmore/readmore.component.css new file mode 100644 index 000000000..7175aeda2 --- /dev/null +++ b/app/mobile-content/readmore/readmore.component.css @@ -0,0 +1,6 @@ +a { + font-weight: bold; + font-style: italic; + font-size: 15px; + text-decoration: underline; +} diff --git a/app/mobile-content/readmore/readmore.component.html b/app/mobile-content/readmore/readmore.component.html new file mode 100644 index 000000000..e62364571 --- /dev/null +++ b/app/mobile-content/readmore/readmore.component.html @@ -0,0 +1,5 @@ + + + +{{'more'}} +{{'less'}} diff --git a/app/mobile-content/readmore/readmore.component.ts b/app/mobile-content/readmore/readmore.component.ts new file mode 100644 index 000000000..46087971c --- /dev/null +++ b/app/mobile-content/readmore/readmore.component.ts @@ -0,0 +1,86 @@ +import { Component, Input, OnChanges, Inject } from '@angular/core'; +import { MdDialogRef, MD_DIALOG_DATA, MdDialog } from '@angular/material'; +import { ChangeHistoryDetailedComponent } from '../shared/change-history/change-history-detailed/change-history-detailed.component'; + +@Component({ + selector: 'readmore', + templateUrl: 'readmore.component.html', + styleUrls: ['readmore.component.css'] +}) +export class ReadMoreComponent implements OnChanges { + @Input() change: any; + text: string; + fullText = true; + showMore = false; + showLess = false; + rmTextShort = ''; + rmTextFull = ''; + popup = false; + minLength = 30; + lengthExtraLong = 60; + + private changeHistoryDetailedDialogRef: MdDialogRef; + + constructor(@Inject(MD_DIALOG_DATA) public data, private dialog: MdDialog) { + + } + + readMore(flag) { + if (flag) { + if (this.popup) { + this.openHistory(); + } else { + this.showMore = false; + this.fullText = true; + this.rmTextFull = this.text; + this.showLess = true; + } + } else { + this.showLess = false; + this.showMore = true; + this.fullText = false; + } + } + + ngOnChanges () { + + if (typeof this.change.value !== 'undefined') { + this.text = this.castToString(this.change.value); + } else { + this.text = ''; + } + + this.rmTextShort = this.text; + this.rmTextFull = this.text; + + if (this.rmTextShort.length > this.minLength) { + if (this.rmTextShort.length > this.lengthExtraLong) { + this.popup = true; + } + + this.fullText = false; + this.showMore = true; + this.rmTextShort = this.rmTextShort.substr(0, this.minLength) + '...'; + } + } + + private openHistory() { + this.changeHistoryDetailedDialogRef = this.dialog.open(ChangeHistoryDetailedComponent, { + width: '40%', + data: { + change: this.change, + } + }); + } + + // cast something to string to be displayed. E.g. empty array [] must be displayed as the string "[]" + castToString(something: any) { + if (something === undefined) { + return '//'; + } + if (typeof something === 'object') { + return JSON.stringify(something); + } + return String(something); + } +} diff --git a/app/mobile-content/shared/change-history/change-history-detailed/change-history-detailed.component.css b/app/mobile-content/shared/change-history/change-history-detailed/change-history-detailed.component.css new file mode 100644 index 000000000..7be78396d --- /dev/null +++ b/app/mobile-content/shared/change-history/change-history-detailed/change-history-detailed.component.css @@ -0,0 +1,33 @@ +.title { + color: #00205c; + font-weight: bold; + display: inline; +} +.text { + display: inline; + margin-left: 20px; +} +.tableColumn{ + /* width: 27%; */ + text-align: left; + ord-wrap: break-word; + float: left; + height: 100%; +} +md-list{ + margin-top: 20px; + background-color: rgba(162, 169, 183, 0.3); +} + +.mat-list { + display: block; + overflow: auto; +} + +.label { + width: 25%; +} + +.content { + width: 70% +} diff --git a/app/mobile-content/shared/change-history/change-history-detailed/change-history-detailed.component.html b/app/mobile-content/shared/change-history/change-history-detailed/change-history-detailed.component.html new file mode 100644 index 000000000..71acd1718 --- /dev/null +++ b/app/mobile-content/shared/change-history/change-history-detailed/change-history-detailed.component.html @@ -0,0 +1,55 @@ +

{{ (data.title ? data.title : ('' | translate) ) + " " +(' Detailed change history' | translate) }}

+ + + + +
+ Description: +
+
+ {{ data.change.description }} +
+
+ +
+ Time Stamp: +
+
+ {{ data.change.timestamp | date: "dd.MM.yyyy" }} +
+
+ +
+ User: +
+
+ {{ data.change.userId }} +
+
+ +
+ Property: +
+
+ {{ data.change.property }} +
+
+ + +
+ Value: +
+
+ {{ data.change.value }} +
+
+ +
+
+ + + + diff --git a/app/mobile-content/shared/change-history/change-history-detailed/change-history-detailed.component.ts b/app/mobile-content/shared/change-history/change-history-detailed/change-history-detailed.component.ts new file mode 100644 index 000000000..409128398 --- /dev/null +++ b/app/mobile-content/shared/change-history/change-history-detailed/change-history-detailed.component.ts @@ -0,0 +1,13 @@ +import { Component, Inject } from '@angular/core'; +import { MdDialogRef, MD_DIALOG_DATA } from '@angular/material'; + +@Component({ + moduleId: module.id, + selector: 'hip-history-changes-detailed-dialog', + templateUrl: 'change-history-detailed.component.html', + styleUrls: ['change-history-detailed.component.css'] +}) +export class ChangeHistoryDetailedComponent { + constructor(@Inject(MD_DIALOG_DATA) public data) { + } +} diff --git a/app/mobile-content/shared/change-history/change-history.component.html b/app/mobile-content/shared/change-history/change-history.component.html index da2517c6a..0a14c8281 100644 --- a/app/mobile-content/shared/change-history/change-history.component.html +++ b/app/mobile-content/shared/change-history/change-history.component.html @@ -41,10 +41,10 @@

{{ (data.title ? data.title : ('no title' | translate) ) + "

{{ change.userId }}

-

{{ castToString(change.property) }}

+

{{ change.property }}

-

{{ castToString(change.value) }}

+
diff --git a/app/mobile-content/shared/change-history/change-history.component.ts b/app/mobile-content/shared/change-history/change-history.component.ts index a0d006f85..7eb6f1f79 100644 --- a/app/mobile-content/shared/change-history/change-history.component.ts +++ b/app/mobile-content/shared/change-history/change-history.component.ts @@ -1,5 +1,6 @@ import { Component, Inject } from '@angular/core'; import { MdDialogRef, MD_DIALOG_DATA } from '@angular/material'; +import { ReadMoreComponent } from '../../readmore/readmore.component'; @Component({ moduleId: module.id, @@ -10,15 +11,4 @@ import { MdDialogRef, MD_DIALOG_DATA } from '@angular/material'; export class ChangeHistoryComponent { constructor(@Inject(MD_DIALOG_DATA) public data, public dialogRef: MdDialogRef) { } - - // cast something to string to be displayed. E.g. empty array [] must be displayed as the string "[]" - castToString(something: any) { - if (something === undefined) { - return '//'; - } - if (typeof something === 'object') { - return JSON.stringify(something); - } - return String(something); - } }