scribo 1.0.40 → 1.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/app/models/scribo/content.rb +3 -3
- data/app/services/scribo/site_import_service.rb +1 -1
- data/db/migrate/20240603090353_add_parent_id_to_scribo_contents.rb +5 -0
- data/db/migrate/20240625131154_create_scribo_content_hierarchies.rb +16 -0
- data/lib/scribo/version.rb +1 -1
- data/lib/scribo.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8d2faa173e2061b2cd692143e967c54c698703b7cf73dded3ab099ce90d4acb
|
4
|
+
data.tar.gz: 64192e917ef3cb45d88dacb9b379d055498880ffc016c752b91fb59b76f99d8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94026a265b5a827cfb849e4ab89a761824df95be4f53f16c341cea9e3eead02a82ccc36214621c1765c08262ced4ca51f5b6c4e063228cc755b3822bd1dce7a2
|
7
|
+
data.tar.gz: 7a6f297f8c9153d6651ebbac27c33db3c1fa72d7397efb68fa79e1524c2929e2155edebcbfab0d324ed19336842304a8c2bdee388b6316a872244c15b7701296
|
data/Gemfile
CHANGED
@@ -5,7 +5,7 @@ require_dependency 'scribo/application_record'
|
|
5
5
|
module Scribo
|
6
6
|
# Represents any content in the system
|
7
7
|
class Content < ApplicationRecord
|
8
|
-
|
8
|
+
has_closure_tree
|
9
9
|
belongs_to :site, class_name: 'Site', foreign_key: 'scribo_site_id'
|
10
10
|
has_one_attached :asset
|
11
11
|
|
@@ -293,7 +293,7 @@ module Scribo
|
|
293
293
|
end
|
294
294
|
|
295
295
|
def store_full_path(force = false)
|
296
|
-
if force || saved_changes.include?(:path) || saved_changes.include?(:
|
296
|
+
if force || saved_changes.include?(:path) || saved_changes.include?(:parent_id)
|
297
297
|
if post?
|
298
298
|
result = categories.join('/') + '/'
|
299
299
|
result += date.strftime('%Y/%m/%d/') if date
|
@@ -310,10 +310,10 @@ module Scribo
|
|
310
310
|
children.reload.each do |child|
|
311
311
|
child.store_full_path(true)
|
312
312
|
end
|
313
|
-
|
314
313
|
end
|
315
314
|
end
|
316
315
|
|
316
|
+
|
317
317
|
def tree_path
|
318
318
|
result = (ancestors.map(&:path) << path).join('/')
|
319
319
|
result = '/' + result unless result.start_with?('/')
|
@@ -31,7 +31,7 @@ module Scribo
|
|
31
31
|
site.contents.located(File.dirname(name), restricted: false).first
|
32
32
|
end
|
33
33
|
content = parent.children.find_by(path: File.basename(name)) if parent
|
34
|
-
content = site.contents.find_by(path: File.basename(name),
|
34
|
+
content = site.contents.find_by(path: File.basename(name), parent_id: nil) if parent.nil? && content.nil?
|
35
35
|
content = site.contents.create!(path: File.basename(name), parent: parent) if content.nil?
|
36
36
|
if File.directory?(name)
|
37
37
|
content.kind = 'folder'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateScriboContentHierarchies < ActiveRecord::Migration[7.1]
|
2
|
+
def change
|
3
|
+
create_table :scribo_content_hierarchies, id: false do |t|
|
4
|
+
t.uuid :ancestor_id, null: false
|
5
|
+
t.uuid :descendant_id, null: false
|
6
|
+
t.integer :generations, null: false
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :scribo_content_hierarchies, [:ancestor_id, :descendant_id, :generations],
|
10
|
+
unique: true,
|
11
|
+
name: "content_anc_desc_idx"
|
12
|
+
|
13
|
+
add_index :scribo_content_hierarchies, [:descendant_id],
|
14
|
+
name: "content_desc_idx"
|
15
|
+
end
|
16
|
+
end
|
data/lib/scribo/version.rb
CHANGED
data/lib/scribo.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scribo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom de Grunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ancestry
|
@@ -1074,6 +1074,8 @@ files:
|
|
1074
1074
|
- db/migrate/20200123095630_initial_scribo.rb
|
1075
1075
|
- db/migrate/20220919124119_add_ancestry_to_scribo_contents.rb
|
1076
1076
|
- db/migrate/20220919124749_remove_parent_id_from_scribo_contents.rb
|
1077
|
+
- db/migrate/20240603090353_add_parent_id_to_scribo_contents.rb
|
1078
|
+
- db/migrate/20240625131154_create_scribo_content_hierarchies.rb
|
1077
1079
|
- docs/content.md
|
1078
1080
|
- docs/editor.png
|
1079
1081
|
- docs/features.md
|