Skip to content

Commit

Permalink
Merge pull request #59 from ljay79/develop
Browse files Browse the repository at this point in the history
#58 fix issue with abandoned custom jira fields in configure dialog
  • Loading branch information
ljay79 authored Feb 9, 2018
2 parents 5b472dd + 1aac472 commit 33e1dfe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Code.gs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* - use google auth with token based Jira RESTful API vs. cleartext password
*/

var BUILD = '0.20.3';
var BUILD = '0.20.4';

/**
* Add a nice menu option for the users.
Expand Down
14 changes: 11 additions & 3 deletions dialogCustomFields.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,26 @@
});
window.dispatchEvent(new Event('load'));
}

function updFavoriteField() {
var add = (this.name === 'customfield') && this.checked;

// add custom field to favorites
if (add) {
addFavoriteItem(JSON.parse(this.value));
}

// remove custom field from favorites
if (!this.checked) {
var field = JSON.parse(this.value);
form.querySelector('#customfield-id-' + field.key).checked = false;
var cfield, field = JSON.parse(this.value);
if (cfield = form.querySelector('#customfield-id-' + field.key)) {
cfield.checked = false;
}
var el = form.querySelector('#favoriteField-' + field.key);
el.parentNode.parentNode.removeChild(el.parentNode);
}
}

function addFavoriteItem(item) {
var chkbox = document.createElement('div');
var chkboxInput = document.createElement('input');
Expand Down Expand Up @@ -160,10 +165,13 @@
function isFavorite(key) {
return _storedFavFields.find(o => o.key === key);
}

google.script.run
.withSuccessHandler(onInitCustomFields)
.fetchCustomFields();

form.addEventListener('submit', formSubmitHandler);

window.addEventListener('load', function(){
Array.prototype.slice.call(form.elements).filter(function(el){
if(el.nodeName === 'INPUT' && el.type === 'checkbox') {
Expand Down

0 comments on commit 33e1dfe

Please sign in to comment.