From 56ad247b0a0e4b2410dc497e1addc95d530d3429 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 20 Sep 2011 09:05:18 -0400 Subject: [PATCH] Update the frontend for the New Directory functionality --- web_frontend/index.html | 3 ++- web_frontend/main.js | 27 +++++++++++++++++++++++++-- web_frontend/screen.css | 6 +++--- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/web_frontend/index.html b/web_frontend/index.html index 3764c50..bfefcac 100644 --- a/web_frontend/index.html +++ b/web_frontend/index.html @@ -12,6 +12,7 @@
+
New Directory

List /

@@ -22,4 +23,4 @@ var app = new armadillo.App(); - \ No newline at end of file + diff --git a/web_frontend/main.js b/web_frontend/main.js index 95401da..f46ab73 100644 --- a/web_frontend/main.js +++ b/web_frontend/main.js @@ -1,7 +1,7 @@ // // Armadillo File Manager -// Copyright (c) 2010, Robert Sesek -// +// Copyright (c) 2010-2011, Robert Sesek +// // This program is free software: you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free Software // Foundation, either version 3 of the License, or any later version. @@ -31,6 +31,10 @@ armadillo.App = function() { this.clearError(false); + var mkdir = goog.dom.getElement('mkdir'); + goog.events.listen(mkdir, goog.events.EventType.CLICK, + this.mkdirHandler_, false, this); + var version = goog.string.format('Armadillo %d.%d (%f)', armadillo.Version.MAJOR, armadillo.Version.MINOR, armadillo.Version.BUILD); @@ -184,3 +188,22 @@ armadillo.App.prototype.showError = function(message) { var anim = new goog.fx.dom.FadeInAndShow(elm, 1000); anim.play(); }; + +/** + * Creates a subdirectory in the current path. + */ +armadillo.App.prototype.mkdirHandler_ = function() { + var name = prompt('Name the new subdirectory', ''); + if (name != null && name != '') { + var path = this.joinPath(this.getCurrentPath(), name); + this.sendRequest('mkdir', {'path':path}, function(e) { + var data = e.target.getResponseJson(); + if (data['error']) { + app.showError(data['message']); + } else { + app.clearError(); + app.list(app.getCurrentPath()); + } + }); + } +}; diff --git a/web_frontend/screen.css b/web_frontend/screen.css index e429ff4..7b6d208 100644 --- a/web_frontend/screen.css +++ b/web_frontend/screen.css @@ -87,7 +87,7 @@ h1 { border-style: solid; } -.actor .tile { +.tile { padding: 0em 1em 0em 1em; height: 2em; display: inline-block; @@ -117,11 +117,11 @@ h1 { line-height: 1.75em; } -.actor .tile .title { +.tile .title { font-size: 0.7em; } -.actor .tile:active { +.tile:active { background: -webkit-gradient( linear, left bottom, -- 2.43.5