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 280-persist-network-on-new-account
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet authored Jun 2, 2017
2 parents 46b6d03 + 11fbf57 commit ce3388e
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 34 deletions.
5 changes: 3 additions & 2 deletions src/components/delegateRegistration/delegateRegistration.less
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
color: rgb(221,44,0);
}

md-dialog-actions .md-button {
margin-left: -8px;
md-divider {
margin: 0 -24px;
clear: both;
}

.info-icon-wrapper {
Expand Down
5 changes: 4 additions & 1 deletion src/components/delegateRegistration/delegateRegistration.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ div.dialog-delegate-registration(aria-label='Vote for delegates')
md-toolbar
.md-toolbar-tools
h2 Delegate Registration
span(flex='')
md-button.md-icon-button(ng-click='$ctrl.cancel(delegateRegistrationForm)', aria-label='Close dialog')
i.material-icons close
md-dialog-content
.md-dialog-content
div
Expand All @@ -25,6 +28,6 @@ div.dialog-delegate-registration(aria-label='Vote for 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' }}
md-button.md-secondary(ng-disabled='$ctrl.loading', ng-click='$ctrl.cancel(delegateRegistrationForm)') {{ 'Cancel' }}
span(flex)
md-button.md-raised.md-primary.register-button(ng-disabled='!delegateRegistrationForm.$valid || $ctrl.loading', type='submit') {{ $ctrl.loading ? 'Registering...' : 'Register' }}
10 changes: 6 additions & 4 deletions src/components/delegates/vote.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
clear: both;
}

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

.pull-right {
float: right;
}

.fee {
font-size: 12px;
line-height: 14px;
color: grey;
}

}
7 changes: 5 additions & 2 deletions src/components/delegates/vote.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ div.dialog-vote(aria-label='Vote for delegates')
md-toolbar
.md-toolbar-tools
h2 Vote for delegates
span(flex='')
md-button.md-icon-button(ng-click='$ctrl.$mdDialog.cancel()', aria-label='Close dialog')
i.material-icons close
md-dialog-content
.md-dialog-content
div
Expand All @@ -21,7 +24,7 @@ div.dialog-vote(aria-label='Vote for delegates')
md-input-container.md-block(ng-if='$ctrl.account.get().secondSignature')
label Second Passphrase
input(type='password', ng-model='$ctrl.secondPassphrase')
p.pull-right Fee: 1 LSK
p.pull-right.fee Fee: 1 LSK
md-divider
div(layout='row')
p.info-icon-wrapper
Expand All @@ -34,4 +37,4 @@ div.dialog-vote(aria-label='Vote for delegates')
md-dialog-actions(layout='row')
md-button(ng-click="$ctrl.$mdDialog.cancel()") Cancel
span(flex)
md-button.md-primary.submit-button(ng-disabled='!$ctrl.canVote()', ng-click="$ctrl.vote()") {{$ctrl.votingInProgress ? 'Voting...' : 'Confirm vote'}}
md-button.md-primary.md-raised.submit-button(ng-disabled='!$ctrl.canVote()', ng-click="$ctrl.vote()") {{$ctrl.votingInProgress ? 'Voting...' : 'Confirm vote'}}
2 changes: 1 addition & 1 deletion src/components/login/login.pug
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ md-card
// md-button(ng-disabled='$ctrl.generatingNewPassphrase', ng-click='$ctrl.devTestAccount()') Dev Test Account
md-button.md-primary.new-account-button(ng-disabled='$ctrl.random || $ctrl.generatingNewPassphrase', ng-click='$ctrl.generatePassphrase()') NEW ACCOUNT
md-button.md-raised.md-primary.login-button(md-autofocus, ng-disabled='($ctrl.valid != undefined && $ctrl.valid !== 1) || $root.loggingIn', type='submit') Login
passphrase(ng-if='$ctrl.generatingNewPassphrase', data-on-login='$ctrl.onLogin', data-target='primary-pass')
passphrase(ng-if='$ctrl.generatingNewPassphrase', data-on-login='$ctrl.onLogin', data-target='primary-pass', data-ok-button-label='Login')
2 changes: 1 addition & 1 deletion src/components/main/secondPass.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ md-dialog.dialog-second(aria-label='Generate a second passphrase for your accoun
md-toolbar
.md-toolbar-tools
h2 Generate a second passphrase of your account
passphrase(data-on-login='md.onLogin', data-target='second-pass')
passphrase(data-on-login='md.onLogin', data-target='second-pass', data-ok-button-label='Register')
14 changes: 10 additions & 4 deletions src/components/passphrase/passphrase.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@ app.directive('passphrase', ($rootScope, $document, Passphrase, dialog, $mdMedia
const generateAndDoubleCheck = (seed) => {
const passphrase = Passphrase.generatePassPhrase(seed);


dialog.modal({
controllerAs: '$ctrl',
controller: /* @ngInject*/ class save {
// eslint-disable-next-line no-shadow
constructor(passphrase) {
constructor(passphrase, okButtonLabel) {
this.passphrase = passphrase;
this.okButtonLabel = okButtonLabel;
}
},
template: '<save-passphrase passphrase="$ctrl.passphrase"></save-passphrase>',
locals: { passphrase },
template: '<save-passphrase ' +
'passphrase="$ctrl.passphrase" ' +
'ok-button-label="$ctrl.okButtonLabel">' +
'</save-passphrase>',
locals: {
passphrase,
okButtonLabel: attrs.okButtonLabel,
},
}).then(() => {
$timeout(() => {
$rootScope.$broadcast('onAfterSignup', {
Expand Down
9 changes: 8 additions & 1 deletion src/components/passphrase/savePassphrase.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ app.component('savePassphrase', {
template: require('./savePassphrase.pug')(),
bindings: {
passphrase: '<',
okButtonLabel: '<',
},
controller: class savePassphrase {
constructor($scope, $rootScope, $mdDialog) {
this.$mdDialog = $mdDialog;
this.$rootScope = $rootScope;

this.step = 1;

$scope.$watch('$ctrl.missing_input', () => {
this.missing_ok = this.missing_input && this.missing_input === this.missing_word;
});
}

next() {
this.enter = true;
this.step = 2;

const words = this.passphrase.split(' ');
const missingNumber = parseInt(Math.random() * words.length, 10);
Expand All @@ -30,6 +33,10 @@ app.component('savePassphrase', {
this.$mdDialog.hide();
}

back() {
this.step = 1;
}

close() {
this.$mdDialog.cancel();
this.$rootScope.$broadcast('onSignupCancel');
Expand Down
35 changes: 24 additions & 11 deletions src/components/passphrase/savePassphrase.pug
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
form
form(ng-if='$ctrl.step === 1')
md-toolbar
.md-toolbar-tools
h2
span(ng-if="!$ctrl.enter") Save your passphrase in a safe place!
span(ng-if="$ctrl.enter") Enter the missing word to continue
h2 Save your passphrase in a safe place!
span(flex='')
md-button.md-icon-button(ng-click='$ctrl.close()', aria-label='Close dialog')
i.material-icons close
md-dialog-content
.md-dialog-content
md-input-container.md-block(ng-if="!$ctrl.enter")
textarea.passphrase(ng-bind='$ctrl.passphrase', md-autofocus, readonly)
div(ng-if="$ctrl.enter")
md-input-container.md-block
textarea.passphrase(ng-bind='$ctrl.passphrase', md-autofocus, readonly, aria-label='Passphrase')
md-dialog-actions(layout='row')
md-button.close-button(ng-click="$ctrl.close()") Cancel
span(flex)
md-button.md-raised.md-primary.yes-its-save-button(ng-click="$ctrl.next()") Yes! It's safe!
form(ng-if='$ctrl.step === 2')
md-toolbar
.md-toolbar-tools
h2 Enter the missing word to continue
span(flex='')
md-button.md-icon-button(ng-click='$ctrl.close()', aria-label='Close dialog')
i.material-icons close
md-dialog-content
.md-dialog-content
div
p.passphrase
span {{ $ctrl.pre }}
span.missing -----
span {{ $ctrl.pos }}
md-input-container.md-block(md-is-error='!$ctrl.missing_ok')
label Enter the missing word
input(ng-model='$ctrl.missing_input')
input(ng-model='$ctrl.missing_input', md-autofocus, aria-label='Enter the missing word')
md-dialog-actions(layout='row')
md-button.close-button(ng-click="$ctrl.close()") Close
md-button.back-button(ng-click="$ctrl.back()") Back
span(flex)
md-button.yes-its-save-button(ng-click="$ctrl.next()", ng-show='!$ctrl.enter') Yes! It's safe!
md-button.ok-button(ng-click="$ctrl.ok()", ng-show='$ctrl.enter', ng-disabled='!$ctrl.missing_ok') OK
md-button.md-raised.md-primary.ok-button(ng-click="$ctrl.ok()", ng-disabled='!$ctrl.missing_ok', ng-bind='$ctrl.okButtonLabel')
4 changes: 0 additions & 4 deletions src/components/send/send.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ send {
margin: -8px -14px;
}

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

md-menu.max-funds {
position: absolute;
top: -10px;
Expand Down
7 changes: 5 additions & 2 deletions src/components/send/send.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ div.dialog-send(aria-label='Send funds')
md-toolbar
.md-toolbar-tools
h2 Send
span(flex='')
md-button.md-icon-button(ng-click='$ctrl.$mdDialog.cancel()', aria-label='Close dialog')
i.material-icons close
md-dialog-content
.md-dialog-content
div
Expand All @@ -21,7 +24,7 @@ div.dialog-send(aria-label='Send funds')
div(ng-message='required') Required
div(ng-message='pattern') Invalid
div(ng-message='max') Insufficient funds
md-menu.max-funds(md-position-mode='target-right target')
md-menu.max-funds(md-position-mode='target-right target', md-offset='4 -15')
md-button.md-icon-button(ng-click='$mdOpenMenu()')
i.material-icons more_vert
md-menu-content(width='4')
Expand All @@ -33,6 +36,6 @@ div.dialog-send(aria-label='Send funds')
label Second Passphrase
input(type='password', ng-model='$ctrl.secondPassphrase', required)
md-dialog-actions(layout='row')
md-button.md-raised.md-secondary(ng-disabled='$ctrl.loading', ng-click='$ctrl.cancel()') {{ 'Cancel' }}
md-button.md-secondary(ng-disabled='$ctrl.loading', ng-click='$ctrl.cancel()') {{ 'Cancel' }}
span(flex)
md-button.md-raised.md-primary.submit-button(ng-disabled='!$ctrl.transferForm.$valid || $ctrl.loading', ng-click='$ctrl.send()') {{ $ctrl.loading ? 'Sending...' : 'Send' }}
4 changes: 3 additions & 1 deletion src/components/signVerify/signMessage.pug
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ div
label Message
textarea.message(name='message', ng-model='$ctrl.message', ng-change='$ctrl.sign()', md-autofocus)
div(layout='row', layout-align='center center')
md-button.sign-button(ngclipboard, data-clipboard-text='{{$ctrl.result}}', ng-click='$ctrl.showResult()', ngclipboard-success="$ctrl.dialog.successToast('Result copied to clipboard')", ng-disabled='!$ctrl.result || $ctrl.resultIsShown') Sign and copy result to clipboard
md-button(ng-click="$ctrl.$mdDialog.cancel()") Cancel
span(flex)
md-button.md-raised.md-primary.sign-button(ngclipboard, data-clipboard-text='{{$ctrl.result}}', ng-click='$ctrl.showResult()', ngclipboard-success="$ctrl.dialog.successToast('Result copied to clipboard')", ng-disabled='!$ctrl.result || $ctrl.resultIsShown') Sign and copy result to clipboard
div(ng-if='$ctrl.resultIsShown')
md-input-container.md-block
label Result
Expand Down
14 changes: 14 additions & 0 deletions src/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ body {
width: 100%;
z-index: 10;
}

md-dialog {
md-dialog-actions {
border: 0;
padding: 24px;
.md-button {
margin: 0px;
}
}
}

.md-toolbar-tools {
padding: 0 24px;
}
}

md-toast.lsk-toast-success {
Expand Down

0 comments on commit ce3388e

Please sign in to comment.