Fixed a bug in the browser template.

This commit is contained in:
Raoul Snyman 2010-06-06 22:10:03 +02:00
parent e3836b5a41
commit 5268a19a48
3 changed files with 9 additions and 5 deletions

View File

@ -46,17 +46,16 @@ ScribeEngine.Namespace.create("ScribeEngine.Media", {
.append(
$("<a>").attr("href", "#").attr("class", "file")
.html("<img src=\""+ file.type +"\" />")
.click(ScribeEngine.Media.selectFile)
)
.append(
$("<a>").attr("href", "#").attr("class", "caption")
.attr("title", file.name).text(file.name)
.click(ScribeEngine.Media.selectFile)
)
);
});
}
);
return false;
},
selectFile: function (e)
{
@ -67,10 +66,12 @@ ScribeEngine.Namespace.create("ScribeEngine.Media", {
}
li.parent().children("li").children(".selected").removeClass("selected");
li.children("a").addClass("selected").blur();
return false;
}
});
ScribeEngine.Events.load(function () {
ScribeEngine.Events.click("#new-directory", ScribeEngine.Media.newDirectory);
ScribeEngine.Events.click("#file-select", ScribeEngine.Media.closeWindow);
ScribeEngine.Events.liveClick("#file-list > ul > li > a", ScribeEngine.Media.selectFile);
});

View File

@ -90,6 +90,9 @@ ScribeEngine.Namespace.create("ScribeEngine.Events", {
keypress: function (selector, func) {
$(selector).bind("keypress", func);
},
liveClick: function (selector, func) {
$(selector).live("click", func);
},
getElement: function(event) {
var targ;
if (!event) {

View File

@ -31,11 +31,11 @@
<ul>
% for file in c.files:
<li>
<a href="#" class="file"><img src="${file[u'type']}" /></div>
<a href="#" class="file"><img src="${file[u'type']}" /></a>
% if len(file[u'name']) > 15:
<a href="#" class="caption" title="${file[u'name']}">${file[u'name'][:12]}...</div>
<a href="#" class="caption" title="${file[u'name']}">${file[u'name'][:12]}...</a>
% else:
<a href="#" class="caption">${file[u'name']}</div>
<a href="#" class="caption">${file[u'name']}</a>
% endif
</li>
% endfor