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

Commit

Permalink
Making buttons compatible with 4.7.1 #128
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Jun 29, 2016
1 parent daf75d6 commit f88dcfe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Changelog of Pull Request Notifier for Bitbucket.
### No issue
Latest changelog plugin

[a2ae249fec5b6f1](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/a2ae249fec5b6f1) Tomas Bjerre *2016-06-24 09:38:01*
[daf75d6290a7d25](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/daf75d6290a7d25) Tomas Bjerre *2016-06-24 21:25:53*

## 2.26
### GitHub [#124](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/124) PR Updated not triggering a Job
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define('plugin/prnfb/admin', [

var buttonsAdminUrlPostUrl = AJS.contextPath() + "/rest/prnfb-admin/1.0/settings/buttons"; 
var buttonsAdminUrl = buttonsAdminUrlPostUrl;

console.log("asd");
if ($('#prnfbRepositorySlug').length !== 0) {
var projectKey = $('#prnfbProjectKey').val();
var repositorySlug = $('#prnfbRepositorySlug').val();
Expand Down
25 changes: 5 additions & 20 deletions src/main/resources/pr-triggerbutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,17 @@ define('plugin/prnfb/pr-triggerbutton', [

var waiting = '<span class="aui-icon aui-icon-wait aui-icon-small">Wait</span>';

var $buttonArea = $(".triggerManualNotification").parent();
var $buttonTemplate = $(".triggerManualNotification");
$buttonTemplate.empty().remove();

$buttonDropdownArea = $('<div id="triggerManualNotification-actions" class="aui-style-default aui-dropdown2"><ul class="aui-list-truncate"></ul></div>');
$buttonDropdownItems = $buttonDropdownArea.find("ul");

var $buttonDropdownParent = $buttonTemplate.clone();
$buttonDropdownParent.html("Actions");
$buttonDropdownParent.attr("aria-owns", "triggerManualNotification-actions");
$buttonDropdownParent.attr("aria-haspopup", "true");
$buttonDropdownParent.addClass("aui-style-default aui-dropdown2-trigger");
$buttonArea.append($buttonDropdownParent);
$buttonDropdownParent.hide();

$("body").append($buttonDropdownArea);
var $buttonArea = $(".triggerManualNotification").closest('ul');
$(".triggerManualNotification").remove();

function loadSettingsAndShowButtons() {
var hasButtons = false;
$buttonDropdownItems.empty();
$.get(buttonsAdminUrl + '/repository/' + pageState.getRepository().id + '/pullrequest/' + pageState.getPullRequest().id, function(settings) {
settings.forEach(function(item) {
hasButtons = true;

var $buttonDropdownItem = $('<li><a class="aui-icon-container" href="#">' + item.name + '</a></li>');
$buttonDropdownItem.find("a").click(function() {
var $buttonDropdownItem = $('<li><button class="aui-button aui-button-link" role="menuitem">' + item.name + '</button></li>');
$buttonDropdownItem.find("button").click(function() {
var $this = $(this);
$this.attr("disabled", "disabled");
$this.attr("aria-disabled", "true");
Expand All @@ -48,7 +33,7 @@ define('plugin/prnfb/pr-triggerbutton', [
});
});

$buttonDropdownItems.append($buttonDropdownItem);
$buttonArea.append($buttonDropdownItem);
});

if (hasButtons) {
Expand Down

0 comments on commit f88dcfe

Please sign in to comment.