Handle the download button by calling the download controller; add some style

This commit is contained in:
Paul van Tilburg 2012-02-11 12:32:36 +01:00
parent 1eb940dc29
commit 4c63e00e82
2 changed files with 15 additions and 3 deletions

View File

@ -21,8 +21,8 @@ $(document).ready(function() {
.hover(function() { $(this).find(".comments").fadeIn(); },
function() { $(this).find(".comments").fadeOut(); });
this.find(".delete").click({ id: this.attr("id"),
element: this },
delete_draggable);
element: this }, delete_draggable);
this.find(".download").click({ id: this.attr("id") }, download_draggable);
this.find(".title").editable('draggables/' + this.attr("id"),
{ tooltip: "Click to edit…",
name: 'title',
@ -101,6 +101,12 @@ function delete_draggable(event) {
}, "json");
}
// Download a draggable from the server.
function download_draggable(event) {
event.preventDefault();
window.open("download/" + event.data.id);
}
// Raise the draggable to the foreground.
function raise_draggable(event) {
var max = 0;

View File

@ -108,6 +108,7 @@ pre {
font-weight: bold;
}
.draggable h2 .download,
.draggable h2 .delete {
width: auto;
float: right;
@ -116,7 +117,12 @@ pre {
color: #ccc;
}
.draggable h2 .delete:hover {
.draggable h2 .download {
margin-right: 4px;
padding: 0px 4px;
}
.draggable h2 :hover {
color: #000;
cursor: pointer;
}