$ -> $(window).bind('body_loaded', => fb = new FileBrowser() ) class FileBrowser constructor: -> $(window).on('hashchange', @hashchange) @hashchange() hashchange: => location = window.location.hash location = location.slice(1,location.length) @load_dir(location) load_dir: (path) => $('#file-list').html("") $('#dir-path').html("") $.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}" create_element: (file) => if file.is_dir el = $("