lib/apps/filebrowser/coffee/filebrowser.coffee in daftos-0.2.0 vs lib/apps/filebrowser/coffee/filebrowser.coffee in daftos-0.3.0
- old
+ new
@@ -21,10 +21,11 @@
$.ajax '/api/file_system/metadata'
data:
path: path
dataType: 'json'
success: (data) =>
+ console.log data
for file in data.contents
$('#dir-path').html(@path_element(path))
$('#file-list').append(@create_element(file))
error: =>
alert "Cant load directory #{path}"
@@ -34,9 +35,11 @@
el = $("<tr><td><a href='##{file.absolute_path}'>#{file.name}</a></td><td><b>DIR</b></td></tr>")
else
app = ""
app = "texteditor" if file.mime_type.match("text/")
app = "photobrowser" if file.mime_type.match("image/")
+ if (app == "" and not file.binary)
+ app = "texteditor"
if app.length > 0
el = $("<tr><td><a href='/#{app}##{file.absolute_path}' target='_blank'>#{file.name}</a></td><td>#{file.mime_type}</td></tr>")
else
el = $("<tr><td>#{file.name}</td><td>#{file.mime_type}</td></tr>")
return el
\ No newline at end of file