OSDN Git Service

fix: any
[pettanr/pettanr.git] / app / assets / javascripts / view.js.coffee
index e384dd7..f1a8a4e 100644 (file)
@@ -1,5 +1,72 @@
 class Pettanr.View extends Backbone.View\r
   \r
-  rb: () ->\r
-    this.$el.append(Tg.rb)\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
+    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.Div(options)\r
+  \r
+  span: (content, options = {}) ->\r
+    options.content = content\r
+    new Tag.Span(options)\r
+  \r
+  open_error_dialog: (response, options) ->\r
+    error_dialog = new Editor.Error.Dialog({parent: this})\r
+    this.$el.append(error_dialog.render().el)\r
+    error_dialog.$el.dialog({\r
+      autoOpen: false,\r
+      resizable: false,\r
+      width: 500, \r
+      height: 600,\r
+      modal: true,\r
+      buttons: {\r
+        close: () ->\r
+          $(@).dialog('close')\r
+      }\r
+    })\r
+    error_dialog.start(response, 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
+    @any_button(item, item.show_url(), icon, options)\r
+  \r
+  @mini_face_button: (item, image, options = {}) ->\r
+    icon = new Pettanr.View.Minicon(image)\r
+    @any_button(item, item.show_url(), icon, options)\r
+  \r
+  @prof_button: (url, options = {}) ->\r
+    file = Pettanr.View.Image.icon_prof_file()\r
+    icon = new Pettanr.View.Icon(file)\r
+    new Pettanr.View.Button(url, icon.render().el, options)\r
+  \r
+  @mini_prof_button: (url, options = {}) ->\r
+    file = Pettanr.View.Image.icon_prof_file()\r
+    icon = new Pettanr.View.Minicon(file)\r
+    new Pettanr.View.Button(url, icon.render().el, options)\r
   \r