Skip to content

Commit

Permalink
ya captura el evento de modificacion del "custom field", al modificar…
Browse files Browse the repository at this point in the history
…lo, actualiza la lista de relacionados
  • Loading branch information
arojoal committed Jun 20, 2017
1 parent 9dc387d commit f3d0a86
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
24 changes: 21 additions & 3 deletions assets/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,18 @@ <h3 class="u-gamma" data-main>Loading...</h3>
}
}

function init(metadata) {
function handleTicketUpdated() {
console.log("TICKET UPDATED");
}

settings = metadata.settings
function searchAndShow(settings){
console.log("custom_field_id: " + settings.custom_field_id);

key = 'ticket.customField:custom_field_' + settings.custom_field_id;
client.get(key).then(function(data) {
var hotel = data[key];
console.log(hotel);
renderTitle('Searching... ' + hotel);
$("#content").html("");
//console.log(data); // { "ticket.requester.name": "Mikkel Svane" }
//search.json?query=tags:premium_support
var fetchSelf = {
Expand All @@ -138,7 +141,22 @@ <h3 class="u-gamma" data-main>Loading...</h3>
renderTitle('Tickets related to ' + hotel + ': ' + data2.count);
renderTicketsTable( data2 );
});
});
}

function init(metadata) {

settings = metadata.settings

searchAndShow(settings);
client.on('ticket.custom_field_' + settings.custom_field_id + '.changed', function() {
console.log("TICKET custom field UPDATED");
settings = metadata.settings

searchAndShow(settings);
return true;
});

}

client.invoke('resize', { width: '100%', height: '280px' });
Expand Down
6 changes: 6 additions & 0 deletions assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ body,table {
h3 {
font-size: 14px;
}

.table .preview td {
border-top: none;
padding-top: 0;
font-size: 12px;
}

0 comments on commit f3d0a86

Please sign in to comment.