Fix selection of different vaults by propagating the correct guid

Signed-off-by: Felix Nüsse <felix.nuesse@t-online.de>
This commit is contained in:
Felix Nüsse 2019-10-12 15:22:11 +02:00
parent 0247ed2f6a
commit 3f72d429be
No known key found for this signature in database
GPG key ID: 2089A3431243E819
2 changed files with 11 additions and 10 deletions

View file

@ -226,26 +226,26 @@
$scope.buildVaultList(args);
});
$scope.informVaultJs = function (event) {
var caller = event.target || event.srcElement;
console.log( caller );
$rootScope.$broadcast('vault_listelement_clicked', caller.getAttribute("guid"));
};
$scope.buildVaultList = function (vaults) {
var list = document.getElementById("app-navigation-vaultlist");
for (var j = 0; j < vaults.length; j++){
var li = document.createElement("li");
li.setAttribute("ng-click", "selectVault(vaults[j])");
var guid = vaults[j].guid;
li.onclick = function(){
$rootScope.$broadcast('vault_listelement_clicked', guid);
};
li.onclick = $scope.informVaultJs;
var a = document.createElement("a");
a.setAttribute("guid", vaults[j].guid);
a.classList="icon-category-security svg";
a.textContent = vaults[j].name;
li.appendChild(a);
list.appendChild(li);
//a.onclick = $scope.selectVault(vaults[j]);
}
var newVault = document.getElementById("app-navigation-vaultlist-new");

View file

@ -57,10 +57,11 @@
$scope.creating_vault = false;
$scope.vault_selected = true;
console.log("show vault "+guid);
for (var i = 0; i < vaults.length; i++) {
if(vaults[i].guid === guid){
$scope.selectVault(vaults[i]);
console.log("show vault "+guid);
console.log("found vault "+guid);
}
}
});