Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
last nice version
Browse files Browse the repository at this point in the history
  • Loading branch information
fix committed Jan 19, 2017
1 parent a8c3281 commit 1eedc57
Show file tree
Hide file tree
Showing 12 changed files with 963 additions and 96 deletions.
6 changes: 3 additions & 3 deletions client/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@
<md-menu-content flex layout-padding width="6">
<md-list>
<md-list-item>
<b translate>Language</b> <md-button class="md-secondary" aria-label="Change Language" md-prevent-menu-close ng-click="ul.selectNextLanguage()">{{ul.language}}</md-button>
<b translate>Language</b> <md-button class="md-secondary" aria-label="Change Language" md-prevent-menu-close ng-click="ul.selectNextLanguage()">{{ul.getLanguage()}}</md-button>
</md-list-item>
<md-list-item>
<md-button aria-label="Add Address" ng-click="ul.addAccount()"><translate>Add Account</translate></md-button>
<md-button aria-label="Create Account" ng-click="ul.createAccount()"><translate>Create Account</translate></md-button>
</md-list-item>
<md-list-item>
<md-button aria-label="Manage Networks" md-prevent-menu-close ng-click="ul.manageNetworks()"><translate>Manage Networks</translate></md-button>
<md-button aria-label="Manage Networks" ng-click="ul.manageNetworks()"><translate>Manage Networks</translate></md-button>
</md-list-item>
</md-menu-content>
</md-menu>
Expand Down Expand Up @@ -137,7 +137,7 @@
</md-toolbar>

<div class="main-dashboard" layout="column" layout-align="space-around center" ng-if="!ul.selected" flex>
<md-content style="min-width:50%; opacity:0.8; border-radius:10px;" md-whiteframe="3">
<md-content style="min-width:50%; opacity:0.9; border-radius:10px;" md-whiteframe="3">
<md-toolbar layout="row">
<div class="md-toolbar-tools">
<h2><translate>My Accounts</translate> {{ul.network.symbol}}{{ul.myAccountsBalance()}}</h2>
Expand Down
74 changes: 67 additions & 7 deletions client/app/src/accounts/AccountController.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,35 @@
function AccountController( accountService, networkService, storageService, changerService, $mdToast, $mdSidenav, $mdBottomSheet, $timeout, $interval, $log, $mdDialog, $scope, $mdMedia, gettextCatalog) {

var self = this;
gettextCatalog.debug = true;

var languages = {
en:gettextCatalog.getString("English"),
fr:gettextCatalog.getString("French"),
el:gettextCatalog.getString("Greek"),
nl:gettextCatalog.getString("Dutch"),
ar:gettextCatalog.getString("Arab"),
pl:gettextCatalog.getString("Polish"),
pt_BR:gettextCatalog.getString("Portuguese"),
bg_BG:gettextCatalog.getString("Bulgarian"),
hu:gettextCatalog.getString("Hungarish"),
sl:gettextCatalog.getString("Slovenian"),
ro:gettextCatalog.getString("Romanian"),
de:gettextCatalog.getString("German"),
it:gettextCatalog.getString("Italian"),
id:gettextCatalog.getString("Indonesian"),
ru:gettextCatalog.getString("Russian")
};


gettextCatalog.debug = false;
self.language = storageService.get("language");
if(!self.language) selectNextLanguage();
else gettextCatalog.setCurrentLanguage(self.language);

self.getLanguage=function(){
return languages[self.language];
};


self.closeApp = function() {
var confirm = $mdDialog.confirm()
Expand Down Expand Up @@ -98,6 +122,8 @@
self.createAccount = createAccount;
self.toggleList = toggleAccountsList;
self.sendArk = sendArk;

self.manageNetworks = manageNetworks;
self.openPassphrasesDialog = openPassphrasesDialog;
self.createDelegate = createDelegate;
self.vote = vote;
Expand Down Expand Up @@ -157,8 +183,8 @@
);

function selectNextLanguage(){
var languages = ["en","fr","el","ara","de","it","es"];
if(self.language) self.language=languages[languages.indexOf(self.language) + 1 % languages.length];
var lkeys=Object.keys(languages);
if(self.language) self.language=lkeys[(lkeys.indexOf(self.language) + 1) % lkeys.length];
else self.language = "en";
storageService.set("language",self.language);
gettextCatalog.setCurrentLanguage(self.language);
Expand Down Expand Up @@ -328,7 +354,7 @@
self.exchangeSell.sentTransaction=transaction;
$mdToast.show(
$mdToast.simple()
.textContent(gettextCatalog.getString('Transaction ')+ transaction.id +gettextCatalog.getString(' sent with success!'))
.textContent(gettextCatalog.getString('Transaction')+ ' ' + transaction.id + ' ' +gettextCatalog.getString('sent with success!'))
.hideDelay(5000)
);
},
Expand Down Expand Up @@ -853,7 +879,7 @@

function sendArk(selectedAccount){
var passphrases = accountService.getPassphrases(selectedAccount.address);
var data={fromAddress: selectedAccount.address, secondSignature:selectedAccount.secondSignature, passphrase: passphrases[0], secondpassphrase: passphrases[1]};
var networks=self.net

function next() {
$mdDialog.hide();
Expand Down Expand Up @@ -908,6 +934,40 @@
});
};

function manageNetworks(){
var networks=networkService.getNetworks();

function save() {
$mdDialog.hide();
for(var network in $scope.send.networks){
console.log(network);
console.log($scope.send.networks[network]);
networkService.setNetwork(network, $scope.send.networks[network]);
}
window.location.reload();
};

function cancel() {
$mdDialog.hide();
};

$scope.send = {
networkKeys: Object.keys(networks),
networks: networks,
cancel: cancel,
save: save
};

$mdDialog.show({
parent : angular.element(document.getElementById('app')),
templateUrl : './src/accounts/view/manageNetwork.html',
clickOutsideToClose: true,
preserveScope: true,
scope: $scope,
fullscreen: true
});
};



function openPassphrasesDialog(selectedAccount){
Expand Down Expand Up @@ -1205,14 +1265,14 @@
function(transaction){
$mdToast.show(
$mdToast.simple()
.textContent(gettextCatalog.getString('Transaction ')+ transaction.id +gettextCatalog.getString(' sent with success!'))
.textContent(gettextCatalog.getString('Transaction')+ ' ' +transaction.id + ' ' +gettextCatalog.getString('sent with success!'))
.hideDelay(5000)
);
},
function(error){
$mdToast.show(
$mdToast.simple()
.textContent(gettextCatalog.getString('Error: ')+ error)
.textContent(gettextCatalog.getString('Error:') +' '+ error)
.hideDelay(5000)
);
}
Expand Down
58 changes: 58 additions & 0 deletions client/app/src/accounts/view/manageNetwork.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<md-dialog aria-label="Manage Networks" ng-cloak flex="50">
<md-toolbar>
<div class="md-toolbar-tools">
<h2><span translate>Manage Networks</span></h2>
</div>
</md-toolbar>
<md-content class="md-padding">
<md-tabs md-dynamic-height md-selected="0" md-stretch-tabs>
<md-tab ng-repeat="network in send.networkKeys" label="{{network}}">
<div>
<md-input-container md-no-float class="md-block">
<label translate>Token name</label>
<input ng-model="send.networks[network].token" type="text" ng-required="false">
</md-input-container>
<md-input-container md-no-float class="md-block">
<label translate>Symbol</label>
<input ng-model="send.networks[network].symbol" type="text" ng-required="false">
</md-input-container>
<md-input-container md-no-float class="md-block">
<label translate>Nethash</label>
<input ng-model="send.networks[network].nethash" type="text" ng-required="true">
</md-input-container>

<div layout-gt-sm="row">
<md-input-container class="md-block" flex-gt-sm="80">
<label translate>Seed Server</label>
<input ng-model="send.networks[network].peerseed" type="text" ng-required="true">
</md-input-container>
<md-input-container class="md-block" flex-gt-sm="20">
<md-switch class="md-secondary" ng-model="send.networks[network].forcepeer" aria-label="Force">
<translate>Force?</translate>
</md-switch>
</md-input-container>
</div>

<md-input-container class="md-block">
<label translate>Explorer</label>
<input ng-model="send.networks[network].explorer" type="text" ng-required="false">
</md-input-container>
<md-input-container class="md-block">
<label translate>Background</label>
<input ng-model="send.networks[network].background" type="text" ng-required="false">
</md-input-container>
<!-- <md-button class="md-primary md-raised" ng-click="removeTab( tab )" ng-disabled="tabs.length <= 1">Remove Tab</md-button> -->
</div>
</md-tab>
</md-tabs>
</md-content>

<md-dialog-actions layout="row">
<md-button md-colors="{'background':'red' }" ng-click="send.save()" translate>
Save
</md-button>
<md-button ng-click="send.cancel()" style="margin-right:20px;" translate>
Cancel
</md-button>
</md-dialog-actions>
</md-dialog>
11 changes: 8 additions & 3 deletions client/app/src/network/NetworkService.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

connection.notify(peer);

function addNetwork(name,newnetwork){
function setNetwork(name,newnetwork){
var n = storageService.getGlobal("networks");
n[name]=newnetwork;
storageService.setGlobal("networks",n);
Expand Down Expand Up @@ -80,14 +80,18 @@
return network;
}

function getNetworks(){
return storageService.getGlobal("networks");
}

function getPrice(){
$http.get("http://coinmarketcap.northpole.ro/api/v5/"+network.token+".json",{timeout: 2000})
.then(function(data){
peer.market=data;
},function(){
peer.market={
price:
{usd: "0.0155258", btc: "0.0000175931", eur: "0.0145368375916", cny: "0.10658539329"}
{btc: "0.00003300"}
};
});
$timeout(function(){
Expand Down Expand Up @@ -219,9 +223,10 @@

return {
switchNetwork: switchNetwork,
addNetwork: addNetwork,
setNetwork: setNetwork,
removeNetwork: removeNetwork,
getNetwork: getNetwork,
getNetworks: getNetworks,
getPeer: getPeer,
getConnection: getConnection,
getFromPeer: getFromPeer,
Expand Down
Loading

0 comments on commit 1eedc57

Please sign in to comment.