OSDN Git Service

t#:
[pettanr/pettanr.git] / app / assets / javascripts / view.js.coffee
index 26ec937..c652f3d 100644 (file)
@@ -1,26 +1,48 @@
 class Pettanr.View extends Backbone.View\r
   \r
+  render: () ->\r
+    this.$el.html('')\r
+    icon = new Pettanr.View.Minicon(Pettanr.View.Image.icon_loading_file())\r
+    this.$el.html(icon.render().el)\r
+    this\r
+  \r
   @rb: (options = null) ->\r
-    rb = new Tag.RowBreak(options).render().el\r
+    new Tag.RowBreak(options).render().el\r
   \r
   rb: (options = null) ->\r
     @constructor.rb(options)\r
   \r
+  append_rb: (options = null) ->\r
+    this.$el.append(@rb())\r
+  \r
   div: (content, options = {}) ->\r
     options.content = content\r
-    new Tag.Span(options)\r
+    new Tag.Div(options)\r
   \r
   span: (content, options = {}) ->\r
     options.content = content\r
-    new Tag.Div(options)\r
+    new Tag.Span(options)\r
+  \r
+  @replace_empty: (caption) ->\r
+    if Pettanr.is_blank(caption)\r
+      empty = new Pettanr.View.EmptyDiv()\r
+      empty.render().el\r
+    else\r
+      caption\r
+  \r
+  @any_button: (item, url, icon, options = {}) ->\r
+    new Pettanr.View.Button(url, icon.render().el, options)\r
+  \r
+  @mini_any_button: (item, url, icon, options = {}) ->\r
+    new Pettanr.View.Button(url, icon.render().el, options)\r
   \r
   @face_button: (item, image, options = {}) ->\r
     icon = new Pettanr.View.Icon(image)\r
-    new Pettanr.View.Button(item.show_url(), icon.render().el, options)\r
+    @any_button(item, item.show_url(), icon, options)\r
   \r
   @mini_face_button: (item, image, options = {}) ->\r
     icon = new Pettanr.View.Minicon(image)\r
-    new Pettanr.View.Button(item.show_url(), icon.render().el, options)\r
+    @any_button(item, item.show_url(), icon, options)\r
   \r
   @prof_button: (url, options = {}) ->\r
     file = Pettanr.View.Image.icon_prof_file()\r