Commit ebd3f9bb authored by laurent l's avatar laurent l

--bundle works

parent edf594db
......@@ -2,29 +2,29 @@
import 'nativescript-i18n';
import * as app from 'tns-core-modules/application';
import {Database, Manager, NSHTTPClient, BackgroundJobs} from './models';
import { Database, Manager, NSHTTPClient, BackgroundJobs } from './models';
import * as config from "./config/config";
import { AccountsController } from './controllers/accounts';
import * as Frames from 'ui/frame';
function myReloadPage() {
let frame:any = Frames.topmost();
if (frame && frame._currentEntry) {
if (frame.currentPage && frame.currentPage.modal) {
frame.currentPage.modal.closeModal();
}
let currentEntry = frame._currentEntry.entry;
let newEntry = {
animated: false,
clearHistory: true,
context: currentEntry.context,
bindingContext: currentEntry.bindingContext,
create: currentEntry.create,
moduleName: currentEntry.moduleName,
backstackVisible: currentEntry.backstackVisible
};
frame.navigate(newEntry);
let frame: any = Frames.topmost();
if (frame && frame._currentEntry) {
if (frame.currentPage && frame.currentPage.modal) {
frame.currentPage.modal.closeModal();
}
let currentEntry = frame._currentEntry.entry;
let newEntry = {
animated: false,
clearHistory: true,
context: currentEntry.context,
bindingContext: currentEntry.bindingContext,
create: currentEntry.create,
moduleName: currentEntry.moduleName,
backstackVisible: currentEntry.backstackVisible
};
frame.navigate(newEntry);
}
}
global.__onLiveSyncCore = myReloadPage;
......@@ -36,5 +36,7 @@ Database.open('prod');
new BackgroundJobs().setupScheduleJob(Database.current())
let manager = new Manager(config.MANAGER_URL, new NSHTTPClient())
app.start({ moduleName: 'views/accounts/list',
bindingContext: new AccountsController( manager ) })
app.start({
moduleName: 'views/accounts/list-page',
bindingContext: new AccountsController(manager)
})
if ((<any>global).TNS_WEBPACK) {
//registers tns-core-modules UI framework modules
require("bundle-entry-points");
global.registerModule("nativescript-pro-ui/sidedrawer",
()=> require('../node_modules/nativescript-pro-ui/sidedrawer'));
//register application modules
global.registerModule("main-page", () => require("./app.ts"));
}
This diff is collapsed.
import {Observable} from 'data/observable';
import { Observable } from 'data/observable';
import * as Frames from 'ui/frame';
import dialogs = require('ui/dialogs');
import {Label} from 'ui/label';
import * as Views from 'ui/core/view';
import * as dialogs from 'ui/dialogs';
import { Label } from 'ui/label';
import * as Utils from "tns-core-modules/utils/utils"
let validator = require('validator');
......@@ -60,14 +59,14 @@ export abstract class Controller extends Observable {
protected isNotEmpty(id, value) {
return this
.validateWith(id, value,
() => { return !validator.isEmpty(value + ''); });
() => { return !validator.isEmpty(value + ''); });
}
protected isUrl(id, value) {
return this
.validateWith(id, value,
() => { return validator.isURL(value + ''); });
() => { return validator.isURL(value + ''); });
}
......@@ -75,7 +74,7 @@ export abstract class Controller extends Observable {
let error_label: Label = <Label>(this.getViewByIdInTopmost(id));
if (!error_label)
return true;
if (closure(value)) {
error_label.visibility = 'collapse';
return true;
......
......@@ -80,7 +80,7 @@ export class LibraryController extends Controller {
public goHomeAction() {
this.navigate({
moduleName: "views/accounts/list",
moduleName: "views/accounts/list-page",
bindingContext: new AccountsController(this._manager),
clearHistory: true
});
......@@ -98,7 +98,7 @@ export class LibraryController extends Controller {
this.set('card_img', imageSource.fromNativeSource(card_img));
this.set('card_number', this._account.getCard().getNumber());
this.navigate({
moduleName: "views/library/card",
moduleName: "views/library/card-page",
bindingContext: this
});
}
......@@ -111,7 +111,7 @@ export class LibraryController extends Controller {
this.set('novelties', novelties);
}
this.navigate({
moduleName: "views/library/novelties",
moduleName: "views/library/novelties-page",
bindingContext: this
});
}
......@@ -134,7 +134,7 @@ export class LibraryController extends Controller {
public openLoansAndHoldsAction() {
this.navigate({
moduleName: "views/library/items",
moduleName: "views/library/items-page",
bindingContext: this
});
}
......@@ -175,9 +175,9 @@ export class LibraryController extends Controller {
openSettingsIfPermissionWasPreviouslyDenied: true
})
.then(
(result) => {
return result.text;
})
(result) => {
return result.text;
})
.then((barcode) => {
this._turnBusyIndicator('on');
return this._portal.fetchItem(this._account, barcode);
......@@ -186,7 +186,7 @@ export class LibraryController extends Controller {
this._turnBusyIndicator('off');
this.set('item', item);
this.navigate({
moduleName: "views/library/loan_item",
moduleName: "views/library/loan_item-page",
backstackVisible: false,
bindingContext: this
});
......@@ -208,9 +208,9 @@ export class LibraryController extends Controller {
this._manager
.loan(Database.current(),
this._account,
r.text,
this.get('item').getBarcode())
this._account,
r.text,
this.get('item').getBarcode())
.then((result) => {
if (result['success'])
return this.dialogs.alert({
......@@ -247,13 +247,13 @@ export class LibraryController extends Controller {
openSettingsIfPermissionWasPreviouslyDenied: true
})
.then(
(result) => {
this._account.credentials['login'] = result.text;
this._askLoginPassword();
},
(result) => {
this._account.credentials['login'] = result.text;
this._askLoginPassword();
},
(error) => {
});
(error) => {
});
}
......@@ -375,7 +375,7 @@ export class LibraryController extends Controller {
this.navigate(
{
moduleName: "views/accounts/list",
moduleName: "views/accounts/list-page",
bindingContext: (new AccountsController(this._manager)).showAddAccountHint(),
clearHistory: true
});
......@@ -399,7 +399,7 @@ export class LibraryController extends Controller {
this._on_loans_page_loaded = this._on_successful_login;
this.set('account_label', account.label);
this.navigate({
moduleName: "views/library/account_label",
moduleName: "views/library/account_label-page",
bindingContext: this
});
})
......@@ -423,19 +423,19 @@ export class LibraryController extends Controller {
oauth_web_view
.login(this._account)
.then(
(token) => {
this._account.credentials['token'] = token;
this._authenticationDone(this._account);
},
() => {
this.dialogs.alert({
title: L('alert'),
message: L('wrong_login_password'),
okButtonText: L('OK')
});
this._doOAuthLogin(oauth_web_view);
}
(token) => {
this._account.credentials['token'] = token;
this._authenticationDone(this._account);
},
() => {
this.dialogs.alert({
title: L('alert'),
message: L('wrong_login_password'),
okButtonText: L('OK')
});
this._doOAuthLogin(oauth_web_view);
}
);
}
......@@ -445,7 +445,7 @@ export class LibraryController extends Controller {
let doOpenWebsite = () => {
this.navigate({
moduleName: "views/library/website",
moduleName: "views/library/website-page",
bindingContext: this
});
this.set('website_url', website_url);
......@@ -491,7 +491,7 @@ export class LibraryController extends Controller {
protected _askLoginPassword(): this {
this.set('credentials', this._account.credentials);
this.navigate({
moduleName: "views/library/login-password",
moduleName: "views/library/login-password-page",
bindingContext: this,
backstackVisible: false
});
......@@ -501,7 +501,7 @@ export class LibraryController extends Controller {
protected _registerOnOAuth(url: string) {
this.navigate({
moduleName: "views/library/oauth",
moduleName: "views/library/oauth-page",
bindingContext: this,
backstackVisible: false
});
......
<Page xmlns:accounts="views/accounts" xmlns:shared="views/shared" loaded="{{ onAddAccountPageLoaded }}" xmlns:nsDrawer="nativescript-ui-sidedrawer">
<Page.actionBar>
<ActionBar
title="{{ L('welcome') }}"
android.windowContentOverlay="@drawable/actionbar_shadow">
<ActionBar
title="{{ L('welcome') }}"
android.windowContentOverlay="@drawable/actionbar_shadow">
<NavigationButton icon="res://icon" tap="{{ showAboutAction }}"/>
<ActionItem text="{{ L('menu') }}" tap="{{ toggleDrawerAction }}" ios.position="right">
......@@ -15,17 +15,17 @@
</Page.actionBar>
<nsDrawer:RadSideDrawer id="sideDrawer" drawerLocation="Right" drawerTransition="PushTransition">
<nsDrawer:RadSideDrawer.drawerContent xmlns:nsDrawer="nativescript-pro-ui/sidedrawer">
<nsDrawer:RadSideDrawer.drawerContent>
<StackLayout id="sideDrawerContent" >
<ScrollView>
<StackLayout>
<StackLayout tap="{{ showAboutAction }}" >
<Label text="{{ '&#xf059; ' + L('about') }}" class="fa" />
<Label text="{{ '&#xf059; ' + L('about') }}" class="fa" />
</StackLayout>
</StackLayout>
</ScrollView>
</StackLayout>
</nsDrawer:RadSideDrawer.drawerContent>
</nsDrawer:RadSideDrawer.drawerContent>
<nsDrawer:RadSideDrawer.mainContent>
<DockLayout id="add_account">
......
......@@ -14,7 +14,7 @@
</Page.actionBar>
<nsDrawer:RadSideDrawer id="sideDrawer" drawerLocation="Right" drawerTransition="PushTransition">
<nsDrawer:RadSideDrawer.drawerContent xmlns:nsDrawer="nativescript-pro-ui/sidedrawer">
<nsDrawer:RadSideDrawer.drawerContent >
<StackLayout id="sideDrawerContent" >
<ScrollView>
<StackLayout>
......
......@@ -9,21 +9,21 @@
</ActionItem.actionView>
</ActionItem>
</ActionBar>
</Page.actionBar>
</Page.actionBar>
<nsDrawer:RadSideDrawer id="sideDrawer" drawerLocation="Right" drawerTransition="PushTransition">
<nsDrawer:RadSideDrawer.drawerContent xmlns:nsDrawer="nativescript-pro-ui/sidedrawer">
<shared:sidedrawer />
</nsDrawer:RadSideDrawer.drawerContent>
<nsDrawer:RadSideDrawer.drawerContent >
<shared:sidedrawer />
</nsDrawer:RadSideDrawer.drawerContent>
<nsDrawer:RadSideDrawer.mainContent>
<StackLayout orientation="horizontal">
<StackLayout orientation="horizontal">
<StackLayout verticalAlignment="center" style="text-align:center">
<Label text="{{ L('card_number') + ' : ' + card.number }}" />
<Label text="{{ L('card_expire_at') + ' : ' + card.formatted_expiration_date }}" visibility="{{ card.expiration_date ? 'visible' : 'collapsed' }}"/>
<Image width="100%" src="{{ card_img }}"/>
</StackLayout>
</StackLayout>
</StackLayout>
</nsDrawer:RadSideDrawer.mainContent>
</nsDrawer:RadSideDrawer>
</Page>
......@@ -19,7 +19,7 @@
<nsDrawer:RadSideDrawer id="sideDrawer" drawerLocation="Right" drawerTransition="PushTransition">
<nsDrawer:RadSideDrawer.drawerContent xmlns:nsDrawer="nativescript-pro-ui/sidedrawer">
<nsDrawer:RadSideDrawer.drawerContent>
<shared:sidedrawer />
</nsDrawer:RadSideDrawer.drawerContent>
......
......@@ -11,17 +11,17 @@
</Page.actionBar>
<nsDrawer:RadSideDrawer id="sideDrawer" drawerLocation="Right" drawerTransition="PushTransition">
<nsDrawer:RadSideDrawer.drawerContent xmlns:nsDrawer="nativescript-pro-ui/sidedrawer">
<shared:sidedrawer />
</nsDrawer:RadSideDrawer.drawerContent>
<nsDrawer:RadSideDrawer.drawerContent>
<shared:sidedrawer />
</nsDrawer:RadSideDrawer.drawerContent>
<nsDrawer:RadSideDrawer.mainContent>
<StackLayout>
<ListView items="{{ novelties }}"
id="novelties"
loadMoreItems="{{ onLoadMoreNovelties }}"
dock="top"
itemTap="{{ onNoveltyTap }}">
id="novelties"
loadMoreItems="{{ onLoadMoreNovelties }}"
dock="top"
itemTap="{{ onNoveltyTap }}">
<ListView.itemTemplate>
<GridLayout columns="100, *" rows="100" id="novel">
<Image src="{{ getThumbnailUrl() }}" col="0" row="0" stretch="aspectFill" class="cover"/>
......@@ -29,7 +29,7 @@
<Label text="{{ getTitle() }}" textWrap="true" class="title" dock="top"/>
<Label text="{{ getDocType() }}" textWrap="true" dock="bottom" />
<Label text="{{ getAuthor() }}" />
</DockLayout>>
</DockLayout>>
</GridLayout>
</ListView.itemTemplate>
......
......@@ -14,15 +14,15 @@
</Page.actionBar>
<nsDrawer:RadSideDrawer id="sideDrawer" drawerLocation="Right" drawerTransition="PushTransition">
<nsDrawer:RadSideDrawer.drawerContent xmlns:nsDrawer="nativescript-pro-ui/sidedrawer">
<nsDrawer:RadSideDrawer.drawerContent>
<shared:sidedrawer />
</nsDrawer:RadSideDrawer.drawerContent>
<nsDrawer:RadSideDrawer.mainContent>
<GridLayout columns="*" rows="*" iosOverflowSafeArea="false">
<mwv:MbaWebView id="webView" height="100%" col="0" row="0"/>
<mwv:MbaWebView id="webView" height="100%" col="0" row="0" />
<ActivityIndicator id="activity-indicator" color="orange" col="0" row="0" />
</GridLayout>>
</GridLayout>
</nsDrawer:RadSideDrawer.mainContent>
</nsDrawer:RadSideDrawer>
</Page>
......
......@@ -39,6 +39,7 @@
"tns-platform-declarations": "^3.4.0",
"url-parse": "^1.4.4",
"validator": "^7.0.0",
"webpack": "^4.29.6",
"xml-js": "^1.6.7"
},
"devDependencies": {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment