OSDN Git Service

c652f3dda57b7117afa3294f8b323cc2e826dd74
[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   @replace_empty: (caption) ->\r
27     if Pettanr.is_blank(caption)\r
28       empty = new Pettanr.View.EmptyDiv()\r
29       empty.render().el\r
30     else\r
31       caption\r
32   \r
33   @any_button: (item, url, icon, options = {}) ->\r
34     new Pettanr.View.Button(url, icon.render().el, options)\r
35   \r
36   @mini_any_button: (item, url, icon, options = {}) ->\r
37     new Pettanr.View.Button(url, icon.render().el, options)\r
38   \r
39   @face_button: (item, image, options = {}) ->\r
40     icon = new Pettanr.View.Icon(image)\r
41     @any_button(item, item.show_url(), icon, options)\r
42   \r
43   @mini_face_button: (item, image, options = {}) ->\r
44     icon = new Pettanr.View.Minicon(image)\r
45     @any_button(item, item.show_url(), icon, options)\r
46   \r
47   @prof_button: (url, options = {}) ->\r
48     file = Pettanr.View.Image.icon_prof_file()\r
49     icon = new Pettanr.View.Icon(file)\r
50     new Pettanr.View.Button(url, icon.render().el, options)\r
51   \r
52   @mini_prof_button: (url, options = {}) ->\r
53     file = Pettanr.View.Image.icon_prof_file()\r
54     icon = new Pettanr.View.Minicon(file)\r
55     new Pettanr.View.Button(url, icon.render().el, options)\r
56   \r