iatelier 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/iatelier/models/book.rb +15 -31
- data/lib/iatelier/templates/books/_engine.html.haml +0 -1
- data/lib/iatelier/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41642a576c00cfcbae058d049b580cecdc53021ea5d3a9ad9b6f20753594e812
|
4
|
+
data.tar.gz: 466c0174268b73872507103aa27e3def5754353dfe795b70e652dd7946507e9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11edb222a516e1c0eb362ccf814cbcf78f1c902d9628b883424ed32bcf04a205ae333f1531ab81634879bda6c4cd12d714f8f3260f9b9bd7ffd23ead48339c9b
|
7
|
+
data.tar.gz: c66ab84ef004c755aaf3b733cc500ce854fcb5ecffb4d5f94e74527b8368e5237894715fcf46468212b3d2e84c1c8704ad1174b9834b45538963ad2ec1c69907
|
data/lib/iatelier/models/book.rb
CHANGED
@@ -2,10 +2,9 @@ require 'redcarpet'
|
|
2
2
|
|
3
3
|
class Book < ActiveRecord::Base
|
4
4
|
self.abstract_class = true
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@@roles = []
|
5
|
+
DIMENSIONS = []
|
6
|
+
GROUPINGS = []
|
7
|
+
ROLES = []
|
9
8
|
|
10
9
|
@content_raw = ''
|
11
10
|
|
@@ -41,24 +40,13 @@ class Book < ActiveRecord::Base
|
|
41
40
|
end
|
42
41
|
|
43
42
|
def dimensions
|
44
|
-
|
45
|
-
end
|
46
|
-
def self.dimensions
|
47
|
-
@@dimensions
|
48
|
-
end
|
49
|
-
|
50
|
-
def roles
|
51
|
-
@@roles
|
43
|
+
self.class::DIMENSIONS
|
52
44
|
end
|
53
|
-
def
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
def groupings
|
58
|
-
@@groupings
|
45
|
+
def groupings
|
46
|
+
self.class::GROUPINGS
|
59
47
|
end
|
60
|
-
def
|
61
|
-
|
48
|
+
def roles
|
49
|
+
self.class::ROLES
|
62
50
|
end
|
63
51
|
|
64
52
|
def individuals requested_role
|
@@ -83,10 +71,6 @@ class Book < ActiveRecord::Base
|
|
83
71
|
end
|
84
72
|
end
|
85
73
|
|
86
|
-
def self.with_all
|
87
|
-
self.includes(self.dimensions + self.groupings)
|
88
|
-
end
|
89
|
-
|
90
74
|
def content
|
91
75
|
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
|
92
76
|
markdown.render(self.content_raw)
|
@@ -95,16 +79,16 @@ class Book < ActiveRecord::Base
|
|
95
79
|
# def initialized
|
96
80
|
# super()
|
97
81
|
# puts "content of the dimension: \n"
|
98
|
-
# puts
|
99
|
-
#
|
82
|
+
# puts Dimensions.inspect
|
83
|
+
# Dimensions.each do |dimension|
|
100
84
|
# reference = dimension + able
|
101
85
|
# hasone dimension.to_sym as: reference.to_sym
|
102
86
|
# end
|
103
87
|
# end
|
104
88
|
|
105
89
|
def create params
|
106
|
-
puts 'these are the stuff were going to add:' +
|
107
|
-
|
90
|
+
puts 'these are the stuff were going to add:' + Dimensions.to_s
|
91
|
+
Dimensions.each do |dimension|
|
108
92
|
method_name = 'setup_' + dimension
|
109
93
|
self.public_send(method_name.to_sym, params)
|
110
94
|
end
|
@@ -115,7 +99,7 @@ class Book < ActiveRecord::Base
|
|
115
99
|
end
|
116
100
|
|
117
101
|
def revise params
|
118
|
-
|
102
|
+
Dimensions.each do |dimension|
|
119
103
|
if self.public_send(dimension.to_sym)
|
120
104
|
method_name = 'revise_' + dimension
|
121
105
|
else
|
@@ -123,7 +107,7 @@ class Book < ActiveRecord::Base
|
|
123
107
|
end
|
124
108
|
self.public_send(method_name.to_sym, params)
|
125
109
|
end
|
126
|
-
|
110
|
+
Dimensions.each do |dimension|
|
127
111
|
self.public_send(dimension.to_sym).save
|
128
112
|
end
|
129
113
|
sync_keywords params
|
@@ -197,7 +181,7 @@ class Book < ActiveRecord::Base
|
|
197
181
|
def setup_subtitle params
|
198
182
|
self.build_subtitle({value: params[:subtitle]})
|
199
183
|
end
|
200
|
-
def
|
184
|
+
def revise_subtitle params
|
201
185
|
self.subtitle.update(value: params[:subtitle])
|
202
186
|
end
|
203
187
|
|
@@ -16,7 +16,6 @@
|
|
16
16
|
-if book.dimensions.include? 'description'
|
17
17
|
%label.label Description
|
18
18
|
%input{:class => "form-control pure-input-1", :name => "description", :type => "text", :placeholder => "Description", :value => book.description.try(:value)}
|
19
|
-
|
20
19
|
.form-box
|
21
20
|
%label Text
|
22
21
|
%textarea{:name => "content", :class => "text-editor pure-input-1 form-control", :type => "text", :placeholder => "Content of the book ..."}
|
data/lib/iatelier/version.rb
CHANGED