class Pettanr.FoldersController extends Pettanr.AppController index: () -> @redraw_title(@params) @filer_list() root: () -> @redraw_title(@params) @set_model() @item = new Pettanr.Folder.Root() @item.fetch({cache: true}).done => @children_html() show_html_format: (format) -> children_html: () -> @redraw_title(@params, @item.get('name')) collection = new Pettanr.Folder.Children({id: @item.get('id')}) collection.fetch({cache: true}).done => f = new Locmare.Filer({ item_name: 'folder', items: collection.models, pager: null, operators: window.operators }) $("#pettanr").html(f.render().el) show: () -> if @params['format'] == 'prof' @set_show() @item = new Pettanr.FolderWatch({id: @params['id']}) # replace refference item @show_prof() else @item = new Pettanr.FolderWatch({id: @params['id']}) @item.fetch({cache: true}).done () => if @item.is_remote() c = @item.get('controller_name') a = if Pettanr.is_blank(@item.get('action_name')) 'index' else @item.get('action_name') window.router['c_i'](c, a, '') # call action event in router for redirect else @children_html() count: () -> new: () -> @redraw_title(@params) @form_new() edit: () -> @redraw_title(@params) @form_edit()