Merge branch 'master' into stef/ZD909384-ticket-org

Conflicts:
	app.js
This commit is contained in:
Stefan Vizzari 2015-02-26 15:16:09 +11:00
Родитель d9791bc0bc 284c0b87e3
Коммит 96a67cc40f
2 изменённых файлов: 26 добавлений и 19 удалений

38
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');
if (!this.storage.locales) { this.countedAjax('getOrganizationFields');
this.countedAjax('getLocales'); if (!this.storage.locales) {
} 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"
} }