OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
authoryasushiito <yas@pen-chan.jp>
Wed, 4 Jun 2014 10:14:47 +0000 (19:14 +0900)
committeryasushiito <yas@pen-chan.jp>
Wed, 4 Jun 2014 10:14:47 +0000 (19:14 +0900)
33 files changed:
app/assets/javascripts/manifest/work/controllers.js.coffee.erb
app/assets/javascripts/manifest/work/filers.js.coffee.erb
app/assets/javascripts/manifest/work/items.js.coffee.erb
app/assets/javascripts/manifest/work/list_groups.js.coffee.erb
app/assets/javascripts/manifest/work/models.js.coffee.erb
app/assets/javascripts/manifest/work/profilers.js.coffee.erb
app/assets/stylesheets/test.css.scss
app/controllers/comics_controller.rb
app/controllers/license_groups_controller.rb
app/controllers/licenses_controller.rb
app/controllers/speech_balloon_templates_controller.rb
app/controllers/system_pictures_controller.rb
app/controllers/writing_formats_controller.rb
app/models/license.rb
app/models/license_group.rb
app/models/speech_balloon_template.rb
app/models/system_picture.rb
app/models/writing_format.rb
app/views/license_groups/show.html.erb
app/views/licenses/show.html.erb
app/views/speech_balloon_templates/_summary.html.erb [deleted file]
app/views/speech_balloon_templates/show.html.erb
app/views/system_pictures/show.html.erb
app/views/writing_formats/show.html.erb [new file with mode: 0644]
config/routes.rb
lib/manifest/item.rb
lib/manifest/item/system_resource.rb [new file with mode: 0644]
lib/manifest/item/template.rb [new file with mode: 0644]
lib/peta.rb
lib/peta/system_resource.rb
lib/peta/template.rb [new file with mode: 0644]
public/local_manifest.json
public/manifest.json

index 05ce36f..b785418 100644 (file)
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   comics: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   stories: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   sheets: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   sheet_panels: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   panels: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   panel_pictures: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   pictures: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   writing_formats: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   license_groups: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   licenses: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   authors: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   artists: {\r
       edit: {\r
         type: 'edit',\r
       },\r
+      create: {\r
+        type: 'create',\r
+      },\r
+      update: {\r
+        type: 'update',\r
+      },\r
+      destroy: {\r
+        type: 'destroy',\r
+      },\r
     },\r
   },\r
   system_pictures: {\r
index a522efa..b7be47e 100644 (file)
   },\r
   writing_format: {\r
     symbol: {\r
+      type: 'default',\r
+      args: {\r
+        face: {\r
+          type: 'picture',\r
+        },\r
+      },\r
     },\r
     caption: {\r
     },\r
index 63d164b..074015b 100644 (file)
     },\r
   },\r
   speech_balloon_template: {\r
+    type: 'template',\r
   },\r
   writing_format: {\r
+    type: 'template',\r
   },\r
   license_group: {\r
+    type: 'template',\r
   },\r
   license: {\r
     type: 'system_resource',\r
   artist: {\r
   },\r
   system_picture: {\r
+    type: 'system_resource',\r
   },\r
 }\r
 \r
index 4bfa6b2..bd61271 100644 (file)
           through: 'speech_balloons',\r
         },\r
       },\r
+      by_system_picture: {\r
+        type: 'filter',\r
+      },\r
       select_items: {\r
         type: 'system_resource',\r
       },\r
index 7119632..057a5b0 100644 (file)
         }, \r
         licenses: {\r
         }, \r
+        writing_formats: {\r
+        }, \r
       },\r
       has_one: {\r
       },\r
index 4aa94f0..337e063 100644 (file)
     associations: {\r
       has_many: [\r
         #'balloons.by_system_picture', \r
-        #'speech_balloon_templates.by_system_picture', \r
+        'speech_balloon_templates.by_system_picture', \r
         'licenses.by_system_picture', \r
+        'writing_formats.by_system_picture', \r
       ],\r
     }, \r
   },\r
index 0d66fef..f0a9278 100644 (file)
@@ -628,8 +628,6 @@ font-family : monospace;
 
 //speech_balloon_template
 .filer-head-speech_balloon_template .filer-head-caption {
-  width: 400px; 
 }
 .filer-item-speech_balloon_template .filer-item-caption {
-  width: 400px; 
 }
index 84c3144..3ef277e 100644 (file)
@@ -87,9 +87,9 @@ class ComicsController < ApplicationController
   
   def create
     set_model
-    @comic = @item
     @item = @my_model_class.new
     @item.supply_default 
+    @my_model_class.fold_extend_settings params[@my_model_class.item_name]
     @item.attributes = params[@my_model_class.item_name]
     @item.overwrite @operators
     render_create
@@ -97,7 +97,7 @@ class ComicsController < ApplicationController
   
   def update
     set_edit
-    @comic = @item
+    @my_model_class.fold_extend_settings params[@my_model_class.item_name]
     @item.attributes = params[@my_model_class.item_name]
     @item.overwrite @operators
     render_update
index 9d1172f..b6a2353 100644 (file)
@@ -36,4 +36,22 @@ class LicenseGroupsController < ApplicationController
     form_edit
   end
   
+  def create
+    set_model
+    @item = @my_model_class.new
+    @item.supply_default 
+    @my_model_class.fold_extend_settings params[@my_model_class.item_name]
+    @item.attributes = params[@my_model_class.item_name]
+    @item.overwrite 
+    render_create
+  end
+  
+  def update
+    set_edit
+    @my_model_class.fold_extend_settings params[@my_model_class.item_name]
+    @item.attributes = params[@my_model_class.item_name]
+    @item.overwrite 
+    render_update
+  end
+  
 end
index a742413..dc31794 100644 (file)
@@ -65,43 +65,23 @@ class LicensesController < ApplicationController
   end
   
   def create
-    @item = self.class.model.new
+    set_model
+    @item = @my_model_class.new
     @item.supply_default 
-    @item.attributes = params[:license]
-    @item.overwrite @operators
-
-    if @item.save
-      respond_to do |format|
-        flash[:notice] = I18n.t('flash.notice.created', :model => self.class.model.model_name.human)
-        format.html { redirect_to @item }
-        format.json { render json: @item.to_json(self.class.model.show_json_opt), status: :created, location: @item }
-      end
-    else
-      flash[:notice] = I18n.t('flash.notice.not_created', :model => self.class.model.model_name.human)
-      render_new
-        format.html { render action: "new" }
-        format.json { render json: @item.errors, status: :unprocessable_entity }
-    end
+    @my_model_class.fold_extend_settings params[@my_model_class.item_name]
+    @item.attributes = params[@my_model_class.item_name]
+    @item.overwrite 
+    render_create
   end
-
+  
   def update
-    @item = self.class.model.edit(params[:id], @operators)
-    self.class.model.fold_extend_settings params[:license]
-    @item.attributes = params[:license]
+    set_edit
+    @my_model_class.fold_extend_settings params[@my_model_class.item_name]
+    @item.attributes = params[@my_model_class.item_name]
     @item.overwrite 
-    respond_to do |format|
-      if @item.save
-        flash[:notice] = I18n.t('flash.notice.updated', :model => self.class.model.model_name.human)
-        format.html { redirect_to @item }
-        format.json { head :ok }
-      else
-        flash[:notice] = I18n.t('flash.notice.not_updated', :model => self.class.model.model_name.human)
-        format.html { render action: "edit" }
-        format.json { render json: @item.errors, status: :unprocessable_entity }
-      end
-    end
+    render_update
   end
-
+  
   def destroy
     @item = self.class.model.edit(params[:id], @operators)
     respond_to do |format|
index 132aae7..96f337d 100644 (file)
@@ -27,7 +27,6 @@ class SpeechBalloonTemplatesController < ApplicationController
   
   def show_html_format format
     format.html {
-      @speech_balloon_template = @item
     }
   end
   
@@ -61,8 +60,8 @@ class SpeechBalloonTemplatesController < ApplicationController
   end
   
   def destroy
-    @speech_balloon_template = SpeechBalloonTemplate.find(params[:id])
-    @speech_balloon_template.destroy
+    @item = SpeechBalloonTemplate.find(params[:id])
+    @item.destroy
 
     respond_to do |format|
       format.html { redirect_to :action => :list }
index 5b9f7e6..ffb75de 100644 (file)
@@ -8,7 +8,7 @@ class SystemPicturesController < ApplicationController
     before_filter :authenticate_author, :only => []
   end
   before_filter :authenticate_admin!, :only => []
-
+  
   def self.model
     SystemPicture
   end
@@ -19,7 +19,6 @@ class SystemPicturesController < ApplicationController
   
   def show_html_format format
     format.html {
-      @system_picture = @item
     }
   end
   
index 5e72055..ab11f80 100644 (file)
@@ -17,7 +17,6 @@ class WritingFormatsController < ApplicationController
 
   def show_html_format format
     format.html {
-      @writing_format = @item
     }
   end
   
@@ -42,4 +41,31 @@ class WritingFormatsController < ApplicationController
     form_edit
   end
   
+  def create
+    set_model
+    @item = @my_model_class.new
+    @item.supply_default 
+    @my_model_class.fold_extend_settings params[@my_model_class.item_name]
+    @item.attributes = params[@my_model_class.item_name]
+    @item.overwrite 
+    render_create
+  end
+  
+  def update
+    set_edit
+    @my_model_class.fold_extend_settings params[@my_model_class.item_name]
+    @item.attributes = params[@my_model_class.item_name]
+    @item.overwrite 
+    render_update
+  end
+  
+  def destroy
+    @item = self.class.model.edit(params[:id], @operators)
+    respond_to do |format|
+        flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => self.class.model.model_name.human)
+        format.html { redirect_to @item }
+        format.json { render json: @item.errors, status: :unprocessable_entity }
+    end
+  end
+  
 end
index 3a70d4d..0a14f8f 100644 (file)
@@ -12,6 +12,9 @@ class License < Peta::SystemResource
   validates :url, :presence => true, :length => {:maximum => 200}, :uniqueness => {:scope => :name}, :url => {:message => I18n.t('errors.messages.url')} #{:allow_blank => true}
   validates :system_picture_id, :presence => true, :numericality => true, :existence => {:both => false}
   
+  def overwrite 
+  end
+  
   def caption_with_group
     self.license_group.caption + '/' + self.caption
   end
index cbd6fc1..fb9f8fc 100644 (file)
@@ -1,5 +1,5 @@
 #ライセンスグループ
-class LicenseGroup < Peta::SystemResource
+class LicenseGroup < Peta::Template
   load_manifest
   has_many :licenses
   
index 3e8b44f..50db132 100644 (file)
@@ -1,5 +1,5 @@
 #フキダシテンプレート
-class SpeechBalloonTemplate < Peta::SystemResource
+class SpeechBalloonTemplate < Peta::Template
   load_manifest
   has_many :speech_balloons
   belongs_to :system_picture
@@ -22,14 +22,6 @@ class SpeechBalloonTemplate < Peta::SystemResource
     self.system_picture.tmb_opt_img_tag
   end
   
-  def self.list_opt
-    {}
-  end
-  
-  def self.list_json_opt
-    {}
-  end
-  
   def self.show_opt
     {}
   end
index 8a3210d..542f2b5 100644 (file)
@@ -1,8 +1,9 @@
-class SystemPicture < Peta::Item
+class SystemPicture < Peta::SystemResource
   load_manifest
   has_many :balloons
   has_many :speech_balloon_templates
   has_many :licenses
+  has_many :writing_formats
   
   validates :ext, :presence => true, :length => {:maximum => 4}, :inclusion => {:in => ['png', 'jpeg', 'gif']}
   validates :width, :presence => true, :numericality => true, :natural_number => true
index 5e54402..071e93f 100644 (file)
@@ -1,4 +1,4 @@
-class WritingFormat < Peta::SystemResource
+class WritingFormat < Peta::Template
   load_manifest
   has_many :speeches
   belongs_to :system_picture
@@ -17,8 +17,12 @@ class WritingFormat < Peta::SystemResource
     self.t = WritingFormat.count.to_i if self.new_record?
   end
   
+  def symbol_option
+    self.system_picture.tmb_opt_img_tag
+  end
+  
   def self.list_where
-    nil
+    ''
   end
   
   def self.list_order
@@ -36,14 +40,6 @@ end
     }
   end
   
-  def self.list_opt
-    {}
-  end
-  
-  def self.list_json_opt
-    {}
-  end
-  
   def self.show_opt
     {}
   end
index 2db98de..a8ae2d4 100644 (file)
@@ -1,29 +1,37 @@
-<h1><%= t('.title') %></h1>
-<p id="notice"><%= notice %></p>
+<h1>
+  <%= link_to icon_tag('LicenseGroup'), license_group_path(@item) %>
+  <%= link_to h(@item.caption), license_group_path(@item) %>
+  <%= link_to icon_tag('Prof'), license_group_path(@item, :format => :prof) %>
+</h1>
 
 <p>
   <b><%= t_m 'LicenseGroup.name' -%>:</b>
-  <%= h @license_group.name %>
+  <%= h @item.name %>
 </p>
 <p>
   <b><%= t_m 'LicenseGroup.classname' -%>:</b>
-  <%= h @license_group.classname %>
-</p>
-<p>
-  <b><%= t_m 'LicenseGroup.caption' -%>:</b>
-  <%= h @license_group.caption %>
+  <%= h @item.classname %>
 </p>
 <p>
   <b><%= t_m 'LicenseGroup.url' -%>:</b>
-  <%= link_to h(@license_group.url), @license_group.url %>
+  <%= link_to h(@item.url), @item.url %>
 </p>
 <p>
   <b><%= t_m 'LicenseGroup.created_at' -%>:</b>
-  <%= l @license_group.created_at %>
+  <%= l @item.created_at %>
 </p>
 <p>
   <b><%= t_m 'LicenseGroup.updated_at' -%>:</b>
-  <%= l @license_group.updated_at %>
+  <%= l @item.updated_at %>
 </p>
 
-<%= link_to t('link.back'), license_groups_path %>
+<% if @item.own? @operators -%>
+  <h3><%= t('editor') -%></h3>
+  <p id="notice"><%= notice %></p>
+  
+  <p>
+    <%= link_to t('link.edit'), edit_license_group_path(@item) %>
+    <%= link_to t('link.destroy'), license_group_path(@item), :method => :delete %>
+  </p>
+  
+<% end %>
index 887723e..8d293d1 100644 (file)
@@ -1,32 +1,37 @@
-<h1><%= t('.title') %></h1>
-<p id="notice"><%= notice %></p>
+<h1>
+  <%= link_to icon_tag('License'), license_path(@item) %>
+  <%= link_to h(@item.caption_with_group), license_path(@item) %>
+  <%= link_to icon_tag('Prof'), license_path(@item, :format => :prof) %>
+</h1>
 
 <p>
   <b><%= t_m 'License.license_group_id' -%>:</b>
-  <%= link_to h(@license.license_group.caption), license_group_path(@license.license_group) %>
+  <%= link_to h(@item.license_group.caption), license_group_path(@item.license_group) %>
 </p>
 <p>
   <b><%= t_m 'License.name' -%>:</b>
-  <%= h @license.name %>
-</p>
-<p>
-  <b><%= t_m 'License.caption' -%>:</b>
-  <%= h @license.caption %>
+  <%= h @item.name %>
 </p>
 <p>
   <b><%= t_m 'License.url' -%>:</b>
-  <%= link_to h(@license.url), @license.url %>
-</p>
-<p>
-  <b><%= t_m 'License.system_picture_id' -%>:</b>
-  <%= link_to tag(:img, :src => @license.system_picture.url), system_picture_path(@license.system_picture) %>
+  <%= link_to h(@item.url), @item.url %>
 </p>
 <p>
   <b><%= t_m 'License.created_at' -%>:</b>
-  <%= l @license.created_at %>
+  <%= l @item.created_at %>
 </p>
 <p>
   <b><%= t_m 'License.updated_at' -%>:</b>
-  <%= l @license.updated_at %>
+  <%= l @item.updated_at %>
 </p>
-<%= link_to t('link.back'), licenses_path %>
+
+<% if @item.own? @operators -%>
+  <h3><%= t('editor') -%></h3>
+  <p id="notice"><%= notice %></p>
+  
+  <p>
+    <%= link_to t('link.edit'), edit_license_path(@item) %>
+    <%= link_to t('link.destroy'), license_path(@item), :method => :delete %>
+  </p>
+  
+<% end %>
diff --git a/app/views/speech_balloon_templates/_summary.html.erb b/app/views/speech_balloon_templates/_summary.html.erb
deleted file mode 100644 (file)
index d300ee6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<div>
-  <%= link_to h(truncate(item.author.name, :length => 12)), author_path(item.author) %>
-</div>
index 45321a5..c3b77c8 100644 (file)
@@ -1,21 +1,19 @@
 <h1><%= t '.title' -%></h1>
-<p id="notice"><%= notice %></p>
 
 <div>
-  <%= link_to tag(:img, @speech_balloon_template.system_picture.tmb_opt_img_tag), speech_balloon_template_path(@speech_balloon_template) %>
+  <%= link_to tag(:img, @item.symbol_option), speech_balloon_template_path(@item) %>
   <div>
-    <%= link_to h(@speech_balloon_template.caption), speech_balloon_template_path(@speech_balloon_template) %>
+    <%= link_to h(@item.caption), speech_balloon_template_path(@item) %>
   </div>
 </div>
 
-<% if @operators.author and @operators.author.working? -%>
-  <h3><%= t('home.index.catch') -%></h3>
-  <%= link_to panel_icon(:object => @operators.author.working_panel, :size => 25), panel_path(@operators.author.working_panel) %>
-  <%= link_to @operators.author.working_panel.caption, main_app.panel_path(@operators.author.working_panel) %>
-
+<% if @item.own? @operators -%>
+  <h3><%= t('editor') -%></h3>
+  <p id="notice"><%= notice %></p>
+  
   <p>
-    <%= link_to t('speech_balloon_templates.add_to_panel'), main_app.new_speech_balloon_path(:speech_balloon_template_id => @speech_balloon_template.id) %>
+    <%= link_to t('link.edit'), edit_speech_balloon_template_path(@item) %>
+    <%= link_to t('link.destroy'), speech_balloon_template_path(@item), :method => :delete %>
   </p>
-<% end -%>
-
-<%= link_to t('link.back'), speech_balloon_templates_path %>
+  
+<% end %>
index 20d53cd..df698c2 100644 (file)
@@ -1,41 +1,12 @@
-<h1><%= t '.title' -%></h1>
-<p id="notice"><%= notice %></p>
-
-<%= link_to tag(:img, @system_picture.opt_img_tag), @system_picture.url %>
-
-<p>
-  <b><%= t_m 'SystemPicture.ext' -%>:</b>
-  <%= @system_picture.ext %>
-</p>
-
-<p>
-  <b><%= t_m 'SystemPicture.width' -%>:</b>
-  <%= @system_picture.width %>
-</p>
-
-<p>
-  <b><%= t_m 'SystemPicture.height' -%>:</b>
-  <%= @system_picture.height %>
-</p>
-
-<p>
-  <b><%= t_m 'SystemPicture.filesize' -%>:</b>
-  <%= @system_picture.filesize %>
-</p>
-
-<p>
-  <b><%= t_m 'SystemPicture.md5' -%>:</b>
-  <%= h @system_picture.md5 %>
-</p>
+<%= link_to tag(:img, @item.opt_img_tag), @item.url %>
 
 <p>
   <b><%= t_m 'SystemPicture.created_at' -%>:</b>
-  <%= l @system_picture.created_at %>
+  <%= l @item.created_at %>
 </p>
 
 <p>
   <b><%= t_m 'SystemPicture.updated_at' -%>:</b>
-  <%= l @system_picture.updated_at %>
+  <%= l @item.updated_at %>
 </p>
 
-<%= link_to t('link.back'), system_pictures_path %>
diff --git a/app/views/writing_formats/show.html.erb b/app/views/writing_formats/show.html.erb
new file mode 100644 (file)
index 0000000..8eed3b3
--- /dev/null
@@ -0,0 +1,33 @@
+<h1>
+  <%= link_to icon_tag('WritingFormat'), writing_format_path(@item) %>
+  <%= link_to h(@item.caption), writing_format_path(@item) %>
+  <%= link_to icon_tag('Prof'), writing_format_path(@item, :format => :prof) %>
+</h1>
+
+<p>
+  <b><%= t_m 'WritingFormat.name' -%>:</b>
+  <%= h @item.name %>
+</p>
+<p>
+  <b><%= t_m 'WritingFormat.classname' -%>:</b>
+  <%= h @item.classname %>
+</p>
+<p>
+  <b><%= t_m 'WritingFormat.created_at' -%>:</b>
+  <%= l @item.created_at %>
+</p>
+<p>
+  <b><%= t_m 'WritingFormat.updated_at' -%>:</b>
+  <%= l @item.updated_at %>
+</p>
+
+<% if @item.own? @operators -%>
+  <h3><%= t('editor') -%></h3>
+  <p id="notice"><%= notice %></p>
+  
+  <p>
+    <%= link_to t('link.edit'), edit_writing_format_path(@item) %>
+    <%= link_to t('link.destroy'), writing_format_path(@item), :method => :delete %>
+  </p>
+  
+<% end %>
index 03c0a4d..102b413 100644 (file)
@@ -400,12 +400,14 @@ Pettanr::Application.routes.draw do
       get :index
       get :show
       get :count
+      post :create
     end
     member do
       get :by_panel
       get :by_system_picture
       get :count_by_system_picture
       get :count_by_panel
+      put :update
       delete :destroy
     end
   end
@@ -414,12 +416,15 @@ Pettanr::Application.routes.draw do
       get :index
       get :show
       get :count
+      post :create
     end
     member do
       get :speeches
       get :by_system_picture
       get :speeches_count
       get :count_by_system_picture
+      put :update
+      delete :destroy
     end
   end
   resources :license_groups do
@@ -427,10 +432,12 @@ Pettanr::Application.routes.draw do
       get :index
       get :show
       get :count
+      post :create
     end
     member do
       get :licenses
       get :licenses_count
+      put :update
       delete :destroy
     end
   end
@@ -440,6 +447,7 @@ Pettanr::Application.routes.draw do
       get :show
       get :count
       get :search
+      post :create
     end
     member do
       get :resource_pictures
@@ -448,6 +456,8 @@ Pettanr::Application.routes.draw do
       get :resource_pictures_count
       get :count_by_license_group
       get :count_by_system_picture
+      put :update
+      delete :destroy
     end
   end
   resources :authors do
index 5bc58a5..69124fe 100644 (file)
@@ -1,5 +1,5 @@
 ManifestBase.require_modules "manifest/item/", 
-  %w|base item owner content root element binder leaf|
+  %w|base item owner system_resource template content root element binder leaf|
 
 module Manifest
   class ItemFactory < ManifestBase::Factory
@@ -7,7 +7,9 @@ module Manifest
     
     def self.types
       {
-        'item' => ItemPeta, 'owner' => OwnerPeta, 'content' => ContentPeta, 
+        'item' => ItemPeta, 'owner' => OwnerPeta, 
+        'system_resource' => SystemResourcePeta, 'template' => TemplatePeta, 
+        'content' => ContentPeta, 
         'root' => RootPeta, 'element' => ElementPeta, 
         'binder' => BinderPeta, 'leaf' => LeafPeta
       }
diff --git a/lib/manifest/item/system_resource.rb b/lib/manifest/item/system_resource.rb
new file mode 100644 (file)
index 0000000..5c27ca0
--- /dev/null
@@ -0,0 +1,15 @@
+module Manifest
+  module ItemModule
+    class SystemResourcePeta < BasePeta
+      
+      def set_default
+        super
+      end
+      
+      def init
+        super
+      end
+      
+    end
+  end
+end
diff --git a/lib/manifest/item/template.rb b/lib/manifest/item/template.rb
new file mode 100644 (file)
index 0000000..ebd17f2
--- /dev/null
@@ -0,0 +1,15 @@
+module Manifest
+  module ItemModule
+    class TemplatePeta < BasePeta
+      
+      def set_default
+        super
+      end
+      
+      def init
+        super
+      end
+      
+    end
+  end
+end
index 7e50b1d..3e8a6ad 100644 (file)
@@ -3,6 +3,7 @@ end
 require_dependency 'peta/item'
 require_dependency 'peta/owner'
 require_dependency 'peta/system_resource'
+require_dependency 'peta/template'
 require_dependency 'peta/content'
 require_dependency 'peta/element_nestable_content'
 require_dependency 'peta/root'
index c669aa6..7799ed3 100644 (file)
@@ -6,35 +6,12 @@ module Peta
     
     # ClassMethods
     
-    def self.enable_list
-      self.find(:all).delete_if {|system_resource|
-        system_resource.enable? == false
-      }
-    end
-    
     def self.edit system_resource_id, operators
       system_resource = self.find system_resource_id, self.show_opt
       raise ActiveRecord::Forbidden unless system_resource.own?(operators)
       system_resource
     end
     
-    def my_engine_resource
-      Manifest.manifest.system_resources.engine_resources[self.table_name]
-    end
-    
-    def enable?
-      return false unless er = self.my_engine_resource
-      er.resource_items.include? self.classname
-    end
-    
-    def my_engine_name
-      self.my_engine_resource.resource_items[self.classname]
-    end
-    
-    def my_engine
-      Object.const_get self.classname
-    end
-    
     def own? operators
       operators.admin?
     end
diff --git a/lib/peta/template.rb b/lib/peta/template.rb
new file mode 100644 (file)
index 0000000..0bc769b
--- /dev/null
@@ -0,0 +1,32 @@
+module Peta
+  class Template < SystemResource
+    self.abstract_class = true
+    
+    # Dynamic ClassMethods
+    
+    # ClassMethods
+    
+    def self.enable_list
+      self.find(:all).delete_if {|system_resource|
+        system_resource.enable? == false
+      }
+    end
+    
+    def my_engine_resource
+      Manifest.manifest.system_resources.engine_resources[self.table_name]
+    end
+    
+    def enable?
+      return false unless er = self.my_engine_resource
+      er.resource_items.include? self.classname
+    end
+    
+    def my_engine_name
+      self.my_engine_resource.resource_items[self.classname]
+    end
+    
+    def my_engine
+      Object.const_get self.classname
+    end
+  end
+end
index 1161d0a..fa11db1 100644 (file)
             "through": "speech_balloons"\r
           }\r
         },\r
+        "by_system_picture": {\r
+          "type": "filter"\r
+        },\r
         "select_items": {\r
           "type": "system_resource"\r
         }\r
       ],\r
       "associations": {\r
         "has_many": [\r
-          "licenses.by_system_picture"\r
+          "speech_balloon_templates.by_system_picture",\r
+          "licenses.by_system_picture",\r
+          "writing_formats.by_system_picture"\r
         ]\r
       }\r
     }\r
       "edit": {}\r
     },\r
     "writing_format": {\r
-      "symbol": {},\r
+      "symbol": {\r
+        "type": "default",\r
+        "args": {\r
+          "face": {\r
+            "type": "picture"\r
+          }\r
+        }\r
+      },\r
       "caption": {},\r
       "summary": {\r
         "type": "none"\r
index 32c3da9..702cc71 100644 (file)
         }\r
       }\r
     },\r
-    "speech_balloon_template": {},\r
-    "writing_format": {},\r
-    "license_group": {},\r
+    "speech_balloon_template": {\r
+      "type": "template"\r
+    },\r
+    "writing_format": {\r
+      "type": "template"\r
+    },\r
+    "license_group": {\r
+      "type": "template"\r
+    },\r
     "license": {\r
-      "type": "leaf",\r
+      "type": "system_resource",\r
       "args": {\r
         "parent_model_name": "license_group",\r
         "boost": {\r
     },\r
     "author": {},\r
     "artist": {},\r
-    "system_picture": {}\r
+    "system_picture": {\r
+      "type": "system_resource"\r
+    }\r
   },\r
   "controllers": {\r
     "folders": {\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         },\r
         "edit": {\r
           "type": "edit"\r
+        },\r
+        "create": {\r
+          "type": "create"\r
+        },\r
+        "update": {\r
+          "type": "update"\r
+        },\r
+        "destroy": {\r
+          "type": "destroy"\r
         }\r
       }\r
     },\r
         "has_many": {\r
           "balloons": {},\r
           "speech_balloon_templates": {},\r
-          "licenses": {}\r
+          "licenses": {},\r
+          "writing_formats": {}\r
         },\r
         "has_one": {}\r
       },\r