diff --git a/plemp.js b/plemp.js index 78d75a9..6e75e22 100644 --- a/plemp.js +++ b/plemp.js @@ -94,40 +94,39 @@ app.get('/draggables/:id', function(req, res) { var drag = draggables[drag_id]; var default_style = "left:" + drag.left + "px;top:" + drag.top + "px;"; var mime_type = drag.mime.split("/") + var title = drag.name || drag.title || 'Title not set'; + var content; switch (mime_type[0]) { case "image": - res.send('' + - ''); + content = ''; break; case "video": - res.send(''); + content = ''; break; case "audio": - res.send(''); + content = ''; break; case "text": file_contents = fs.readFileSync("public/upload/" + drag_id); - res.send('
' + file_contents +
-               '
'); + content = '
' + file_contents + '
'; break; case 'application': // FIXME: treat as code for now, but it is probably wrong file_contents = fs.readFileSync("public/upload/" + drag_id); - res.send('
' + file_contents +
-               '
'); + content = '
' + file_contents +
+                     '
'; break; default: - res.send('
Unknown type: ' + - mime_type + '
'); + content = 'Unknown type: ' + mime_type + ''; } + + // Wrap the content in a div with title and comments. + res.send('
' + + '
' + title + + '(edit)' + + '
X
' + + '
' + content + '
' + + '
'); }); // The position save controller: access through AJAX request by the main diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css index 63020b4..e3f1e83 100644 --- a/public/stylesheets/style.css +++ b/public/stylesheets/style.css @@ -61,10 +61,59 @@ pre { .draggable { position: absolute; + background: white; + border: thin solid #888; padding: 10px; width: 400px; +} + +.draggable div, +.draggable img, +.draggable audio, +.draggable video, +.draggable pre { + width: 400px; max-height: 300px; overflow: auto; - border: thin solid #888; - background: white; +} + +.draggable pre { + width: 388px; +} + +.draggable .header { + padding-bottom: 3px; + font-size: 11px; + text-align: center; +} + +.draggable .header .title { + width: 100%; + margin-right: 30px; + font-weight: bold; + overflow: hidden; +} + +.draggable .header .title .edit { + padding-left: 10px; + color: #cccccc; +} + +.draggable .header .delete { + width: auto; + float: right; + padding: 0px 2px; + border: thin solid black; + color: #cccccc; + margin-left: 20px; +} + +.draggable .header .edit:hover, +.draggable .header .delete:hover { + color: #000000; + cursor: pointer; +} + +.draggable .comments { + display: none; }