Merge branch 'master' into stef/ZD909384-ticket-org
Conflicts: app.js
This commit is contained in:
Коммит
96a67cc40f
24
app.js
24
app.js
|
@ -2,8 +2,8 @@
|
||||||
return {
|
return {
|
||||||
events: {
|
events: {
|
||||||
// App
|
// App
|
||||||
'app.activated': 'onAppActivation',
|
'app.created': 'init',
|
||||||
'ticket.requester.email.changed': 'onAppActivation',
|
'ticket.requester.email.changed': 'onRequesterEmailChanged',
|
||||||
|
|
||||||
// Requests
|
// Requests
|
||||||
'getUser.done': 'onGetUserDone',
|
'getUser.done': 'onGetUserDone',
|
||||||
|
@ -245,8 +245,7 @@
|
||||||
|
|
||||||
// EVENTS ==================================================================
|
// EVENTS ==================================================================
|
||||||
|
|
||||||
// we use throttle because of race conditions when this fires twice in quick succession
|
init: function() {
|
||||||
onAppActivation: _.throttle(function() {
|
|
||||||
var defaultStorage = {
|
var defaultStorage = {
|
||||||
user: null,
|
user: null,
|
||||||
ticketsCounters: {},
|
ticketsCounters: {},
|
||||||
|
@ -264,19 +263,24 @@
|
||||||
var defaultOrgSelection = '[]';
|
var defaultOrgSelection = '[]';
|
||||||
this.storage.selectedOrgKeys = JSON.parse(this.setting('orgFields') || defaultOrgSelection);
|
this.storage.selectedOrgKeys = JSON.parse(this.setting('orgFields') || defaultOrgSelection);
|
||||||
if (!this.locale) { this.countedAjax('getCurrentUserLocale'); }
|
if (!this.locale) { this.countedAjax('getCurrentUserLocale'); }
|
||||||
_.defer((function() {
|
|
||||||
if (this.ticket().requester()) {
|
if (this.ticket().requester()) {
|
||||||
|
this.requesterEmail = this.ticket().requester().email();
|
||||||
this.countedAjax('getUser', this.ticket().requester().id());
|
this.countedAjax('getUser', this.ticket().requester().id());
|
||||||
this.countedAjax('getUserFields');
|
this.countedAjax('getUserFields');
|
||||||
|
this.countedAjax('getOrganizationFields');
|
||||||
if (!this.storage.locales) {
|
if (!this.storage.locales) {
|
||||||
this.countedAjax('getLocales');
|
this.countedAjax('getLocales');
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.switchTo('empty');
|
this.switchTo('empty');
|
||||||
}
|
}
|
||||||
}).bind(this));
|
},
|
||||||
}, 1000, {leading: false}),
|
|
||||||
|
onRequesterEmailChanged: function(event, email) {
|
||||||
|
if (email && this.requesterEmail != email) {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onRequestsFinished: function() {
|
onRequestsFinished: function() {
|
||||||
if (!this.storage.user) return;
|
if (!this.storage.user) return;
|
||||||
|
@ -333,7 +337,7 @@
|
||||||
this.$('.save').hide();
|
this.$('.save').hide();
|
||||||
this.$('.wait-spin').show();
|
this.$('.wait-spin').show();
|
||||||
this.ajax('saveSelectedFields', keys, orgKeys)
|
this.ajax('saveSelectedFields', keys, orgKeys)
|
||||||
.always(this.onAppActivation.bind(this));
|
.always(this.init.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
onNotesOrDetailsChanged: _.debounce(function(e) {
|
onNotesOrDetailsChanged: _.debounce(function(e) {
|
||||||
|
|
|
@ -24,7 +24,10 @@
|
||||||
"defaultLocale": "en",
|
"defaultLocale": "en",
|
||||||
"private": false,
|
"private": false,
|
||||||
"singleInstall": true,
|
"singleInstall": true,
|
||||||
"location": ["ticket_sidebar", "new_ticket_sidebar"],
|
"location": [
|
||||||
|
"ticket_sidebar",
|
||||||
|
"new_ticket_sidebar"
|
||||||
|
],
|
||||||
"frameworkVersion": "1.0",
|
"frameworkVersion": "1.0",
|
||||||
"version": "1.0.3"
|
"version": "1.0.6"
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче