OSDN Git Service

fix js filer
authoryasushiito <yas@pen-chan.jp>
Fri, 8 Aug 2014 06:35:55 +0000 (15:35 +0900)
committeryasushiito <yas@pen-chan.jp>
Fri, 8 Aug 2014 06:35:55 +0000 (15:35 +0900)
59 files changed:
app/assets/javascripts/ap.js
app/assets/javascripts/local_manifest/filer/caption/default/link/action.js.coffee
app/assets/javascripts/local_manifest/filer/caption/default/link/base.js.coffee
app/assets/javascripts/local_manifest/filer/symbol/default/face/base.js.coffee
app/assets/javascripts/local_manifest/filer/symbol/default/face/image.js.coffee
app/assets/javascripts/local_manifest/filer/symbol/default/link/action.js.coffee
app/assets/javascripts/local_manifest/filer/symbol/default/link/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/face.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/face/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/face/column.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/face/method.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/face/none.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/link.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/link/action.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/link/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/link/none.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/link/url_column.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/none.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/template.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/date/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/date/default.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/date/none.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/edit/account.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/edit/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/edit/default.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/edit/none.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/edit/template.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/icon/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/icon/default.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/icon/none.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/summary/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/summary/template.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/face.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/face/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/face/image.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/face/picture.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/link.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/template.js.coffee
app/assets/javascripts/main.js.coffee
app/assets/javascripts/models/admin.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/artist.js.coffee
app/assets/javascripts/models/author.js.coffee
app/assets/javascripts/models/demander.js.coffee [new file with mode: 0644]
app/assets/javascripts/models/user.js.coffee [new file with mode: 0644]
app/assets/javascripts/pettanr.js.coffee
app/assets/javascripts/pettanr/operator.js.coffee [new file with mode: 0644]
app/views/layouts/ap.html.erb
app/views/top/ap.html.erb
spec/factories/panel.rb
spec/factories/writing_format.rb
spec/peta/leaf_spec.rb
spec/peta/root_spec.rb
spec/peta/template_spec.rb

index 50a3d42..808206e 100644 (file)
 //= require ./i18n/translations
 //= require_directory ./models
 //= require_directory ./views
+//= require_directory ./pettanr
 //= require main
index a24e6db..f3147d2 100644 (file)
@@ -9,6 +9,9 @@ class LocalManifest.FilerModule.CaptionModule.DefaultModule.LinkModule.ActionLin
     @action_name = @args['action_name']\r
   \r
   action_path: () ->\r
-    a = @action_name == 'show' ? '' : @action_name + '/'\r
-    '/' + this.filer.item_class.path_name + '/' + a\r
+    a = if @action_name == 'show'\r
+      ''\r
+    else\r
+      @action_name + '/'\r
+    '/' + this.filer().item_class.path_name() + '/' + a\r
   \r
index 1526ce0..09fa16a 100644 (file)
@@ -7,5 +7,5 @@ class LocalManifest.FilerModule.CaptionModule.DefaultModule.LinkModule.BaseLink
     super()\r
   \r
   filer: () ->\r
-    @parent.filer\r
+    @parent.filer()\r
 \r
index 34fd67e..57f6764 100644 (file)
@@ -9,5 +9,5 @@ class LocalManifest.FilerModule.SymbolModule.DefaultModule.FaceModule.BaseFace e
     @item_name = @args.item_name\r
   \r
   filer: () ->\r
-    @parent.filer\r
+    @parent.filer()\r
 \r
index 0e070b3..11dd9ac 100644 (file)
@@ -2,7 +2,7 @@ class LocalManifest.FilerModule.SymbolModule.DefaultModule.FaceModule.ImageFace
   \r
   set_default: () ->\r
     super()\r
-    @args['url'] ||= '/images/' + this.filer.item_name + '.gif'\r
+    @args['url'] ||= '/images/' + @filer().item_name() + '.gif'\r
     \r
   init: () ->\r
     super()\r
index f792415..fdc3fa3 100644 (file)
@@ -9,6 +9,9 @@ class LocalManifest.FilerModule.SymbolModule.DefaultModule.LinkModule.ActionLink
     @action_name = @args['action_name']\r
   \r
   action_path: () ->\r
-    a = @action_name == 'show' ? '' : @action_name + '/'\r
-    '/' + this.filer.item_class.path_name + '/' + a\r
+    a = if @action_name == 'show'\r
+      ''\r
+    else\r
+      @action_name + '/'\r
+    '/' + this.filer().item_class.path_name() + '/' + a\r
   \r
index 2a96ef5..b53f82e 100644 (file)
@@ -9,5 +9,5 @@ class LocalManifest.FilerModule.SymbolModule.DefaultModule.LinkModule.BaseLink e
     @item_name = @args.item_name\r
   \r
   filer: () ->\r
-    @parent.filer\r
+    @parent.filer()\r
 \r
index 5ba9692..ac0b895 100644 (file)
@@ -4,14 +4,18 @@ class Locmare.FilerModule.BodyModule.FileBody extends Backbone.View
   initialize: (options) ->\r
     @body = options.body\r
     _this = this\r
-    @file_items = @collection().fetch({}).done(() -> _this.render())\r
+    @collection().fetch({}) #.done(() -> _this.set_file_items())\r
+  \r
+  set_file_items: () ->\r
+    @file_items = this.collection\r
   \r
   render: () ->\r
     _this = this\r
+    @file_items = this.collection().models\r
     _.each @collection().models, (item) ->\r
       c = _this.file_item_class()\r
       file_item = new c({'file_body': _this, 'item': item})\r
-      args = {'file_body': _this}\r
+      args = {'file_item': file_item}\r
       template = _.template($("#" + file_item.template_name()).html())\r
       _this.$el.append(template(args))\r
     this\r
index caf330d..65d8749 100644 (file)
@@ -1,16 +1,16 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItem extends Backbone.View\r
   tagName: 'li'\r
-  class: "filer-item filer-item---file_item.item_name-"\r
   \r
   initialize: (options) ->\r
     @file_body = options.file_body\r
     @item = options.item\r
     @symbol = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnFactory.factory this, @manifest().symbol, @item\r
     @caption = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnFactory.factory this, @manifest().caption, @item\r
-    @summary = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SummaryItemColumnFactory.factory this, @manifest().manifest.summary, @item\r
+    @summary = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SummaryItemColumnFactory.factory this, @manifest().summary, @item\r
     @icon = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColumnFactory.factory this, @manifest().icon, @item\r
     @date = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.DateItemColumnFactory.factory this, @manifest().date, @item\r
     @edit = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColumnFactory.factory this, @manifest().edit, @item\r
+    @el.className = 'filer-item filer-item-' + @item.item_name()\r
   \r
   render: () ->\r
     args = {'header': this}\r
index 0d5612b..292a6f7 100644 (file)
@@ -6,6 +6,19 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
     @my_manifest = options.my_manifest\r
     @item = options.item\r
     @column_name = 'caption'\r
+    @el.className = 'filer-item-' + @column_name\r
+  \r
+  render_column: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @column_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
+  \r
+  render_item: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @item_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
   \r
   filer: () ->\r
     @file_item.filer()\r
@@ -17,7 +30,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
     @filer().item_name\r
   \r
   column_template_dir: () ->\r
-    @filer().template_dir() + 'item_column-'\r
+    @filer().template_dir + 'item_column-'\r
   \r
   column_template_file_name: () ->\r
     raise "undefined column_template_file_name\n"\r
@@ -26,7 +39,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
     @column_template_dir() + @column_template_file_name()\r
   \r
   item_template_dir: () ->\r
-    @filer().template_dir() + 'caption-'\r
+    @filer().template_dir + 'caption-'\r
   \r
   item_template_file_name: () ->\r
     raise "undefined item_template_file_name\n"\r
index 6ca4a1a..12afda8 100644 (file)
@@ -10,7 +10,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
     'show'\r
   \r
   item_template_file_name: () ->\r
-    if @my_manifest.link.type() == 'none'\r
+    if @my_manifest.link.type == 'none'\r
       'default_without_link'\r
     else\r
       'default'\r
index 23128cf..a48a9aa 100644 (file)
@@ -1,20 +1,22 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceFactory\r
   \r
   @types: () ->\r
+    m = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule\r
     {\r
-      'column': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule.ColumnFace, \r
-      'method': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule.MethodFace, \r
-      'none': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule.NoneFace\r
+      'column': m.ColumnFace, \r
+      'method': m.MethodFace, \r
+      'none': m.NoneFace\r
     }\r
   \r
-  @factory: (file_item, my_manifest, item) ->\r
+  @factory: (default_caption, my_manifest, item) ->\r
     type = my_manifest.type\r
     if not type\r
-      alert_message "undefined type for local view filers > #{file_item.item_name} > caption > face\n"\r
-    my_class = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceFactory.types()[type]\r
+      ManifestBase.alert_message 'undefined type', "local view filers > #{default_caption.item_name} > caption > face\n"\r
+    m = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceFactory\r
+    my_class = m.types()[type]\r
     if not my_class\r
-      alert_message "undefined class for local view filers > #{file_item.item_name} > caption > face > #{type}\n"\r
-    new my_class({'file_item': file_item, 'my_manifest': my_manifest, 'item': item})\r
+      ManifestBase.alert_message 'undefined class', "local view filers > #{default_caption.item_name} > caption > face > #{type}\n"\r
+    new my_class({default_caption: default_caption, my_manifest: my_manifest, item: item})\r
   \r
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule\r
 \r
index 19bedfb..f8b840b 100644 (file)
@@ -2,10 +2,16 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
   tagName: 'div'\r
   \r
   initialize: (options) ->\r
-    @file_item = options.file_item\r
-    @default_caption = options.my_manifest\r
+    @default_caption = options.default_caption\r
+    @my_manifest = options.my_manifest\r
     @item = options.item\r
   \r
+  render: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
+  \r
   filer: () ->\r
     @default_caption.filer()\r
   \r
index 6effeae..91e9b93 100644 (file)
@@ -1,11 +1,14 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule.ColumnFace extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule.BaseFace\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   template_file_name: () ->\r
-    if @face.is_blank()\r
+    if Pettanr.is_blank(@face())\r
       'empty'\r
     else\r
       'column'\r
   \r
   face: () ->\r
-    @item.get(@my_manifest.column_name())\r
+    @item.get(@my_manifest.column_name)\r
   \r
index 1de23d9..200127d 100644 (file)
@@ -1,7 +1,10 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule.MethodFace extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule.BaseFace\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   @template_file_name: () ->\r
-    if @face.is_blank()\r
+    if @face().is_blank()\r
       'empty'\r
     else\r
       'column'\r
index ae72d84..bdc1d41 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule.NoneFace extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule.BaseFace\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   template_file_name: () ->\r
     'none'\r
 \r
index 714b061..a04947c 100644 (file)
@@ -1,21 +1,22 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkFactory\r
   \r
   @types: () ->\r
+    m = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule\r
     {\r
-      'action': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule.ActionLink, \r
-      'none': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule.NoneLink, \r
-      'url_column': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule.UrlColumnLink\r
+      'action': m.ActionLink, \r
+      'none': m.NoneLink, \r
+      'url_column': m.UrlColumnLink\r
     }\r
   \r
-  @factory: (file_item, my_manifest, item) ->\r
+  @factory: (default_caption, my_manifest, item) ->\r
     type = my_manifest.type\r
     if not type\r
-      alert_message "undefined type for local view filers > #{file_item.item_name} > caption > link\n"\r
-    my_class = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkFactory.types()[type]\r
+      ManifestBase.alert_message 'undefined type', "local view filers > #{default_caption.item_name} > caption > link\n"\r
+    m = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkFactory\r
+    my_class = m.types()[type]\r
     if not my_class\r
-      alert_message "undefined class for local view filers > #{file_item.item_name} > caption > link > #{type}\n"\r
-    new my_class({'file_item': file_item, 'my_manifest': my_manifest, 'item': item})\r
+      ManifestBase.alert_message 'undefined class', "local view filers > #{default_caption.item_name} > caption > link > #{type}\n"\r
+    new my_class({default_caption: default_caption, my_manifest: my_manifest, item: item})\r
   \r
-    \r
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule\r
 \r
index fc35293..9291220 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule.ActionLink extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule.BaseLink\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   url: () ->\r
     @my_manifest.action_path() + @item.get('id').toString()\r
   \r
index a2e8e75..d2c152e 100644 (file)
@@ -2,8 +2,8 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
   tagName: 'div'\r
   \r
   initialize: (options) ->\r
-    @file_item = options.file_item\r
-    @default_caption = options.my_manifest\r
+    @default_caption = options.default_caption\r
+    @my_manifest = options.my_manifest\r
     @item = options.item\r
   \r
   url: () ->\r
index 12a5a22..4c5faf1 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule.NoneLink extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule.BaseLink\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   url: () ->\r
     null\r
     \r
index 24631e5..8090a4e 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule.UrlColumnLink extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.LinkModule.BaseLink\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   url: () ->\r
     @item.get(@my_manifest.column_name())\r
 \r
index 80340b1..1b913a4 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.None extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   column_template_file_name: () ->\r
     'none'\r
   \r
index bcda9c7..f8d6883 100644 (file)
@@ -1,4 +1,7 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.Template extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   template_file_name: () ->\r
     @my_manifest.template_name()\r
index 0db33a3..859a20e 100644 (file)
@@ -3,9 +3,22 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.DateItemColum
   \r
   initialize: (options) ->\r
     @file_item = options.file_item\r
-    @date_manifest = options.my_manifest\r
+    @my_manifest = options.my_manifest\r
     @item = options.item\r
     @column_name = 'date'\r
+    @el.className = 'filer-item-' + @column_name\r
+  \r
+  render_column: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @column_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
+  \r
+  render_item: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @item_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
   \r
   filer: () ->\r
     @file_item.filer()\r
@@ -14,10 +27,10 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.DateItemColum
     @filer.manifest\r
   \r
   item_name: () ->\r
-    @filer.item_name\r
+    @filer().item_name\r
   \r
   column_template_dir: () ->\r
-    @filer.template_dir + 'item_column-'\r
+    @filer().template_dir + 'item_column-'\r
   \r
   column_template_file_name: () ->\r
     raise "undefined column_template_file_name\n"\r
@@ -26,7 +39,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.DateItemColum
     @column_template_dir() + @column_template_file_name()\r
   \r
   item_template_dir: () ->\r
-    @filer.template_dir + 'date-'\r
+    @filer().template_dir + 'date-'\r
   \r
   item_template_file_name: () ->\r
     raise "undefined item_template_file_name\n"\r
index b8972d0..a16b9f1 100644 (file)
@@ -1,8 +1,14 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.DateItemColumnModule.Default extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.DateItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   column_template_file_name: () ->\r
     'show'\r
   \r
   item_template_file_name: () ->\r
     'default'\r
   \r
+  time_ago: () ->\r
+    Pettanr.AppHelper.distance_of_time_in_words_to_now @item.get('updated_at')\r
+  \r
index 15a3789..e63a7c4 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.DateItemColumnModule.None extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.DateItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   column_template_file_name: () ->\r
     'none'\r
   \r
index fc5e555..d17fd06 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColumnModule.Account extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   column_template_file_name: () ->\r
     'show'\r
   \r
@@ -12,10 +15,13 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
   edit_img_file_name: () ->\r
     @image_dir() + 'edit.png'\r
    \r
+  icon_size: () ->\r
+    Manifest.manifest().magic_numbers['thumbnail_width'] / 2\r
+  \r
   img_opt: () ->\r
     {\r
-      'width': Manifest.manifest.magic_numbers['thumbnail_width'] / 2, \r
-      'height': Manifest.manifest.magic_numbers['thumbnail_height'] / 2\r
+      'width': Manifest.manifest().magic_numbers['thumbnail_width'] / 2, \r
+      'height': Manifest.manifest().magic_numbers['thumbnail_height'] / 2\r
     }\r
   \r
   edit_img_opt: () ->\r
index 43ebcd8..f7b0489 100644 (file)
@@ -3,9 +3,22 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
   \r
   initialize: (options) ->\r
     @file_item = options.file_item\r
-    @date_manifest = options.my_manifest\r
+    @my_manifest = options.my_manifest\r
     @item = options.item\r
     @column_name = 'edit'\r
+    @el.className = 'filer-item-' + @column_name\r
+  \r
+  render_column: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @column_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
+  \r
+  render_item: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @item_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
   \r
   filer: () ->\r
     @file_item.filer()\r
@@ -17,10 +30,10 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
     @filer().item_name\r
   \r
   image_dir: () ->\r
-    @filer().image_dir\r
+    @filer().image_dir()\r
   \r
   column_template_dir: () ->\r
-    @filer().template_dir + 'item_column/'\r
+    @filer().template_dir + 'item_column-'\r
   \r
   column_template_file_name: () ->\r
     raise "undefined column_template_file_name\n"\r
@@ -29,7 +42,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
     @column_template_dir() + @column_template_file_name()\r
   \r
   item_template_dir: () ->\r
-    @filer().template_dir + 'edit/'\r
+    @filer().template_dir + 'edit-'\r
   \r
   item_template_file_name: () ->\r
     raise "undefined item_template_file_name\n"\r
index b837813..3006b39 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColumnModule.Default extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   column_template_file_name: () ->\r
     'show'\r
   \r
index f6be2f8..bf407ca 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColumnModule.None extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   column_template_file_name: () ->\r
     'none'\r
   \r
index 4764054..5fd8437 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColumnModule.Template extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   column_template_file_name: () ->\r
     'show'\r
   \r
@@ -7,7 +10,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
     'template'\r
   \r
   template_dir: () ->\r
-    @item.path_name() + '/'\r
+    @item.path_name() + '-'\r
   \r
   template_file_name: () ->\r
     @my_manifest.template_name()\r
index e4207e5..a6244ef 100644 (file)
@@ -3,9 +3,22 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColum
   \r
   initialize: (options) ->\r
     @file_item = options.file_item\r
-    @date_manifest = options.my_manifest\r
+    @my_manifest = options.my_manifest\r
     @item = options.item\r
     @column_name = 'icon'\r
+    @el.className = 'filer-item-' + @column_name\r
+  \r
+  render_column: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @column_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
+  \r
+  render_item: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @item_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
   \r
   filer: () ->\r
     @file_item.filer()\r
@@ -17,7 +30,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColum
     @filer().item_name\r
   \r
   column_template_dir: () ->\r
-    @filer().template_dir() + 'item_column-'\r
+    @filer().template_dir + 'item_column-'\r
   \r
   column_template_file_name: () ->\r
     raise "undefined column_template_file_name\n"\r
@@ -26,7 +39,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColum
     @column_template_dir() + @column_template_file_name()\r
   \r
   item_template_dir: () ->\r
-    @filer().template_dir() + 'icon-'\r
+    @filer().template_dir + 'icon-'\r
   \r
   item_template_file_name: () ->\r
     raise "undefined item_template_file_name\n"\r
index 6a1a0bd..614a96f 100644 (file)
@@ -1,8 +1,14 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColumnModule.Default extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   column_template_file_name: () ->\r
     'show'\r
   \r
+  path_name: () ->\r
+    '/' + @manifest().item_class.path_name() + '/' + @item.get('id').toString() + '.prof'\r
+  \r
   item_template_file_name: () ->\r
     'default'\r
   \r
index c36869a..5144949 100644 (file)
@@ -1,5 +1,8 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColumnModule.None extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   column_template_file_name: () ->\r
     'none'\r
   \r
index cf91ad9..b08a70d 100644 (file)
@@ -3,9 +3,22 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SummaryItemCo
   \r
   initialize: (options) ->\r
     @file_item = options.file_item\r
-    @date_manifest = options.my_manifest\r
+    @my_manifest = options.my_manifest\r
     @item = options.item\r
     @column_name = 'summary'\r
+    @el.className = 'filer-item-' + @column_name\r
+  \r
+  render_column: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @column_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
+  \r
+  render_item: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @item_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
   \r
   filer: () ->\r
     @file_item.filer()\r
@@ -17,7 +30,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SummaryItemCo
     @filer().item_name\r
   \r
   column_template_dir: () ->\r
-    @filer().template_dir() + 'item_column-'\r
+    @filer().template_dir + 'item_column-'\r
   \r
   column_template_file_name: () ->\r
     raise "undefined column_template_file_name\n"\r
index cf2fede..2288700 100644 (file)
@@ -1,17 +1,17 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SummaryItemColumnModule.Template extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SummaryItemColumnModule.Base\r
   \r
+  initialize: (options) ->\r
+    super(options)\r
+  \r
   column_template_file_name: () ->\r
     'show'\r
   \r
-  item_template_file_name: () ->\r
-    'template'\r
-  \r
   template_dir: () ->\r
     @item.path_name() + '-'\r
   \r
   template_file_name: () ->\r
-    @my_manifest.template_name()\r
+    @my_manifest.template_name\r
   \r
-  template_name: () ->\r
+  item_template_name: () ->\r
     @template_dir() + @template_file_name()\r
  \r
index aa87e37..c0ea7d0 100644 (file)
@@ -6,6 +6,19 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
     @my_manifest = options.my_manifest\r
     @item = options.item\r
     @column_name = 'symbol'\r
+    @el.className = 'filer-item-' + @column_name\r
+  \r
+  render_column: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @column_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
+  \r
+  render_item: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @item_template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
   \r
   filer: () ->\r
     @file_item.filer()\r
@@ -26,7 +39,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
     @column_template_dir() + @column_template_file_name()\r
   \r
   item_template_dir: () ->\r
-    @filer().template_dir() + 'symbol-'\r
+    @filer().template_dir + 'symbol-'\r
   \r
   item_template_file_name: () ->\r
     raise "undefined item_template_file_name\n"\r
index 23aba6f..a969bad 100644 (file)
@@ -10,7 +10,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
     'show'\r
   \r
   item_template_file_name: () ->\r
-    if @symbol_manifest.link.type == 'none'\r
+    if @my_manifest.link.type == 'none'\r
       'default_without_link'\r
     else\r
       'default'\r
index be85b1e..0a6de73 100644 (file)
@@ -1,16 +1,20 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.FaceFactory\r
   \r
   @types: () ->\r
+    m = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.FaceModule\r
     {\r
-      'image': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.FaceModule.ImageFace, \r
-      'picture': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.FaceModule.PictureFace\r
+      'image': m.ImageFace, \r
+      'picture': m.PictureFace\r
     }\r
   \r
   @factory: (default_symbol, my_manifest, item) ->\r
     type = my_manifest.type\r
-    ManifestBase.alert_message('undefined type', "local view filers > #{default_symbol.item_name} > symbol > link\n") if not type\r
-    my_class = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.FaceFactory.types()[type]\r
-    ManifestBase.alert_message('undefined class', "local view filers > #{default_symbol.item_name} > symbol > face > #{type}\n") if not my_class\r
+    if not type\r
+      ManifestBase.alert_message 'undefined type', "local view filers > #{default_symbol.item_name} > symbol > link\n"\r
+    m = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.FaceFactory\r
+    my_class = m.types()[type]\r
+    if not my_class\r
+      ManifestBase.alert_message 'undefined class', "local view filers > #{default_symbol.item_name} > symbol > face > #{type}\n"\r
     new my_class({default_symbol: default_symbol, my_manifest: my_manifest, item: item})\r
     \r
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.FaceModule\r
index ae90522..18c7443 100644 (file)
@@ -6,6 +6,12 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
     @my_manifest = options.my_manifest\r
     @item = options.item\r
   \r
+  render: () ->\r
+    args = {'item_column': this}\r
+    template = _.template($("#" + @template_name()).html())\r
+    this.$el.html(template(args))\r
+    this\r
+  \r
   filer: () ->\r
     @default_symbol.filer()\r
   \r
index cb8f476..6e23fcd 100644 (file)
@@ -9,6 +9,9 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   url: () ->\r
     @my_manifest.url\r
   \r
+  icon_size: () ->\r
+    Manifest.manifest().magic_numbers['thumbnail_width']\r
+  \r
   tag_opt: () ->\r
     {'src': @url(), 'width': Manifest.manifest().magic_numbers['thumbnail_width'], 'height': Manifest.manifest().magic_numbers['thumbnail_height']}\r
   \r
index 0b15d8c..692306c 100644 (file)
@@ -9,6 +9,12 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   method_name: () ->\r
     @my_manifest.method_name()\r
   \r
+  url: () ->\r
+    if @item.methods(true).is_include(@method_name())\r
+      @item[@method_name()]()\r
+    else\r
+      '/images/error.png'\r
+  \r
   tag_opt: () ->\r
     if @item.methods(true).is_include(@method_name())\r
       @item[@method_name()]()\r
index f587cb8..991ecb1 100644 (file)
@@ -1,17 +1,21 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.LinkFactory\r
   \r
   @types: () ->\r
+    m = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.LinkModule\r
     {\r
-      'action': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.LinkModule.ActionLink, \r
-      'none': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.LinkModule.NoneLink, \r
-      'url_column': Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.LinkModule.UrlColumnLink\r
+      'action': m.ActionLink, \r
+      'none': m.NoneLink, \r
+      'url_column': m.UrlColumnLink\r
     }\r
   \r
   @factory: (default_symbol, my_manifest, item) ->\r
     type = my_manifest.type\r
-    ManifestBase.alert_message('undefined type', "local view filers > #{default_symbol.item_name} > symbol > link\n") if not type\r
-    my_class = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.LinkFactory.types()[type]\r
-    ManifestBase.alert_message('undefined class', "local view filers > #{default_symbol.item_name} > symbol > link > #{type}\n") if not my_class\r
+    if not type\r
+      ManifestBase.alert_message('undefined type', "local view filers > #{default_symbol.item_name} > symbol > link\n")\r
+    m = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.LinkFactory\r
+    my_class = m.types()[type]\r
+    if not my_class\r
+      ManifestBase.alert_message('undefined class', "local view filers > #{default_symbol.item_name} > symbol > link > #{type}\n")\r
     new my_class({default_symbol: default_symbol, my_manifest: my_manifest, item: item})\r
     \r
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.LinkModule\r
index 1851a77..ab02ef1 100644 (file)
@@ -13,7 +13,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
     @item.path_name() + '-'\r
   \r
   template_file_name: () ->\r
-    @symbol_manifest.template_name()\r
+    @my_manifest.template_name()\r
   \r
   template_name: () ->\r
     @template_dir() + @template_file_name()\r
index 2539178..a201419 100644 (file)
@@ -24,18 +24,17 @@ $ ->
     on_open: () ->\r
       @render()\r
     render: () ->\r
-      class ArCol extends Backbone.Collection\r
-        model: Pettanr.Artist\r
-        url: '/artists'\r
-      cc = new ArCol({})\r
-      cc.fetch({})\r
   class ArtistCollection extends Backbone.Collection\r
     model: Pettanr.Artist\r
     url: '/artists'\r
   cc = new ArtistCollection({})\r
   cc.fetch({})\r
   list_result = null\r
-  operators = null\r
+  author = new Pettanr.Author({id: author_id})\r
+  author.fetch({})\r
+  artist = new Pettanr.Artist({id: artist_id})\r
+  artist.fetch({})\r
+  operators = new Pettanr.Operator([author, artist])\r
   v = new Locmare.Filer({\r
     item_name: 'artist', \r
     collection: cc, \r
diff --git a/app/assets/javascripts/models/admin.js.coffee b/app/assets/javascripts/models/admin.js.coffee
new file mode 100644 (file)
index 0000000..d511faf
--- /dev/null
@@ -0,0 +1,9 @@
+class Pettanr.Admin extends Backbone.Model\r
+  \r
+  defaults: {\r
+    id: null\r
+  } \r
+  \r
+  initialize: () ->\r
+  \r
+\r
index 051e898..427e6da 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.Artist extends Peta.Owner\r
+  url: '/artists/'\r
+  \r
   @singular: () ->\r
     'Artist'\r
   \r
@@ -11,5 +13,6 @@ class Pettanr.Artist extends Peta.Owner
   } \r
   \r
   initialize: () ->\r
-  \r
+    if @id\r
+      @url = @url + @id\r
 \r
index 2db7564..8a6d2c3 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.Author extends Peta.Owner\r
+  url: '/authors/'\r
+  \r
   @singular: () ->\r
     'Author'\r
   \r
@@ -11,5 +13,7 @@ class Pettanr.Author extends Peta.Owner
   } \r
   \r
   initialize: () ->\r
-  \r
+    if @id\r
+      @url = @url + @id\r
+\r
 \r
diff --git a/app/assets/javascripts/models/demander.js.coffee b/app/assets/javascripts/models/demander.js.coffee
new file mode 100644 (file)
index 0000000..59d3484
--- /dev/null
@@ -0,0 +1,9 @@
+class Pettanr.Demander extends Backbone.Model\r
+  \r
+  defaults: {\r
+    id: null\r
+  } \r
+  \r
+  initialize: () ->\r
+  \r
+\r
diff --git a/app/assets/javascripts/models/user.js.coffee b/app/assets/javascripts/models/user.js.coffee
new file mode 100644 (file)
index 0000000..469fde4
--- /dev/null
@@ -0,0 +1,16 @@
+class Pettanr.User extends Backbone.Model\r
+  \r
+  url: '/users/'\r
+  \r
+  defaults: {\r
+    id: null\r
+  } \r
+  \r
+  author: () ->\r
+  \r
+  artist: () ->\r
+  \r
+  initialize: () ->\r
+    if @id\r
+      @url = @url + @id\r
+  \r
index 3704d7e..1dc7510 100644 (file)
@@ -1,4 +1,7 @@
 class Pettanr\r
+  @is_blank: (str) ->\r
+    !str?.trim()\r
+  \r
   class Pettanr.AppHelper\r
     @manifest: () ->\r
       Manifest.manifest\r
@@ -23,6 +26,13 @@ class Pettanr
     @t_selected_item: (name, index) ->\r
       I18n.t(Manifest.manifest().system_resources.select_items[name][index][0])\r
     \r
+    @image_tag: (src, opt = {}) ->\r
+      size = if opt['size']\r
+        parseInt(opt['size'])\r
+      else\r
+        35\r
+      "<img src=\"" + src + "\" width=" + size.toString() + " height=" + size.toString() + ">"\r
+    \r
     @icon_tag: (name, opt = {}) ->\r
       title = if opt['object']\r
         name + ' ID:' + opt['object'].get(id).toString()\r
@@ -33,6 +43,9 @@ class Pettanr
       else\r
         35\r
       "<img src=\"" + '/images/' + Pettanr.underscore(name) + '.gif' + "\" width=" + size.toString() + " height=" + size.toString() + " alt=\"" + name + ' Icon' + "title=\"" + title + ">"\r
+    \r
+    @distance_of_time_in_words_to_now: (datetime) ->\r
+      datetime\r
 \r
   class Pettanr.AppController\r
 \r
diff --git a/app/assets/javascripts/pettanr/operator.js.coffee b/app/assets/javascripts/pettanr/operator.js.coffee
new file mode 100644 (file)
index 0000000..e0d8ee8
--- /dev/null
@@ -0,0 +1,71 @@
+class Pettanr.Operator\r
+  \r
+  initialize: (operators) ->\r
+    @operators = operators\r
+  \r
+  #InstanceMethods\r
+  find_user: () ->\r
+    _.each @operators, (operator) ->\r
+      return operator if operator instanceof Pettanr.User\r
+      return operator.user if operator instanceof Pettanr.Author\r
+      return operator.user if operator instanceof Pettanr.Artist\r
+    nil\r
+  \r
+  find_author: () ->\r
+    _.each @operators, (operator) ->\r
+      return operator if operator instanceof Pettanr.Author\r
+      return operator.author if operator instanceof Pettanr.User\r
+      return operator.user.author if (operator instanceof Pettanr.Artist) and operator.user.author\r
+    nil\r
+  \r
+  find_artist: () ->\r
+    _.each @operators, (operator) ->\r
+      return operator.user.artist if (operator instanceof Pettanr.Author) and operator.user.artist\r
+      return operator.artist if operator instanceof Pettanr.User\r
+      return operator if operator instanceof Pettanr.Artist\r
+    nil\r
+  \r
+  find_admin: () ->\r
+    _.each @operators, (operator) ->\r
+      return operator if operator instanceof Pettanr.Admin\r
+    nil\r
+  \r
+  user: () ->\r
+    return @user if @user\r
+    @user = @find_user()\r
+  \r
+  author: () ->\r
+    return @author if @author\r
+    @author = @find_author()\r
+  \r
+  artist: () ->\r
+    return @artist if @artist\r
+    @artist = @find_artist()\r
+  \r
+  admin: () ->\r
+    return @admin if @admin\r
+    @admin = @find_admin()\r
+  \r
+  is_guest: () ->\r
+    true\r
+  \r
+  is_reader: () ->\r
+    _.each @operators, (operator) ->\r
+      return true if (operator instanceof Pettanr.Author) or (operator instanceof Pettanr.Artist) or (operator instanceof Pettanr.Admin) or (operator instanceof Pettanr.User)\r
+    false\r
+  \r
+  is_user: () ->\r
+    _.each @operators, (operator) ->\r
+      return true if (operator instanceof Pettanr.Author) or (operator instanceof Pettanr.Artist) or (operator instanceof Pettanr.User)\r
+    false\r
+  \r
+  is_resource_reader: () ->\r
+    _.each @operators, (operator) ->\r
+      return true if (operator instanceof Pettanr.Author) or (operator instanceof Artist) or (operator instanceof Pettanr.Admin) or (operator instanceof Pettanr.User) or (operator instanceof Pettanr.DemandUser)\r
+    false\r
+  \r
+  is_admin: () ->\r
+    _.each @operators, (operator) ->\r
+      return true if operator instanceof Pettanr.Admin\r
+    false\r
+  \r
index b4da561..25f961c 100644 (file)
@@ -4,7 +4,7 @@
   <title>\r
     ap - <%= h(manifest.magic_numbers['profile']['users']['caption']) %>\r
   </title>\r
-  <%# stylesheet_link_tag "application" %>\r
+  <%= stylesheet_link_tag "test" %>\r
   <%= javascript_include_tag "application" %>\r
   <%= javascript_include_tag "ap" %>\r
   <%# raw panel_editor_javascript_include_tags %>\r
index 055cf77..84dc66d 100644 (file)
@@ -4,6 +4,10 @@
   <a href="#" class="btn">filer</a>\r
 </div>\r
 <script type="text/javascript" id="manifest">\r
+  author_id = <%= @operators.author.id -%>;\r
+  artist_id = <%= @operators.artist.id -%>;\r
+</script>\r
+<script type="text/javascript" id="manifest">\r
 </script>\r
 <script type="text/javascript" id="local-manifest">\r
 </script>\r
@@ -19,8 +23,8 @@
 </script>\r
 <script type="text/template" id="templates-filer-body">\r
   <ul class="filer-body">\r
-    <&= body.file_header.render().el.innerHTML &>\r
-    <&= body.file_body.render().el.innerHTML &>\r
+    <&= body.file_header.render().el.outerHTML &>\r
+    <&= body.file_body.render().el.outerHTML &>\r
   </ul>\r
   <div class="row_break">\r
   </div>\r
@@ -34,7 +38,7 @@
   <&= file_header.edit.render().el.innerHTML &>\r
 </script>\r
 <script type="text/template" id="templates-filer-file_body">\r
-  <&= file_body.file_item.render().el.innerHTML &>\r
+  <&= file_body.file_item.render().el.outerHTML &>\r
 </script>\r
 <script type="text/template" id="templates-filer-header_column-show">\r
   <&= I18n.t('filer.header.' + header_column.column_name) &>\r
 <script type="text/template" id="templates-filer-header_column-none">\r
 </script>\r
 <script type="text/template" id="templates-filer-file_item">\r
-  <&= file_item.symbol.render_column().el.innerHTML &>\r
-  <&= file_item.caption.render_column().el.innerHTML &>\r
-  <&= file_item.summary.render_column().el.innerHTML &>\r
-  <&= file_item.icon.render_column().el.innerHTML &>\r
-  <&= file_item.date.render_column().el.innerHTML &>\r
-  <&= file_item.edit.render_column().el.innerHTML &>\r
+  <&= file_item.symbol.render_column().el.outerHTML &>\r
+  <&= file_item.caption.render_column().el.outerHTML &>\r
+  <&= file_item.summary.render_column().el.outerHTML &>\r
+  <&= file_item.icon.render_column().el.outerHTML &>\r
+  <&= file_item.date.render_column().el.outerHTML &>\r
+  <&= file_item.edit.render_column().el.outerHTML &>\r
 </script>\r
 <script type="text/template" id="templates-filer-item_column-show">\r
-  <&= render item_column.item_template_name, :item_column => item_column &>\r
+  <&= item_column.render_item().el.innerHTML &>\r
 </script>\r
 <script type="text/template" id="templates-filer-item_column-none">\r
 </script>\r
+\r
+<script type="text/template" id="templates-filer-symbol-default">\r
+  <a href="<&= item_column.link.url() &>">\r
+    <&= item_column.face.render().el.outerHTML &>\r
+  </a>\r
+</script>\r
+<script type="text/template" id="templates-filer-symbol-default_without_link">\r
+  <&= item_column.face.render() &>\r
+</script>\r
+<script type="text/template" id="templates-filer-symbol-template">\r
+  <&= item_column.template_name &>\r
+</script>\r
+<script type="text/template" id="templates-filer-symbol_face-image">\r
+  <&= Pettanr.AppHelper.image_tag(item_column.url(), {'size': item_column.icon_size()}) &>\r
+</script>\r
+<script type="text/template" id="templates-filer-symbol_face-picture">\r
+  <&= Pettanr.AppHelper.image_tag(item_column.url(), {'size': item_column.icon_size()}) &>\r
+</script>\r
+\r
+<script type="text/template" id="templates-filer-caption-default">\r
+  <a href="<&= item_column.link.url() &>">\r
+    <&= item_column.face.render().el.outerHTML &>\r
+  </a>\r
+</script>\r
+<script type="text/template" id="templates-filer-caption-default_without_link">\r
+  <&= item_column.face.render() &>\r
+</script>\r
+<script type="text/template" id="templates-filer-caption-template">\r
+  <&= item_column.template_name &>\r
+</script>\r
+<script type="text/template" id="templates-filer-caption_face-column">\r
+  <a href="a">\r
+    <&= item_column.face() &>\r
+  </a>\r
+</script>\r
+<script type="text/template" id="templates-filer-caption_face-method">\r
+  <&= item_column.face() &>\r
+</script>\r
+<script type="text/template" id="templates-filer-caption_face-empty">\r
+  <&= 'empty' &>\r
+</script>\r
+\r
+<script type="text/template" id="templates-filer-summary-template">\r
+  <&= item_column.template_name &>\r
+</script>\r
+<script type="text/template" id="templates-filer-summary-none">\r
+</script>\r
+\r
+<script type="text/template" id="templates-filer-icon-default">\r
+  <a href="<&= item_column.path_name() &>">\r
+    <&= Pettanr.AppHelper.image_tag(item_column.icon_file_name(), {'size': item_column.icon_size()}) &>\r
+  </a>\r
+</script>\r
+<script type="text/template" id="templates-filer-date-default">\r
+  <&= item_column.time_ago() &>\r
+</script>\r
+<script type="text/template" id="templates-filer-date-none">\r
+</script>\r
+<script type="text/template" id="templates-filer-edit-default">\r
+  <&= item_column.template_name &>\r
+  # link_to tag(:img, item_column.edit_img_opt), polymorphic_path(item_column.item, :action => :edit)\r
+  # link_to tag(:img, item_column.remove_img_opt), item_column.item, confirm: 'Are you sure?', :method => :delete \r
+</script>\r
+<script type="text/template" id="templates-filer-edit-account">\r
+  <a href="<&= '/home/configure' &>">\r
+    <&= Pettanr.AppHelper.image_tag(item_column.edit_img_file_name(), {'size': item_column.icon_size()}) &>\r
+  </a>\r
+</script>\r
+<script type="text/template" id="templates-filer-edit-template">\r
+  <&= item_column.template_name &>\r
+  # render item_column.template_name, :item => item_column.item\r
+</script>\r
+<script type="text/template" id="templates-filer-edit-none">\r
+</script>\r
+\r
+\r
+<script type="text/template" id="artists-summary">\r
+  P.\r
+</script>\r
index 0eceba5..4741a1b 100644 (file)
@@ -56,6 +56,7 @@ FactoryGirl.define do
     i.height 80\r
     i.border 2\r
     i.caption ''\r
+    i.publish 1\r
   end\r
   factory :panel_awesome, :class => Panel do |i|\r
     i.width 333\r
index 5a66f77..521b2d2 100644 (file)
@@ -15,7 +15,7 @@ FactoryGirl.define do
   end\r
   factory :writing_format_test, :class => WritingFormat do |i|\r
     i.name 'test@pettan.com'\r
-    i.module_name 'PettanrSimpleFormat'\r
+    i.module_name 'PettanrTestFormat'\r
     i.caption 'test'\r
     i.settings '{}'\r
     trait :with_system_picture do\r
index ebaee0f..86b3796 100644 (file)
@@ -20,49 +20,49 @@ describe ScrollPanel do
     before do
     end
     
-    it 'ぶら下がるそれぞれのリーフを取得できる' do
+    it '親モデルであるバインダーを取得している' do
       expect(@model.parent_model).to eq Scroll
     end
-    it 'すべてのリーフを取得できる' do
+    it '差し込むコンテンツのモデルを取得している' do
       expect(@model.destination_model).to eq Panel
     end
     
-    it 'ã\81¶ã\82\89ä¸\8bã\81\8cã\82\8bã\81\9dã\82\8cã\81\9eã\82\8cã\81®ã\83ªã\83¼ã\83\95ã\82\92å\8f\96å¾\97ã\81§ã\81\8dる' do
+    it 'ã\83\90ã\82¤ã\83³ã\83\80ã\83¼ã\82\92å\8f\96å¾\97ã\81\99ã\82\8bã\81\9fã\82\81ã\81®IDã\81®ã\82«ã\83©ã\83 ã\82\92è¿\94ã\81\97ã\81¦ã\81\84る' do
       expect(@model.binder_key).to eq 'scroll_id'
     end
     
-    it 'ぶら下がるそれぞれのリーフを取得できる' do
+    it '差し込むコンテンツを取得するためのIDのカラムを返している' do
       expect(@model.destination_key).to eq 'panel_id'
     end
     
   end
   
-  describe 'myに於いて' do
+  describe '便利機能に於いて' do
     before do
     end
     
-    it '名前の活用に於いて' do
+    it 'バインダーのIDを返している' do
       expect(@item.binder_id).to eq @scroll.id
     end
     
-    it 'å\90\8då\89\8dã\81®æ´»ç\94¨ã\81«æ\96¼ã\81\84ã\81¦' do
+    it 'å·®ã\81\97è¾¼ã\82\80ã\82³ã\83³ã\83\86ã\83³ã\83\84ã\81®IDã\82\92è¿\94ã\81\97ã\81¦ã\81\84ã\82\8b' do
       expect(@item.destination_id).to eq @panel.id
     end
   end
   
-  describe 'cutに於いて' do
-    it 'cut' do
+  describe 'クラスメソッドへのショートカットに於いて' do
+    it 'binder_keyメソッドを呼び出せる' do
       expect(@item.binder_key).to eq @model.binder_key
     end
     
-    it 'cut' do
+    it 'destination_keyメソッドを呼び出せる' do
       expect(@item.destination_key).to eq @model.destination_key
     end
     
   end
   
   describe 'playに於いて' do
-    it 'cut' do
+    it '時系列でソートできるようなSQLを返している' do
       expect(@model.play_list_order).to eq 'scroll_panels.t'
     end
     
@@ -318,40 +318,42 @@ describe StorySheet do
     # insert_shift, lesser_shift, higher_shift, update_shift, rotate
 end
 
-# 
+# I/O処理については、マニフェストで動作が変わることがないのでスクロールとスクコマでのみテストしておく
 describe ScrollPanel do
   include LeafMacros
   before do
-    @admin =FactoryGirl.create :admin
+    @admin = FactoryGirl.create :admin
     @user_yas = FactoryGirl.create :user_yas_with_owner
     @user_rom = FactoryGirl.create :user_rom
-    @author_yas =  @user_yas.author
+    @author_yas = @user_yas.author
     
     @model = ScrollPanel
   end
   
-  describe 'new_tに於いて' do
+  describe 't補充値new_tに於いて' do
     before do
-      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @dummy =  FactoryGirl.create :scroll_great_with_scroll_panels, author: @author_yas
+      @scroll = FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
     end
     
-    context 'ã\82ªã\83¼ã\82½ã\83\89ã\83\83ã\82¯ã\82¹ã\81ªã\83\87ã\83¼ã\82¿ã\81®ã\81¨ã\81\8d' do
-      it 'cut' do
+    context 'ã\82¹ã\82¯ã\83­ã\83¼ã\83«å\88\9dã\81®ã\82³ã\83\9eã\81ªã\82\89' do
+      it '0を補充値とする' do
         expect(@model.new_t(@scroll.id)).to eq 0
       end
       
     end
     
-    context 'ã\82ªã\83¼ã\82½ã\83\89ã\83\83ã\82¯ã\82¹ã\81ªã\83\87ã\83¼ã\82¿ã\81®とき' do
-      it 'cut' do
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 1, t: 0, scroll: @scroll, panel: @panel
+    context 'ã\82¹ã\82¯ã\83­ã\83¼ã\83«ã\81«ã\82³ã\83\9eã\81\8cã\81\82ã\82\8bとき' do
+      it '一個なら1を補充値とする' do
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
         expect(@model.new_t(@scroll.id)).to eq 1
       end
       
-      it 'cut' do
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 1, t: 0, scroll: @scroll, panel: @panel
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 2, t: 1, scroll: @scroll, panel: @panel
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 3, t: 2, scroll: @scroll, panel: @panel
+      it '3個なら3を補充値とする' do
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
         expect(@model.new_t(@scroll.id)).to eq 3
       end
       
@@ -359,29 +361,30 @@ describe ScrollPanel do
     
   end
   
-  describe 'collect_tに於いて' do
+  describe 't収集collect_tに於いて' do
     before do
       @dummy =  FactoryGirl.create :scroll_great_with_scroll_panels, author: @author_yas
       @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
     end
     
-    context 'オーソドックスなデータのとき' do
-      it 'cut' do
+    context '空っぽのスクロールのとき' do
+      it '当然リストは空っぽになっている' do
         expect(@model.collect_t(@scroll.id)).to be_empty
       end
       
     end
     
     context 'オーソドックスなデータのとき' do
-      it 'cut' do
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 1, t: 0, scroll: @scroll, panel: @panel
+      it 'スクコマから同一スクロールのtだけを収集している' do
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
         expect(@model.collect_t(@scroll.id)).to eq [0]
       end
       
-      it 'cut' do
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 1, t: 0, scroll: @scroll, panel: @panel
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 2, t: 1, scroll: @scroll, panel: @panel
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 3, t: 2, scroll: @scroll, panel: @panel
+      it 'スクコマから同一スクロールのtだけを収集している' do
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
         expect(@model.collect_t(@scroll.id)).to eq [0, 1, 2]
       end
       
@@ -391,192 +394,151 @@ describe ScrollPanel do
   
   describe 'tチェックに於いて' do
     before do
-      @sheet = FactoryGirl.create :sheet, :author_id => @author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-      @item = FactoryGirl.build :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-    end
-    context 'つつがなく終わるとき' do
-      it 't収集を依頼している' do
-        SheetPanel.should_receive(:collect_t).with(any_args).exactly(1)
-        SheetPanel.stub(:collect_t).with(any_args).and_return([])
-        SheetPanel.stub(:serial?).with(any_args).and_return(true)
-        r = SheetPanel.validate_t @item
-      end
-      it '収集したtをシリアライズチェック依頼している' do
-        SheetPanel.stub(:collect_t).with(any_args).and_return([])
-        SheetPanel.should_receive(:serial?).with(any_args).exactly(1)
-        SheetPanel.stub(:serial?).with(any_args).and_return(true)
-        r = SheetPanel.validate_t @item
-      end
+      @dummy =  FactoryGirl.create :scroll_great_with_scroll_panels, author: @author_yas
+      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
     end
-    #実データでチェック
-    #依頼チェックだけでは不安なので最低限のチェックを
+    #実データで最低限のチェックを
     context '新規のとき' do
       it '一件だけで正常通過している' do
-        @item = FactoryGirl.build :sheet_panel, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id, :t => 0
-        r = SheetPanel.validate_t @item
-        r.should be_true 
+        @item =  FactoryGirl.build :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        r = ScrollPanel.validate_t @item
+        expect(r).to be_true 
       end
     end
     context '既存のとき' do
       it '2件目を作っても正常通過している' do
-        @item = FactoryGirl.create :sheet_panel, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id, :t => 0
-        @item2 = FactoryGirl.build :sheet_panel, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id, :t => 1
-        r = SheetPanel.validate_t @item2
-        r.should be_true 
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.build :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        r = ScrollPanel.validate_t @item2
+        expect(r).to be_true 
       end
     end
   end
   describe '挿入シフトに於いて' do
     before do
-      @sheet = FactoryGirl.create :sheet, :author_id => @author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-    end
-    context '依頼チェック' do
-      #テーブルが空で0に挿入
-      it 'Updateを依頼している' do
-        SheetPanel.stub(:update_all).with(any_args)
-        SheetPanel.should_receive(:update_all).with(any_args).exactly(1)
-        @item = FactoryGirl.build :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item.insert_shift
-      end
+      @dummy_scroll =  FactoryGirl.create :scroll_great_with_scroll_panels, author: @author_yas
+      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
     end
     context 'テーブルに1件(t:0)で0に挿入したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.build :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.build :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
       end
       it '既存の行を1にシフトしている' do
         @item2.insert_shift
-        l = SheetPanel.find :all
-        l.first.t.should eq 1
+        @item.reload
+        expect(@item.t).to eq 1
       end
       it 'これから挿入するt(0)が欠番になっている' do
         @item2.insert_shift
-        l = SheetPanel.find(:all).map {|s| s.t }
-        l.include?(0).should_not be_true
+        @item.reload
+        expect(@item2.t).to eq 0
       end
     end
     context 'テーブルに2件(t:0,1)で1に挿入したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.build :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.build :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
       end
       it '既存のt1を2にシフトしてこれから挿入するt(1)が欠番になっている' do
         @item3.insert_shift
-        l = SheetPanel.find(:all).map {|s| s.t }
-        l.sort.should eq [0, 2]
+        @item.reload
+        @item2.reload
+        expect(@item.t).to eq 0
+        expect(@item2.t).to eq 2
       end
     end
     context 'テーブルに5件(t:0,1,2,3,4)で2に挿入したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item6 = FactoryGirl.build :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-      end
-      it '既存のt1を2にシフトしてこれから挿入するt(1)が欠番になっている' do
-        @item6.insert_shift
-        l = SheetPanel.find(:all).map {|s| s.t }
-        l.sort.should eq [0, 1, 3, 4, 5]
-      end
-    end
-    context '先ほどのケース+他の用紙1件で挿入したとき' do
-      before do
-        @sheet2 = FactoryGirl.create :sheet, :author_id => @author.id
-        @itemc2 = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet2.id, :panel_id => @panel.id, :author_id => @author.id
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item6 = FactoryGirl.build :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
+        @item6 =  FactoryGirl.build :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
       end
       it '既存のt1を2にシフトしてこれから挿入するt(1)が欠番になっている' do
         @item6.insert_shift
-        l = SheetPanel.find(:all, :conditions => ['sheet_id = ?', @sheet.id]).map {|s| s.t }
-        l.sort.should eq [0, 1, 3, 4, 5]
-      end
-      it '他の用紙に影響がない' do
-        ot = @itemc2.t
-        @item6.insert_shift
-        @itemc2.reload
-        @itemc2.t.should eq ot
+        @item.reload
+        @item2.reload
+        @item3.reload
+        @item4.reload
+        @item5.reload
+        expect(@item.t).to eq 0
+        expect(@item2.t).to eq 1
+        expect(@item3.t).to eq 3
+        expect(@item4.t).to eq 4
+        expect(@item5.t).to eq 5
       end
     end
   end
   describe '少ない方に移動に於いて' do
     before do
-      @sheet = FactoryGirl.create :sheet, :author_id => @author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-    end
-    context '依頼チェック' do
-      it 'Updateを依頼している' do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        SheetPanel.stub(:update_all).with(any_args)
-        SheetPanel.should_receive(:update_all).with(any_args).exactly(1)
-        ot = @item2.t
-        @item2.t = 0
-        @item2.lesser_shift ot
-      end
+      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
     end
     context 'テーブルに2件(t:0,1)で1を0に移動したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
         @ot = @item2.t
         @item2.t = 0
       end
       it '既存のt0を1にシフトしてこれから挿入するt(0)が欠番になっている' do
         #移動させたい行はそのまま残る
         @item2.lesser_shift @ot
-        l = SheetPanel.find(:all).map {|s| s.t }
-        l.sort.should eq [1, 1]
+        @item.reload
+        @item2.reload
+        expect(@item.t).to eq 1
+        expect(@item2.t).to eq 1
       end
       it '既存のt0を1にシフトしている' do
         @item2.lesser_shift @ot
         @item.reload
-        @item.t.should eq 1
+        expect(@item.t).to eq 1
       end
     end
     context 'テーブルに3件(t:0,1,2)で2を1に移動したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
         @ot = @item3.t
         @item3.t = 1
       end
       it '既存のt1を2にシフトしてこれから挿入するt(1)が欠番になっている' do
         #移動させたい行はそのまま残る
         @item3.lesser_shift @ot
-        l = SheetPanel.find(:all).map {|s| s.t }
-        l.sort.should eq [0, 2, 2]
+        @item.reload
+        @item2.reload
+        @item3.reload
+        expect(@item.t).to eq 0
+        expect(@item2.t).to eq 2
+        expect(@item3.t).to eq 2
       end
       it '既存のt1を2にシフトしている' do
         @item3.lesser_shift @ot
         @item2.reload
-        @item2.t.should eq 2
+        expect(@item2.t).to eq 2
       end
     end
     context 'テーブルに5件(t:0,1,2,3,4)で3を1に移動したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
         @ot = @item4.t
         @item4.t = 1
       end
       it 'これから挿入するt(1)が欠番になっている' do
         #移動させたい行はそのまま残る
         @item4.lesser_shift @ot
-        l = SheetPanel.find(:all).map {|s| s.t }
+        l = ScrollPanel.find(:all).map {|s| s.t }
         l.sort.should eq [0, 2, 3, 3, 4]
       end
       it '既存のt0には変化がない' do
@@ -600,21 +562,19 @@ describe ScrollPanel do
         @item3.t.should eq 3
       end
     end
-    context '先ほどのケース+他の用紙1件で挿入したとき' do
+    context '先ほどのケース+他のスクロール1件で挿入したとき' do
       before do
-        @sheet2 = FactoryGirl.create :sheet, :author_id => @author.id
-        @itemc2 = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet2.id, :panel_id => @panel.id, :author_id => @author.id
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
         @ot = @item4.t
         @item4.t = 1
       end
       it 'これから挿入するt(1)が欠番になっている' do
         @item4.lesser_shift @ot
-        l = SheetPanel.find(:all).map {|s| s.t }
+        l = ScrollPanel.find(:all).map {|s| s.t }
         l.sort.should eq [0, 0, 2, 3, 3, 4]
       end
       it '既存のt0には変化がない' do
@@ -637,7 +597,7 @@ describe ScrollPanel do
         @item3.reload
         @item3.t.should eq 3
       end
-      it '他の用紙に影響がない' do
+      it '他のスクロールに影響がない' do
         @item4.lesser_shift @ot
         @itemc2.reload
         @itemc2.t.should eq 0
@@ -647,15 +607,16 @@ describe ScrollPanel do
     #負のときは0として正常扱い
     context 'テーブルに2件(t:0,1)で1を-1に移動したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 = FactoryGirl.create :scroll_panel, :t => 1, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
         @ot = @item2.t
         @item2.t = -1
       end
       it '既存のt0を1にシフトしてこれから挿入するt(0)が欠番になっている' do
         #移動させたい行はそのまま残る
         @item2.lesser_shift @ot
-        l = SheetPanel.find(:all).map {|s| s.t }
+        l = ScrollPanel.find(:all).map {|s| s.t }
         l.sort.should eq [1, 1]
       end
       it '既存のt0を1にシフトしている' do
@@ -671,15 +632,16 @@ describe ScrollPanel do
   end
   describe '大きい方に移動に於いて' do
     before do
-      @sheet = FactoryGirl.create :sheet, :author_id => @author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
+      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
     end
     context '依頼チェック' do
       it 'Updateを依頼している' do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        SheetPanel.stub(:update_all).with(any_args)
-        SheetPanel.should_receive(:update_all).with(any_args).exactly(1)
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 = FactoryGirl.create :scroll_panel, :t => 1, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
+        ScrollPanel.stub(:update_all).with(any_args)
+        ScrollPanel.should_receive(:update_all).with(any_args).exactly(1)
         ot = @item.t
         @item.t = 1
         @item.higher_shift ot
@@ -687,15 +649,16 @@ describe ScrollPanel do
     end
     context 'テーブルに2件(t:0,1)で0を1に移動したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 = FactoryGirl.create :scroll_panel, :t => 1, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
         @ot = @item.t
         @item.t = 1
       end
       it '既存のt1を0にシフトしてこれから挿入するt(1)が欠番になっている' do
         #移動させたい行はそのまま残る
         @item.higher_shift @ot
-        l = SheetPanel.find(:all).map {|s| s.t }
+        l = ScrollPanel.find(:all).map {|s| s.t }
         l.sort.should eq [0, 0]
       end
       it '既存のt1を0にシフトしている' do
@@ -706,16 +669,16 @@ describe ScrollPanel do
     end
     context 'テーブルに3件(t:0,1,2)で0を1に移動したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
         @ot = @item.t
         @item.t = 1
       end
       it '既存のt1を0にシフトしてこれから挿入するt(1)が欠番になっている' do
         #移動させたい行はそのまま残る
         @item.higher_shift @ot
-        l = SheetPanel.find(:all).map {|s| s.t }
+        l = ScrollPanel.find(:all).map {|s| s.t }
         l.sort.should eq [0, 0, 2]
       end
       it '既存のt1を0にシフトしている' do
@@ -726,18 +689,18 @@ describe ScrollPanel do
     end
     context 'テーブルに5件(t:0,1,2,3,4)で1を3に移動したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
         @ot = @item2.t
         @item2.t = 3
       end
       it 'これから挿入するt(3)が欠番になっている' do
         #移動させたい行はそのまま残る
         @item2.higher_shift @ot
-        l = SheetPanel.find(:all).map {|s| s.t }
+        l = ScrollPanel.find(:all).map {|s| s.t }
         l.sort.should eq [0, 1, 1, 2, 4]
       end
       it '既存のt0には変化がない' do
@@ -761,22 +724,22 @@ describe ScrollPanel do
         @item4.t.should eq 2
       end
     end
-    context '先ほどのケース+他の用紙1件で挿入したとき' do
+    context '先ほどのケース+他のスクロール1件で挿入したとき' do
       before do
-        @sheet2 = FactoryGirl.create :sheet, :author_id => @author.id
-        @itemc2 = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet2.id, :panel_id => @panel.id, :author_id => @author.id
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @scroll2 = FactoryGirl.create :scroll, :author_id => @author.id
+        @itemc2 = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll2.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
         @ot = @item2.t
         @item2.t = 3
       end
       it 'これから挿入するt(3)が欠番になっている' do
         #移動させたい行はそのまま残る
         @item2.higher_shift @ot
-        l = SheetPanel.find(:all).map {|s| s.t }
+        l = ScrollPanel.find(:all).map {|s| s.t }
         l.sort.should eq [0, 0, 1, 1, 2, 4]
       end
       it '既存のt0には変化がない' do
@@ -799,7 +762,7 @@ describe ScrollPanel do
         @item4.reload
         @item4.t.should eq 2
       end
-      it '他の用紙に影響がない' do
+      it '他のスクロールに影響がない' do
         @item2.higher_shift @ot
         @itemc2.reload
         @itemc2.t.should eq 0
@@ -809,15 +772,16 @@ describe ScrollPanel do
     #max超えたときはmaxとして正常扱い
     context 'テーブルに2件(t:0,1)で0を2に移動したとき' do
       before do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 = FactoryGirl.create :scroll_panel, :t => 1, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
         @ot = @item.t
         @item.t = 2
       end
       it '既存のt1を0にシフトしてこれから挿入するt(1)が欠番になっている' do
         #移動させたい行はそのまま残る
         @item.higher_shift @ot
-        l = SheetPanel.find(:all).map {|s| s.t }
+        l = ScrollPanel.find(:all).map {|s| s.t }
         l.sort.should eq [0, 0]
       end
       it '既存のt1を0にシフトしている' do
@@ -833,15 +797,16 @@ describe ScrollPanel do
   end
   describe '入れ替えに於いて' do
     before do
-      @sheet = FactoryGirl.create :sheet, :author_id => @author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-      @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-      @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+      @item = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
+      @item2 = FactoryGirl.create :scroll_panel, :t => 1, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
     end
     context '新tが旧tより小さいとき' do
       it '少ない方に移動を依頼している' do
-        SheetPanel.any_instance.stub(:lesser_shift).with(any_args)
-        SheetPanel.any_instance.should_receive(:lesser_shift).with(any_args).exactly(1)
+        ScrollPanel.any_instance.stub(:lesser_shift).with(any_args)
+        ScrollPanel.any_instance.should_receive(:lesser_shift).with(any_args).exactly(1)
         ot = @item2.t
         @item2.t = 0
         @item2.update_shift ot
@@ -849,8 +814,8 @@ describe ScrollPanel do
     end
     context '新tが旧tより大きいとき' do
       it '大きい方に移動を依頼している' do
-        SheetPanel.any_instance.stub(:higher_shift).with(any_args)
-        SheetPanel.any_instance.should_receive(:higher_shift).with(any_args).exactly(1)
+        ScrollPanel.any_instance.stub(:higher_shift).with(any_args)
+        ScrollPanel.any_instance.should_receive(:higher_shift).with(any_args).exactly(1)
         ot = @item.t
         @item.t = 1
         @item.update_shift ot
@@ -859,33 +824,36 @@ describe ScrollPanel do
   end
   describe '順序入れ替えに於いて' do
     before do
-      @sheet = FactoryGirl.create :sheet, :author_id => @author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
+      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
     end
     context 'オブジェクトが新規でtが空のとき' do
       it '末尾追加としてtを補充依頼している' do
-        @item = FactoryGirl.build :sheet_panel, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        SheetPanel.stub(:new_t).with(any_args).and_return(0)
-        SheetPanel.should_receive(:new_t).with(any_args).exactly(1)
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item = FactoryGirl.build :scroll_panel, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
+        ScrollPanel.stub(:new_t).with(any_args).and_return(0)
+        ScrollPanel.should_receive(:new_t).with(any_args).exactly(1)
         @item.t = nil
         r = @item.rotate
       end
     end
     context 'オブジェクトが新規でtが設定されているとき' do
       it '挿入追加として挿入シフトを依頼している' do
-        @item = FactoryGirl.build :sheet_panel, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        SheetPanel.any_instance.stub(:insert_shift).with(any_args)
-        SheetPanel.any_instance.should_receive(:insert_shift).with(any_args).exactly(1)
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item = FactoryGirl.build :scroll_panel, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
+        ScrollPanel.any_instance.stub(:insert_shift).with(any_args)
+        ScrollPanel.any_instance.should_receive(:insert_shift).with(any_args).exactly(1)
         @item.t = 0
         r = @item.rotate
       end
     end
     context 'オブジェクトが新規でなくtが設定されているとき' do
       it 'コマ移動として入れ替えを依頼している' do
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        SheetPanel.any_instance.stub(:update_shift).with(any_args)
-        SheetPanel.any_instance.should_receive(:update_shift).with(1).exactly(1)
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item = FactoryGirl.create :scroll_panel, :t => 0, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 = FactoryGirl.create :scroll_panel, :t => 1, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
+        ScrollPanel.any_instance.stub(:update_shift).with(any_args)
+        ScrollPanel.any_instance.should_receive(:update_shift).with(1).exactly(1)
         @item2.t = 0
         r = @item.rotate 1
       end
@@ -898,216 +866,182 @@ describe ScrollPanel do
   end
   describe '保存に於いて' do
     before do
-      @sheet = FactoryGirl.create :sheet, :author_id => @author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-      @item = FactoryGirl.build :sheet_panel, :t => nil, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-    end
-    context 'つつがなく終わるとき' do
-      it '編集許可チェックを依頼している' do
-        SheetPanel.any_instance.stub(:allow?).with(any_args).and_return(true)
-        SheetPanel.any_instance.should_receive(:allow?).with(any_args).exactly(1)
-        r = @item.store
-      end
-      it '順序入れ替えを依頼している' do
-        SheetPanel.any_instance.stub(:rotate).with(any_args).and_return(0)
-        SheetPanel.any_instance.should_receive(:rotate).with(any_args).exactly(1)
-        SheetPanel.any_instance.stub(:save).with(any_args).and_return(true)
-        SheetPanel.stub(:validate_t).with(any_args).and_return(true)
-        r = @item.store 
-      end
-      it '保存を依頼している' do
-        SheetPanel.stub(:new_t).with(any_args).and_return(0)
-        SheetPanel.any_instance.stub(:save).with(any_args).and_return(true)
-        SheetPanel.any_instance.should_receive(:save).with(any_args).exactly(1)
-        SheetPanel.stub(:validate_t).with(any_args).and_return(true)
-        r = @item.store
-      end
-      it 'tのシリアライズチェックを依頼している' do
-        SheetPanel.stub(:new_t).with(any_args).and_return(0)
-        SheetPanel.any_instance.stub(:save).with(any_args).and_return(true)
-        SheetPanel.stub(:validate_t).with(any_args).and_return(true)
-        SheetPanel.should_receive(:validate_t).with(any_args).exactly(1)
-        r = @item.store
-      end
+      @dummy_scroll =  FactoryGirl.create :scroll_great_with_scroll_panels, author: @author_yas
+      @dummy_scroll_panels = @dummy_scroll.scroll_panels
+      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
     end
     #入れ替えテストと同じテストを実施。こちらはシフトだけでなく本尊も更新されている
-    context 'テーブルに5件(t:0,1,2,3,4)+他の用紙1件で2に挿入したとき' do
+    context 'テーブルに5件(t:0,1,2,3,4)+他のスクロール1件で2に挿入したとき' do
       before do
-        @sheet2 = FactoryGirl.create :sheet, :author_id => @author.id
-        @itemc2 = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet2.id, :panel_id => @panel.id, :author_id => @author.id
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item6 = FactoryGirl.build :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
+        @item6 =  FactoryGirl.build :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
       end
       it '既存のt0には変化がない' do
         @item6.store
         @item.reload
-        @item.t.should eq 0
+        expect(@item.t).to eq 0
       end
       it '既存のt1には変化がない' do
         @item6.store
         @item2.reload
-        @item2.t.should eq 1
+        expect(@item2.t).to eq 1
       end
       it '既存のt2を3にシフトしている' do
         @item6.store
         @item3.reload
-        @item3.t.should eq 3
+        expect(@item3.t).to eq 3
       end
       it '既存のt3を4にシフトしている' do
         @item6.store
         @item4.reload
-        @item4.t.should eq 4
+        expect(@item4.t).to eq 4
       end
       it '既存のt5を5にシフトしている' do
         @item6.store
         @item5.reload
-        @item5.t.should eq 5
+        expect(@item5.t).to eq 5
       end
       it '新規のt2が作成されている' do
         @item6.store
         @item6.reload
-        @item6.t.should eq 2
+        expect(@item6.t).to eq 2
       end
-      it '他の用紙に影響がない' do
-        @ot = @itemc2.t
+      it '他のスクロールに影響がない' do
+        @before_status = @dummy_scroll_panels.map {|sp| [sp.id, sp.t]}
         @item6.store
-        @itemc2.reload
-        @itemc2.t.should eq @ot
+        @after_status = @dummy_scroll_panels.map {|sp| sp.reload ; [sp.id, sp.t]}
+        expect(@after_status).to eq @ot
       end
     end
-    context 'テーブルに5件(t:0,1,2,3,4)+他の用紙1件で3を1に移動したとき' do
+    context 'テーブルに5件(t:0,1,2,3,4)+他のスクロール1件で3を1に移動したとき' do
       before do
-        @sheet2 = FactoryGirl.create :sheet, :author_id => @author.id
-        @itemc2 = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet2.id, :panel_id => @panel.id, :author_id => @author.id
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
         @ot = @item4.t
         @item4.t = 1
       end
       it '既存のt0には変化がない' do
         @item4.store @ot
         @item.reload
-        @item.t.should eq 0
+        expect(@item.t).to eq 0
       end
       it '既存のt4には変化がない' do
         @item4.store @ot
         @item5.reload
-        @item5.t.should eq 4
+        expect(@item5.t).to eq 4
       end
       it '既存のt1を2にシフトしている' do
         @item4.store @ot
         @item2.reload
-        @item2.t.should eq 2
+        expect(@item2.t).to eq 2
       end
       it '既存のt2を3にシフトしている' do
         @item4.store @ot
         @item3.reload
-        @item3.t.should eq 3
+        expect(@item3.t).to eq 3
       end
       it '既存のt3を1にシフトしている' do
         @item4.store @ot
         @item4.reload
-        @item4.t.should eq 1
+        expect(@item4.t).to eq 1
       end
-      it '他の用紙に影響がない' do
+      it '他のスクロールに影響がない' do
+        @before_status = @dummy_scroll_panels.map {|sp| [sp.id, sp.t]}
         @item4.store @ot
-        @itemc2.reload
-        @itemc2.t.should eq 0
+        @after_status = @dummy_scroll_panels.map {|sp| sp.reload ; [sp.id, sp.t]}
+        expect(@after_status).to eq @ot
       end
     end
-    context 'テーブルに5件(t:0,1,2,3,4)+他の用紙1件で1を3に移動したとき' do
+    context 'テーブルに5件(t:0,1,2,3,4)+他のスクロール1件で1を3に移動したとき' do
       before do
-        @sheet2 = FactoryGirl.create :sheet, :author_id => @author.id
-        @itemc2 = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet2.id, :panel_id => @panel.id, :author_id => @author.id
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
         @ot = @item2.t
         @item2.t = 3
       end
       it '既存のt0には変化がない' do
         @item2.store @ot
         @item.reload
-        @item.t.should eq 0
+        expect(@item.t).to eq 0
       end
       it '既存のt4には変化がない' do
         @item2.store @ot
         @item5.reload
-        @item5.t.should eq 4
+        expect(@item5.t).to eq 4
       end
       it '既存のt1を3にシフトしている' do
         @item2.store @ot
         @item2.reload
-        @item2.t.should eq 3
+        expect(@item2.t).to eq 3
       end
       it '既存のt2を1にシフトしている' do
         @item2.store @ot
         @item3.reload
-        @item3.t.should eq 1
+        expect(@item3.t).to eq 1
       end
       it '既存のt3を2にシフトしている' do
         @item2.store @ot
         @item4.reload
-        @item4.t.should eq 2
+        expect(@item4.t).to eq 2
       end
-      it '他の用紙に影響がない' do
+      it '他のスクロールに影響がない' do
+        @before_status = @dummy_scroll_panels.map {|sp| [sp.id, sp.t]}
         @item2.store @ot
-        @itemc2.reload
-        @itemc2.t.should eq 0
+        @after_status = @dummy_scroll_panels.map {|sp| sp.reload ; [sp.id, sp.t]}
+        expect(@after_status).to eq @ot
       end
     end
     #ロールバックテスト。入れ替えが直接DBをいじるので、すべてのケースで確実にロールバックを確認する
-    context 'テーブルに5件(t:0,1,2,3,4)+他の用紙1件で2に挿入したが保存に失敗したとき' do
+    context 'テーブルに5件(t:0,1,2,3,4)+他のスクロール1件で2に挿入したが保存に失敗したとき' do
       before do
-        SheetPanel.any_instance.stub(:save).with(any_args).and_return(false)
-        @sheet2 = FactoryGirl.create :sheet, :author_id => @author.id
-        @itemc2 = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet2.id, :panel_id => @panel.id, :author_id => @author.id
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item6 = FactoryGirl.build :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        ScrollPanel.any_instance.stub(:save).with(any_args).and_return(false)
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
+        @item6 = FactoryGirl.build :scroll_panel, :t => 2, :scroll_id => @scroll.id, :panel_id => @panel.id, :author_id => @author.id
       end
       it '既存のtに変化がない' do
         @item6.store
         @item.reload
-        @item.t.should eq 0
         @item2.reload
-        @item2.t.should eq 1
         @item3.reload
-        @item3.t.should eq 2
         @item4.reload
-        @item4.t.should eq 3
         @item5.reload
-        @item5.t.should eq 4
+        expect(@item.t).to eq 0
+        expect(@item2.t).to eq 1
+        expect(@item3.t).to eq 2
+        expect(@item4.t).to eq 3
+        expect(@item5.t).to eq 4
+        expect(@item.t).to eq 5
         @itemc2.reload
         @itemc2.t.should eq 0
       end
       it 'falseを返す' do
         r = @item6.store
-        r.should be_false
+        expect(r).to be_false
       end
     end
-    context 'テーブルに5件(t:0,1,2,3,4)+他の用紙1件で3を1に移動したがシリアルチェックに失敗したとき' do
+    context 'テーブルに5件(t:0,1,2,3,4)+他のスクロール1件で3を1に移動したがシリアルチェックに失敗したとき' do
       before do
-        SheetPanel.stub(:validate_t).with(any_args).and_return(false)
-        @sheet2 = FactoryGirl.create :sheet, :author_id => @author.id
-        @itemc2 = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet2.id, :panel_id => @panel.id, :author_id => @author.id
-        @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        ScrollPanel.stub(:validate_t).with(any_args).and_return(false)
+        @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
         @ot = @item4.t
         @item4.t = 1
       end
@@ -1125,149 +1059,144 @@ describe ScrollPanel do
         @item5.t.should eq 4
         @itemc2.reload
         @itemc2.t.should eq 0
+        expect(@item.t).to eq 0
+        expect(@item.t).to eq 0
+        expect(@item.t).to eq 0
+        expect(@item.t).to eq 0
+        expect(@item.t).to eq 0
+        expect(@item.t).to eq 0
       end
       it 'falseを返す' do
         r = @item4.store @ot
-        r.should be_false
+        expect(r).to be_false
       end
       it 'tにエラーメッセージが入っている' do
         @item4.store @ot
-        @item4.errors[:t].should_not be_empty
-        @item4.valid?.should be_true
-      end
-    end
-    context '編集不可だったとき' do
-      before do
-        @item = FactoryGirl.build :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        SheetPanel.any_instance.stub(:allow?).and_return(false)
-      end
-      it '403Forbidden例外を返す' do
-        lambda{
-          @item.store
-        }.should raise_error(ActiveRecord::Forbidden)
+        expect(@item4.errors[:t]).to be_empty
+        expect(@item4.valid?).to be_true
       end
     end
   end
   describe '切り詰め処理つき削除に於いて' do
     before do
-      @sheet = FactoryGirl.create :sheet, :author_id => @author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-      @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+      @dummy =  FactoryGirl.create :scroll_great_with_scroll_panels, author: @author_yas
+      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
+      @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
     end
     context 'つつがなく終わるとき' do
       it '削除される' do
-        lambda{
+        expect {
           @item.destroy_and_shorten
-        }.should change(SheetPanel, :count ).by(-1)
+        }.to change(ScrollPanel, :count ).by(-1)
       end
       it 'Trueを返す' do
         r = @item.destroy_and_shorten
-        r.should be_true 
+        expect(r).to be_true 
       end
     end
     context '削除に失敗したとき' do
       before do
-        SheetPanel.any_instance.stub(:destroy).and_return(false)
+        ScrollPanel.any_instance.stub(:destroy).and_return(false)
       end
       it 'ロールバックされる' do
-        lambda{
+        expect {
           @item.destroy_and_shorten
-        }.should_not change(SheetPanel, :count )
+        }.to change(ScrollPanel, :count )
       end
       it 'Falseを返す' do
         r = @item.destroy_and_shorten
-        r.should be_false
+        expect(r).to be_false
       end
     end
     #連携テスト。切り詰めが直接DBをいじる
     context '2件で先頭を削除したとき' do
       before do
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
       end
       it '行が削除される' do
-        lambda{
+        expect {
           @item.destroy_and_shorten
-        }.should change(SheetPanel, :count ).by(-1)
+        }.to change(ScrollPanel, :count ).by(-1)
       end
       it '先頭は削除される' do
         @item.destroy_and_shorten
-        lambda{
-          SheetPanel.find @item.id
-        }.should raise_error(ActiveRecord::RecordNotFound)
+        expect {
+          ScrollPanel.find @item.id
+        }.to raise_error(ActiveRecord::RecordNotFound)
       end
       it '2件目は前に詰められる' do
         @item.destroy_and_shorten
         @item2.reload
-        @item2.t.should eq 0
+        expect(@item2.t).to eq 0
       end
     end
     context '3件で先頭を削除したとき' do
       before do
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
       end
       it '行が削除される' do
-        lambda{
+        expect {
           @item.destroy_and_shorten
-        }.should change(SheetPanel, :count ).by(-1)
+        }.to change(ScrollPanel, :count ).by(-1)
       end
       it '先頭は削除される' do
         @item.destroy_and_shorten
-        lambda{
-          SheetPanel.find @item.id
-        }.should raise_error(ActiveRecord::RecordNotFound)
+        expect {
+          ScrollPanel.find @item.id
+        }.to raise_error(ActiveRecord::RecordNotFound)
       end
       it '2件目は前に詰められる' do
         @item.destroy_and_shorten
         @item2.reload
-        @item2.t.should eq 0
+        expect(@item2.t).to eq 0
       end
       it '3件目は前に詰められる' do
         @item.destroy_and_shorten
         @item3.reload
-        @item3.t.should eq 1
+        expect(@item3.t).to eq 1
       end
     end
     context '5件で3件目を削除したとき' do
       before do
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
       end
       it '行が削除される' do
-        lambda{
+        expect {
           @item3.destroy_and_shorten
-        }.should change(SheetPanel, :count ).by(-1)
+        }.to change(ScrollPanel, :count ).by(-1)
       end
       it '1件目は変化がない' do
         @item3.destroy_and_shorten
         @item.reload
-        @item.t.should eq 0
+        expect(@item.t).to eq 0
       end
       it '2件目は変化がない' do
         @item3.destroy_and_shorten
         @item2.reload
-        @item2.t.should eq 1
+        expect(@item2.t).to eq 1
       end
       it '3件目は削除される' do
         @item3.destroy_and_shorten
-        lambda{
-          SheetPanel.find @item3.id
-        }.should raise_error(ActiveRecord::RecordNotFound)
+        expect {
+          ScrollPanel.find @item3.id
+        }.to raise_error(ActiveRecord::RecordNotFound)
       end
       it '4件目は前に詰められる' do
         @item3.destroy_and_shorten
         @item4.reload
-        @item4.t.should eq 2
+        expect(@item4.t).to eq 2
       end
       it '5件目は前に詰められる' do
         @item3.destroy_and_shorten
         @item5.reload
-        @item5.t.should eq 3
+        expect(@item5.t).to eq 3
       end
     end
     #ロールバックテスト。切り詰めが直接DBをいじるので、すべてのケースで確実にロールバックを確認する
   end
 end
-
index 6a974b6..54b68bd 100644 (file)
@@ -23,7 +23,7 @@ describe Sheet do
       @item =  FactoryGirl.create :sheet_install_a_with_sheet_panels, author: @author_yas
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99る' do
+    it 'ã\82³ã\83\94ã\83¼ã\81\97ã\81¦ã\81»ã\81\97ã\81\8fã\81ªã\81\84ã\82«ã\83©ã\83 ã\82\92å\8f\96ã\82\8aé\99¤ã\81\84ã\81¦ã\81\84る' do
     end
   end
   
@@ -46,149 +46,101 @@ describe Panel do
   end
   
 end
-# 
-describe ScrollPanel do
-  include LeafMacros
+# I/O処理については、マニフェストで動作が変わることがないのでコマでのみテストしておく
+describe Panel do
+  include RootMacros
   before do
     @admin =FactoryGirl.create :admin
     @user_yas = FactoryGirl.create :user_yas_with_owner
     @user_rom = FactoryGirl.create :user_rom
     @author_yas =  @user_yas.author
     
-    @model = ScrollPanel
+    @model = Panel
   end
   
-  describe 'new_tに於いて' do
+  describe 'エレメント取得parts_elementに於いて' do
     before do
-      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @item =  FactoryGirl.create :sheet_install_a_with_sheet_panels, author: @author_yas
     end
     
-    context 'オーソドックスなデータのとき' do
-      it 'cut' do
-        expect(@model.new_t(@scroll.id)).to eq 0
-      end
-      
+    it '順番にかかわらずぶら下がるエレメントすべてをリストで取得してくる' do
+    end
+  end
+  
+  describe '重ね合わせ順のエレメント取得zorderd_elementsに於いて' do
+    before do
+      @item =  FactoryGirl.create :sheet_install_a_with_sheet_panels, author: @author_yas
     end
     
-    context 'オーソドックスなデータのとき' do
-      it 'cut' do
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 1, t: 0, scroll: @scroll, panel: @panel
-        expect(@model.new_t(@scroll.id)).to eq 1
-      end
-      
-      it 'cut' do
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 1, t: 0, scroll: @scroll, panel: @panel
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 2, t: 1, scroll: @scroll, panel: @panel
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 3, t: 2, scroll: @scroll, panel: @panel
-        expect(@model.new_t(@scroll.id)).to eq 3
-      end
-      
+    it 'エレメントをすべてリストで取得してくる' do
+    end
+  end
+  
+  describe '重ね合わせ順のエレメント取得scenario_elementsに於いて' do
+    before do
+      @item =  FactoryGirl.create :sheet_install_a_with_sheet_panels, author: @author_yas
     end
     
+    it 'エレメントをすべてリストで取得してくる' do
+    end
   end
   
-  describe 'collect_tに於いて' do
+  describe 'new_tに於いて' do
     before do
-      @dummy =  FactoryGirl.create :scroll_great_with_scroll_panels, author: @author_yas
       @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
     end
     
-    context 'オーソドックスなデータのとき' do
-      it 'cut' do
-        expect(@model.collect_t(@scroll.id)).to be_empty
-      end
-      
+    it 'オフセットはゼロなのでエレメントの総数と一致する' do
+      expect(@model.new_t(@scroll.id)).to eq 0
     end
     
-    context 'オーソドックスなデータのとき' do
-      it 'cut' do
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 1, t: 0, scroll: @scroll, panel: @panel
-        expect(@model.collect_t(@scroll.id)).to eq [0]
-      end
-      
-      it 'cut' do
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 1, t: 0, scroll: @scroll, panel: @panel
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 2, t: 1, scroll: @scroll, panel: @panel
-        @item =  FactoryGirl.create :scroll_panel_plain, z: 3, t: 2, scroll: @scroll, panel: @panel
-        expect(@model.collect_t(@scroll.id)).to eq [0, 1, 2]
-      end
-      
+  end
+  
+  describe 'collect_tに於いて' do
+    before do
+      @dummy =  FactoryGirl.create :scroll_great_with_scroll_panels, author: @author_yas
+      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
     end
     
+    it 'オフセットは1なのでエレメントの総数+1と一致する' do
+      expect(@model.collect_t(@scroll.id)).to be_empty
+    end
   end
   
-  describe 'tチェックに於いて' do
+  describe 'validate_childに於いて' do
     before do
       @sheet = FactoryGirl.create :sheet, :author_id => @author.id
       @panel = FactoryGirl.create :panel, :author_id => @author.id
       @item = FactoryGirl.build :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
     end
-    context 'つつがなく終わるとき' do
-      it 't収集を依頼している' do
-        SheetPanel.should_receive(:collect_t).with(any_args).exactly(1)
-        SheetPanel.stub(:collect_t).with(any_args).and_return([])
-        SheetPanel.stub(:serial?).with(any_args).and_return(true)
-        r = SheetPanel.validate_t @item
-      end
-      it '収集したtをシリアライズチェック依頼している' do
-        SheetPanel.stub(:collect_t).with(any_args).and_return([])
-        SheetPanel.should_receive(:serial?).with(any_args).exactly(1)
-        SheetPanel.stub(:serial?).with(any_args).and_return(true)
+    #実データで最低限のチェックを
+    context '正常のとき' do
+      it '真を返している' do
+        @item = FactoryGirl.build :sheet_panel, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id, :t => 0
         r = SheetPanel.validate_t @item
+        r.should be_true 
       end
     end
-    #実データでチェック
-    #依頼チェックだけでは不安なので最低限のチェックを
-    context '新規のとき' do
-      it '一件だけで正常通過している' do
-        @item = FactoryGirl.build :sheet_panel, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id, :t => 0
-        r = SheetPanel.validate_t @item
+    context '重ね合わせ順が壊れているとき' do
+      it '偽を返している' do
+        r = SheetPanel.validate_t @item2
         r.should be_true 
       end
     end
-    context '既存のとき' do
-      it '2件目を作っても正常通過している' do
-        @item = FactoryGirl.create :sheet_panel, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id, :t => 0
-        @item2 = FactoryGirl.build :sheet_panel, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id, :t => 1
+    context 'シナリオ順が壊れているとき' do
+      it '偽を返している' do
         r = SheetPanel.validate_t @item2
         r.should be_true 
       end
     end
   end
+  
   describe '保存に於いて' do
     before do
       @sheet = FactoryGirl.create :sheet, :author_id => @author.id
       @panel = FactoryGirl.create :panel, :author_id => @author.id
       @item = FactoryGirl.build :sheet_panel, :t => nil, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
     end
-    context 'つつがなく終わるとき' do
-      it '編集許可チェックを依頼している' do
-        SheetPanel.any_instance.stub(:allow?).with(any_args).and_return(true)
-        SheetPanel.any_instance.should_receive(:allow?).with(any_args).exactly(1)
-        r = @item.store
-      end
-      it '順序入れ替えを依頼している' do
-        SheetPanel.any_instance.stub(:rotate).with(any_args).and_return(0)
-        SheetPanel.any_instance.should_receive(:rotate).with(any_args).exactly(1)
-        SheetPanel.any_instance.stub(:save).with(any_args).and_return(true)
-        SheetPanel.stub(:validate_t).with(any_args).and_return(true)
-        r = @item.store 
-      end
-      it '保存を依頼している' do
-        SheetPanel.stub(:new_t).with(any_args).and_return(0)
-        SheetPanel.any_instance.stub(:save).with(any_args).and_return(true)
-        SheetPanel.any_instance.should_receive(:save).with(any_args).exactly(1)
-        SheetPanel.stub(:validate_t).with(any_args).and_return(true)
-        r = @item.store
-      end
-      it 'tのシリアライズチェックを依頼している' do
-        SheetPanel.stub(:new_t).with(any_args).and_return(0)
-        SheetPanel.any_instance.stub(:save).with(any_args).and_return(true)
-        SheetPanel.stub(:validate_t).with(any_args).and_return(true)
-        SheetPanel.should_receive(:validate_t).with(any_args).exactly(1)
-        r = @item.store
-      end
-    end
     #入れ替えテストと同じテストを実施。こちらはシフトだけでなく本尊も更新されている
     context 'テーブルに5件(t:0,1,2,3,4)+他の用紙1件で2に挿入したとき' do
       before do
@@ -409,121 +361,122 @@ describe ScrollPanel do
   end
   describe '切り詰め処理つき削除に於いて' do
     before do
-      @sheet = FactoryGirl.create :sheet, :author_id => @author.id
-      @panel = FactoryGirl.create :panel, :author_id => @author.id
-      @item = FactoryGirl.create :sheet_panel, :t => 0, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+      @dummy =  FactoryGirl.create :scroll_great_with_scroll_panels, author: @author_yas
+      @scroll =  FactoryGirl.create :scroll_hello, author: @author_yas
+      @panel = FactoryGirl.create :panel_hello, author: @author_yas
+      @item =  FactoryGirl.create :scroll_panel_plain, t: 0, scroll: @scroll, panel: @panel
     end
     context 'つつがなく終わるとき' do
       it '削除される' do
-        lambda{
+        expect {
           @item.destroy_and_shorten
-        }.should change(SheetPanel, :count ).by(-1)
+        }.to change(ScrollPanel, :count ).by(-1)
       end
       it 'Trueを返す' do
         r = @item.destroy_and_shorten
-        r.should be_true 
+        expect(r).to be_true 
       end
     end
     context '削除に失敗したとき' do
       before do
-        SheetPanel.any_instance.stub(:destroy).and_return(false)
+        ScrollPanel.any_instance.stub(:destroy).and_return(false)
       end
       it 'ロールバックされる' do
-        lambda{
+        expect {
           @item.destroy_and_shorten
-        }.should_not change(SheetPanel, :count )
+        }.to change(ScrollPanel, :count )
       end
       it 'Falseを返す' do
         r = @item.destroy_and_shorten
-        r.should be_false
+        expect(r).to be_false
       end
     end
     #連携テスト。切り詰めが直接DBをいじる
     context '2件で先頭を削除したとき' do
       before do
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
       end
       it '行が削除される' do
-        lambda{
+        expect {
           @item.destroy_and_shorten
-        }.should change(SheetPanel, :count ).by(-1)
+        }.to change(ScrollPanel, :count ).by(-1)
       end
       it '先頭は削除される' do
         @item.destroy_and_shorten
-        lambda{
-          SheetPanel.find @item.id
-        }.should raise_error(ActiveRecord::RecordNotFound)
+        expect {
+          ScrollPanel.find @item.id
+        }.to raise_error(ActiveRecord::RecordNotFound)
       end
       it '2件目は前に詰められる' do
         @item.destroy_and_shorten
         @item2.reload
-        @item2.t.should eq 0
+        expect(@item2.t).to eq 0
       end
     end
     context '3件で先頭を削除したとき' do
       before do
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
       end
       it '行が削除される' do
-        lambda{
+        expect {
           @item.destroy_and_shorten
-        }.should change(SheetPanel, :count ).by(-1)
+        }.to change(ScrollPanel, :count ).by(-1)
       end
       it '先頭は削除される' do
         @item.destroy_and_shorten
-        lambda{
-          SheetPanel.find @item.id
-        }.should raise_error(ActiveRecord::RecordNotFound)
+        expect {
+          ScrollPanel.find @item.id
+        }.to raise_error(ActiveRecord::RecordNotFound)
       end
       it '2件目は前に詰められる' do
         @item.destroy_and_shorten
         @item2.reload
-        @item2.t.should eq 0
+        expect(@item2.t).to eq 0
       end
       it '3件目は前に詰められる' do
         @item.destroy_and_shorten
         @item3.reload
-        @item3.t.should eq 1
+        expect(@item3.t).to eq 1
       end
     end
     context '5件で3件目を削除したとき' do
       before do
-        @item2 = FactoryGirl.create :sheet_panel, :t => 1, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item3 = FactoryGirl.create :sheet_panel, :t => 2, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item4 = FactoryGirl.create :sheet_panel, :t => 3, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
-        @item5 = FactoryGirl.create :sheet_panel, :t => 4, :sheet_id => @sheet.id, :panel_id => @panel.id, :author_id => @author.id
+        @item2 =  FactoryGirl.create :scroll_panel_plain, t: 1, scroll: @scroll, panel: @panel
+        @item3 =  FactoryGirl.create :scroll_panel_plain, t: 2, scroll: @scroll, panel: @panel
+        @item4 =  FactoryGirl.create :scroll_panel_plain, t: 3, scroll: @scroll, panel: @panel
+        @item5 =  FactoryGirl.create :scroll_panel_plain, t: 4, scroll: @scroll, panel: @panel
       end
       it '行が削除される' do
-        lambda{
+        expect {
           @item3.destroy_and_shorten
-        }.should change(SheetPanel, :count ).by(-1)
+        }.to change(ScrollPanel, :count ).by(-1)
       end
       it '1件目は変化がない' do
         @item3.destroy_and_shorten
         @item.reload
-        @item.t.should eq 0
+        expect(@item.t).to eq 0
       end
       it '2件目は変化がない' do
         @item3.destroy_and_shorten
         @item2.reload
-        @item2.t.should eq 1
+        expect(@item2.t).to eq 1
       end
       it '3件目は削除される' do
         @item3.destroy_and_shorten
-        lambda{
-          SheetPanel.find @item3.id
-        }.should raise_error(ActiveRecord::RecordNotFound)
+        expect {
+          ScrollPanel.find @item3.id
+        }.to raise_error(ActiveRecord::RecordNotFound)
       end
       it '4件目は前に詰められる' do
         @item3.destroy_and_shorten
         @item4.reload
-        @item4.t.should eq 2
+        expect(@item4.t).to eq 2
       end
       it '5件目は前に詰められる' do
         @item3.destroy_and_shorten
         @item5.reload
-        @item5.t.should eq 3
+        expect(@item5.t).to eq 3
       end
     end
     #ロールバックテスト。切り詰めが直接DBをいじるので、すべてのケースで確実にロールバックを確認する
index 9ec76e4..b0be393 100644 (file)
@@ -26,16 +26,16 @@ describe SpeechBalloonTemplate do
     before do
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '有効なテンプレートをリストで返している' do
       expect(SpeechBalloonTemplate.enable_list).to_not be_empty
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99る' do
+    it 'ã\83\86ã\83³ã\83\97ã\83¬ã\83¼ã\83\88ã\81\8cç\84¡å\8a¹ã\81ªã\82\89ã\83ªã\82¹ã\83\88ã\81¯ç©ºã\81«ã\81ªã\81£ã\81¦ã\81\84る' do
       allow_any_instance_of(SpeechBalloonTemplate).to receive(:enable?).and_return(false)
       expect(SpeechBalloonTemplate.enable_list).to be_empty
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '実データでテストしてみる' do
       allow(@circle).to receive(:enable?).and_return(false)
       expect(SpeechBalloonTemplate.enable_list.size).to eq 3
     end
@@ -46,16 +46,16 @@ describe SpeechBalloonTemplate do
     before do
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99ã\82\8b' do
+    it 'ã\83\86ã\83³ã\83\97ã\83¬ã\83¼ã\83\88ã\81®ã\83\9eã\83\8bã\83\95ã\82§ã\82¹ã\83\88ã\81\8c設å®\9aã\81\95ã\82\8cã\81¦ã\81\84ã\81ªã\81\84ã\81¨ã\81\8dã\81¯å\81½ã\82\92è¿\94ã\81\99' do
       allow(SpeechBalloonTemplate).to receive(:template_manifest).and_return(nil)
       expect(@circle.enable?).to be false
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '有効なテンプレートであれば真を返す' do
       expect(@circle.enable?).to be true
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '無効なテンプレートの時は偽を返す' do
       expect(@test.enable?).to be false
     end
   end
@@ -64,7 +64,7 @@ describe SpeechBalloonTemplate do
     before do
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99る' do
+    it 'ã\81\9dã\82\8cã\81\9eã\82\8cã\81®ã\83¢ã\82¸ã\83¥ã\83¼ã\83«ã\82\92è¿\94ã\81\97ã\81¦ã\81\84る' do
       expect(@circle.template_module).to eq CircleSpeechBalloon
       expect(@square.template_module).to eq SquareSpeechBalloon
     end
@@ -74,7 +74,7 @@ describe SpeechBalloonTemplate do
     before do
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99る' do
+    it 'ã\81\9dã\82\8cã\81\9eã\82\8cã\81®ã\83\91ã\82¹ã\83\8dã\83¼ã\83 ã\82\92è¿\94ã\81\97ã\81¦ã\81\84る' do
       expect(@circle.template_path_name).to eq 'circle_speech_balloon'
       expect(@square.template_path_name).to eq 'square_speech_balloon'
     end
@@ -105,16 +105,16 @@ describe LicenseGroup do
     before do
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '有効なテンプレートをリストで返している' do
       expect(LicenseGroup.enable_list).to_not be_empty
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99る' do
+    it 'ã\83\86ã\83³ã\83\97ã\83¬ã\83¼ã\83\88ã\81\8cç\84¡å\8a¹ã\81ªã\82\89ã\83ªã\82¹ã\83\88ã\81¯ç©ºã\81«ã\81ªã\81£ã\81¦ã\81\84る' do
       allow_any_instance_of(LicenseGroup).to receive(:enable?).and_return(false)
       expect(LicenseGroup.enable_list).to be_empty
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '実データでテストしてみる' do
       expect(LicenseGroup.enable_list.size).to eq 2
     end
     
@@ -124,16 +124,16 @@ describe LicenseGroup do
     before do
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99ã\82\8b' do
+    it 'ã\83\86ã\83³ã\83\97ã\83¬ã\83¼ã\83\88ã\81®ã\83\9eã\83\8bã\83\95ã\82§ã\82¹ã\83\88ã\81\8c設å®\9aã\81\95ã\82\8cã\81¦ã\81\84ã\81ªã\81\84ã\81¨ã\81\8dã\81¯å\81½ã\82\92è¿\94ã\81\99' do
       allow(LicenseGroup).to receive(:template_manifest).and_return(nil)
       expect(@cc.enable?).to be false
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '有効なテンプレートであれば真を返す' do
       expect(@cc.enable?).to be true
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '無効なテンプレートの時は偽を返す' do
       expect(@test.enable?).to be false
     end
   end
@@ -142,7 +142,7 @@ describe LicenseGroup do
     before do
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99る' do
+    it 'ã\81\9dã\82\8cã\81\9eã\82\8cã\81®ã\83¢ã\82¸ã\83¥ã\83¼ã\83«ã\82\92è¿\94ã\81\97ã\81¦ã\81\84る' do
       expect(@cc.template_module).to eq PettanrCreativeCommonsV30Licenses
       expect(@pc.template_module).to eq PettanrPettanCommonsV01Licenses
     end
@@ -152,7 +152,7 @@ describe LicenseGroup do
     before do
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99る' do
+    it 'ã\81\9dã\82\8cã\81\9eã\82\8cã\81®ã\83\91ã\82¹ã\83\8dã\83¼ã\83 ã\82\92è¿\94ã\81\97ã\81¦ã\81\84る' do
       expect(@cc.template_path_name).to eq 'pettanr_creative_commons_v30_licenses'
       expect(@pc.template_path_name).to eq 'pettanr_pettan_commons_v01_licenses'
     end
@@ -182,18 +182,18 @@ describe WritingFormat do
     before do
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '有効なテンプレートをリストで返している' do
       expect(WritingFormat.enable_list).to_not be_empty
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99る' do
+    it 'ã\83\86ã\83³ã\83\97ã\83¬ã\83¼ã\83\88ã\81\8cç\84¡å\8a¹ã\81ªã\82\89ã\83ªã\82¹ã\83\88ã\81¯ç©ºã\81«ã\81ªã\81£ã\81¦ã\81\84る' do
       allow_any_instance_of(WritingFormat).to receive(:enable?).and_return(false)
       expect(SpeechBalloonTemplate.enable_list).to be_empty
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '実データでテストしてみる' do
       allow(@simple).to receive(:enable?).and_return(false)
-      expect(WritingFormat.enable_list.size).to eq 2
+      expect(WritingFormat.enable_list.size).to eq 1
     end
     
   end
@@ -202,17 +202,16 @@ describe WritingFormat do
     before do
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99ã\82\8b' do
+    it 'ã\83\86ã\83³ã\83\97ã\83¬ã\83¼ã\83\88ã\81®ã\83\9eã\83\8bã\83\95ã\82§ã\82¹ã\83\88ã\81\8c設å®\9aã\81\95ã\82\8cã\81¦ã\81\84ã\81ªã\81\84ã\81¨ã\81\8dã\81¯å\81½ã\82\92è¿\94ã\81\99' do
       allow(WritingFormat).to receive(:template_manifest).and_return(nil)
       expect(@simple.enable?).to be false
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
+    it '有効なテンプレートであれば真を返す' do
       expect(@simple.enable?).to be true
     end
     
-    it 'ブーストメッセージをリーフに伝搬する' do
-      allow_any_instance_of(WritingFormat).to receive(:module_name).and_return('excluded')
+    it '無効なテンプレートの時は偽を返す' do
       expect(@test.enable?).to be false
     end
   end
@@ -221,7 +220,7 @@ describe WritingFormat do
     before do
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99る' do
+    it 'ã\81\9dã\82\8cã\81\9eã\82\8cã\81®ã\83¢ã\82¸ã\83¥ã\83¼ã\83«ã\82\92è¿\94ã\81\97ã\81¦ã\81\84る' do
       expect(@simple.template_module).to eq PettanrSimpleFormat
     end
   end
@@ -230,7 +229,7 @@ describe WritingFormat do
     before do
     end
     
-    it 'ã\83\96ã\83¼ã\82¹ã\83\88ã\83¡ã\83\83ã\82»ã\83¼ã\82¸ã\82\92ã\83ªã\83¼ã\83\95ã\81«ä¼\9dæ\90¬ã\81\99る' do
+    it 'ã\81\9dã\82\8cã\81\9eã\82\8cã\81®ã\83\91ã\82¹ã\83\8dã\83¼ã\83 ã\82\92è¿\94ã\81\97ã\81¦ã\81\84る' do
       expect(@simple.template_path_name).to eq 'pettanr_simple_format'
     end
   end