diff --git a/js/app/controllers/credential.js b/js/app/controllers/credential.js
index 03d83f92..105c4709 100644
--- a/js/app/controllers/credential.js
+++ b/js/app/controllers/credential.js
@@ -102,12 +102,32 @@ angular.module('passmanApp')
label: ''
};
$scope.selectedtags = [];
+ var to;
$rootScope.$on('selected_tags_updated', function (evt, _sTags) {
var _selectedTags = [];
for(var x = 0; x < _sTags.length; x++){
_selectedTags.push(_sTags[x].text)
}
$scope.selectedtags = _selectedTags;
+ $timeout.cancel(to);
+ if(_selectedTags.length > 0) {
+ to = $timeout(function () {
+ if ($scope.filtered_credentials) {
+ var _filtered_tags = [];
+ for (var i = 0; i < $scope.filtered_credentials.length; i++) {
+ var tags = $scope.filtered_credentials[i].tags_raw;
+ for(var x = 0; x < tags.length; x++){
+ var tag = tags[x].text;
+ if(_filtered_tags.indexOf(tag) === -1){
+ _filtered_tags.push(tag);
+ }
+ }
+ }
+
+ $rootScope.$emit('limit_tags_in_list', _filtered_tags);
+ }
+ }, 50)
+ }
});
$scope.delete_time = 0;
diff --git a/js/app/controllers/menu.js b/js/app/controllers/menu.js
index 04624db1..6f56473e 100644
--- a/js/app/controllers/menu.js
+++ b/js/app/controllers/menu.js
@@ -24,6 +24,27 @@ angular.module('passmanApp')
return TagService.searchTag($query);
};
+ $scope.filtered_tags = [];
+ $rootScope.$on('limit_tags_in_list', function (evt, tags) {
+ $scope.filtered_tags = [];
+ for (var i = 0; i < tags.length; i++) {
+ var tag = {
+ text: tags[i]
+ };
+
+ var found = false;
+ for (var x = 0; x < $scope.selectedTags.length; x++) {
+ if($scope.selectedTags[x].text === tag.text){
+ found = true;
+ }
+ }
+ if(found === false){
+ $scope.filtered_tags.push(tag);
+ }
+
+ }
+ });
+
$scope.$watch('selectedTags', function () {
$rootScope.$broadcast('selected_tags_updated', $scope.selectedTags)
}, true);
@@ -35,7 +56,11 @@ angular.module('passmanApp')
$scope.available_tags = TagService.getTags();
$scope.$watch(function () {
- return TagService.getTags();
+ if ($scope.selectedTags.length === 0) {
+ return TagService.getTags();
+ } else {
+ return $scope.filtered_tags;
+ }
}, function (tags) {
$scope.available_tags = tags;
}, true);
diff --git a/js/app/filters/as.js b/js/app/filters/as.js
new file mode 100644
index 00000000..befe25f1
--- /dev/null
+++ b/js/app/filters/as.js
@@ -0,0 +1,16 @@
+'use strict';
+
+/**
+ * @ngdoc filter
+ * @name passmanApp.filter:as
+ * @function
+ * @description
+ * # as
+ * Filter in the passmanApp.
+ */
+angular.module('passmanApp')
+ .filter("as", function($parse) {
+ return function(value, context, path) {
+ return $parse(path).assign(context, value);
+ };
+ });
\ No newline at end of file
diff --git a/js/templates.js b/js/templates.js
index eefcecdc..72da384f 100644
--- a/js/templates.js
+++ b/js/templates.js
@@ -47,7 +47,7 @@ angular.module('views/partials/password-meter.html', []).run(['$templateCache',
angular.module('views/show_vault.html', []).run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('views/show_vault.html',
- '
{{credential.label}} {{tag.text}} |
');
+ '{{credential.label}} {{tag.text}} |
');
}]);
angular.module('views/vaults.html', []).run(['$templateCache', function($templateCache) {
diff --git a/js/vendor/zxcvbn/zxcvbn.js b/js/vendor/zxcvbn/zxcvbn.js
index b6711ecc..e5873184 100644
--- a/js/vendor/zxcvbn/zxcvbn.js
+++ b/js/vendor/zxcvbn/zxcvbn.js
@@ -25,4 +25,3 @@ var time_estimates;time_estimates={estimate_attack_times:function(e){var t,n,s,o
},{}]},{},[4])(4)
});
-//# sourceMappingURL=zxcvbn.js.map
diff --git a/templates/main.php b/templates/main.php
index 25709ac3..fed13686 100644
--- a/templates/main.php
+++ b/templates/main.php
@@ -33,6 +33,7 @@ script('passman', 'app/filters/range');
script('passman', 'app/filters/propsfilter');
script('passman', 'app/filters/byte');
script('passman', 'app/filters/tagfilter');
+script('passman', 'app/filters/as');
script('passman', 'app/services/cacheservice');
script('passman', 'app/services/vaultservice');
script('passman', 'app/services/credentialservice');
diff --git a/templates/views/show_vault.html b/templates/views/show_vault.html
index b129c0ff..fc7cc758 100644
--- a/templates/views/show_vault.html
+++ b/templates/views/show_vault.html
@@ -40,7 +40,7 @@