aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-09-29 11:14:17 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-03 10:22:15 +0200
commitb4c71946414387b4d7ba295e663228c76bda5257 (patch)
treebb014fb034413808c3d8478f789b7682e1870856 /server/sonar-web/src
parentb66f125104e97f4724afb87e448a79605a532222 (diff)
downloadsonarqube-b4c71946414387b4d7ba295e663228c76bda5257.tar.gz
sonarqube-b4c71946414387b4d7ba295e663228c76bda5257.zip
SONAR-9195 Ease removing of SCM accounts
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r--server/sonar-web/src/main/js/apps/users/form-view.js19
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-form.hbs18
2 files changed, 28 insertions, 9 deletions
diff --git a/server/sonar-web/src/main/js/apps/users/form-view.js b/server/sonar-web/src/main/js/apps/users/form-view.js
index 9fccdea1f39..ade9b2070bc 100644
--- a/server/sonar-web/src/main/js/apps/users/form-view.js
+++ b/server/sonar-web/src/main/js/apps/users/form-view.js
@@ -27,7 +27,8 @@ export default ModalForm.extend({
events() {
return {
...ModalForm.prototype.events.apply(this, arguments),
- 'click #create-user-add-scm-account': 'onAddScmAccountClick'
+ 'click #create-user-add-scm-account': 'onAddScmAccountClick',
+ 'click .js-remove-scm': 'onRemoveScmAccountClick'
};
},
@@ -61,11 +62,21 @@ export default ModalForm.extend({
},
addScmAccount() {
- const fields = this.$('[name="scmAccounts"]');
- fields
+ const fields = this.$('.js-scm-input');
+ const newField = fields
.first()
.clone()
+ .removeClass('hidden');
+ newField.insertAfter(fields.last());
+ newField
+ .find('input')
.val('')
- .insertAfter(fields.last());
+ .focus();
+ },
+
+ onRemoveScmAccountClick(e) {
+ $(e.currentTarget)
+ .parent()
+ .remove();
}
});
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-form.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-form.hbs
index 908eefb5df4..8538c31d914 100644
--- a/server/sonar-web/src/main/js/apps/users/templates/users-form.hbs
+++ b/server/sonar-web/src/main/js/apps/users/templates/users-form.hbs
@@ -36,13 +36,21 @@
{{/unless}}
<div class="modal-field">
<label>{{t 'my_profile.scm_accounts'}}</label>
- {{#each scmAccounts}}
- <input name="scmAccounts" type="text" size="50" maxlength="255" value="{{this}}">
- {{else}}
+ <span class="js-scm-input hidden">
<input name="scmAccounts" type="text" size="50" maxlength="255">
+ <a class="icon-delete js-remove-scm" href="#"></a>
+ </span>
+ {{#each scmAccounts}}
+ <span class="js-scm-input">
+ <input name="scmAccounts" type="text" size="50" maxlength="255" value="{{this}}">
+ <a class="icon-delete js-remove-scm" href="#"></a>
+ </span>
{{/each}}
- <a id="create-user-add-scm-account" class="icon-plus" href="#" title="Add another SCM account"
- data-toggle="tooltip"></a>
+ <div class="spacer-bottom">
+ <a id="create-user-add-scm-account" class="button" href="#">
+ {{t 'add_verb'}}
+ </a>
+ </div>
<p class="note">{{t 'user.login_or_email_used_as_scm_account'}}</p>
</div>
</div>