spina 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spina might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spina/admin/{pages.js.coffee → pages.js.coffee.erb} +4 -0
- data/app/controllers/spina/admin/pages_controller.rb +10 -6
- data/app/models/spina/page.rb +3 -10
- data/lib/generators/spina/install_generator.rb +0 -1
- data/lib/generators/spina/templates/app/views/default/shared/_navigation.html.haml +5 -0
- data/lib/generators/spina/templates/config/initializers/spina.rb +6 -0
- data/lib/spina.rb +3 -1
- data/lib/spina/version.rb +1 -1
- metadata +4 -4
- data/app/models/spina/spina.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8050dae6944a2f6eab52fd1cacefc622d0cbd867
|
4
|
+
data.tar.gz: d192030943c6f20cee65e9a668034a9f75dc25a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67d7777dd5978acc9f3d6cfb65273e16725a353e31e5f66c75abc5e3fc76e048e63a08cf8c3fcc50d77d0aa47870ba8dbb53c7eb79dfa837c5a0892366930992
|
7
|
+
data.tar.gz: b50e5baecdf2803b9c9524c1ea83865ce2119e034b085e67e010474797a6440de737961d196562da9ad15618c200ecd0cab72717de29b0270786acdce020baf0
|
@@ -58,12 +58,7 @@ module Spina
|
|
58
58
|
|
59
59
|
def sort
|
60
60
|
params[:list].each_pair do |parent_pos, parent_node|
|
61
|
-
|
62
|
-
parent_node[:children].each_pair do |child_pos, child_node|
|
63
|
-
child_node[:children].each_pair { |grand_child_pos, grand_child| update_page_position(grand_child, grand_child_pos, child_node[:id]) } if child_node[:children].present?
|
64
|
-
update_page_position(child_node, child_pos, parent_node[:id])
|
65
|
-
end
|
66
|
-
end
|
61
|
+
update_child_pages_position(parent_node)
|
67
62
|
update_page_position(parent_node, parent_pos, nil)
|
68
63
|
end
|
69
64
|
render nothing: true
|
@@ -89,6 +84,15 @@ module Spina
|
|
89
84
|
Page.update(page[:id], position: position.to_i + 1, parent_id: parent_id )
|
90
85
|
end
|
91
86
|
|
87
|
+
def update_child_pages_position(node)
|
88
|
+
if node[:children].present?
|
89
|
+
node[:children].each_pair do |child_pos, child_node|
|
90
|
+
update_child_pages_position(child_node) if child_node[:children].present?
|
91
|
+
update_page_position(child_node, child_pos, node[:id])
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
92
96
|
def page_params
|
93
97
|
params.require(:page).permit!
|
94
98
|
end
|
data/app/models/spina/page.rb
CHANGED
@@ -86,17 +86,10 @@ module Spina
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def generate_materialized_path
|
89
|
-
if
|
90
|
-
|
89
|
+
if root?
|
90
|
+
name == 'homepage' ? '/' : "/#{url_title}"
|
91
91
|
else
|
92
|
-
|
93
|
-
when 0
|
94
|
-
"/#{url_title}"
|
95
|
-
when 1
|
96
|
-
"/#{self.parent.url_title}/#{url_title}"
|
97
|
-
when 2
|
98
|
-
"/#{self.parent.parent.url_title}/#{self.parent.url_title}/#{url_title}"
|
99
|
-
end
|
92
|
+
ancestors.collect(&:url_title).append(url_title).join('/').prepend('/')
|
100
93
|
end
|
101
94
|
end
|
102
95
|
|
@@ -10,6 +10,12 @@ Spina.configure do |config|
|
|
10
10
|
# Specify a backend path. Defaults to /admin.
|
11
11
|
# config.backend_path = 'admin'
|
12
12
|
|
13
|
+
# Pages Options
|
14
|
+
# ===============
|
15
|
+
|
16
|
+
# Note that you might need to remove cached asset after changing this value
|
17
|
+
# config.max_page_depth = 5
|
18
|
+
|
13
19
|
# Storage Options
|
14
20
|
# ===============
|
15
21
|
|
data/lib/spina.rb
CHANGED
@@ -5,12 +5,14 @@ module Spina
|
|
5
5
|
|
6
6
|
include ActiveSupport::Configurable
|
7
7
|
|
8
|
-
config_accessor :backend_path, :storage
|
8
|
+
config_accessor :backend_path, :storage, :max_page_depth
|
9
9
|
|
10
10
|
self.backend_path = 'admin'
|
11
11
|
|
12
12
|
self.storage = :file
|
13
13
|
|
14
|
+
self.max_page_depth = 5
|
15
|
+
|
14
16
|
class << self
|
15
17
|
|
16
18
|
@@themes = []
|
data/lib/spina/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bram Jetten
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -265,7 +265,7 @@ files:
|
|
265
265
|
- app/assets/javascripts/spina/admin/application.js
|
266
266
|
- app/assets/javascripts/spina/admin/aviary.js.coffee
|
267
267
|
- app/assets/javascripts/spina/admin/confirm_delete.js.coffee.erb
|
268
|
-
- app/assets/javascripts/spina/admin/pages.js.coffee
|
268
|
+
- app/assets/javascripts/spina/admin/pages.js.coffee.erb
|
269
269
|
- app/assets/javascripts/spina/admin/spina.infinite_scroll.coffee
|
270
270
|
- app/assets/javascripts/spina/admin/spina.scaffold.coffee
|
271
271
|
- app/assets/javascripts/spina/admin/spina.trix.js.coffee
|
@@ -306,7 +306,6 @@ files:
|
|
306
306
|
- app/models/spina/photo_collection.rb
|
307
307
|
- app/models/spina/photo_collections_photo.rb
|
308
308
|
- app/models/spina/rewrite_rule.rb
|
309
|
-
- app/models/spina/spina.rb
|
310
309
|
- app/models/spina/structure.rb
|
311
310
|
- app/models/spina/structure_item.rb
|
312
311
|
- app/models/spina/structure_part.rb
|
@@ -430,6 +429,7 @@ files:
|
|
430
429
|
- lib/generators/spina/templates/app/assets/stylesheets/demo/application.css.sass
|
431
430
|
- lib/generators/spina/templates/app/views/default/pages/homepage.html.haml
|
432
431
|
- lib/generators/spina/templates/app/views/default/pages/show.html.haml
|
432
|
+
- lib/generators/spina/templates/app/views/default/shared/_navigation.html.haml
|
433
433
|
- lib/generators/spina/templates/app/views/demo/pages/demo.html.haml
|
434
434
|
- lib/generators/spina/templates/app/views/demo/pages/homepage.html.haml
|
435
435
|
- lib/generators/spina/templates/app/views/demo/pages/show.html.haml
|