pettanr_unknown_v01_licenses 0.1.0 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/pettanr_unknown_v01_licenses/credit_picture.rb +13 -0
- data/app/models/pettanr_unknown_v01_licenses/license.rb +19 -0
- data/app/views/pettanr_unknown_v01_licenses/attributes/_credit.html.erb +3 -2
- data/db/migrate/20140408085355_create_pettanr_unknown_v01_licenses_licenses.rb +19 -0
- data/db/migrate/20140408085413_create_pettanr_unknown_v01_licenses_credit_pictures.rb +10 -0
- data/db/pettanr_unknown_v01_license.json +1 -1
- data/db/pettanr_unknown_v01_license.yml +2 -3
- data/lib/pettanr_unknown_v01_licenses/version.rb +1 -1
- data/lib/pettanr_unknown_v01_licenses.rb +70 -0
- metadata +6 -2
@@ -0,0 +1,13 @@
|
|
1
|
+
module PettanrUnknownV01Licenses
|
2
|
+
class CreditPicture < ActiveRecord::Base
|
3
|
+
belongs_to :source_url_btn, :class_name => "SystemPicture", :foreign_key => "source_url_btn_id"
|
4
|
+
belongs_to :source_url_off_btn, :class_name => "SystemPicture", :foreign_key => "source_url_off_btn_id"
|
5
|
+
|
6
|
+
validates :source_url_btn_id, :presence => true, :numericality => true, :existence => {:both => false}
|
7
|
+
validates :source_url_off_btn_id, :presence => true, :numericality => true, :existence => {:both => false}
|
8
|
+
|
9
|
+
def supply_default
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module PettanrUnknownV01Licenses
|
2
|
+
class License < ActiveRecord::Base
|
3
|
+
validates :open, :presence => true, :numericality => true, :existence => true
|
4
|
+
validates :commercial, :presence => true, :numericality => true, :existence => true
|
5
|
+
validates :official, :presence => true, :numericality => true, :existence => true
|
6
|
+
validates :attribution, :presence => true, :numericality => true, :existence => true
|
7
|
+
validates :derive, :presence => true, :numericality => true, :existence => true
|
8
|
+
validates :thumbnail, :presence => true, :numericality => true, :existence => true
|
9
|
+
validates :gif_convert, :presence => true, :numericality => true, :existence => true
|
10
|
+
validates :reverse, :presence => true, :numericality => true, :existence => true
|
11
|
+
validates :sync_vh, :presence => true, :numericality => true, :existence => true
|
12
|
+
validates :overlap, :presence => true, :numericality => true, :existence => true
|
13
|
+
validates :trackback, :presence => true, :numericality => true, :existence => true
|
14
|
+
|
15
|
+
def supply_default
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -8,13 +8,14 @@
|
|
8
8
|
</td>
|
9
9
|
<td>
|
10
10
|
<div class="md5">
|
11
|
+
<% picture.license.boosts 'read' %>
|
11
12
|
<% if picture.credit_data['source_url'].blank? %>
|
12
|
-
<% source_url_off_btn = SystemPicture.find(picture.license.
|
13
|
+
<% source_url_off_btn = SystemPicture.find(picture.license.credit_picture_extend.source_url_off_btn_id) %>
|
13
14
|
<%=
|
14
15
|
tag(:img, :src => source_url_off_btn.url, :alt => 'no source', :width => source_url_off_btn.width, :height => source_url_off_btn.height)
|
15
16
|
%>
|
16
17
|
<% else %>
|
17
|
-
<% source_url_btn = SystemPicture.find(picture.license.
|
18
|
+
<% source_url_btn = SystemPicture.find(picture.license.credit_picture_extend.source_url_btn_id) %>
|
18
19
|
<%= link_to(
|
19
20
|
tag(:img, :src => source_url_btn.url, :alt => 'source url', :width => source_url_btn.width, :height => source_url_btn.height),
|
20
21
|
picture.credit_data['source_url'] )
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreatePettanrUnknownV01LicensesLicenses < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :pettanr_unknown_v01_licenses_licenses do |t|
|
4
|
+
t.column :open, :integer, :null => false, :default => 0
|
5
|
+
t.column :commercial, :integer, :null => false, :default => 0
|
6
|
+
t.column :official, :integer, :null => false, :default => 0
|
7
|
+
t.column :attribution, :integer, :null => false, :default => 0
|
8
|
+
t.column :derive, :integer, :null => false, :default => 0
|
9
|
+
t.column :thumbnail, :integer, :null => false, :default => 0
|
10
|
+
t.column :gif_convert, :integer, :null => false, :default => 0
|
11
|
+
t.column :reverse, :integer, :null => false, :default => 0
|
12
|
+
t.column :sync_vh, :integer, :null => false, :default => 0
|
13
|
+
t.column :overlap, :integer, :null => false, :default => 0
|
14
|
+
t.column :trackback, :integer, :null => false, :default => 0
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class CreatePettanrUnknownV01LicensesCreditPictures < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :pettanr_unknown_v01_licenses_credit_pictures do |t|
|
4
|
+
t.column :source_url_btn_id, :integer, :null => false, :default => 0
|
5
|
+
t.column :source_url_off_btn_id, :integer, :null => false, :default => 0
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -1 +1 @@
|
|
1
|
-
{"UnknownV01Licenses@pettanr":{"classname":"PettanrUnknownV01Licenses","caption":"Unknown 0.1","url":"https://github.com/yasushiito/pettanr_unknown_v01_licenses/wiki","licenses_attributes":{"UnknownV01Licenses:UK@pettanr":{"caption":"Unknown","url":"https://github.com/yasushiito/pettanr_unknown_v01_licenses/wiki/Unknown","
|
1
|
+
{"UnknownV01Licenses@pettanr":{"classname":"PettanrUnknownV01Licenses","caption":"Unknown 0.1","url":"https://github.com/yasushiito/pettanr_unknown_v01_licenses/wiki","licenses_attributes":{"UnknownV01Licenses:UK@pettanr":{"caption":"Unknown","url":"https://github.com/yasushiito/pettanr_unknown_v01_licenses/wiki/Unknown","credit_picture_settings":{"source_url_btn_id":{"text":"iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAIAAAC0D9CtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVDhPY3j/ZAOpiIFUDUD1OPV0MIjiMm5UD55wwxMHoHADBisagmvAKjUap1ROo3jiBwCmiapYhZeQ8QAAAABJRU5ErkJggg=="},"source_url_off_btn_id":{"text":"iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAABISURBVDhPY3z//v1/BgoBE4X6wdoJGnKqO4OgPQQNIWgCMS4ZgYYwUiOdgA3BFY1mpTPg4YpPDVVcQjCdjCY2YhI5phqqxA4An6wclAZTJpkAAAAASUVORK5CYII="}},"license_group_settings":{"open":0,"commercial":1,"official":0,"attribution":-1,"derive":-1,"thumbnail":1,"gif_convert":1,"reverse":1,"sync_vh":1,"overlap":1,"trackback":0},"license_group_classname":"PettanrUnknownV01Licenses","system_picture_id":{"text":"iVBORw0KGgoAAAANSUhEUgAAAFgAAAAfCAYAAABjyArgAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAWeSURBVHja7JprbBRVFMf/Mzu7dHfbLi0tLY/SUtoSKG1sSEzKKyHUVi0BJYRobCQKakIiBo1f+EBiSJroFw2ERIMJBhVRSPiAphFNFEQTCUG7LdZSSKWlLS1td7ct+5qX59zd2dYCjYklYc2cZrszd+5j53fPOffcMyOVFuZXNG5/7lhV1apqWZZV2PKfxTAMZ1tbu/+b0ydfkva+vvdCVXXVer5AgG06swNYfLf5235SVq5YsYpPnIpik5klcZCiqpoGZqs4XU5AkmwqsyzsDWRiK5umadN4SMJsbaf7sDXZRmADtgHbYgO2Af/vAXOwpqoq9OQuxAozuMyYUjZdOKDWdN0mORNgBinR3+3BIaixuIBsGKbYf/T19QvA+jTIifhZwvCdYcSisXuu2zINsGka+Ozoh+jt6xMaadC5puk4/tERhEJjiBF4LudPjLQ6obUmzpw6ia6uazDoXNUSHy15rBuJuqzllljthWXQuDx5qqrB2u7wMdfhybWuJcoM0WdsmpWllQ+WHfJ9Ez58sxIhYO1W43EMkFbT3QsoksRtHAJKPBbF+FgIcdLoWDRC0A3004TFYzEBk+uY1I7bD4+M8MxCJ/jj42O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W+XFyH+s/Ly0ssqvRPSYaFHIkIn0Vl3CYz05vqxsPQqZ6SXCO8XvcjDXfGMM1BMS1/pov1zM5M3lgKSBKQyN7L94+jrbqp/l0P7t9yWVPbWMczjWEne+xsmi02YBuwLfcAlux3Ih5eDExsZTWupsWePt1EpFo5rfBHR0c7v5vGOzn73bTZg8vCbJWvT32xm+JL8XYl7S3stytnQczJtyt3/y3AAHuZzFnaMK7HAAAAAElFTkSuQmCC"}}}}}
|
@@ -7,10 +7,10 @@ UnknownV01Licenses@pettanr:
|
|
7
7
|
caption: Unknown
|
8
8
|
url: https://github.com/yasushiito/pettanr_unknown_v01_licenses/wiki/Unknown
|
9
9
|
system_picture_file: ./Unknown.png
|
10
|
-
|
10
|
+
credit_picture_settings:
|
11
11
|
source_url_btn_id: ./b1.png
|
12
12
|
source_url_off_btn_id: ./b2.png
|
13
|
-
|
13
|
+
license_group_settings:
|
14
14
|
open: 0
|
15
15
|
commercial: 1
|
16
16
|
official: 0
|
@@ -19,7 +19,6 @@ UnknownV01Licenses@pettanr:
|
|
19
19
|
thumbnail: 1
|
20
20
|
gif_convert: 1
|
21
21
|
reverse: 1
|
22
|
-
resize: 1
|
23
22
|
sync_vh: 1
|
24
23
|
overlap: 1
|
25
24
|
trackback: 0
|
@@ -1,4 +1,74 @@
|
|
1
1
|
require "pettanr_unknown_v01_licenses/engine"
|
2
2
|
|
3
3
|
module PettanrUnknownV01Licenses
|
4
|
+
module LicenseModule
|
5
|
+
def supply_default
|
6
|
+
super
|
7
|
+
self.license_group_classname = self.license_group.classname
|
8
|
+
end
|
9
|
+
|
10
|
+
def license_extend
|
11
|
+
self.new_license unless @license_extend
|
12
|
+
@license_extend
|
13
|
+
end
|
14
|
+
|
15
|
+
def license_extend= params
|
16
|
+
# load attributes
|
17
|
+
@license_extend = PettanrUnknownV01Licenses::License.new params
|
18
|
+
# no supply default params
|
19
|
+
end
|
20
|
+
|
21
|
+
def new_license params = {}
|
22
|
+
@license_extend = PettanrUnknownV01Licenses::License.new params
|
23
|
+
@license_extend.supply_default
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
module CreditPictureModule
|
29
|
+
def supply_default
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def credit_picture_extend
|
34
|
+
self.new_credit_picture unless @credit_picture_extend
|
35
|
+
@credit_picture_extend
|
36
|
+
end
|
37
|
+
|
38
|
+
def credit_picture_extend= params
|
39
|
+
# load attributes
|
40
|
+
@credit_picture_extend = PettanrUnknownV01Licenses::CreditPicture.new params
|
41
|
+
# no supply default params
|
42
|
+
end
|
43
|
+
|
44
|
+
def new_credit_picture params = {}
|
45
|
+
@credit_picture_extend = PettanrUnknownV01Licenses::CreditPicture.new params
|
46
|
+
@credit_picture_extend.supply_default
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
module AttributeModule
|
52
|
+
def supply_default
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
56
|
+
def resource_picture_extend
|
57
|
+
self.new_resource_picture unless @resource_picture_extend
|
58
|
+
@resource_picture_extend ||= PettanrUnknownV01Licenses::Attribute.new
|
59
|
+
end
|
60
|
+
|
61
|
+
def resource_picture_extend= params
|
62
|
+
# load attributes
|
63
|
+
@resource_picture_extend = PettanrUnknownV01Licenses::Attribute.new params
|
64
|
+
# no supply default params
|
65
|
+
end
|
66
|
+
|
67
|
+
def new_resource_picture params = {}
|
68
|
+
@resource_picture_extend = PettanrUnknownV01Licenses::Attribute.new params
|
69
|
+
# Attribute's supply_default need operators
|
70
|
+
# @resource_picture_extend.supply_default operators
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
4
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pettanr_unknown_v01_licenses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-04-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -57,6 +57,8 @@ files:
|
|
57
57
|
- app/helpers/pettanr_unknown_v01_licenses/application_helper.rb
|
58
58
|
- app/helpers/pettanr_unknown_v01_licenses/attributes_helper.rb
|
59
59
|
- app/models/pettanr_unknown_v01_licenses/attribute.rb
|
60
|
+
- app/models/pettanr_unknown_v01_licenses/credit_picture.rb
|
61
|
+
- app/models/pettanr_unknown_v01_licenses/license.rb
|
60
62
|
- app/views/layouts/pettanr_unknown_v01_licenses/application.html.erb
|
61
63
|
- app/views/pettanr_unknown_v01_licenses/attributes/new.html.erb
|
62
64
|
- app/views/pettanr_unknown_v01_licenses/attributes/new.js.erb
|
@@ -70,6 +72,8 @@ files:
|
|
70
72
|
- db/b1.png
|
71
73
|
- db/b2.png
|
72
74
|
- db/migrate/20121007054509_create_pettanr_unknown_v01_licenses_attributes.rb
|
75
|
+
- db/migrate/20140408085355_create_pettanr_unknown_v01_licenses_licenses.rb
|
76
|
+
- db/migrate/20140408085413_create_pettanr_unknown_v01_licenses_credit_pictures.rb
|
73
77
|
- db/pettanr_unknown_v01_license.json
|
74
78
|
- db/pettanr_unknown_v01_license.yml
|
75
79
|
- db/Unknown.png
|