Permalink
Browse files

fixes #7

  • Loading branch information...
1 parent 17c4942 commit b1684fe214b0241d6aaafce4394df51ee29b3b00 @pizzapanther committed Sep 10, 2011
@@ -5,6 +5,7 @@
<li class="fd">{{ d }}</li>\
<li class="btop"><a href="javascript: void(0)" onclick="new_stuff(\'{{ d }}\', \'{{ dir|escapejs }}\', \'{{ did }}\')" class="new">New File/Dir</a></li>\
<li><a href="javascript: void(0)" onclick="refresh_dir(\'{{ did }}\')" class="refresh">Refresh</a></li>\
+ {% if did != 'file_browser' %}<li><a href="javascript: rename(\'{{ dir }}\', \'{{ did }}\')" class="rename">Rename</a></li>{% endif %}\
{% if did != 'file_browser' %}<li><a href="javascript: delete_me(\'{{ dir }}\', \'{{ did }}\')" class="delete">Delete</a></li>{% endif %}\
<li class="btop"><a href="javascript: void(0)" onclick="$(\'#{{ did }}_right\').css(\'display\', \'none\')" class="cancel">Cancel</a>\
</ul>\
@@ -15,6 +16,13 @@
$("#{{ did }}_right").css("display", 'block');
var t = e.pageY - 20;
+ var h = $("#{{ did }}_right").height();
+ var bottom = t + h;
+ var doch = $('body').height();
+ if (bottom > doch) {
+ t = doch - h;
+ }
+
$("#{{ did }}_right").css("top", t + 'px');
var ol = e.pageX - 20;
@@ -14,6 +14,12 @@
$("#{{ fid }}_right").css("display", 'block');
var t = e.pageY - 20;
+ var h = $("#{{ fid }}_right").height();
+ var bottom = t + h;
+ var doch = $('body').height();
+ if (bottom > doch) {
+ t = doch - h;
+ }
$("#{{ fid }}_right").css("top", t + 'px');
var ol = e.pageX - 20;
@@ -29,6 +29,11 @@ textarea {
height: 500px;
}
+#file_browser > a {
+ text-align: center;
+ border-bottom: solid 1px #bbb;
+}
+
#tabs li .ui-icon-close { float: left; margin: 0.4em 0.2em 0 0; cursor: pointer; }
.editor {
@@ -184,3 +189,7 @@ ul.jqueryFileTree {
background-image: url(/static/ide/img/refresh.png);
}
+.right_menu ul li a.delete {
+ background-image: url(/static/ide/img/remove.png);
+}
+
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -191,7 +191,7 @@ $(document).keyup(function (e) {
});
function file_browser () {
- $('#file_browser').fileTree({ root: '', script: '/filetree/', expandSpeed: 200, collapseSpeed: 200 }, function(file) {
+ $('#file_browser > div.inner').fileTree({ root: '', script: '/filetree/', expandSpeed: 200, collapseSpeed: 200 }, function(file) {
$.post('/fileget/', {f: file}, create_tab);
});
}
@@ -1,4 +1,4 @@
-UL.jqueryFileTree {
+UL.jqueryFileTree, #file_browser > a {
font-family: Verdana, sans-serif;
font-size: 11px;
line-height: 18px;
@@ -14,7 +14,7 @@ UL.jqueryFileTree LI {
white-space: nowrap;
}
-UL.jqueryFileTree A {
+UL.jqueryFileTree A, #file_browser > a {
color: #333;
text-decoration: none;
display: block;
@@ -92,3 +92,55 @@ function show_new_upload () {
$("#new_upload").css('display', 'block');
}
+function delete_me (path, did) {
+ if (confirm('Are you sure you want to delete: ' + path + '?')) {
+ $.ajax({
+ type: "POST",
+ dataType: 'json',
+ url: "/delete/",
+ data: {dir: path},
+ success: function (data, textStatus, jqXHR) {
+ refresh_dir(data.message);
+ },
+ error: function (jqXHR, textStatus, errorThrown) {
+ alert('Error deleting ' + path);
+ }
+ });
+ }
+
+ close_right(did);
+}
+
+function rename (path, did) {
+ var tmp = path.split("/");
+ if (tmp[tmp.length - 1] == '') {
+ var name = tmp[tmp.length - 2];
+ }
+
+ else {
+ var name = tmp[tmp.length - 1];
+ }
+
+ var newname = prompt('Rename', name);
+ if (newname) {
+ $.ajax({
+ type: "POST",
+ dataType: 'json',
+ url: "/rename/",
+ data: {dir: path, name: newname},
+ success: function (data, textStatus, jqXHR) {
+ if (data.result) {
+ refresh_dir(data.message);
+ }
+
+ else {
+ alert(data.message);
+ }
+ },
+ error: function (jqXHR, textStatus, errorThrown) {
+ alert('Error renaming ' + path);
+ }
+ });
+ }
+ close_right(did);
+}

0 comments on commit b1684fe

Please sign in to comment.