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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4e4b1784b564edca7a13a364f7650ce835944cc
4
- data.tar.gz: 4351a34d95b556208ae978dcd164e46a051ed3e7
3
+ metadata.gz: 8050dae6944a2f6eab52fd1cacefc622d0cbd867
4
+ data.tar.gz: d192030943c6f20cee65e9a668034a9f75dc25a2
5
5
  SHA512:
6
- metadata.gz: 7dbe816464e53e80105ec9cefe092f5de007200b7554cae73ee69008605ab6b5ed0fceb826f99daa8a9b7367fd9b4da581c7a9b30541f3493ac45aa6f84dbeda
7
- data.tar.gz: f5293cd7192fb2ac5f63db3a838d4f4d57c8c60aa569b0a60fb176b9318113b0f1af053409b899233f7b03f8dde2b6a68a7d6e27e42e0c40c1c6b22e46522735
6
+ metadata.gz: 67d7777dd5978acc9f3d6cfb65273e16725a353e31e5f66c75abc5e3fc76e048e63a08cf8c3fcc50d77d0aa47870ba8dbb53c7eb79dfa837c5a0892366930992
7
+ data.tar.gz: b50e5baecdf2803b9c9524c1ea83865ce2119e034b085e67e010474797a6440de737961d196562da9ad15618c200ecd0cab72717de29b0270786acdce020baf0
@@ -1,4 +1,8 @@
1
1
  ready = ->
2
+ if $.isFunction($.fn.nestable)
3
+ $('.dd').nestable
4
+ maxDepth: "<%= Spina.config.max_page_depth %>"
5
+
2
6
  if $('.page-template').length > 0
3
7
  page_parts = $('.page-template').data('page-parts')
4
8
  show_page_parts(page_parts)
@@ -58,12 +58,7 @@ module Spina
58
58
 
59
59
  def sort
60
60
  params[:list].each_pair do |parent_pos, parent_node|
61
- if parent_node[:children].present?
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
@@ -86,17 +86,10 @@ module Spina
86
86
  end
87
87
 
88
88
  def generate_materialized_path
89
- if self.name == 'homepage'
90
- "/"
89
+ if root?
90
+ name == 'homepage' ? '/' : "/#{url_title}"
91
91
  else
92
- case self.depth
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
 
@@ -41,7 +41,6 @@ module Spina
41
41
  directory "app/assets/stylesheets/#{theme}"
42
42
  directory "app/views/#{theme}"
43
43
  directory "app/views/layouts/#{theme}"
44
- directory "app/views/layouts/#{theme}"
45
44
  end
46
45
 
47
46
 
@@ -0,0 +1,5 @@
1
+ - pages = current_user.present? ? Spina::Page.active : Spina::Page.live
2
+ - menu = Spina::Pages::MenuPresenter.new(pages.in_menu.arrange(order: :position), self, @page)
3
+ - menu.list_class = 'nav'
4
+ - menu.list_item_css = 'nav-item'
5
+ = menu.to_html
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Spina
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
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.2
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-02-29 00:00:00.000000000 Z
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
@@ -1,7 +0,0 @@
1
- module Spina
2
- module Spina
3
- def self.table_name_prefix
4
- 'spina_'
5
- end
6
- end
7
- end