\r
},\r
},\r
+ by_license_group: {\r
+ type: 'list',\r
+ },\r
by_license: {\r
type: 'list',\r
},\r
list_name: 'public',\r
},\r
},\r
+ count_by_license_group: {\r
+ type: 'count',\r
+ },\r
count_by_license: {\r
type: 'count',\r
},\r
by_original_picture: {\r
type: 'filter',\r
},\r
+ by_license_group: {\r
+ type: 'filter',\r
+ },\r
by_license: {\r
type: 'filter',\r
},\r
public: {\r
type: 'public',\r
},\r
+ by_resource_picture: {\r
+ type: 'filter',\r
+ },\r
select_items: {\r
type: 'system_resource',\r
},\r
belongs_to: {\r
original_picture: {\r
}, \r
+ license_group: {\r
+ }, \r
license: {\r
}, \r
artist: {\r
number: true,\r
}\r
},\r
+ license_group_id: {\r
+ type: 'number',\r
+ rules : {\r
+ required: true,\r
+ number: true,\r
+ }\r
+ },\r
license_id: {\r
type: 'number',\r
rules : {\r
belongs_to: {\r
},\r
has_many: {\r
+ resource_pictures: {\r
+ }, \r
licenses: {\r
}, \r
},\r
],\r
associations: {\r
belongs_to: [\r
+ 'license_group',\r
'license',\r
'artist',\r
],\r
},\r
associations: {\r
has_many: [\r
+ 'resource_pictures.by_license_group', \r
'licenses.by_license_group', \r
],\r
}, \r
before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
else
before_filter :authenticate_resource_reader, :only => [
- :index, :show, :credit, :by_license, :by_artist, :count, :count_by_license, :count_by_artist
+ :index, :show, :credit, :by_license_group, :by_license, :by_artist, :count, :count_by_license_group, :count_by_license, :count_by_artist
]
before_filter :authenticate_user, :only => [:new, :create, :update, :destroy]
before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
filer_list
end
+ def by_license_group
+ filer_list
+ end
+
def by_license
filer_list
end
list_count
end
+ def count_by_license_group
+ list_count
+ end
+
def count_by_license
list_count
end
#ライセンスグループ
class LicenseGroup < Peta::Template
load_manifest
+ has_many :resource_pictures
has_many :licenses
validates :name, :presence => true, :length => {:maximum => 50}, :uniqueness => true
class ResourcePicture < Peta::Content
load_manifest
belongs_to :artist
+ belongs_to :license_group
belongs_to :license
belongs_to :system_picture
belongs_to :picture
title: 素材一覧
by_artist:
title: 絵師の素材一覧
+ by_license_group:
+ title: ライセンスの素材一覧
by_license:
title: ライセンスの素材一覧
show:
get :count
end
member do
+ get :by_license_group
get :by_license
get :by_artist
+ get :count_by_license_group
get :count_by_license
get :count_by_artist
delete :destroy
post :create
end
member do
+ get :resource_pictures
+ get :resource_pictures_count
get :licenses
get :licenses_count
put :update
--- /dev/null
+class LicenseOnExtendData < ActiveRecord::Migration
+ def up
+ ResourcePicture.all.each do |rp|
+ if rp.license_group_id.blank? or rp.license_group_id == 0
+ rp.license_group_id = rp.license.license_group_id
+ rp.boosts 'post'
+ rp.save!
+ end
+ end
+ end
+
+ def down
+ end
+end
"by_original_picture": {\r
"type": "filter"\r
},\r
+ "by_license_group": {\r
+ "type": "filter"\r
+ },\r
"by_license": {\r
"type": "filter"\r
},\r
"public": {\r
"type": "public"\r
},\r
+ "by_resource_picture": {\r
+ "type": "filter"\r
+ },\r
"select_items": {\r
"type": "system_resource"\r
}\r
],\r
"associations": {\r
"belongs_to": [\r
+ "license_group",\r
"license",\r
"artist"\r
]\r
},\r
"associations": {\r
"has_many": [\r
+ "resource_pictures.by_license_group",\r
"licenses.by_license_group"\r
]\r
}\r
"list_name": "public"\r
}\r
},\r
+ "by_license_group": {\r
+ "type": "list"\r
+ },\r
"by_license": {\r
"type": "list"\r
},\r
"list_name": "public"\r
}\r
},\r
+ "count_by_license_group": {\r
+ "type": "count"\r
+ },\r
"count_by_license": {\r
"type": "count"\r
},\r
"associations": {\r
"belongs_to": {\r
"original_picture": {},\r
+ "license_group": {},\r
"license": {},\r
"artist": {},\r
"system_picture": {}\r
"number": true\r
}\r
},\r
+ "license_group_id": {\r
+ "type": "number",\r
+ "rules": {\r
+ "required": true,\r
+ "number": true\r
+ }\r
+ },\r
"license_id": {\r
"type": "number",\r
"rules": {\r
"number": true\r
}\r
},\r
- "license_group_id": {\r
- "type": "number",\r
- "rules": {\r
- "required": true,\r
- "number": true\r
- }\r
- },\r
"license_group_settings": {\r
"type": "text",\r
"rules": {}\r
"associations": {\r
"belongs_to": {},\r
"has_many": {\r
+ "resource_pictures": {},\r
"licenses": {}\r
},\r
"has_one": {}\r