OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
authoryasushiito <yas@pen-chan.jp>
Tue, 12 Nov 2013 08:19:27 +0000 (17:19 +0900)
committeryasushiito <yas@pen-chan.jp>
Tue, 12 Nov 2013 08:19:27 +0000 (17:19 +0900)
36 files changed:
app/assets/javascripts/application.js
app/assets/javascripts/content.js.coffee [new file with mode: 0644]
app/assets/javascripts/element.js.coffee
app/assets/javascripts/item.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/artist.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/author.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/balloon.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/comic.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/ground_color.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/ground_picture.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/license.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/license_group.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/original_picture.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/panel.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/panel_picture.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/picture.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/resource_picture.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/scroll.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/scroll_panel.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/sheet.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/sheet_panel.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/speech.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/speech_balloon.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/speech_balloon_template.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/story.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/story_sheet.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/system_picture.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/writing_format.js.coffee [new file with mode: 0644]
app/assets/javascripts/panels.js.coffee
app/views/sheet_panels/_element.html.erb
vendor/plugins/content/init.rb [new file with mode: 0644]
vendor/plugins/content/lib/content.rb [new file with mode: 0644]
vendor/plugins/element/init.rb [new file with mode: 0644]
vendor/plugins/element/lib/element.rb [new file with mode: 0644]
vendor/plugins/item/init.rb [new file with mode: 0644]
vendor/plugins/item/lib/item.rb [new file with mode: 0644]

index 750f965..07ab6a0 100644 (file)
 //= require jquery.validate.localization/messages_ja
 //= require textchange
 //= require underscore
+//= require backbone
 //= require configurations
+//= require item
+//= require element
+//= require_directory ./models
 //= require pettanr_editor
 //= require pettanr_sheeter
 //= require writing_formats
diff --git a/app/assets/javascripts/content.js.coffee b/app/assets/javascripts/content.js.coffee
new file mode 100644 (file)
index 0000000..eae373a
--- /dev/null
@@ -0,0 +1,141 @@
+class Content extends Item\r
+  @single: () ->\r
+    'Name'\r
+  \r
+  @plural: () ->\r
+    'Names'\r
+  \r
+  @class_name: () ->\r
+    @single()\r
+  \r
+  @item_name: () ->\r
+    @underscore(@single())\r
+  \r
+  @table_name: () ->\r
+    @underscore(@plural())\r
+  \r
+  @path_name: (with_engine = false) ->\r
+    @table_name()\r
+  \r
+  #>> https://gist.github.com/davidjbeveridge/3813724\r
+  @xeach: (arr, func, index=0) ->\r
+    if index < arr.length then [ func(arr[index], index), @xeach(arr, func, index + 1)... ] else []\r
+  \r
+  @camelize: (input) ->\r
+    pieces = input.split(/[\W_-]/)\r
+    @xeach(pieces, @capitalize).join("")\r
+  \r
+  @capitalize: (input) ->\r
+    input.charAt(0).toUpperCase() + input.slice(1)\r
+  \r
+  @lowercase: (input) ->\r
+    input.toLowerCase()\r
+   \r
+  @underscore: (input) ->\r
+    pieces = input.replace(/([A-Z])/g, '_$1').split(/[\W_-]/).filter (n) -> !!n\r
+    @xeach(pieces, @lowercase ).join("_")\r
+  # <<\r
+  @is_a_string: (str) ->\r
+    if (str instanceof String) or (typeof str == "string")\r
+      true\r
+    else\r
+      false\r
+  \r
+  has_picture: () ->\r
+    false\r
+  \r
+  has_helper: (column_name) ->\r
+    c = @constructor.colum_structures()\r
+    if c[column_name] and c[column_name]['helper']\r
+      true\r
+    else\r
+      false\r
+  \r
+  element_name: () ->\r
+    @constructor.element_name()\r
+  \r
+  extend_column: () ->\r
+    null\r
+  \r
+  extend_element_name: () ->\r
+    if @extend_column()\r
+      @get(@extend_column())\r
+    else\r
+      @element_name()\r
+  \r
+  find_configurations: (hash, key) ->\r
+    if @constructor.is_a_string(hash[key])\r
+      @find_configurations(hash, hash[key])\r
+    else\r
+      return hash[key]\r
+  \r
+  tag_id: (c = null) ->\r
+    'panel' + @tag_panel_id() + @tag_element_type() + @tag_element_id() + c\r
+  \r
+  field_tag_id: (f) ->\r
+    @tag_id() + f\r
+  \r
+  tag_panel_id: () ->\r
+    @get_panel().get('id') || '0'\r
+  \r
+  tag_element_id: () ->\r
+    @get('id') || '0'\r
+  \r
+  tag_element_type: () ->\r
+    @constructor.element_name()\r
+  \r
+  tag_new_index: () ->\r
+    @new_index()\r
+  \r
+  path_name: (with_engine = false) ->\r
+    @constructor.path_name(with_engine)\r
+  \r
+  form_template: (with_engine = false) ->\r
+    @path_name(with_engine) + '/form'\r
+  \r
+  form_helper_template: (column_name) ->\r
+    c = @constructor.colum_structures()\r
+    if @has_helper(column_name)\r
+      c[colum_name]['helper']\r
+    else\r
+      ''\r
+  \r
+  tag_attributes: (column = null, opt = {}) ->\r
+    r = {\r
+      id: @field_tag_id(column), panel_id: @tag_panel_id(), \r
+      element_id: @tag_element_id(), element_type: @tag_element_type()\r
+    }\r
+    _.extend(r, opt)\r
+    r\r
+  \r
+  field_tag_attributes: (column, no_attr, opt = {}) ->\r
+    r = @tag_attributes(column)\r
+    _.extend(r, {column: column, new_index: @tag_new_index(), no_attr: no_attr})\r
+    _.extend(r, opt)\r
+    r\r
+  \r
+  #render element by body\r
+  any_tag_attributes: (name = null, opt = {}) ->\r
+    r = @tag_attributes(name)\r
+    if @new_index()\r
+       _.extend(r, {new_index: @tag_new_index()})\r
+    _.extend(r, opt)\r
+    r\r
+  \r
+  select_tag_attributes: (selected, column, no_attr) ->\r
+    [\r
+      'last', 'first', \r
+      {html: {selected: selected}}, \r
+      @field_tag_attributes(column, no_attr)\r
+    ]\r
+  \r
+  tag_attr: (column = null, opt = {}) ->\r
+    @tag_attributes(column, opt).to_attr\r
+  \r
+  field_tag_attr: (column, no_attr, opt = {}) ->\r
+    @field_tag_attributes(column, no_attr, opt).to_attr\r
+  \r
+  any_tag_attr: (name = null, opt = {}) ->\r
+    @any_tag_attributes(name, opt).to_attr\r
+\r
+@Item = Item\r
index 9d28ad3..24d6d40 100644 (file)
-class Element\r
-  colum_structures = () ->\r
-    raise\r
+class Element extends Item\r
+  @single: () ->\r
+    'Name'\r
   \r
-  list_opt_for_panel = () ->\r
-    {}\r
+  @plural: () ->\r
+    'Names'\r
   \r
-  show_opt_for_panel = () ->\r
-    {}\r
+  @class_name: () ->\r
+    @single()\r
   \r
-  json_opt_for_panel = () ->\r
-    {}\r
+  @element_name: () ->\r
+    @underscore(@single())\r
   \r
-  path_name = (with_engine = false) ->\r
-    self.to_s.tableize\r
+  @table_name: () ->\r
+    @underscore(@plural())\r
   \r
+  @path_name: (with_engine = false) ->\r
+    @table_name()\r
   \r
+  @colum_structures: ->\r
+    {}\r
   \r
-  has_picture? = () ->\r
-    false\r
+  #>> https://gist.github.com/davidjbeveridge/3813724\r
+  @xeach: (arr, func, index=0) ->\r
+    if index < arr.length then [ func(arr[index], index), @xeach(arr, func, index + 1)... ] else []\r
+  \r
+  @camelize: (input) ->\r
+    pieces = input.split(/[\W_-]/)\r
+    @xeach(pieces, @capitalize).join("")\r
+  \r
+  @capitalize: (input) ->\r
+    input.charAt(0).toUpperCase() + input.slice(1)\r
+  \r
+  @lowercase: (input) ->\r
+    input.toLowerCase()\r
+   \r
+  @underscore: (input) ->\r
+    pieces = input.replace(/([A-Z])/g, '_$1').split(/[\W_-]/).filter (n) -> !!n\r
+    @xeach(pieces, @lowercase ).join("_")\r
+  # <<\r
+  @is_a_string: (str) ->\r
+    if (str instanceof String) or (typeof str == "string")\r
+      true\r
+    else\r
+      false\r
   \r
-  has_part? = () ->\r
+  has_picture: () ->\r
     false\r
   \r
-  parts = () ->\r
-    @parts ||= []\r
+  has_part: () ->\r
+    false\r
   \r
-  has_helper? = (column_name) ->\r
-    self.class.colum_structures[column_name] and self.class.colum_structures[column_name][:helper]\r
+  parts: () ->\r
+    @_parts ? @_parts = []\r
   \r
-  element_name = () ->\r
-    self.class.to_s.underscore\r
+  has_helper: (column_name) ->\r
+    c = @constructor.colum_structures()\r
+    if c[column_name] and c[column_name]['helper']\r
+      true\r
+    else\r
+      false\r
   \r
-  extend_column = () ->\r
-    nil\r
+  element_name: () ->\r
+    @constructor.element_name()\r
   \r
-  extend_element_name = () ->\r
-    self.extend_column ? self.attributes[extend_column] : self.element_name\r
+  extend_column: () ->\r
+    null\r
   \r
-  find_configurations hash, key = () ->\r
-     if hash[key].is_a? String\r
-       self.find_configurations hash, hash[key]\r
-     else\r
-       return hash[key]\r
+  extend_element_name: () ->\r
+    if @extend_column()\r
+      @get(@extend_column())\r
+    else\r
+      @element_name()\r
   \r
-  new_index = () ->\r
-    @new_index\r
+  find_configurations: (hash, key) ->\r
+    if @constructor.is_a_string(hash[key])\r
+      @find_configurations(hash, hash[key])\r
+    else\r
+      return hash[key]\r
   \r
-  new_index= v = () ->\r
-    @new_index = v\r
+  new_index: () ->\r
+    @_new_index\r
   \r
-  new_panel = () ->\r
-    @new_panel\r
+  set_new_index: (v) ->\r
+    @_new_index = v\r
   \r
-  new_panel= v = () ->\r
-    @new_panel = v\r
+  get_new_panel: () ->\r
+    @_new_panel\r
   \r
-  get_panel = () ->\r
-    self.panel || @new_panel\r
+  set_new_panel: (v) ->\r
+    @_new_panel = v\r
   \r
-  tag_id = (c = nil) ->\r
-    'panel' + self.tag_panel_id + self.tag_element_type + self.tag_element_id + c.to_s\r
+  set_panel: (v) ->\r
+    @_panel = v\r
   \r
-  field_tag_id = (f) ->\r
-    self.tag_id + f.to_s\r
+  get_panel: () ->\r
+    @_panel || @_new_panel\r
   \r
-  tag_panel_id = () ->\r
-    self.get_panel.new_record? ? '0' : self.get_panel.id.to_s\r
+  tag_id: (c = null) ->\r
+    'panel' + @tag_panel_id() + @tag_element_type() + @tag_element_id() + c\r
   \r
-  tag_element_id = () ->\r
-    self.new_record? ? '0' : self.id.to_s\r
+  field_tag_id: (f) ->\r
+    @tag_id() + f\r
   \r
-  tag_element_type = () ->\r
-    raise\r
+  tag_panel_id: () ->\r
+    @get_panel().get('id') || '0'\r
   \r
-  tag_new_index = () ->\r
-    self.new_index.to_s\r
+  tag_element_id: () ->\r
+    @get('id') || '0'\r
   \r
-  path_name = (with_engine = false) ->\r
-    self.class.path_name(with_engine)\r
+  tag_element_type: () ->\r
+    @constructor.element_name()\r
   \r
-  form_template = (with_engine = false) ->\r
-    self.path_name(with_engine) + '/form'\r
+  tag_new_index: () ->\r
+    @new_index()\r
   \r
-  scenario_template = (with_engine = false) ->\r
-    self.path_name(with_engine) + '/scenario'\r
+  path_name: (with_engine = false) ->\r
+    @constructor.path_name(with_engine)\r
   \r
-  element_face_template = (with_engine = false) ->\r
-    self.path_name(with_engine) + '/element_face'\r
+  form_template: (with_engine = false) ->\r
+    @path_name(with_engine) + '/form'\r
   \r
-  form_helper_template(colum_name) = () ->\r
-    self.class.colum_structures[colum_name][:helper]\r
+  scenario_template: (with_engine = false) ->\r
+    @path_name(with_engine) + '/scenario'\r
   \r
-  tag_attributes = (column = nil, opt = {}) ->\r
-    {\r
-      :id => self.field_tag_id(column), :panel_id => self.tag_panel_id, \r
-      :element_id => self.tag_element_id, :element_type => self.tag_element_type\r
-    }.merge(opt)\r
+  element_face_template: (with_engine = false) ->\r
+    @path_name(with_engine) + '/element_face'\r
   \r
-  field_tag_attributes = (column, no_attr, opt = {}) ->\r
-    self.tag_attributes(column).merge(\r
-      {:column => column, :new_index => self.tag_new_index, :no_attr => no_attr}\r
-    ).merge(opt)\r
+  form_helper_template: (column_name) ->\r
+    c = @constructor.colum_structures()\r
+    if @has_helper(column_name)\r
+      c[colum_name]['helper']\r
+    else\r
+      ''\r
+  \r
+  tag_attributes: (column = null, opt = {}) ->\r
+    r = {\r
+      id: @field_tag_id(column), panel_id: @tag_panel_id(), \r
+      element_id: @tag_element_id(), element_type: @tag_element_type()\r
+    }\r
+    _.extend(r, opt)\r
+    r\r
+  \r
+  field_tag_attributes: (column, no_attr, opt = {}) ->\r
+    r = @tag_attributes(column)\r
+    _.extend(r, {column: column, new_index: @tag_new_index(), no_attr: no_attr})\r
+    _.extend(r, opt)\r
+    r\r
   \r
   #render element by body\r
-  any_tag_attributes = (name = nil, opt = {}) ->\r
-    r = self.tag_attributes(name)\r
-    _.extend(r, \r
-      {:new_index => self.tag_new_index}\r
-    ) if self.new_index\r
-    r.merge(opt)\r
-  \r
-  select_tag_attributes = (selected, column, no_attr) ->\r
+  any_tag_attributes: (name = null, opt = {}) ->\r
+    r = @tag_attributes(name)\r
+    if @new_index()\r
+       _.extend(r, {new_index: @tag_new_index()})\r
+    _.extend(r, opt)\r
+    r\r
+  \r
+  select_tag_attributes: (selected, column, no_attr) ->\r
     [\r
-      :last, :first\r
-      {:html => {:selected => selected}}, \r
-      self.field_tag_attributes(column, no_attr)\r
+      'last', 'first'\r
+      {html: {selected: selected}}, \r
+      @field_tag_attributes(column, no_attr)\r
     ]\r
   \r
-  tag_attr = (column = nil, opt = {}) ->\r
-    self.tag_attributes(column, opt).to_attr\r
-  \r
-  field_tag_attr = (column, no_attr, opt = {}) ->\r
-    self.field_tag_attributes(column, no_attr, opt).to_attr\r
+  tag_attr: (column = null, opt = {}) ->\r
+    @tag_attributes(column, opt).to_attr\r
   \r
-  any_tag_attr = (name = nil, opt = {}) ->\r
-    self.any_tag_attributes(name, opt).to_attr\r
-\r
-  @pettanr_current_panel_id = 0\r
+  field_tag_attr: (column, no_attr, opt = {}) ->\r
+    @field_tag_attributes(column, no_attr, opt).to_attr\r
   \r
-  @new_element_index = {}\r
-  @new_element_index[PettanrEditor.pettanr_current_panel_id] = 0\r
-  \r
-  @current_panel = () ->\r
-    $('#panel' + PettanrEditor.pettanr_current_panel_id.toString())\r
-  \r
-  @set_tree_value = (keys, last_attr, value) ->\r
-    key = keys.shift()\r
-    if keys.length <= 0\r
-      last_attr[key] = value\r
-    else\r
-      last_attr[key] = last_attr[key] || {}\r
-      PettanrEditor.set_tree_value(keys, last_attr[key], value)\r
-\r
-  @repeat_texts = ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']\r
-  \r
-  @is_editting = () ->\r
-    trace = '#panel' + PettanrEditor.pettanr_current_panel_id.toString() + 'wrapper'\r
-    if $(trace) and $(trace).attr('editable')\r
-      return true\r
-    else\r
-      return false\r
-  @is_editable = (p) ->\r
-    if p.parent().attr('editable')\r
-      return true\r
-    else\r
-      return false\r
-  @is_var = (o) ->\r
-    if parseInt(o.attr('no_attr')) > 0\r
-      return false\r
-    else\r
-      if o.attr('column') \r
-        if o.attr('column') == '_destroy' and o.val().length < 1\r
-          return false\r
-        else\r
-          return true\r
-      else\r
-        return false\r
-  @is_panel = (o) ->\r
-    if PettanrEditor.is_element(o)\r
-      return false\r
-    else\r
-      return true\r
-  @is_element = (o) ->\r
-    if o.attr('element_type')\r
-      return true\r
-    else\r
-      return false\r
-  @is_element_part = (o) ->\r
-    if o.attr('element_part_type')\r
-      return true\r
-    else\r
-      return false\r
-  @element_is = (element_type, o) ->\r
-    if PettanrEditor.is_element(o) and o.attr('element_type') == element_type\r
-      return true\r
-    else\r
-      return false\r
-  @element_types  = {'panel_picture': 'panel_pictures', 'speech_balloon': 'speech_balloons', 'ground_picture': 'ground_pictures', 'ground_color': 'ground_colors'}\r
-  @element_type_to_table = (element_type) ->\r
-    PettanrEditor.element_types[element_type]\r
-  @text_align_texts = ['left', 'left', 'right', 'center']\r
+  any_tag_attr: (name = null, opt = {}) ->\r
+    @any_tag_attributes(name, opt).to_attr\r
 \r
-  @make_tree = (attr, o) ->\r
-    if PettanrEditor.is_var(o)\r
-      tree = 'panels-' + o.attr('panel_id') + '-'\r
-      if PettanrEditor.is_element(o)\r
-        tree = tree + PettanrEditor.element_type_to_table(o.attr('element_type')) + '_attributes-' + o.attr('element_id') + '-'\r
-        if PettanrEditor.is_element_part(o)\r
-          tree = tree + o.attr('element_part_type') + '_attributes-'\r
-      tree = tree + o.attr('column')\r
-      keys = tree.split('-')\r
-      PettanrEditor.set_tree_value(keys, attr, o.val())\r
-  \r
-  @panel_tag_id = (element) ->\r
-    '#panel' + element.attr('panel_id')\r
-  \r
-  @element_tag_id = (element) ->\r
-    '#panel' + element.attr('panel_id') + element.attr('element_type') + element.attr('element_id')\r
-  \r
-  @element_part_tag_id = (element_part) ->\r
-    '#panel' + element_part.attr('panel_id') + element_part.attr('element_type') + element_part.attr('element_id') + element_part.attr('element_part_type') + element_part.attr('element_part_id')\r
-  \r
-  @refresh_attribute = (field) ->\r
-    attr = {}\r
-    $('input').map ->\r
-      PettanrEditor.make_tree(attr, $(@))\r
-    $('textarea').map  ->\r
-      PettanrEditor.make_tree(attr, $(@))\r
-    $('select').map ->\r
-      PettanrEditor.make_tree(attr, $(@))\r
-    field.val(JSON.stringify(attr['panels'][PettanrEditor.pettanr_current_panel_id.toString() ]))\r
-  \r
-@PettanrEditor = PettanrEditor\r
+@Element = Element\r
diff --git a/app/assets/javascripts/item.js.coffee b/app/assets/javascripts/item.js.coffee
new file mode 100644 (file)
index 0000000..130f241
--- /dev/null
@@ -0,0 +1,141 @@
+class Item extends Backbone.Model\r
+  @singular: () ->\r
+    'Name'\r
+  \r
+  @plural: () ->\r
+    'Names'\r
+  \r
+  @class_name: () ->\r
+    @single()\r
+  \r
+  @item_name: () ->\r
+    @underscore(@single())\r
+  \r
+  @table_name: () ->\r
+    @underscore(@plural())\r
+  \r
+  @path_name: (with_engine = false) ->\r
+    @table_name()\r
+  \r
+  #>> https://gist.github.com/davidjbeveridge/3813724\r
+  @xeach: (arr, func, index=0) ->\r
+    if index < arr.length then [ func(arr[index], index), @xeach(arr, func, index + 1)... ] else []\r
+  \r
+  @camelize: (input) ->\r
+    pieces = input.split(/[\W_-]/)\r
+    @xeach(pieces, @capitalize).join("")\r
+  \r
+  @capitalize: (input) ->\r
+    input.charAt(0).toUpperCase() + input.slice(1)\r
+  \r
+  @lowercase: (input) ->\r
+    input.toLowerCase()\r
+   \r
+  @underscore: (input) ->\r
+    pieces = input.replace(/([A-Z])/g, '_$1').split(/[\W_-]/).filter (n) -> !!n\r
+    @xeach(pieces, @lowercase ).join("_")\r
+  # <<\r
+  @is_a_string: (str) ->\r
+    if (str instanceof String) or (typeof str == "string")\r
+      true\r
+    else\r
+      false\r
+  \r
+  has_picture: () ->\r
+    false\r
+  \r
+  has_helper: (column_name) ->\r
+    c = @constructor.colum_structures()\r
+    if c[column_name] and c[column_name]['helper']\r
+      true\r
+    else\r
+      false\r
+  \r
+  element_name: () ->\r
+    @constructor.element_name()\r
+  \r
+  extend_column: () ->\r
+    null\r
+  \r
+  extend_element_name: () ->\r
+    if @extend_column()\r
+      @get(@extend_column())\r
+    else\r
+      @element_name()\r
+  \r
+  find_configurations: (hash, key) ->\r
+    if @constructor.is_a_string(hash[key])\r
+      @find_configurations(hash, hash[key])\r
+    else\r
+      return hash[key]\r
+  \r
+  tag_id: (c = null) ->\r
+    'panel' + @tag_panel_id() + @tag_element_type() + @tag_element_id() + c\r
+  \r
+  field_tag_id: (f) ->\r
+    @tag_id() + f\r
+  \r
+  tag_panel_id: () ->\r
+    @get_panel().get('id') || '0'\r
+  \r
+  tag_element_id: () ->\r
+    @get('id') || '0'\r
+  \r
+  tag_element_type: () ->\r
+    @constructor.element_name()\r
+  \r
+  tag_new_index: () ->\r
+    @new_index()\r
+  \r
+  path_name: (with_engine = false) ->\r
+    @constructor.path_name(with_engine)\r
+  \r
+  form_template: (with_engine = false) ->\r
+    @path_name(with_engine) + '/form'\r
+  \r
+  form_helper_template: (column_name) ->\r
+    c = @constructor.colum_structures()\r
+    if @has_helper(column_name)\r
+      c[colum_name]['helper']\r
+    else\r
+      ''\r
+  \r
+  tag_attributes: (column = null, opt = {}) ->\r
+    r = {\r
+      id: @field_tag_id(column), panel_id: @tag_panel_id(), \r
+      element_id: @tag_element_id(), element_type: @tag_element_type()\r
+    }\r
+    _.extend(r, opt)\r
+    r\r
+  \r
+  field_tag_attributes: (column, no_attr, opt = {}) ->\r
+    r = @tag_attributes(column)\r
+    _.extend(r, {column: column, new_index: @tag_new_index(), no_attr: no_attr})\r
+    _.extend(r, opt)\r
+    r\r
+  \r
+  #render element by body\r
+  any_tag_attributes: (name = null, opt = {}) ->\r
+    r = @tag_attributes(name)\r
+    if @new_index()\r
+       _.extend(r, {new_index: @tag_new_index()})\r
+    _.extend(r, opt)\r
+    r\r
+  \r
+  select_tag_attributes: (selected, column, no_attr) ->\r
+    [\r
+      'last', 'first', \r
+      {html: {selected: selected}}, \r
+      @field_tag_attributes(column, no_attr)\r
+    ]\r
+  \r
+  tag_attr: (column = null, opt = {}) ->\r
+    @tag_attributes(column, opt).to_attr\r
+  \r
+  field_tag_attr: (column, no_attr, opt = {}) ->\r
+    @field_tag_attributes(column, no_attr, opt).to_attr\r
+  \r
+  any_tag_attr: (name = null, opt = {}) ->\r
+    @any_tag_attributes(name, opt).to_attr\r
+\r
+@Item = Item\r
diff --git a/app/assets/javascripts/models/artist.js.coffee b/app/assets/javascripts/models/artist.js.coffee
new file mode 100644 (file)
index 0000000..e548ce0
--- /dev/null
@@ -0,0 +1,25 @@
+class Artist extends Item\r
+  @single: () ->\r
+    'Artist'\r
+  \r
+  @plural: () ->\r
+    'Artists'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/author.js.coffee b/app/assets/javascripts/models/author.js.coffee
new file mode 100644 (file)
index 0000000..80d12c9
--- /dev/null
@@ -0,0 +1,25 @@
+class Author extends Item\r
+  @single: () ->\r
+    'Author'\r
+  \r
+  @plural: () ->\r
+    'Authors'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/balloon.js.coffee b/app/assets/javascripts/models/balloon.js.coffee
new file mode 100644 (file)
index 0000000..9b03bf7
--- /dev/null
@@ -0,0 +1,70 @@
+class Balloon extends Element\r
+  @single: () ->\r
+    'Balloon'\r
+  \r
+  @plural: () ->\r
+    'Balloons'\r
+  \r
+  @colum_structures: ->\r
+    {}\r
+  \r
+  defaults: {\r
+    x: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to this world")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    confirm( @path_name() )\r
+    confirm( @colum_structures() )\r
+    \r
+  has_picture: () ->\r
+    true\r
+  \r
+  has_part: () ->\r
+    false\r
+  \r
+  extend_column: () ->\r
+    null\r
+  \r
+  test: () ->\r
+    confirm( @has_picture() )\r
+    confirm( @has_part() )\r
+    confirm( @parts() )\r
+    confirm( @has_helper('column_name') )\r
+    confirm( @element_name() )\r
+    confirm( @extend_column() )\r
+    confirm( @extend_element_name() )\r
+    confirm( @find_configurations(window.configurations,'v') )\r
+    confirm( @new_index() )\r
+    confirm( @set_new_index(3) )\r
+    confirm( @set_new_panel('v') )\r
+    confirm( @get_new_panel() )\r
+    confirm( '@get_panel()' )\r
+    confirm( @get_panel() )\r
+    confirm( @tag_id('c') )\r
+    confirm( @field_tag_id('f') )\r
+    confirm( @tag_panel_id() )\r
+    confirm( @tag_element_id() )\r
+    confirm( @tag_element_type() )\r
+    confirm( @tag_new_index() )\r
+    confirm( @path_name() )\r
+    confirm( @form_template() )\r
+    confirm( @scenario_template() )\r
+    confirm( @element_face_template() )\r
+    confirm( @form_helper_template('colum_name') )\r
+    confirm( @tag_attributes('column') )\r
+    confirm( @field_tag_attributes('column', 0, {}) )\r
+    confirm( @any_tag_attributes('name', {}) )\r
+    confirm( @select_tag_attributes(true, 'column', 0) )\r
+    confirm( @tag_attr('column', {}) )\r
+    confirm( @field_tag_attr('column', 1, {}) )\r
+    confirm( @any_tag_attr('name', {}) )\r
+\r
+@PanelPicture = PanelPicture\r
diff --git a/app/assets/javascripts/models/comic.js.coffee b/app/assets/javascripts/models/comic.js.coffee
new file mode 100644 (file)
index 0000000..4291d53
--- /dev/null
@@ -0,0 +1,25 @@
+class Comic extends Item\r
+  @single: () ->\r
+    'Comic'\r
+  \r
+  @plural: () ->\r
+    'Comics'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/ground_color.js.coffee b/app/assets/javascripts/models/ground_color.js.coffee
new file mode 100644 (file)
index 0000000..eaca96d
--- /dev/null
@@ -0,0 +1,70 @@
+class GroundColor extends Element\r
+  @single: () ->\r
+    'GroundColor'\r
+  \r
+  @plural: () ->\r
+    'GroundColors'\r
+  \r
+  @colum_structures: ->\r
+    {}\r
+  \r
+  defaults: {\r
+    x: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to this world")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    confirm( @path_name() )\r
+    confirm( @colum_structures() )\r
+    \r
+  has_picture: () ->\r
+    true\r
+  \r
+  has_part: () ->\r
+    false\r
+  \r
+  extend_column: () ->\r
+    null\r
+  \r
+  test: () ->\r
+    confirm( @has_picture() )\r
+    confirm( @has_part() )\r
+    confirm( @parts() )\r
+    confirm( @has_helper('column_name') )\r
+    confirm( @element_name() )\r
+    confirm( @extend_column() )\r
+    confirm( @extend_element_name() )\r
+    confirm( @find_configurations(window.configurations,'v') )\r
+    confirm( @new_index() )\r
+    confirm( @set_new_index(3) )\r
+    confirm( @set_new_panel('v') )\r
+    confirm( @get_new_panel() )\r
+    confirm( '@get_panel()' )\r
+    confirm( @get_panel() )\r
+    confirm( @tag_id('c') )\r
+    confirm( @field_tag_id('f') )\r
+    confirm( @tag_panel_id() )\r
+    confirm( @tag_element_id() )\r
+    confirm( @tag_element_type() )\r
+    confirm( @tag_new_index() )\r
+    confirm( @path_name() )\r
+    confirm( @form_template() )\r
+    confirm( @scenario_template() )\r
+    confirm( @element_face_template() )\r
+    confirm( @form_helper_template('colum_name') )\r
+    confirm( @tag_attributes('column') )\r
+    confirm( @field_tag_attributes('column', 0, {}) )\r
+    confirm( @any_tag_attributes('name', {}) )\r
+    confirm( @select_tag_attributes(true, 'column', 0) )\r
+    confirm( @tag_attr('column', {}) )\r
+    confirm( @field_tag_attr('column', 1, {}) )\r
+    confirm( @any_tag_attr('name', {}) )\r
+\r
+@PanelPicture = PanelPicture\r
diff --git a/app/assets/javascripts/models/ground_picture.js.coffee b/app/assets/javascripts/models/ground_picture.js.coffee
new file mode 100644 (file)
index 0000000..d5820fa
--- /dev/null
@@ -0,0 +1,70 @@
+class GroundPicture extends Element\r
+  @single: () ->\r
+    'GroundPicture'\r
+  \r
+  @plural: () ->\r
+    'GroundPictures'\r
+  \r
+  @colum_structures: ->\r
+    {}\r
+  \r
+  defaults: {\r
+    x: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to this world")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    confirm( @path_name() )\r
+    confirm( @colum_structures() )\r
+    \r
+  has_picture: () ->\r
+    true\r
+  \r
+  has_part: () ->\r
+    false\r
+  \r
+  extend_column: () ->\r
+    null\r
+  \r
+  test: () ->\r
+    confirm( @has_picture() )\r
+    confirm( @has_part() )\r
+    confirm( @parts() )\r
+    confirm( @has_helper('column_name') )\r
+    confirm( @element_name() )\r
+    confirm( @extend_column() )\r
+    confirm( @extend_element_name() )\r
+    confirm( @find_configurations(window.configurations,'v') )\r
+    confirm( @new_index() )\r
+    confirm( @set_new_index(3) )\r
+    confirm( @set_new_panel('v') )\r
+    confirm( @get_new_panel() )\r
+    confirm( '@get_panel()' )\r
+    confirm( @get_panel() )\r
+    confirm( @tag_id('c') )\r
+    confirm( @field_tag_id('f') )\r
+    confirm( @tag_panel_id() )\r
+    confirm( @tag_element_id() )\r
+    confirm( @tag_element_type() )\r
+    confirm( @tag_new_index() )\r
+    confirm( @path_name() )\r
+    confirm( @form_template() )\r
+    confirm( @scenario_template() )\r
+    confirm( @element_face_template() )\r
+    confirm( @form_helper_template('colum_name') )\r
+    confirm( @tag_attributes('column') )\r
+    confirm( @field_tag_attributes('column', 0, {}) )\r
+    confirm( @any_tag_attributes('name', {}) )\r
+    confirm( @select_tag_attributes(true, 'column', 0) )\r
+    confirm( @tag_attr('column', {}) )\r
+    confirm( @field_tag_attr('column', 1, {}) )\r
+    confirm( @any_tag_attr('name', {}) )\r
+\r
+@PanelPicture = PanelPicture\r
diff --git a/app/assets/javascripts/models/license.js.coffee b/app/assets/javascripts/models/license.js.coffee
new file mode 100644 (file)
index 0000000..19e5b94
--- /dev/null
@@ -0,0 +1,25 @@
+class License extends Item\r
+  @single: () ->\r
+    'License'\r
+  \r
+  @plural: () ->\r
+    'Licenses'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/license_group.js.coffee b/app/assets/javascripts/models/license_group.js.coffee
new file mode 100644 (file)
index 0000000..db6e759
--- /dev/null
@@ -0,0 +1,25 @@
+class LicenseGroup extends Item\r
+  @single: () ->\r
+    'LicenseGroup'\r
+  \r
+  @plural: () ->\r
+    'LicenseGroups'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/original_picture.js.coffee b/app/assets/javascripts/models/original_picture.js.coffee
new file mode 100644 (file)
index 0000000..cb58ca3
--- /dev/null
@@ -0,0 +1,25 @@
+class OriginalPicture extends Item\r
+  @single: () ->\r
+    'OriginalPicture'\r
+  \r
+  @plural: () ->\r
+    'OriginalPictures'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/panel.js.coffee b/app/assets/javascripts/models/panel.js.coffee
new file mode 100644 (file)
index 0000000..1e476e1
--- /dev/null
@@ -0,0 +1,25 @@
+class Panel extends Item\r
+  @single: () ->\r
+    'Panel'\r
+  \r
+  @plural: () ->\r
+    'Panels'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/panel_picture.js.coffee b/app/assets/javascripts/models/panel_picture.js.coffee
new file mode 100644 (file)
index 0000000..1dcb93e
--- /dev/null
@@ -0,0 +1,70 @@
+class PanelPicture extends Element\r
+  @single: () ->\r
+    'PanelPicture'\r
+  \r
+  @plural: () ->\r
+    'PanelPictures'\r
+  \r
+  @colum_structures: ->\r
+    {}\r
+  \r
+  defaults: {\r
+    x: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to this world")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    confirm( @path_name() )\r
+    confirm( @colum_structures() )\r
+    \r
+  has_picture: () ->\r
+    true\r
+  \r
+  has_part: () ->\r
+    false\r
+  \r
+  extend_column: () ->\r
+    null\r
+  \r
+  test: () ->\r
+    confirm( @has_picture() )\r
+    confirm( @has_part() )\r
+    confirm( @parts() )\r
+    confirm( @has_helper('column_name') )\r
+    confirm( @element_name() )\r
+    confirm( @extend_column() )\r
+    confirm( @extend_element_name() )\r
+    confirm( @find_configurations(window.configurations,'v') )\r
+    confirm( @new_index() )\r
+    confirm( @set_new_index(3) )\r
+    confirm( @set_new_panel('v') )\r
+    confirm( @get_new_panel() )\r
+    confirm( '@get_panel()' )\r
+    confirm( @get_panel() )\r
+    confirm( @tag_id('c') )\r
+    confirm( @field_tag_id('f') )\r
+    confirm( @tag_panel_id() )\r
+    confirm( @tag_element_id() )\r
+    confirm( @tag_element_type() )\r
+    confirm( @tag_new_index() )\r
+    confirm( @path_name() )\r
+    confirm( @form_template() )\r
+    confirm( @scenario_template() )\r
+    confirm( @element_face_template() )\r
+    confirm( @form_helper_template('colum_name') )\r
+    confirm( @tag_attributes('column') )\r
+    confirm( @field_tag_attributes('column', 0, {}) )\r
+    confirm( @any_tag_attributes('name', {}) )\r
+    confirm( @select_tag_attributes(true, 'column', 0) )\r
+    confirm( @tag_attr('column', {}) )\r
+    confirm( @field_tag_attr('column', 1, {}) )\r
+    confirm( @any_tag_attr('name', {}) )\r
+\r
+@PanelPicture = PanelPicture\r
diff --git a/app/assets/javascripts/models/picture.js.coffee b/app/assets/javascripts/models/picture.js.coffee
new file mode 100644 (file)
index 0000000..295cb85
--- /dev/null
@@ -0,0 +1,25 @@
+class Picture extends Item\r
+  @single: () ->\r
+    'Picture'\r
+  \r
+  @plural: () ->\r
+    'Pictures'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/resource_picture.js.coffee b/app/assets/javascripts/models/resource_picture.js.coffee
new file mode 100644 (file)
index 0000000..1853af3
--- /dev/null
@@ -0,0 +1,25 @@
+class ResourcePicture extends Item\r
+  @single: () ->\r
+    'ResourcePicture'\r
+  \r
+  @plural: () ->\r
+    'ResourcePictures'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/scroll.js.coffee b/app/assets/javascripts/models/scroll.js.coffee
new file mode 100644 (file)
index 0000000..52f9581
--- /dev/null
@@ -0,0 +1,25 @@
+class Scroll extends Item\r
+  @single: () ->\r
+    'Scroll'\r
+  \r
+  @plural: () ->\r
+    'Scrolls'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/scroll_panel.js.coffee b/app/assets/javascripts/models/scroll_panel.js.coffee
new file mode 100644 (file)
index 0000000..f5b289c
--- /dev/null
@@ -0,0 +1,25 @@
+class ScrollPanel extends Item\r
+  @single: () ->\r
+    'ScrollPanel'\r
+  \r
+  @plural: () ->\r
+    'ScrollPanels'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/sheet.js.coffee b/app/assets/javascripts/models/sheet.js.coffee
new file mode 100644 (file)
index 0000000..d4ee92d
--- /dev/null
@@ -0,0 +1,25 @@
+class Sheet extends Item\r
+  @single: () ->\r
+    'Sheet'\r
+  \r
+  @plural: () ->\r
+    'Sheets'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/sheet_panel.js.coffee b/app/assets/javascripts/models/sheet_panel.js.coffee
new file mode 100644 (file)
index 0000000..ed3c1b1
--- /dev/null
@@ -0,0 +1,25 @@
+class SheetPanel extends Item\r
+  @single: () ->\r
+    'SheetPanel'\r
+  \r
+  @plural: () ->\r
+    'SheetPanels'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/speech.js.coffee b/app/assets/javascripts/models/speech.js.coffee
new file mode 100644 (file)
index 0000000..bf3fb39
--- /dev/null
@@ -0,0 +1,70 @@
+class SpeechBalloon extends Element\r
+  @single: () ->\r
+    'Speech'\r
+  \r
+  @plural: () ->\r
+    'Speeches'\r
+  \r
+  @colum_structures: ->\r
+    {}\r
+  \r
+  defaults: {\r
+    x: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to this world")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    confirm( @path_name() )\r
+    confirm( @colum_structures() )\r
+    \r
+  has_picture: () ->\r
+    true\r
+  \r
+  has_part: () ->\r
+    false\r
+  \r
+  extend_column: () ->\r
+    null\r
+  \r
+  test: () ->\r
+    confirm( @has_picture() )\r
+    confirm( @has_part() )\r
+    confirm( @parts() )\r
+    confirm( @has_helper('column_name') )\r
+    confirm( @element_name() )\r
+    confirm( @extend_column() )\r
+    confirm( @extend_element_name() )\r
+    confirm( @find_configurations(window.configurations,'v') )\r
+    confirm( @new_index() )\r
+    confirm( @set_new_index(3) )\r
+    confirm( @set_new_panel('v') )\r
+    confirm( @get_new_panel() )\r
+    confirm( '@get_panel()' )\r
+    confirm( @get_panel() )\r
+    confirm( @tag_id('c') )\r
+    confirm( @field_tag_id('f') )\r
+    confirm( @tag_panel_id() )\r
+    confirm( @tag_element_id() )\r
+    confirm( @tag_element_type() )\r
+    confirm( @tag_new_index() )\r
+    confirm( @path_name() )\r
+    confirm( @form_template() )\r
+    confirm( @scenario_template() )\r
+    confirm( @element_face_template() )\r
+    confirm( @form_helper_template('colum_name') )\r
+    confirm( @tag_attributes('column') )\r
+    confirm( @field_tag_attributes('column', 0, {}) )\r
+    confirm( @any_tag_attributes('name', {}) )\r
+    confirm( @select_tag_attributes(true, 'column', 0) )\r
+    confirm( @tag_attr('column', {}) )\r
+    confirm( @field_tag_attr('column', 1, {}) )\r
+    confirm( @any_tag_attr('name', {}) )\r
+\r
+@PanelPicture = PanelPicture\r
diff --git a/app/assets/javascripts/models/speech_balloon.js.coffee b/app/assets/javascripts/models/speech_balloon.js.coffee
new file mode 100644 (file)
index 0000000..4a28202
--- /dev/null
@@ -0,0 +1,70 @@
+class SpeechBalloon extends Element\r
+  @single: () ->\r
+    'SpeechBalloon'\r
+  \r
+  @plural: () ->\r
+    'SpeechBalloons'\r
+  \r
+  @colum_structures: ->\r
+    {}\r
+  \r
+  defaults: {\r
+    x: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to this world")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    confirm( @path_name() )\r
+    confirm( @colum_structures() )\r
+    \r
+  has_picture: () ->\r
+    true\r
+  \r
+  has_part: () ->\r
+    false\r
+  \r
+  extend_column: () ->\r
+    null\r
+  \r
+  test: () ->\r
+    confirm( @has_picture() )\r
+    confirm( @has_part() )\r
+    confirm( @parts() )\r
+    confirm( @has_helper('column_name') )\r
+    confirm( @element_name() )\r
+    confirm( @extend_column() )\r
+    confirm( @extend_element_name() )\r
+    confirm( @find_configurations(window.configurations,'v') )\r
+    confirm( @new_index() )\r
+    confirm( @set_new_index(3) )\r
+    confirm( @set_new_panel('v') )\r
+    confirm( @get_new_panel() )\r
+    confirm( '@get_panel()' )\r
+    confirm( @get_panel() )\r
+    confirm( @tag_id('c') )\r
+    confirm( @field_tag_id('f') )\r
+    confirm( @tag_panel_id() )\r
+    confirm( @tag_element_id() )\r
+    confirm( @tag_element_type() )\r
+    confirm( @tag_new_index() )\r
+    confirm( @path_name() )\r
+    confirm( @form_template() )\r
+    confirm( @scenario_template() )\r
+    confirm( @element_face_template() )\r
+    confirm( @form_helper_template('colum_name') )\r
+    confirm( @tag_attributes('column') )\r
+    confirm( @field_tag_attributes('column', 0, {}) )\r
+    confirm( @any_tag_attributes('name', {}) )\r
+    confirm( @select_tag_attributes(true, 'column', 0) )\r
+    confirm( @tag_attr('column', {}) )\r
+    confirm( @field_tag_attr('column', 1, {}) )\r
+    confirm( @any_tag_attr('name', {}) )\r
+\r
+@PanelPicture = PanelPicture\r
diff --git a/app/assets/javascripts/models/speech_balloon_template.js.coffee b/app/assets/javascripts/models/speech_balloon_template.js.coffee
new file mode 100644 (file)
index 0000000..0416833
--- /dev/null
@@ -0,0 +1,25 @@
+class SpeechBalloonTemplate extends Item\r
+  @single: () ->\r
+    'SpeechBalloonTemplate'\r
+  \r
+  @plural: () ->\r
+    'SpeechBalloonTemplates'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/story.js.coffee b/app/assets/javascripts/models/story.js.coffee
new file mode 100644 (file)
index 0000000..d635ff7
--- /dev/null
@@ -0,0 +1,25 @@
+class Story extends Item\r
+  @single: () ->\r
+    'Story'\r
+  \r
+  @plural: () ->\r
+    'Stories'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/story_sheet.js.coffee b/app/assets/javascripts/models/story_sheet.js.coffee
new file mode 100644 (file)
index 0000000..95f4b2c
--- /dev/null
@@ -0,0 +1,25 @@
+class StorySheet extends Item\r
+  @single: () ->\r
+    'StorySheet'\r
+  \r
+  @plural: () ->\r
+    'StorySheets'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/system_picture.js.coffee b/app/assets/javascripts/models/system_picture.js.coffee
new file mode 100644 (file)
index 0000000..628870b
--- /dev/null
@@ -0,0 +1,25 @@
+class SystemPicture extends Item\r
+  @single: () ->\r
+    'SystemPicture'\r
+  \r
+  @plural: () ->\r
+    'SystemPictures'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
diff --git a/app/assets/javascripts/models/writing_format.js.coffee b/app/assets/javascripts/models/writing_format.js.coffee
new file mode 100644 (file)
index 0000000..620b331
--- /dev/null
@@ -0,0 +1,25 @@
+class WritingFormat extends Item\r
+  @single: () ->\r
+    'WritingFormat'\r
+  \r
+  @plural: () ->\r
+    'WritingFormats'\r
+  \r
+  defaults: {\r
+    id: 11\r
+  } \r
+  \r
+  initialize: () ->\r
+    confirm("Welcome to Panel")\r
+  \r
+  @test: () ->\r
+    confirm( @single())\r
+    confirm( @plural() )\r
+    confirm( @class_name() )\r
+    confirm( @element_name() )\r
+    confirm( @table_name() )\r
+    \r
+  \r
+  test: () ->\r
+\r
+@Panel = Panel\r
index 5e2e622..b541b22 100644 (file)
@@ -14,6 +14,11 @@ $ ->
   ColorHelper = window.PettanrColorHelper\r
   PopupHelper = window.PettanrPopupHelper\r
   \r
+  #panel = new Panel\r
+  #pp = new PanelPicture\r
+  #pp.set_panel(panel)\r
+  #confirm( PanelPicture.test()  )\r
+  #confirm( pp.test() )\r
   find_configurations = ( hash, key) ->\r
     if typeof(hash[key]) == 'string'\r
       find_configurations(hash, hash[key])\r
index 1c96409..bc7d448 100644 (file)
@@ -1,6 +1,6 @@
 <div <%= raw elm.any_tag_attr() -%> class="sheet_panel" style="top:<%= elm.y %>px; left:<%= elm.x %>px; z-index:<%= elm.z %>;">
   <% if elm.panel -%>
-    <% panel = Panel.show elm.panel, author -%>
-    <%= render 'panels/body', :panel => panel, :author => author, :spot => nil %>
+    <%# blocked in panels/body panel = Panel.show elm.panel, author -%>
+    <%= render 'panels/body', :panel => elm.panel, :author => author, :spot => nil %>
   <% end %>
 </div>
diff --git a/vendor/plugins/content/init.rb b/vendor/plugins/content/init.rb
new file mode 100644 (file)
index 0000000..c5f49cc
--- /dev/null
@@ -0,0 +1 @@
+require 'content'
diff --git a/vendor/plugins/content/lib/content.rb b/vendor/plugins/content/lib/content.rb
new file mode 100644 (file)
index 0000000..2357006
--- /dev/null
@@ -0,0 +1,75 @@
+module ActiveRecord
+  class Base
+    module Content
+      def self.included(base)
+        base.extend(ClassMethods)
+        base.__send__ :include, InstanceMethods
+      end
+      
+      module ClassMethods
+        
+        def self.mylist_where au
+          ['panels.author_id = ?', au.id]
+        end
+        
+        def self.himlist_where au
+          ['panels.author_id = ? and panels.publish > 0', au.id]
+        end
+        
+        def self.mylist au, page = 1, page_size = Author.default_panel_picture_page_size
+          PanelPicture.where(self.mylist_where(au)).includes(PanelPicture.list_opt).order('panel_pictures.updated_at desc').offset((page -1) * page_size).limit(page_size)
+        end
+        
+        def self.himlist au, page = 1, page_size = Author.default_panel_picture_page_size
+          PanelPicture.where(self.himlist_where(au)).includes(PanelPicture.list_opt).order('panel_pictures.updated_at desc').offset((page -1) * page_size).limit(page_size)
+        end
+        
+        def self.mylist_paginate au, page = 1, page_size = Author.default_panel_picture_page_size
+          Kaminari.paginate_array(Array.new(PanelPicture.where(self.mylist_where(au)).includes(PanelPicture.list_opt).count, nil)).page(page).per(page_size)
+        end
+        
+        def self.himlist_paginate au, page = 1, page_size = Author.default_panel_picture_page_size
+          Kaminari.paginate_array(Array.new(PanelPicture.where(self.himlist_where(au)).includes(PanelPicture.list_opt).count, nil)).page(page).per(page_size)
+        end
+        
+      end
+      
+      module InstanceMethods
+        private
+        
+        public
+        
+        def visible? roles
+          if MagicNumber['run_mode'] == 0
+            return false unless guest_role_check(roles)
+          else
+            return false unless reader_role_check(roles)
+          end
+          return true if self.panel.own?(roles)
+          self.panel.visible? roles
+        end
+        
+        def supply_default
+          self.x = 0
+          self.y = 0
+          if self.picture
+            self.width = self.picture.width 
+            self.height = self.picture.height 
+          end
+          if self.panel
+            self.t = self.panel.new_t 
+            self.z = self.panel.new_z 
+          end
+        end
+        
+        def overwrite  pid
+          self.panel_id = pid
+        end
+        
+      end
+      
+    end
+    include Content
+  end
+end
+
diff --git a/vendor/plugins/element/init.rb b/vendor/plugins/element/init.rb
new file mode 100644 (file)
index 0000000..6c58bcb
--- /dev/null
@@ -0,0 +1 @@
+require 'element'
diff --git a/vendor/plugins/element/lib/element.rb b/vendor/plugins/element/lib/element.rb
new file mode 100644 (file)
index 0000000..154a9ba
--- /dev/null
@@ -0,0 +1,23 @@
+module ActiveRecord
+  class Base
+    module Element
+      def self.included(base)
+        base.extend(ClassMethods)
+        base.__send__ :include, InstanceMethods
+      end
+      
+      module ClassMethods
+      end
+      
+      module InstanceMethods
+        private
+        
+        public
+        
+      end
+      
+    end
+    include Element
+  end
+end
+
diff --git a/vendor/plugins/item/init.rb b/vendor/plugins/item/init.rb
new file mode 100644 (file)
index 0000000..e81018b
--- /dev/null
@@ -0,0 +1 @@
+require 'item'
diff --git a/vendor/plugins/item/lib/item.rb b/vendor/plugins/item/lib/item.rb
new file mode 100644 (file)
index 0000000..986bd82
--- /dev/null
@@ -0,0 +1,160 @@
+module ActiveRecord
+  class Base
+    module Item
+      def self.included(base)
+        base.extend(ClassMethods)
+        base.__send__ :include, InstanceMethods
+      end
+      
+      module ClassMethods
+        # class_name
+        # table_name
+        
+        def singular
+        end
+        
+        def plural
+        end
+        
+        def item_name
+        end
+        
+        def path_name
+        end
+        
+        def self.default_page_size
+          25
+        end
+        
+        def self.max_page_size
+          100
+        end
+        
+        def self.page prm = nil
+          page = prm.to_i
+          page = 1 if page < 1
+          page
+        end
+        
+        def self.page_size prm = self.default_page_size
+          page_size = prm.to_i
+          page_size = self.max_page_size if page_size > self.max_page_size
+          page_size = self.default_page_size if page_size < 1
+          page_size
+        end
+        
+        def self.list_where
+          'panels.publish > 0'
+        end
+        
+        def self.list page = 1, page_size = self.default_page_size
+          PanelPicture.where(self.list_where()).includes(PanelPicture.list_opt).order('panel_pictures.updated_at desc').offset((page -1) * page_size).limit(page_size)
+        end
+        
+        def self.list_paginate page = 1, page_size = self.default_page_size
+          Kaminari.paginate_array(Array.new(PanelPicture.where(self.list_where()).includes(PanelPicture.list_opt).count, nil)).page(page).per(page_size)
+        end
+        
+        def self.list_opt
+          {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}} }
+        end
+        
+        def self.list_json_opt
+          {:include => {:panel => {:include => {:author => {}}}, :picture => {:include => {:artist => {}, :license => {}}} }}
+        end
+        
+        def self.show cid, au
+          opt = {}
+          opt.merge!(PanelPicture.show_opt)
+          res = PanelPicture.find(cid, opt)
+          raise ActiveRecord::Forbidden unless res.visible?(au)
+          res
+        end
+        
+        def self.show_opt
+          {:include => {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}}}}
+        end
+        
+        def self.show_json_opt
+          {:include => {:panel => {:include => {:author => {}}}, :picture => {:include => {:artist => {}, :license => {}}} }}
+        end
+        
+      end
+      
+      module InstanceMethods
+        private
+        
+        public
+        
+        def item_name
+        end
+        
+        def item_id 
+          self.new_record? ? '0' : self.id.to_s
+        end
+        
+        def tag_item_id c = nil
+          self.item_name + self.item_id + c.to_s
+        end
+        
+        def tag_item_field_id field_name
+          self.tag_item_id + field_name.to_s
+        end
+        
+        def path_name with_engine = false
+          self.class.path_name(with_engine)
+        end
+        
+        def form_template with_engine = false
+          self.path_name(with_engine) + '/form'
+        end
+        
+        def tag_item_attributes column = nil, opt = {}
+          {
+            :id => self.field_tag_id(column), :panel_id => self.tag_panel_id, 
+            :element_id => self.tag_element_id, :element_type => self.tag_element_type
+          }.merge(opt)
+        end
+        
+        def field_tag_attributes column, no_attr, opt = {}
+          self.tag_attributes(column).merge(
+            {:column => column, :new_index => self.tag_new_index, :no_attr => no_attr}
+          ).merge(opt)
+        end
+        
+        #render element by body
+        def any_tag_attributes name = nil, opt = {}
+          r = self.tag_attributes(name)
+          r.merge!(
+            {:new_index => self.tag_new_index}
+          ) if self.new_index
+          r.merge(opt)
+        end
+        
+        def select_tag_attributes(selected, column, no_attr)
+          [
+            :last, :first, 
+            {:html => {:selected => selected}}, 
+            self.field_tag_attributes(column, no_attr)
+          ]
+        end
+        
+        def tag_attr column = nil, opt = {}
+          self.tag_attributes(column, opt).to_attr
+        end
+        
+        def field_tag_attr column, no_attr, opt = {}
+          self.field_tag_attributes(column, no_attr, opt).to_attr
+        end
+        
+        def any_tag_attr name = nil, opt = {}
+          self.any_tag_attributes(name, opt).to_attr
+        end
+        
+      end
+      
+    end
+    include Item
+  end
+end
+