iatelier 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/iatelier/controllers/books/edit.rb +1 -1
- data/lib/iatelier/controllers/books/update.rb +3 -1
- data/lib/iatelier/models/book.rb +14 -17
- data/lib/iatelier/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76590b778f4a1751dd45b71b66454fd09cd4ccef1d618877104640f4b081ada5
|
4
|
+
data.tar.gz: 19ee2dac571df2899673d08636fedcbeef8f77a29a5280d7c7e4c8711251ec23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85efe36bba980cf2d6ae02dad61d6d2d8df5f88cf4d65223d0bac66be8512ed167d804ba9b791348245a94c4c2bccb6487fa49e0495e3a7c765a952735fb2677
|
7
|
+
data.tar.gz: 2bad2720e84c46ba353a4226768a76a1384a6f2d4a6ccf95dbf5eb5f7ff3520d861de25a721eefd0b38a490e385537b22a8f5138d2aa7338d567c1d98f642add
|
@@ -9,7 +9,7 @@ module Iatelier
|
|
9
9
|
@database = params[:database]
|
10
10
|
self.set_database database
|
11
11
|
@book = Object.const_get(params[:book_type].capitalize).find(params[:id])
|
12
|
-
|
12
|
+
@book.namespace = Ilog.configuration.namespaces.key(@database)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -5,8 +5,10 @@ module Iatelier
|
|
5
5
|
include Iatelier::Action
|
6
6
|
include Iatelier::Controllers::Books::DbConnector
|
7
7
|
def call(params)
|
8
|
-
|
8
|
+
@database = params[:database]
|
9
|
+
self.set_database @database
|
9
10
|
@book = Object.const_get(params[:book_type].capitalize).find(params[:id])
|
11
|
+
@book.namespace = Ilog.configuration.namespaces.key(@database)
|
10
12
|
@book.revise(params)
|
11
13
|
@book.save
|
12
14
|
self.body = @book.save.to_json
|
data/lib/iatelier/models/book.rb
CHANGED
@@ -5,10 +5,8 @@ class Book < ActiveRecord::Base
|
|
5
5
|
DIMENSIONS = []
|
6
6
|
GROUPINGS = []
|
7
7
|
ROLES = []
|
8
|
-
|
8
|
+
|
9
9
|
@content_raw = ''
|
10
|
-
|
11
|
-
@namespace = nil
|
12
10
|
|
13
11
|
has_one :title, as: :titleable, class_name: 'Dimensions::Title'
|
14
12
|
has_one :slug, as: :slugable, class_name: 'Dimensions::Slug'
|
@@ -22,23 +20,23 @@ class Book < ActiveRecord::Base
|
|
22
20
|
|
23
21
|
has_many :peopleables, as: :peopleable, dependent: :destroy
|
24
22
|
has_many :peoples, through: :peopleables
|
25
|
-
|
23
|
+
|
26
24
|
has_many :bundleables, as: :bundleable, dependent: :destroy
|
27
25
|
has_many :bundles, through: :bundleables
|
28
|
-
|
26
|
+
|
29
27
|
accepts_nested_attributes_for :title, :slug, :subtitle, :description, :thumbnail, :timestamp
|
30
28
|
validates_associated :slug
|
31
|
-
|
29
|
+
|
32
30
|
attr_accessor :namespace
|
33
31
|
|
34
|
-
|
32
|
+
|
35
33
|
def kind
|
36
34
|
self.class.to_s
|
37
35
|
end
|
38
36
|
def uniq
|
39
37
|
self.class.to_s + self.id.to_s
|
40
38
|
end
|
41
|
-
|
39
|
+
|
42
40
|
def dimensions
|
43
41
|
self.class::DIMENSIONS
|
44
42
|
end
|
@@ -53,7 +51,7 @@ class Book < ActiveRecord::Base
|
|
53
51
|
@query = '`peopleables`.`role` = "' + requested_role.to_s + '"'
|
54
52
|
self.peoples.includes(:peopleables).where(@query)
|
55
53
|
end
|
56
|
-
|
54
|
+
|
57
55
|
def content_raw
|
58
56
|
puts 'trying to open content'
|
59
57
|
unless self.id.nil?
|
@@ -70,7 +68,7 @@ class Book < ActiveRecord::Base
|
|
70
68
|
@content = nil
|
71
69
|
end
|
72
70
|
end
|
73
|
-
|
71
|
+
|
74
72
|
def content
|
75
73
|
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
|
76
74
|
markdown.render(self.content_raw)
|
@@ -177,7 +175,7 @@ class Book < ActiveRecord::Base
|
|
177
175
|
def revise_title params
|
178
176
|
self.title.update(value: params[:title])
|
179
177
|
end
|
180
|
-
|
178
|
+
|
181
179
|
def setup_subtitle params
|
182
180
|
self.build_subtitle({value: params[:subtitle]})
|
183
181
|
end
|
@@ -191,12 +189,12 @@ class Book < ActiveRecord::Base
|
|
191
189
|
def revise_slug params
|
192
190
|
self.slug.update(value: params[:slug])
|
193
191
|
end
|
194
|
-
|
192
|
+
|
195
193
|
def setup_thumbnail params
|
196
194
|
end
|
197
195
|
def revise_thumbnail params
|
198
196
|
end
|
199
|
-
|
197
|
+
|
200
198
|
def setup_timestamp params
|
201
199
|
puts 'setting up timestamp'
|
202
200
|
self.build_timestamp({
|
@@ -219,10 +217,9 @@ class Book < ActiveRecord::Base
|
|
219
217
|
self.setup_timestamp params
|
220
218
|
end
|
221
219
|
end
|
222
|
-
|
220
|
+
|
223
221
|
def sync_content params
|
224
|
-
|
225
|
-
path = Iatelier.configuration.storage_dir + params[:database].to_s + self.class.name.downcase + '/' + self.id.to_s
|
222
|
+
path = Iatelier.configuration.storage_dir + @namespace.to_s + self.class.name.downcase + '/' + self.id.to_s
|
226
223
|
Dir.mkdir(path) unless File.exists?(path)
|
227
224
|
File.open(path + '/main.md', 'w+') do |file|
|
228
225
|
file.puts params[:content]
|
@@ -232,4 +229,4 @@ class Book < ActiveRecord::Base
|
|
232
229
|
self.save
|
233
230
|
puts self.loc.to_s
|
234
231
|
end
|
235
|
-
end
|
232
|
+
end
|
data/lib/iatelier/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iatelier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Captain Husayn Pinguin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|