Skip to content

Instantly share code, notes, and snippets.

@styson
Created June 17, 2013 18:33
Show Gist options
  • Save styson/5799102 to your computer and use it in GitHub Desktop.
Save styson/5799102 to your computer and use it in GitHub Desktop.
shortcuts.update('caseUploadFile', function() {
var dfd = Case.Controller.tabController.getTabDeferred();
dfd.done(openFileDialog);
Case.Controller.tabController.loadDeferredTab(dfd, 'attachments');
});
getTabDeferred: function () {
return $.Deferred();
},
loadTab: function (tabName) {
var tabModel = this.collection.find(function (m) { return m.get('name') == tabName; });
tabModel.loadTab();
},
loadDeferredTab: function (dfd, tabName) {
$.when(this.loadTab(tabName)).done(function () {
dfd.resolve();
}).fail(function () { dfd.reject(); });
return dfd;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment