OSDN Git Service

fix event names
[pettanr/pettanr.git] / app / assets / javascripts / controllers / writing_formats.js.coffee
1 class Pettanr.WritingFormatsController extends Pettanr.AppController\r
2   \r
3   index: () ->\r
4     @trigger('title', @params)\r
5     @filer_list()\r
6   \r
7   by_system_picture: () ->\r
8     @trigger('title', @params)\r
9     @filer_list()\r
10   \r
11   show_html: () -> \r
12     @item.fetch({cache: true}).done =>\r
13       @trigger('title', @params, @item.get('caption'))\r
14       show = new Pettanr.Views.WritingFormat.Show({\r
15         item: @item,\r
16         operators: @operators\r
17       })\r
18       show.render()\r
19       @trigger('ready', show)\r
20   \r
21   show: () ->\r
22     @set_show()\r
23     switch @params['format']\r
24       when 'prof'\r
25         @show_prof()\r
26       when 'html'\r
27         @show_html()\r
28   \r
29   count: () ->\r
30   \r
31   new: () ->\r
32     @trigger('title', @params)\r
33     @form_new()\r
34   \r
35   edit: () ->\r
36     @trigger('title', @params)\r
37     @form_edit()\r
38   \r
39   create: () ->\r
40     @listenTo(@form, 'success', @post_success)\r
41     @listenTo(@form, 'fail', @post_fail)\r
42     @form.save()\r
43   \r
44   update: () ->\r
45     @listenTo(@form, 'success', @post_success)\r
46     @listenTo(@form, 'fail', @post_fail)\r
47     @form.save()\r
48   \r
49   destroy: () ->\r
50     @set_show()\r
51     @item.fetch({cache: true}).done =>\r
52       @listenTo(@item, 'destroy:success', @destroy_success)\r
53       @listenTo(@item, 'destroy:fail', @destroy_fail)\r
54       @item.destroy()\r
55   \r