complete buttons functionality
This commit is contained in:
parent
58a5cb7b6a
commit
b774d84022
2 changed files with 21 additions and 9 deletions
|
|
@ -27,7 +27,9 @@
|
|||
<div class="row m10b">
|
||||
<div class="columns">
|
||||
<div class="p10 panel" ng-class="{'enable_text_select': index.network == 'testnet'}">
|
||||
<div id="addWord"></div>
|
||||
<div id="addWord">
|
||||
<!-- <button class="button radius tiny" style="white-space:nowrap" ng-click="wordsC.removeButton('quiz')" id="{{word}}">ASD</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="p10" style="background:white" ng-class="{'enable_text_select': index.network == 'testnet'}">
|
||||
<span ng-repeat="word in wordsC.mnemonicWords track by $index">
|
||||
|
|
|
|||
|
|
@ -88,30 +88,40 @@ angular.module('copayApp.controllers').controller('wordsController',
|
|||
}
|
||||
}
|
||||
|
||||
self.enableButton = function(word) {
|
||||
document.getElementById(word).disabled = false;
|
||||
lodash.remove(customSortWords, function(v) {
|
||||
return v == word;
|
||||
});
|
||||
}
|
||||
|
||||
self.disableButton = function(word) {
|
||||
document.getElementById(word).disabled = true;
|
||||
$scope.seed += word + ' ';
|
||||
customSortWords.push(word);
|
||||
|
||||
if (customSortWords.length == 12)
|
||||
self.shouldContinue(customSortWords);
|
||||
|
||||
self.addButton(word);
|
||||
}
|
||||
|
||||
self.addButton = function(word) {
|
||||
var asd = 'apospodk';
|
||||
var btnhtml = '<button class="button radius tiny" style="white-space:nowrap" ' +
|
||||
'ng - click = "wordsC.removeButton(' + word + ')" id = "{{' + word + '_}}" > ' + word + ' </button>';
|
||||
'data-ng-click="wordsC.removeButton($event)" id="_' + word + '" > ' + word + ' </button>';
|
||||
var temp = $compile(btnhtml)($scope);
|
||||
angular.element(document.getElementById('addWord')).append(temp);
|
||||
self.shouldContinue(customSortWords);
|
||||
}
|
||||
|
||||
self.removeButton = function(word) {
|
||||
|
||||
self.removeButton = function(event) {
|
||||
var id = (event.target.id);
|
||||
var element = document.getElementById(id);
|
||||
element.remove();
|
||||
self.enableButton(id.substring(1));
|
||||
self.shouldContinue(customSortWords);
|
||||
}
|
||||
|
||||
self.shouldContinue = function(customSortWords) {
|
||||
if (lodash.isEqual(self.mnemonicWords, customSortWords))
|
||||
self.sorted = true;
|
||||
else
|
||||
self.sorted = false;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue