caboose-cms 0.3.80 → 0.3.81

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjM0NzlkMjVlYzFkNDY0ZjY1YTE5ODllZWY4ZjgzNGNmZmNmMjI0OQ==
4
+ MjliMGI3MWI1YmQ4MWRmMzc4NGMxNTVmZDQ5OWQ2OTAyYzVlYmYwNw==
5
5
  data.tar.gz: !binary |-
6
- YmM1MTQ1MDQ0MGIzNzA1ZjNmMTIyN2E0ZDBkYTBjODEwMmRkMzI2OA==
6
+ NTk5NmE5MTk0ZjFhODY5NWJkYzM2NmNiYjcyYmU0ZGZlZmI5MmRkMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YmYzM2VmM2NjM2FkZjU4ZDY1YzRiYzk4MjlhNjMzNWIzN2I4OTZiYjBmN2Mx
10
- YzM2NmIwMTZmYTJkZTljMTIwNjhjYmJmN2U5ZTRhZGNhYjFlMDQzOTUzMzdm
11
- M2ZjNGY1NWM1ZDVjYjFkNWEyNmZkZTVkMGIyOWQyMGU5Zjc2ZjA=
9
+ Y2ZkZmE4YjRiZDUzZjIwOWI5MWQ3NjhjMmU2N2EwZGI5NGY4MDc3ZTE0MThm
10
+ ZDU3ZWE3YWRlMDdmNDcyNGQ1YzRjM2VkMGYzMzViOGZlNzhiNjQyZDE5YzAy
11
+ YTljMzRhMzNhNDIwZGQzZDg4MjM1MTVhYWZjODgwODVhZGU4ZDM=
12
12
  data.tar.gz: !binary |-
13
- OGM3Y2E1ZjY5MWNmYmEzNzBlZDg5NzkyNjU2NTY1OTcyMzU2MjNlYWM5ZmEw
14
- NWJjNjM0MmQ3ZjNiNDI2OWZmMDU0ODUzMmRkNmUwOGIwYzY2ZThmMWFjNjdj
15
- ZWQwODM5MGI2OWE5ZjE3MGFjOTU1ZDE0Nzc2YmQ0ZjVjYjYxM2U=
13
+ ZmJiYzdjMzVjZGY3YWY2NDhkNTZiYjRkNjgyYTA4NGVlNjAyYTU5MGMwOWY1
14
+ MzMwNTU5YmFkOWU2ZTU5ZDBmMTM0MDUzYWExOTBmNmJkNjcyZGIzMDlhODk1
15
+ ZjkyNDU2MjE0MTRmZjJlZjZhZDM2MGNhOTc0NjI5ZmZlODY4OWE=
@@ -184,6 +184,28 @@ module Caboose
184
184
  render :layout => 'caboose/admin'
185
185
  end
186
186
 
187
+ # GET /admin/pages/:id/child-order
188
+ def admin_edit_child_sort_order
189
+ return unless user_is_allowed('pages', 'edit')
190
+ @page = Page.find(params[:id])
191
+ render :layout => 'caboose/admin'
192
+ end
193
+
194
+ # PUT /admin/pages/:id/child-order
195
+ def admin_update_child_sort_order
196
+ return unless user_is_allowed('pages', 'edit')
197
+ @page = Page.find(params[:id])
198
+ page_ids = params[:page_ids]
199
+ i = 0
200
+ page_ids.each do |pid|
201
+ p = Page.find(pid)
202
+ p.sort_order = i
203
+ p.save
204
+ i = i + 1
205
+ end
206
+ render :json => true
207
+ end
208
+
187
209
  # POST /admin/pages
188
210
  def admin_create
189
211
  return unless user_is_allowed('pages', 'add')
@@ -0,0 +1,46 @@
1
+
2
+ <%= render :partial => 'caboose/pages/admin_header' %>
3
+
4
+ <p class='uri'>URI: /<span id='uri'><%= @page.uri %></span></p>
5
+
6
+ <p>Drag the pages into the order you would like.</p>
7
+ <% if @page.children && @page.children.count > 0 %>
8
+ <ul id='children'>
9
+ <% Caboose::Page.where(:parent_id => @page.id).reorder(:sort_order).all.each do |p| %>
10
+ <li id='page_ids_<%= p.id %>'><%= p.title %></li>
11
+ <% end %>
12
+ </ul>
13
+ <% else %>
14
+ <p>This page doesn't have any children.</p>
15
+ <% end %>
16
+ <p><input type='button' value='< Back to edit' onclick="window.location='/admin/pages/<%= @page.id %>/edit';" /></p>
17
+
18
+ <%= render :partial => 'caboose/pages/admin_footer' %>
19
+
20
+ <% content_for :caboose_css do %>
21
+ <style type='text/css'>
22
+ #children { list-style: none; margin: 0; padding: 0; }
23
+ #children li { list-style: none; margin: 4px 0; padding: 10px; border: #ccc 1px solid; }
24
+ </style>
25
+ <% end %>
26
+ <% content_for :caboose_js do %>
27
+ <script type='text/javascript'>
28
+
29
+ $(document).ready(function() {
30
+ $('#children').sortable({
31
+ axis: 'y',
32
+ update: function (event, ui) {
33
+ $.ajax({
34
+ url: '/admin/pages/<%= @page.id %>/child-order',
35
+ type: 'put',
36
+ data: $(this).sortable('serialize'),
37
+ success: function(resp) {
38
+
39
+ }
40
+ });
41
+ }
42
+ });
43
+ });
44
+
45
+ </script>
46
+ <% end %>
@@ -10,7 +10,7 @@
10
10
  <div class='field_with_explanation'><div id='page_<%= @page.id %>_redirect_url' ></div><span class='explanation'>If the redirect URL field is set, then this page will simply redirect to that URL instead of showing the page itself.</span></div>
11
11
  <div class='field_with_explanation'><div id='page_<%= @page.id %>_hide' ></div><span class='explanation'>Whether or not this page is displayed in the menu.</span></div>
12
12
  <div class='field_with_explanation'><div id='page_<%= @page.id %>_layout' ></div><span class='explanation'>Specify a specific layout file for this page.</span></div>
13
- <div class='field_with_explanation'><div id='page_<%= @page.id %>_custom_sort_children' ></div><span class='explanation'>Sort child pages alphabetically or custom.</span></div>
13
+ <div class='field_with_explanation'><div id='page_<%= @page.id %>_custom_sort_children' ></div><span class='explanation'>Sort child pages alphabetically or <a href='/admin/pages/<%= @page.id %>/child-order'>custom</a>.</span></div>
14
14
  <div class='field_with_explanation'><div id='page_<%= @page.id %>_content_format' ></div><span class='explanation'>Specify whether or not you want to embed ruby code in your page.</span></div>
15
15
 
16
16
  <%= render :partial => 'caboose/pages/admin_footer' %>
@@ -72,10 +72,12 @@ Caboose::Engine.routes.draw do
72
72
  get "admin/pages/:id/seo" => "pages#admin_edit_seo"
73
73
  get "admin/pages/:id/block-order" => "pages#admin_edit_block_order"
74
74
  put "admin/pages/:id/block-order" => "pages#admin_update_block_order"
75
+ get "admin/pages/:id/child-order" => "pages#admin_edit_child_sort_order"
76
+ put "admin/pages/:id/child-order" => "pages#admin_update_child_sort_order"
75
77
  get "admin/pages/:id/new-blocks" => "pages#admin_new_blocks"
76
78
  get "admin/pages/:id/content" => "pages#admin_edit_content"
77
79
  put "admin/pages/:id/viewers" => "pages#admin_update_viewers"
78
- put "admin/pages/:id/editors" => "pages#admin_update_editors"
80
+ put "admin/pages/:id/editors" => "pages#admin_update_editors"
79
81
  put "admin/pages/:id" => "pages#admin_update"
80
82
  get "admin/pages" => "pages#admin_index"
81
83
  post "admin/pages" => "pages#admin_create"
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.3.80'
2
+ VERSION = '0.3.81'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.80
4
+ version: 0.3.81
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-25 00:00:00.000000000 Z
11
+ date: 2014-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -313,6 +313,7 @@ files:
313
313
  - app/views/caboose/pages/_admin_header.html.erb
314
314
  - app/views/caboose/pages/_content.html.erb
315
315
  - app/views/caboose/pages/admin_delete_form.html.erb
316
+ - app/views/caboose/pages/admin_edit_child_sort_order.html.erb
316
317
  - app/views/caboose/pages/admin_edit_content.html.erb
317
318
  - app/views/caboose/pages/admin_edit_css.html.erb
318
319
  - app/views/caboose/pages/admin_edit_general.html.erb