Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Commit

Permalink
Avoid adding same button multiple times #206
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Mar 4, 2017
1 parent 87db223 commit 51b86d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/resources/pr-triggerbutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define('plugin/prnfb/pr-triggerbutton', [

var $buttonArea = $(".triggerManualNotification").closest('ul');
var buttonTemplate = function(name) {
return $('<li><button class="aui-button aui-button-link" role="menuitem">' + name + '</button></li>');
return $('<li><button class="aui-button aui-button-link prnfb-button" role="menuitem">' + name + '</button></li>');
};

var dialogTemplate = function(name, content) {
Expand Down Expand Up @@ -209,6 +209,7 @@ define('plugin/prnfb/pr-triggerbutton', [

function loadSettingsAndShowButtons() {
$.get(buttonsAdminUrl + '/repository/' + pageState.getRepository().id + '/pullrequest/' + pageState.getPullRequest().id, function(settings) {
$buttonArea.find('.prnfb-button').remove();
settings.forEach(function(item) {
var $buttonDropdownItem = buttonTemplate(item.name.replace(/<script>/g, 'script'));
$buttonDropdownItem.click(function() {
Expand Down

0 comments on commit 51b86d7

Please sign in to comment.