OSDN Git Service

conflict
[pettanr/pettanr.git] / app / assets / javascripts / view.js.coffee
1 class Pettanr.View extends Backbone.View\r
2   \r
3   render: () ->\r
4     this.$el.html('')\r
5     icon = new Pettanr.View.Minicon(Pettanr.View.Image.icon_loading_file())\r
6     this.$el.html(icon.render().el)\r
7     this\r
8   \r
9   @rb: (options = null) ->\r
10     new Tag.RowBreak(options).render().el\r
11   \r
12   rb: (options = null) ->\r
13     @constructor.rb(options)\r
14   \r
15   append_rb: (options = null) ->\r
16     this.$el.append(@rb())\r
17   \r
18   div: (content, options = {}) ->\r
19     options.content = content\r
20     new Tag.Div(options)\r
21   \r
22   span: (content, options = {}) ->\r
23     options.content = content\r
24     new Tag.Span(options)\r
25   \r
26   open_error_dialog: (response, options) ->\r
27     error_dialog = new Editor.Error.Dialog({parent: this})\r
28     this.$el.append(error_dialog.render().el)\r
29     error_dialog.$el.dialog({\r
30       autoOpen: false,\r
31       resizable: false,\r
32       width: 500, \r
33       height: 600,\r
34       modal: true,\r
35       buttons: {\r
36         close: () ->\r
37           $(@).dialog('close')\r
38       }\r
39     })\r
40     error_dialog.start(response, options)\r
41   \r
42   @replace_empty: (caption) ->\r
43     if Pettanr.is_blank(caption)\r
44       empty = new Pettanr.View.EmptyDiv()\r
45       empty.render().el\r
46     else\r
47       caption\r
48   \r
49   @any_button: (item, url, icon, options = {}) ->\r
50     new Pettanr.View.Button(url, icon.render().el, options)\r
51   \r
52   @mini_any_button: (item, url, icon, options = {}) ->\r
53     new Pettanr.View.Button(url, icon.render().el, options)\r
54   \r
55   @face_button: (item, image, options = {}) ->\r
56     icon = new Pettanr.View.Icon(image)\r
57     @any_button(item, item.show_url(), icon, options)\r
58   \r
59   @mini_face_button: (item, image, options = {}) ->\r
60     icon = new Pettanr.View.Minicon(image)\r
61     @any_button(item, item.show_url(), icon, options)\r
62   \r
63   @prof_button: (url, options = {}) ->\r
64     file = Pettanr.View.Image.icon_prof_file()\r
65     icon = new Pettanr.View.Icon(file)\r
66     new Pettanr.View.Button(url, icon.render().el, options)\r
67   \r
68   @mini_prof_button: (url, options = {}) ->\r
69     file = Pettanr.View.Image.icon_prof_file()\r
70     icon = new Pettanr.View.Minicon(file)\r
71     new Pettanr.View.Button(url, icon.render().el, options)\r
72   \r