Skip to content

Commit

Permalink
Stumped in place for non-recursive AJAX thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcantelon committed Jul 25, 2012
1 parent 88b4e25 commit 3a48376
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions lib/backbone-file-browser.js
Expand Up @@ -145,15 +145,16 @@
tagName: 'div',

initialize: function() {
this.model = this.options.directory;
this.explorer = this.options.explorer;
this.levelTemplate = _.template(this.options.levelTemplate);
this.entryTemplate = _.template(this.options.entryTemplate);
this.model = this.options.directory;
this.explorer = this.options.explorer;
this.ajaxChildDataUrl = this.options.ajaxChildDataUrl;
this.levelTemplate = _.template(this.options.levelTemplate);
this.entryTemplate = _.template(this.options.entryTemplate);
this.closeDirsByDefault = this.options.closeDirsByDefault;
this.hideFiles = this.options.hideFiles;
this.entryClickHandler = this.options.entryClickHandler;
this.nameClickHandler = this.options.nameClickHandler;
this.actionHandlers = this.options.actionHandlers;
this.hideFiles = this.options.hideFiles;
this.entryClickHandler = this.options.entryClickHandler;
this.nameClickHandler = this.options.nameClickHandler;
this.actionHandlers = this.options.actionHandlers;
},

renderChildren: function (self, entry, levelEl, level) {
Expand Down Expand Up @@ -236,21 +237,24 @@

var uiUpdateLogic = function() {
if (!rendered) {
self.renderChildren(self, entry, levelEl, level);

// update zebra striping
$('.backbone-file-explorer-entry').removeClass(
'backbone-file-explorer-entry-odd'
);
$('.backbone-file-explorer-entry:visible:odd').addClass(
'backbone-file-explorer-entry-odd'
);

// re-bind drag/drop
if (self.explorer.moveHandler) {
self.explorer.initDragAndDrop();
if (this.ajaxChildDataUrl) {
console.log('pull from ' + this.ajaxChildDataUrl + ' then render');
} else {
self.renderChildren(self, entry, levelEl, level);

// update zebra striping
$('.backbone-file-explorer-entry').removeClass(
'backbone-file-explorer-entry-odd'
);
$('.backbone-file-explorer-entry:visible:odd').addClass(
'backbone-file-explorer-entry-odd'
);

// re-bind drag/drop
if (self.explorer.moveHandler) {
self.explorer.initDragAndDrop();
}
}

rendered = true;
}
};
Expand Down Expand Up @@ -296,12 +300,13 @@
tagName: 'div',

initialize: function() {
this.directory = this.options.directory;
this.structure = this.options.structure;
this.moveHandler = this.options.moveHandler;
this.openDirs = this.options.openDirs;
this.openDirs = this.openDirs || [];
this.id = $(this.el).attr('id');
this.ajaxChildDataUrl = this.options.ajaxChildDataUrl;
this.directory = this.options.directory;
this.structure = this.options.structure;
this.moveHandler = this.options.moveHandler;
this.openDirs = this.options.openDirs;
this.openDirs = this.openDirs || [];
this.id = $(this.el).attr('id');
this.render();
this.initDragAndDrop();
},
Expand Down Expand Up @@ -449,6 +454,7 @@

this.dirView = new exports.DirectoryView({
explorer: this,
ajaxChildDataUrl: this.ajaxChildDataUrl,
directory: directory,
openDirs: this.openDirs,
levelTemplate: this.options.levelTemplate,
Expand Down

0 comments on commit 3a48376

Please sign in to comment.