Commit 71b41167 authored by Laurent's avatar Laurent
Browse files

Display account info screen on badges click

parent 171eec67
......@@ -166,11 +166,19 @@ Page {
border-radius: 2dip;
}
#add_account {
margin: 5dip;
.connexion-info {
margin: 5dip 0 5dip 0;
padding: 5dip;
background-color: $zone-background-color;
}
.connexion-info .portal-label {
text-align: center;
text-transform: uppercase;
font-weight: bold;
margin-bottom: 5dip;
}
#accounts {
margin-top: 2dip;
......
......@@ -10,7 +10,6 @@ import { TokenModel } from "nativescript-ui-autocomplete"
import { SwissArmyKnife } from "nativescript-swiss-army-knife"
import { RadSideDrawer } from 'nativescript-ui-sidedrawer'
import { knownFolders, Folder, File } from "tns-core-modules/file-system"
import * as Utils from "tns-core-modules/utils/utils"
export class AccountsController extends Controller {
protected _portal: Portal = new Portal()
......@@ -119,12 +118,6 @@ export class AccountsController extends Controller {
form.set('url', selected_portal.url)
SwissArmyKnife.dismissSoftKeyboard()
}
public contactCommunityAction(event) {
Utils.openUrl('https://groups.google.com/forum/#!forum/my-bib-app')
this.goBack()
}
public onAddAccountPageLoaded(args) {
......@@ -159,6 +152,15 @@ export class AccountsController extends Controller {
}
public displayAccountInfoAction(event) {
let account = event.object.bindingContext
this.navigate( {
moduleName: "views/library/account_info",
bindingContext: (new LibraryController(account, this._manager)).showAccountInfo()
} )
}
public openAccountAction(args) {
let account = this._accounts.getItem(args.index)
this.navigate({moduleName: "views/library/items",
......
......@@ -3,6 +3,7 @@ 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 Utils from "tns-core-modules/utils/utils"
let validator = require('validator');
......@@ -39,6 +40,13 @@ export abstract class Controller extends Observable {
}
public browserOpenUrl(event) {
let url = event.object.url
Utils.openUrl(url)
this.goBack()
}
get dialogs(): any {
return this._dialogs ? this._dialogs : dialogs;
}
......
......@@ -343,6 +343,12 @@ export class LibraryController extends Controller {
bindingContext: (new AccountsController(this._manager)).showAddAccountHint(),
clearHistory: true });
}
public showAccountInfo(): this {
this.set('account', this._account)
return this
}
protected _authenticationDone(account:Account): LibraryController {
......
<Page xmlns:accounts="views/accounts" loaded="{{ onAddAccountPageLoaded }}" xmlns:nsDrawer="nativescript-ui-sidedrawer">
<Page xmlns:accounts="views/accounts" xmlns:shared="views/shared" loaded="{{ onAddAccountPageLoaded }}" xmlns:nsDrawer="nativescript-ui-sidedrawer">
<Page.actionBar>
<ActionBar
title="{{ L('welcome') }}"
......@@ -37,7 +37,6 @@
class="button-bottom"/>/>
<StackLayout>
<Label text="{{ L('welcome_help') }}"
textWrap="true"
class="text-multi"
......@@ -49,46 +48,13 @@
visibility="{{account.portal, account.portal.url ? 'collapsed' : 'visible' }}" />
<accounts:search_library />
<GridLayout columns="50, *"
rows="auto, auto, auto, auto, auto"
class="connexion_info"
visibility="{{account.portal, account.portal.url ? 'visible' : 'collapsed' }}">
<Label text="&#xf0c1;" class="key" col="0" row="0" />
<Label text="{{ account.portal, account.portal.url ? account.portal.url : '' }}" col="1" row="0"/>
<Label text="{{ account.portal, (account.portal.is_secure ? '&#xf023;' : '&#xf3c1;') }}"
col="0"
row="1"
class="{{ account.portal, 'badge' + (account.portal.is_secure ? ' badge-ok' : '')}}" />
<Label
col="1"
row="1"
textWrap="true"
text="{{ account.portal, account.portal.is_secure ? L('portal_secure') : L('portal_not_secure') }}" />
<Label text="{{ account.portal, (account.portal.is_certified ? '&#xf0a3;' : '&#xf071;') }}"
col="0"
row="2"
class="{{ account.portal, 'badge' + (account.portal.is_certified ? ' badge-ok' : '')}}" />
<StackLayout col="1" row="2">
<Label
textWrap="true"
text="{{ account.portal, account.portal.is_certified ? L('portal_certified') : L('portal_not_certified') }}" />
<Label text="{{ '&#xf086; ' + L('open_forum') }}"
onTap="{{ contactCommunityAction }}"
class="link"
visibility="{{account.portal, account.portal.is_certified ? 'collapsed' : 'visible' }}" />
</StackLayout>
<Button text="{{ ' &#xf2f6; ' + L('go_connect') }}"
tap="{{ saveAccountAction }}"
colSpan="2"
col="0"
row="4"
class="button-bottom" />
</GridLayout>
<shared:account_info />
<Button text="{{ ' &#xf2f6; ' + L('go_connect') }}"
tap="{{ saveAccountAction }}"
colSpan="2"
visibility="{{account.portal, account.portal.url ? 'visible' : 'collapsed' }}"
class="button-bottom" />
</StackLayout>
</DockLayout>
</ScrollView>
......
......@@ -50,7 +50,7 @@
<lv:RadListView.itemTemplate>
<StackLayout class="list-accounts">
<GridLayout columns="150, 50, *" rows="auto, auto, auto, auto" class="account">
<GridLayout columns="30, 35" rows="" col="2" row="0" horizontalAlignment="right" class="badges" >
<GridLayout columns="30, 35" rows="" col="2" row="0" horizontalAlignment="right" class="badges" onTap="{{ displayAccountInfoAction }}">
<Label text="&#xf0a3;" col="0" row="0" class="{{ 'badge' + (isPortalCertified ? ' badge-ok' : '')}}" />
<Label text="{{ isPortalSecure ? '&#xf023;' : '&#xf3c1;'}}" col="1" row="0" class="{{ 'badge' + (isPortalSecure ? ' badge-ok' : '')}}" />
</GridLayout>
......
<Page xmlns:shared="views/shared">
<Page.actionBar>
<ActionBar title="{{ page_title }}" icon="">
<NavigationButton android.systemIcon="ic_menu_back" tap="{{ goHomeAction }}"/>
</ActionBar>
</Page.actionBar>
<StackLayout>
<shared:account_info />
</StackLayout>
</Page>
<GridLayout columns="40, *"
rows="auto auto, auto, auto, auto"
class="connexion-info"
visibility="{{account.portal, account.portal.url ? 'visible' : 'collapsed' }}">
<Label text="{{ account.portal, account.portal.label ? account.portal.label : '' }}"
colSpan="2"
col="0"
row="0"
class="portal-label" />
<Label text="&#xf0c1;" class="key" col="0" row="1" />
<Label text="{{ account.portal, account.portal.url ? account.portal.url : '' }}" col="1" row="1"/>
<Label text="{{ account.portal, (account.portal.is_secure ? '&#xf023;' : '&#xf3c1;') }}"
col="0"
row="2"
class="{{ account.portal, 'badge' + (account.portal.is_secure ? ' badge-ok' : '')}}" />
<Label
col="1"
row="2"
textWrap="true"
text="{{ account.portal, account.portal.is_secure ? L('portal_secure') : L('portal_not_secure') }}" />
<Label text="{{ account.portal, (account.portal.is_certified ? '&#xf0a3;' : '&#xf071;') }}"
col="0"
row="3"
class="{{ account.portal, 'badge' + (account.portal.is_certified ? ' badge-ok' : '')}}" />
<StackLayout col="1" row="3">
<Label
textWrap="true"
text="{{ account.portal, account.portal.is_certified ? L('portal_certified') : L('portal_not_certified') }}" />
<Label text="{{ '&#xf086; ' + L('open_forum') }}"
url="https://groups.google.com/forum/#!forum/my-bib-app"
onTap="{{ browserOpenUrl }}"
class="link"
visibility="{{account.portal, account.portal.is_certified ? 'collapsed' : 'visible' }}" />
</StackLayout>
</GridLayout>
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