Permalink
Browse files

Merge branch 'master' of github.com:mozilla/FlightDeck

  • Loading branch information...
2 parents e94bdbf + 74fb195 commit 3ddbc11e6207a3a31a335334603937a5e556ef20 @zalun zalun committed Feb 10, 2011
Showing with 41 additions and 5 deletions.
  1. +12 −2 media/jetpack/js/FileTree.js
  2. +11 −3 media/jetpack/js/Sidebar.js
  3. +18 −0 migrations/003-create_empty_dirs.sql
@@ -77,12 +77,22 @@ FileTree = new Class({
if (target.get('tag') !== 'ul') {
target = target.getElement('ul');
}
+
+ var isEditable = this.options.editable;
+
options = Object.merge({}, {
- add: attr.rel == 'directory' ? true : false,
- edit: attr.rel == 'directory' ? false : true,
+ add: attr.rel == 'directory',
+ edit: attr.rel != 'directory',
remove: true, //can delete anything
collapsed: true
}, this.options.actions, options);
+
+ if (!isEditable) {
+ delete options.add;
+ delete options.edit;
+ delete options.remove;
+ }
+
attr.html = ('<a class="expand" href="#"></a>' +
'<div class="holder">' +
'<span id="{id}" class="label" title="{title}">{title}</span><span class="icon"></span>' +
@@ -45,11 +45,15 @@ var Sidebar = new Class({
) ? false : true;
},
onChange: function(){
- that.renameFile(this.current.retrieve('file'), this.getFullPath(this.current));
+ var file = this.current.retrieve('file');
+ if (file) {
+ that.renameFile(file, this.getFullPath(this.current));
+ }
// remove this folder, since the back-end already deleted
// it in a signal.
that.silentlyRemoveFolders(this.current);
- }
+ },
+ editable: this.options.editable
};
// Tree and Collapse initilizations
@@ -183,7 +187,10 @@ var Sidebar = new Class({
Object.each(this.trees, function(tree, name) {
tree.addEvents({
'renameComplete': function(li, fullpath) {
- that.renameFile(li.retrieve('file'), fullpath);
+ var file = li.retrieve('file');
+ if (file) {
+ that.renameFile(li.retrieve('file'), fullpath);
+ }
}
});
});
@@ -224,6 +231,7 @@ var Sidebar = new Class({
};
if (!this.options.editable || file.options.main) {
+ options.add = false
options.edit = false;
options.remove = false;
options.nodrag = true;
@@ -0,0 +1,18 @@
+CREATE TABLE `jetpack_emptydir` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(255) NOT NULL,
+ `author_id` int(11) NOT NULL,
+ `root_dir` varchar(10) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `jetpack_emptydir_337b96ff` (`author_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+CREATE TABLE `jetpack_emptydir_revisions` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `emptydir_id` int(11) NOT NULL,
+ `packagerevision_id` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `emptydir_id` (`emptydir_id`,`packagerevision_id`),
+ KEY `jetpack_emptydir_revisions_de303cc` (`emptydir_id`),
+ KEY `jetpack_emptydir_revisions_13e2c2ac` (`packagerevision_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;

0 comments on commit 3ddbc11

Please sign in to comment.