Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Merge branch 'development' into 194_maximum-amount-validation
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet authored May 10, 2017
2 parents ec98c9a + c70678b commit 4e38024
Show file tree
Hide file tree
Showing 95 changed files with 4,281 additions and 985 deletions.
2 changes: 1 addition & 1 deletion app/index.html

Large diffs are not rendered by default.

105 changes: 105 additions & 0 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,63 @@ function createWindow() {
},
],
},
{
label: 'View',
submenu: [
{
role: 'reload',
},
{
role: 'togglefullscreen',
}
],
},
{
label: 'Window',
submenu: [
{
role: 'minimize',
},
],
},
{
label: 'Help',
submenu: [
{
label: 'Lisk Website',
click: function () {
electron.shell.openExternal('https://lisk.io');
}
},
{
label: 'Lisk Chat',
click: function () {
electron.shell.openExternal('https://lisk.chat');
}
},
{
label: 'Lisk Forum',
click: function () {
electron.shell.openExternal('https://forum.lisk.io');
}
},
{
type: 'separator',
},
{
label: 'Report Issue...',
click: function () {
electron.shell.openExternal('https://github.com/LiskHQ/lisk-nano/issues/new');
}
},
{
label: 'What\'s New...',
click: function () {
electron.shell.openExternal('https://github.com/LiskHQ/lisk-nano/releases');
}
},
],
},
];

if (process.platform === 'darwin') {
Expand All @@ -49,12 +106,30 @@ function createWindow() {
template.unshift({
label: name,
submenu: [
{
role: 'about',
label: 'About',
},
{
role: 'quit',
label: 'Quit',
},
],
});
} else {
template[template.length - 1].submenu.push({
label: 'About',
click: function (item, focusedWindow) {
if (focusedWindow) {
const options = {
buttons: ['OK'],
icon: `${__dirname}/assets/lisk.png`,
message: `Lisk Nano\nVersion ${app.getVersion()}\nCopyright © 2017 Lisk Foundation`,
}
electron.dialog.showMessageBox(focusedWindow, options, function () {})
}
}
});
}

const menu = Menu.buildFromTemplate(template);
Expand All @@ -63,6 +138,36 @@ function createWindow() {
win.loadURL(`file://${__dirname}/index.html`);

win.on('closed', () => win = null);

setupContextMenu(win);
}

function setupContextMenu(window) {
const selectionMenu = Menu.buildFromTemplate([
{role: 'copy'},
{type: 'separator'},
{role: 'selectall'},
]);

const inputMenu = Menu.buildFromTemplate([
{role: 'undo'},
{role: 'redo'},
{type: 'separator'},
{role: 'cut'},
{role: 'copy'},
{role: 'paste'},
{type: 'separator'},
{role: 'selectall'},
]);

window.webContents.on('context-menu', (e, props) => {
const { selectionText, isEditable } = props;
if (isEditable) {
inputMenu.popup(window);
} else if (selectionText && selectionText.trim() !== '') {
selectionMenu.popup(window);
}
});
}

app.on('ready', createWindow);
Expand Down
5 changes: 1 addition & 4 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@
"version": "0.2.0",
"description": "Lisk Nano",
"main": "main.js",
"author":{
"name": "Ricardo Ferro",
"email": "[email protected]"
}
"author": "Lisk Foundation <[email protected]>, lightcurve GmbH <[email protected]>"
}
3 changes: 2 additions & 1 deletion src/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"no-plusplus": "off",
"no-restricted-properties": "off",
"no-return-assign": "off",
"no-underscore-dangle": "off"
"no-underscore-dangle": "off",
"no-param-reassign": "off"
}
}
7 changes: 6 additions & 1 deletion src/app/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
export default angular.module('app', [
const app = angular.module('app', [
'ui.router',
'angular-svg-round-progressbar',
'ngMessages',
'ngMaterial',
'ngAnimate',
'ngCookies',
'infinite-scroll',
'md.data.table',
]);

export default app;
File renamed without changes
File renamed without changes
64 changes: 64 additions & 0 deletions src/app/components/delegate-registration/delegateRegistration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import './delegateRegistration.less';

app.directive('delegateRegistration', ($mdDialog, delegateService, Account, dialog) => {
const DelegateRegistrationLink = function ($scope, $element) {
$scope.form = {
name: '',
fee: 25,
error: '',
onSubmit: (form) => {
if (form.$valid) {
delegateService.registerDelegate($scope.form.name.toLowerCase(), Account.get().passphrase)
.then(() => {
dialog.successAlert({
title: 'Congratulations!',
text: 'Account was successfully registered as delegate.',
})
.then(() => {
Account.set({
isDelegate: true,
username: $scope.form.name.toLowerCase(),
});
$scope.reset(form);
$mdDialog.hide();
});
})
.catch((error) => {
$scope.form.error = error.message ? error.message : '';
});
}
},
};

$scope.reset = (form) => {
$scope.form.name = '';
$scope.form.error = '';

form.$setPristine();
form.$setUntouched();
};

$scope.cancel = (form) => {
$scope.reset(form);
$mdDialog.hide();
};

$element.bind('click', () => {
$mdDialog.show({
template: require('./delegateRegistration.pug')(),
bindToController: true,
locals: {
form: $scope.form,
cancel: $scope.cancel,
},
controller: () => {},
controllerAs: '$ctrl',
});
});
};

return {
restrict: 'A',
link: DelegateRegistrationLink,
};
});
41 changes: 41 additions & 0 deletions src/app/components/delegate-registration/delegateRegistration.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.dialog-delegate-registration {
background: transparent;
box-shadow: none;

& > md-card {
box-shadow:
0px 4px 6px -4px rgba(0, 0, 0, 0.2),
0px 8px 10px 2px rgba(0, 0, 0, 0.14),
0px 3px 12px 4px rgba(0, 0, 0, 0.12);
}

.fee {
position: absolute;
left: auto;
right: 6px;
bottom: 7px;
font-size: 12px;
line-height: 14px;
transition: all 0.3s cubic-bezier(0.55, 0, 0.55, 0.2);
color: grey;
}

input {
text-transform: lowercase;
}

p.error {
font-size:.8em;
width: 100%;
text-align: center;
color: rgb(221,44,0);
}

md-dialog-actions .md-button {
margin-left: -8px;
}

.info-icon-wrapper {
margin: 24px 24px 0 0;
}
}
27 changes: 27 additions & 0 deletions src/app/components/delegate-registration/delegateRegistration.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
div.dialog-delegate-registration(aria-label='Vote for delegates')
form(name='delegateRegistrationForm', ng-submit='$ctrl.form.onSubmit(delegateRegistrationForm)')
md-toolbar
.md-toolbar-tools
h2 Delegate Registration
md-dialog-content
.md-dialog-content
div
md-input-container.md-block
label Delegate name
input(type='text', name='delegateName', ng-model='$ctrl.form.name', required, ng-disabled='$ctrl.loading')
div(ng-messages='delegateRegistrationForm.name.$error')
div(ng-message='required') Required
md-input-container.md-block
div.fee Fee: {{$ctrl.form.fee}} LSK
md-divider
div(layout='row')
p.info-icon-wrapper
i.material-icons info
p
span Becoming a delegate requires registration. You may choose your own delegate name, which can be used to promote your delegate. Only the top 101 delegates are eligible to forge. All fees are shared equally between the top 101 delegates.
md-divider
p.error(ng-bind='$ctrl.form.error', ng-if='$ctrl.form.error')
md-dialog-actions(layout='row')
md-button.md-raised.md-secondary(ng-disabled='$ctrl.loading', ng-click='$ctrl.cancel(delegateRegistrationForm)') {{ 'Cancel' }}
span(flex)
md-button.md-raised.md-primary(ng-disabled='!delegateRegistrationForm.$valid || $ctrl.loading', type='submit') {{ $ctrl.loading ? 'Registering...' : 'Register' }}
Loading

0 comments on commit 4e38024

Please sign in to comment.