class Pettanr.AuthorsController extends Pettanr.AppController\r
\r
index: () ->\r
- @trigger('retitle', @params)\r
+ @trigger('title', @params)\r
@filer_list()\r
- \r
- show_html: () -> \r
- @item.fetch({cache: true}).done =>\r
- @trigger('retitle', @params, @item.get('name'))\r
- show = new Pettanr.Views.Author.Show({\r
- item: @item,\r
- operators: @operators\r
- })\r
- show.render()\r
- @trigger('ready', show)\r
+ @trigger('done', @params)\r
\r
show: () ->\r
- @set_show()\r
+ @set_show(@render_show)\r
+ \r
+ render_show: () -> \r
switch @params['format']\r
when 'prof'\r
@show_prof()\r
when 'html'\r
@show_html()\r
\r
+ show_html: () -> \r
+ @trigger('title', @params, @item.get('name'))\r
+ show = new Pettanr.Views.Author.Show({\r
+ item: @item,\r
+ operators: @operators\r
+ })\r
+ show.render()\r
+ @trigger('ready', show)\r
+ @trigger('done', @params)\r
+ \r
count: () ->\r
\r
new: () ->\r
- @trigger('retitle', @params)\r
+ @trigger('title', @params)\r
@form_new()\r
+ @trigger('done', @params)\r
\r
edit: () ->\r
- @trigger('retitle', @params)\r
+ @trigger('title', @params)\r
@form_edit()\r
+ @trigger('done', @params)\r
\r
create: () ->\r
+ @listenTo(@form, 'success', @post_success)\r
+ @listenTo(@form, 'fail', @post_fail)\r
+ @form.save()\r
\r
update: () ->\r
+ @listenTo(@form, 'success', @post_success)\r
+ @listenTo(@form, 'fail', @post_fail)\r
+ @form.save()\r
\r
destroy: () ->\r
- \r
+ @set_show(@render_destroy)\r
+ \r
+ render_destroy: () ->\r
+ @listenTo(@item, 'destroy:success', @destroy_success)\r
+ @listenTo(@item, 'destroy:fail', @destroy_fail)\r
+ @item.destroy()\r
+ \r
+ post_success: (model, response) ->\r
+ @trigger('redirect', '/home/configure')\r
+ @trigger('success', model, response)\r
+ \r
+ @is_deny_action_on_picker: (params) ->\r
+ switch params['action']\r
+ when 'new'\r
+ true\r
+ when 'edit'\r
+ true\r
+ else\r
+ false\r
+ \r