From: yasushiito Date: Tue, 15 Apr 2014 09:33:13 +0000 (+0900) Subject: license extended X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=commitdiff_plain;h=8b87bde4b61bea53c697047889941c4232b493de license extended --- diff --git a/app/models/resource_picture.rb b/app/models/resource_picture.rb index 4a9f7346..2ec06855 100644 --- a/app/models/resource_picture.rb +++ b/app/models/resource_picture.rb @@ -29,8 +29,9 @@ class ResourcePicture < Peta::Content end def visible? operators - return false unless super - true + # no super + # content model call to owner checker + self.user_visible? operators end def filename @@ -46,7 +47,7 @@ class ResourcePicture < Peta::Content end def url subdir = nil - '/resource_pictures/' + (subdir.to_s.empty? ? '' : subdir.to_s + '/' ) + filename + '/resource_pictures/' + filename + (subdir.to_s.empty? ? '' : '?subdir=' + subdir.to_s) end def to_gif? @@ -99,6 +100,7 @@ class ResourcePicture < Peta::Content pc = Picture.new pc.supply_default pc.overwrite self + pc.boosts 'post' r = pc.store imager return pc if r self.errors.add :base, Picture.model_name.human + I18n.t('errors.not_create') diff --git a/config/routes.rb b/config/routes.rb index bcc06b5b..c2bdbc9e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -572,7 +572,9 @@ Pettanr::Application.routes.draw do # Sample of regular route: # match 'products/:id' => 'catalog#view' # Keep in mind you can assign values other than :controller and :action - match 'resource_pictures/full/:id(.:format)/' => 'resource_pictures#show' + + # resource_pictures/1.png?subdir=full + # match 'resource_pictures/full/:id(.:format)/' => 'resource_pictures#show' match 'pictures/:subdir/:id(.:format)/' => 'pictures#show' #match 'scroll_panels/scroll/:id(.:format)' => 'scroll_panels#scroll' match 'top/(:action)', :controller => 'top' diff --git a/lib/peta/item.rb b/lib/peta/item.rb index 8025da9e..0fd4b802 100644 --- a/lib/peta/item.rb +++ b/lib/peta/item.rb @@ -193,7 +193,7 @@ module Peta def overwrite end - def visible? operators + def user_visible? operators if Manifest.manifest.magic_numbers['run_mode'] == 0 return false unless operators.guest? else @@ -202,6 +202,11 @@ module Peta true end + def visible? operators + return false unless self.user_visible? operators + true + end + def editize? self.respond_to? :editor end diff --git a/lib/peta/system_resource.rb b/lib/peta/system_resource.rb index f3e36949..953ceb9b 100644 --- a/lib/peta/system_resource.rb +++ b/lib/peta/system_resource.rb @@ -8,8 +8,6 @@ module Peta def self.enable_list self.find(:all).delete_if {|system_resource| - p system_resource - p system_resource.enable? system_resource.enable? == false } end diff --git a/public/manifest.json b/public/manifest.json index a7cacb18..53cb3a83 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -97,15 +97,26 @@ "picture": { "args": { "boost": { - "license_group": {}, + "license_group": { + "resource_name": "license", + "extend_column_name": "license_group_classname", + "settings_column_name": "license_group_settings", + "extend_model_class_name": "License", + "extend_item_name": "license" + }, "license": { + "level": "read", + "extend_column_name": "license_group_classname", + "extend_model_class_name": "Attribute", "extend_item_name": "attribute" }, "credit_picture": { "level": "read", + "resource_name": "license", + "extend_column_name": "license_group_classname", + "settings_column_name": "credit_picture_settings", "extend_model_class_name": "CreditPicture", - "extend_item_name": "credit_picture", - "extend_column_name": "license_group_classname" + "extend_item_name": "credit_picture" } } } @@ -2101,6 +2112,13 @@ "number": true } }, + "license_group_id": { + "type": "number", + "rules": { + "required": true, + "number": true + } + }, "license_id": { "type": "number", "rules": { @@ -2132,7 +2150,7 @@ "type": "text", "rules": {} }, - "license_classname": { + "license_group_classname": { "type": "text", "rules": { "required": true @@ -2199,6 +2217,13 @@ "number": true } }, + "license_group_id": { + "type": "number", + "rules": { + "required": true, + "number": true + } + }, "license_id": { "type": "number", "rules": { @@ -2237,7 +2262,7 @@ "number": true } }, - "license_classname": { + "license_group_classname": { "type": "text", "rules": { "required": true