Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrantje <brantje@gmail.com>2016-12-28 18:20:45 +0300
committerbrantje <brantje@gmail.com>2016-12-28 18:20:45 +0300
commit43d26aafe0a667d0944363d81f2e49a5c494e695 (patch)
treeab769b88733ed2c1ebe7faccc1dc40448d920c20
parenta4e08bcff0995d83667c95fe9775622c6d3b681e (diff)
Fix custom fields always beeing added as text fields
-rw-r--r--js/app/controllers/edit_credential.js50
-rw-r--r--js/templates.js2
-rw-r--r--templates/views/partials/forms/edit_credential/custom_fields.html4
3 files changed, 28 insertions, 28 deletions
diff --git a/js/app/controllers/edit_credential.js b/js/app/controllers/edit_credential.js
index 3b432041..840ae511 100644
--- a/js/app/controllers/edit_credential.js
+++ b/js/app/controllers/edit_credential.js
@@ -73,27 +73,30 @@
color: 'blue'
};
- $scope.tabs = [{
- title: $translate.instant('general'),
- url: 'views/partials/forms/edit_credential/basics.html',
- color: 'blue'
- }, {
- title: $translate.instant('password'),
- url: 'views/partials/forms/edit_credential/password.html',
- color: 'green'
- }, {
- title: $translate.instant('custom.fields'),
- url: 'views/partials/forms/edit_credential/custom_fields.html',
- color: 'orange'
- }, {
- title: $translate.instant('files'),
- url: 'views/partials/forms/edit_credential/files.html',
- color: 'yellow'
- }, {
- title: $translate.instant('otp'),
- url: 'views/partials/forms/edit_credential/otp.html',
- color: 'purple'
- }];
+ $translate(['general', 'password', 'custom.fields','files','otp']).then(function (translations) {
+ $scope.tabs = [{
+ title: translations.general,
+ url: 'views/partials/forms/edit_credential/basics.html',
+ color: 'blue'
+ }, {
+ title: translations.password,
+ url: 'views/partials/forms/edit_credential/password.html',
+ color: 'green'
+ }, {
+ title:translations['custom.fields'],
+ url: 'views/partials/forms/edit_credential/custom_fields.html',
+ color: 'orange'
+ }, {
+ title: translations.files,
+ url: 'views/partials/forms/edit_credential/files.html',
+ color: 'yellow'
+ }, {
+ title: translations.otp,
+ url: 'views/partials/forms/edit_credential/otp.html',
+ color: 'purple'
+ }];
+ $scope.currentTab = $scope.tabs[0];
+ });
if ($scope.active_vault) {
$scope.$parent.selectedVault = true;
@@ -143,7 +146,6 @@
$scope.addCustomField = function () {
var _field = angular.copy($scope.new_custom_field);
-
if (!_field.label) {
NotificationService.showNotification($translate.instant('error.no.label'), 3000);
}
@@ -154,9 +156,7 @@
return;
}
$scope.selected_field_type = 'text';
-
- _field.secret = angular.copy(($scope.selected_field_type === 'password'));
- _field.field_type = angular.copy($scope.selected_field_type);
+ _field.secret = (_field.field_type === 'password');
if(_field.field_type === 'file'){
var key = false;
var _file = $scope.new_custom_field.value;
diff --git a/js/templates.js b/js/templates.js
index 8ee4c99c..bae76d8c 100644
--- a/js/templates.js
+++ b/js/templates.js
@@ -21,7 +21,7 @@ angular.module('views/partials/forms/edit_credential/basics.html', []).run(['$te
angular.module('views/partials/forms/edit_credential/custom_fields.html', []).run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('views/partials/forms/edit_credential/custom_fields.html',
- '<div class="row"><div class="col-xs-12 col-md-4"><label>{{ \'field.label\' | translate}}</label><input type="text" ng-model="new_custom_field.label"></div><div class="col-xs-10 col-md-6 field-value"><div class="row"><div class="col-xs-12"><label>{{ \'field.value\' | translate}}</label></div></div><div class="row"><div class="col-xs-8 valueInput"><input type="text" ng-model="new_custom_field.value" ng-show="selected_field_type === \'text\'"><password-gen ng-model="new_custom_field.value" ng-show="selected_field_type ===\'password\'" settings="{generateOnCreate: false }"></password-gen><span ng-show="selected_field_type ===\'file\'"><input id="custom_field_file" class="inputfile" type="file" file-select success="addFileToCustomField" error="fileLoadError" progress="fileSelectProgress"><label for="custom_field_file"><i class="fa fa-upload" aria-hidden="true"></i> {{ new_custom_field.value.filename || \'select.file\' | translate}}</label></span></div><div class="col-xs-4 selectType"><select class="form-control" ng-model="$parent.selected_field_type"><option value="text">{{ \'text\' | translate}}</option><option value="password">{{ \'password\' | translate}}</option><option value="file">{{ \'file\' | translate}}</option></select></div></div><div class="row"><div class="col-xs-12"><ng-password-meter ng-if="selected_field_type ===\'password\'" password="new_custom_field.value"></ng-password-meter></div></div></div><div class="col-xs-2 col-md-2"><label class="invisible">{{\'add\' | translate}}</label><button ng-click="addCustomField()">+</button></div></div><div class="row custom_fields" ng-if="storedCredential.custom_fields.length > 0"><div class="col-xs-12 table"><table><thead><tr use-theme><td class="dragger"></td><th class="field_label">{{ \'label\' | translate}}</th><th class="field_value">{{ \'value\' | translate}}</th><th class="field_secret">{{ \'type\' | translate}}</th><th class="field_actions">{{ \'actions\' | translate}}</th></tr></thead><tbody ui-sortable ng-model="storedCredential.custom_fields"><tr ng-repeat="field in storedCredential.custom_fields"><td class="dragger"><i class="fa fa-arrows-v"></i></td><td><a href="#" editable-text="field.label">{{ field.label || "empty" }}</a></td><td><span ng-if="field.field_type === \'text\'"><a href="#" editable-text="field.value">{{ field.value || \'empty\' | translate }}</a></span> <span ng-if="field.field_type === \'password\'"><a href="#" editable-password="field.value"><span ng-repeat="n in [] | range:field.value.length">*</span></a></span> <span ng-if="field.field_type === \'file\'">{{field.value.filename}} ({{field.value.size | bytes}})</span></td><td>{{ field.field_type }}</td><td class="field_actions"><i class="fa fa-trash" ng-click="deleteCustomField(field)"></i></td></tr></tbody></table></div></div>');
+ '<div class="row"><div class="col-xs-12 col-md-4"><label>{{ \'field.label\' | translate}}</label><input type="text" ng-model="new_custom_field.label"></div><div class="col-xs-10 col-md-6 field-value"><div class="row"><div class="col-xs-12"><label>{{ \'field.value\' | translate}}</label></div></div><div class="row"><div class="col-xs-8 valueInput"><input type="text" ng-model="new_custom_field.value" ng-show="selected_field_type === \'text\'"><password-gen ng-model="new_custom_field.value" ng-show="selected_field_type ===\'password\'" settings="{generateOnCreate: false }"></password-gen><span ng-show="selected_field_type ===\'file\'"><input id="custom_field_file" class="inputfile" type="file" file-select success="addFileToCustomField" error="fileLoadError" progress="fileSelectProgress"><label for="custom_field_file"><i class="fa fa-upload" aria-hidden="true"></i> {{ new_custom_field.value.filename || \'select.file\' | translate}}</label></span></div><div class="col-xs-4 selectType"><select class="form-control" ng-model="new_custom_field.field_type"><option value="text">{{ \'text\' | translate}}</option><option value="password">{{ \'password\' | translate}}</option><option value="file">{{ \'file\' | translate}}</option></select></div></div><div class="row"><div class="col-xs-12"><ng-password-meter ng-if="new_custom_field.field_type ===\'password\'" password="new_custom_field.value"></ng-password-meter></div></div></div><div class="col-xs-2 col-md-2"><label class="invisible">{{\'add\' | translate}}</label><button ng-click="addCustomField()">+</button></div></div><div class="row custom_fields" ng-if="storedCredential.custom_fields.length > 0"><div class="col-xs-12 table"><table><thead><tr use-theme><td class="dragger"></td><th class="field_label">{{ \'label\' | translate}}</th><th class="field_value">{{ \'value\' | translate}}</th><th class="field_secret">{{ \'type\' | translate}}</th><th class="field_actions">{{ \'actions\' | translate}}</th></tr></thead><tbody ui-sortable ng-model="storedCredential.custom_fields"><tr ng-repeat="field in storedCredential.custom_fields"><td class="dragger"><i class="fa fa-arrows-v"></i></td><td><a href="#" editable-text="field.label">{{ field.label || "empty" }}</a></td><td><span ng-if="field.field_type === \'text\'"><a href="#" editable-text="field.value">{{ field.value || \'empty\' | translate }}</a></span> <span ng-if="field.field_type === \'password\'"><a href="#" editable-password="field.value"><span ng-repeat="n in [] | range:field.value.length">*</span></a></span> <span ng-if="field.field_type === \'file\'">{{field.value.filename}} ({{field.value.size | bytes}})</span></td><td>{{ field.field_type }}</td><td class="field_actions"><i class="fa fa-trash" ng-click="deleteCustomField(field)"></i></td></tr></tbody></table></div></div>');
}]);
angular.module('views/partials/forms/edit_credential/files.html', []).run(['$templateCache', function($templateCache) {
diff --git a/templates/views/partials/forms/edit_credential/custom_fields.html b/templates/views/partials/forms/edit_credential/custom_fields.html
index 27d43830..45507ebf 100644
--- a/templates/views/partials/forms/edit_credential/custom_fields.html
+++ b/templates/views/partials/forms/edit_credential/custom_fields.html
@@ -21,7 +21,7 @@
</span>
</div>
<div class="col-xs-4 selectType">
- <select class="form-control" ng-model="$parent.selected_field_type">
+ <select class="form-control" ng-model="new_custom_field.field_type">
<option value="text">{{ 'text' | translate}}</option>
<option value="password">{{ 'password' | translate}}</option>
<option value="file">{{ 'file' | translate}}</option>
@@ -30,7 +30,7 @@
</div>
<div class="row">
<div class="col-xs-12">
- <ng-password-meter ng-if="selected_field_type ==='password'"
+ <ng-password-meter ng-if="new_custom_field.field_type ==='password'"
password="new_custom_field.value"></ng-password-meter>
</div>
</div>