Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in menu view #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions app/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
</button>
</ion-list>
<ion-list>
<ion-list-header> Categories </ion-list-header>
<ion-item menuClose *ngFor="#p1 of items" (click)="openPage1(p1)">{{p1.title}}</ion-item>
<ion-list-header (click)="hideCat()"> Categories
<ion-icon *ngIf="hidecat" item-left name="ios-arrow-up"></ion-icon>
<ion-icon *ngIf="!hidecat" item-left name="ios-arrow-down"></ion-icon>
</ion-list-header>
<ion-item *ngIf="hidecat">
<ion-item menuClose *ngFor="#p1 of items" (click)="openPage(p1)">{{p1.title}}</ion-item>
</ion-item>
</ion-list>
<button menuClose ion-item (click)="Logout()">
Logout
Expand Down
65 changes: 29 additions & 36 deletions app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,20 @@ class MyApp {
items: any;
uniteItem: any;
submenuitem: boolean;
unitetoast : UniteToast;
category: string;
siteconfig: any;
constructor(private app: IonicApp, uniteItem: UniteItem, private platform: Platform, uniteMenu: UniteMenu, private events: Events, private zone: NgZone, siteconfig: SiteConfig) {
hidecat : boolean;

constructor(private app: IonicApp, uniteItem: UniteItem, private platform: Platform, uniteMenu: UniteMenu, private events: Events, private zone: NgZone, siteconfig: SiteConfig, unitetoast : UniteToast) {
this.initializeApp();
this.uniteMenu = uniteMenu;
this.submenuitem = false;
this.category = "false"
this.category = "false";
this.unitetoast = unitetoast;
this.siteconfig = siteconfig;
this.uniteMenu.menuMap = {
this.hidecat = false;
this.uniteMenu.menuMap = {
'GettingStartedPage': GettingStartedPage,
'ListPage': ListPage,
'DetailsPage': DetailsPage,
Expand Down Expand Up @@ -101,48 +106,32 @@ class MyApp {
this.uniteMenu.updateMenu(res[0]);
});
});


}

openPage(page) {
// Reset the content nav to have just this page
// we wouldn't want the back button to show in this scenario
let nav = this.app.getComponent('nav');

if (page.component == 'CatPage' && this.submenuitem == false) {
this.submenuitem = true;

nav.setRoot(ListPage, { item: page.id });
} else {
this.submenuitem = false;
}


if (page.id) {
nav.setRoot(ListPage, { item: page.id });
// nav.setRoot(this.uniteMenu.menuMap[ListPage]), {item: page.id});
} else {

nav.setRoot(this.uniteMenu.menuMap[page.component]);
}
}

openPage1(page) {
openPage(page) {
let nav = this.app.getComponent('nav');
if(page.component)
nav.setRoot(this.uniteMenu.menuMap[page.component], { item: page.id, title: page.title });
else
nav.setRoot(ListPage, { item: page.id, title: page.title });
}
Logout() {
this.local.clear();
let nav = this.app.getComponent('nav');
nav.setRoot(LoginPage);
}
// loadData() {
// let url = this.siteconfig.getConfig().siteurl + '/index.php?option=com_api&app=categories&resource=categories&format=raw&lang=en&key=' + this.siteconfig.getConfig().authkey;
// this.uniteItem.getData(url).then((value: any) => {
// if(value){
// this.items = value;
// }
// });
// }

hideCat()
{
if(this.hidecat == false)
{
this.hidecat = true;
}
else{this.hidecat = false;
}
}

loadData() {
let config = this.siteconfig.getConfig();
let url = config.siteurl + '/index.php?option=com_api&app=categories&resource=categories&format=raw&lang=en&key=' + config.authkey;
Expand All @@ -152,4 +141,8 @@ class MyApp {
}
});
}




}
2 changes: 1 addition & 1 deletion app/pages/addarticle/addarticle.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</button>
<ion-title>Add Article</ion-title>
</ion-navbar>
<ion-content class="article">
<ion-content class="article">
<ion-list>
<form #addarticleForm="ngForm" novalidate>
<ion-item>
Expand Down
2 changes: 1 addition & 1 deletion app/pages/addarticle/addarticle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class AddArticlePage {
}
success = (result: any): void => {
let file = JSON.parse(result.response);
console.log("In article view : img file path get from server ="+file.filepath);
this.datatobesend += '&intro_image=' + file.filepath + '&full_image=' + file.filepath;
this.postData();
this.loading.dismiss();
Expand Down Expand Up @@ -133,7 +134,6 @@ export class AddArticlePage {
let state = 1;
let date = new Date();
let FromDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);

if (published < FromDate) {
this.uniteToast.toastOptions.message = "Enter valid Start publishing date";
this.uniteToast.showToast();
Expand Down
9 changes: 5 additions & 4 deletions app/pages/details/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
<ion-card>
<ion-card-content>
<img src="{{selectedItem.images.full_image_url}} " fallbackSrc><br>
<h4 class="no-lap" [innerHTML]="selectedItem.fulltext"></h4><br>
<h4>By : {{selectedItem.created_by.name}}</h4>
<h4>Category : {{selectedItem.catid.title}}</h4>
<h4>Created Date : {{selectedItem.created}}</h4>
<h4 class="no-lap" [innerHTML]="selectedItem.fulltext"></h4><br>
<h4> <ion-row><ion-col width-30>By </ion-col> <ion-col width-10> : </ion-col> <ion-col width-50>{{selectedItem.created_by.name}}</ion-col></ion-row>
<ion-row><ion-col width-30>Category </ion-col> <ion-col width-10>: </ion-col> <ion-col width-50>{{selectedItem.catid.title}}</ion-col></ion-row>
<ion-row><ion-col width-30> Created Date </ion-col> <ion-col width-10>: </ion-col> <ion-col width-50>{{selectedItem.created}}</ion-col></ion-row>
</h4>
</ion-card-content>
</ion-card>
</ion-content>
6 changes: 5 additions & 1 deletion app/pages/login/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<ion-content padding class="login">
<ion-list>
<form #loginForm="ngForm" novalidate>
<!--
<button primary block>Demo</button>
-->
<ion-item>
<ion-label floating primary>Site URL</ion-label>
<ion-input [(ngModel)]="login.siteurl" ngControl="siteurl" type="text" #siteurl="ngForm" required>
Expand All @@ -34,7 +37,8 @@
</p>
<ion-row>
<button (click)="onLogin(loginForm)" type="submit" primary block>Login</button>
</ion-row>
</ion-row>

</form>
</ion-list>
</ion-content>