Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #236 from Ajoymaity/release-1.11.0
Browse files Browse the repository at this point in the history
Issue #SB-8748 feat: Show all parents node in Qr Code.
  • Loading branch information
swayangjit authored Nov 1, 2018
2 parents 17b5d11 + ea5f12c commit 02a42a6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/pages/qr-code-result/qr-code-result.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

<ion-content padding>

<div class="card-container" *ngFor="let content of results">
<div class="card-container" *ngFor="let content of results; let i = index">
<ion-row class="P010">
<ul class="breadcrumbs">
<li *ngFor="let result of parents" (click)="navigateToDetailsPage(result)">
<li *ngFor="let result of paths[i]" (click)="navigateToDetailsPage(result)">
{{ (result?.contentData?.name?.length>30)? (result?.contentData?.name | slice:0:30)+'...' :
(result?.contentData?.name) }}
</li>
Expand Down
17 changes: 17 additions & 0 deletions src/pages/qr-code-result/qr-code-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import * as _ from 'lodash';
import { PopoverController } from 'ionic-angular';
import { Popover } from 'ionic-angular';
import { ProfileSettingsPage } from '../profile-settings/profile-settings';
import { ComponentsModule } from '../../component/components.module';

@IonicPage()
@Component({
Expand Down Expand Up @@ -91,6 +92,7 @@ export class QrCodeResultPage {
results: Array<any> = [];
defaultImg: string;
parents: Array<any> = [];
paths: Array<any> = [];
categories: Array<any> = [];
boardList: Array<any> = [];
mediumList: Array<any> = [];
Expand Down Expand Up @@ -193,6 +195,11 @@ export class QrCodeResultPage {
const contentData = JSON.parse(JSON.stringify(data.result.contentData));
this.checkProfileData(contentData, this.profile);
this.findContentNode(data.result);
this.paths.forEach(path => {
path.forEach(element => {
console.log(element.identifier);
});
});

if (this.results && this.results.length === 0) {
this.commonUtilService.showContentComingSoonAlert(this.source);
Expand All @@ -208,18 +215,28 @@ export class QrCodeResultPage {
this.commonUtilService.showContentComingSoonAlert(this.source);
this.navCtrl.pop();
});

}

private showAllChild(content: any) {
this.zone.run(() => {
if (content.children === undefined) {
if (content.mimeType !== MimeType.COLLECTION) {
this.results.push(content);

const path = [];
this.parents.forEach(ele => {
path.push(ele);
});
path.splice(-1, 1);
this.paths.push(path);
}
return;
}
content.children.forEach(child => {
this.parents.push(child);
this.showAllChild(child);
this.parents.splice(-1, 1);
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/search/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h4>{{ 'EMPTY_SEARCH_RESULTS' | translate }}</h4>
<div no-lines class="collection-header" margin-start>
<div class="collection-name">
<span>{{'FROM' | translate}} </span>{{ result.name }}</div>
<button ion-button clear no-padding class="view-collection" (click)="openCollection(result)">
<button ion-button clear no-padding class="view-collection" (click)="openContent(result,result, 0)">
{{'VIEW' | translate}} {{ result.contentType }} &nbsp;
<ion-icon ios="ios-arrow-forward" md="ios-arrow-forward"></ion-icon>
</button>
Expand Down
5 changes: 3 additions & 2 deletions src/pages/search/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,9 @@ export class SearchPage {
}

if (contentArray && contentArray.length === 1 && !isParentCheckStarted) {
this.navCtrl.pop();
this.showContentDetails(contentArray[0], true);
// this.navCtrl.pop();
// this.showContentDetails(contentArray[0], true);
this.openContent(contentArray[0], contentArray[0], 0);
return;
}

Expand Down

0 comments on commit 02a42a6

Please sign in to comment.