caboose-cms 0.5.188 → 0.5.189
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/controllers/caboose/categories_controller.rb +20 -2
- data/app/views/caboose/categories/admin_edit.html.erb +5 -0
- data/app/views/caboose/categories/admin_sort_children.html.erb +64 -0
- data/app/views/caboose/orders/admin_index.html.erb +2 -0
- data/config/routes.rb +14 -10
- data/lib/caboose/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzgwNzYwNDY1NWVlMTZmNmEwNzQxMTM5NDk4NTljYzAwNTJkODcxYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTk3ZTZhY2RhOGEzMWQ0Nzk5Y2Q2NzE0NTMwYjc2ZWJiODQ3Y2ZkMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzdlN2JjYTZiOGQ5Yzk2MWFlYTdmYTljM2EzMTNiMWQ3NWE0NjVmNmNmMzFm
|
10
|
+
YmNjZTM4ZmY2NDdhNzRiM2M2OTE5NTA2Yzk0ZTJkZGEwM2E5YTY3YjZhMzdm
|
11
|
+
NGM2YTQ5MmY5MDMxNzRkZjFlMzQwNTcwYzhkM2Q0ZjkyZjMzZDA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Mzg5NGI4YzQyMGJiZmM2YTE4ZTI2YWEzNTc0YTcxMzJkNzM0ZDA4Nzc3MzE4
|
14
|
+
Nzk1MmQ5MDE3MDM1YWRlMDY3Y2NlZjUyZDJhZGNhZDE0OGIxN2U3ZGYzMGE4
|
15
|
+
NjZlYWIwOTFmMThjYzZlZDdkZmQwMjVhYjBiN2FiMDE5NmM2MDM=
|
@@ -54,12 +54,30 @@ module Caboose
|
|
54
54
|
render :json => resp
|
55
55
|
end
|
56
56
|
|
57
|
-
# GET /admin/categories/:id
|
57
|
+
# GET /admin/categories/:id
|
58
58
|
def admin_edit
|
59
59
|
return unless user_is_allowed('categories', 'edit')
|
60
60
|
@category = Category.find(params[:id])
|
61
61
|
render :layout => 'caboose/admin'
|
62
|
-
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# GET /admin/categories/:id/sort-children
|
65
|
+
def admin_sort_children
|
66
|
+
return unless user_is_allowed('categories', 'edit')
|
67
|
+
@category = Category.find(params[:id])
|
68
|
+
render :layout => 'caboose/admin'
|
69
|
+
end
|
70
|
+
|
71
|
+
# PUT /admin/categories/:id/children/sort-order
|
72
|
+
def admin_update_sort_order
|
73
|
+
return unless user_is_allowed('categories', 'edit')
|
74
|
+
params[:category_ids].each_with_index do |cat_id, i|
|
75
|
+
cat = Category.find(cat_id)
|
76
|
+
cat.sort_order = i
|
77
|
+
cat.save
|
78
|
+
end
|
79
|
+
render :json => { :success => true }
|
80
|
+
end
|
63
81
|
|
64
82
|
# PUT /admin/categories/:id
|
65
83
|
def admin_update
|
@@ -19,8 +19,13 @@
|
|
19
19
|
<% end %>
|
20
20
|
|
21
21
|
<div id="message"></div>
|
22
|
+
<p>
|
22
23
|
<input type="button" value="< Back" onclick="window.location='/admin/categories';" />
|
24
|
+
<% if @category.children && @category.children.count > 0 %>
|
25
|
+
<input type="button" value="Sort Child Categories" onclick="window.location='/admin/categories/<%= @category.id %>/sort-children';" />
|
26
|
+
<% end %>
|
23
27
|
<input type="button" value="Delete Category" onclick="delete_category(<%= @category.id %>)" />
|
28
|
+
</p>
|
24
29
|
|
25
30
|
<% content_for :caboose_css do %>
|
26
31
|
<style>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<h1>Sort Children</h1>
|
2
|
+
|
3
|
+
<p>Drag the categories into the order you would like them displayed.</p>
|
4
|
+
|
5
|
+
<div id='categories'>
|
6
|
+
<ul id='category_list'>
|
7
|
+
<% @category.children.reorder(:sort_order).all.each do |cat| %>
|
8
|
+
<li id='category_<%= cat.id %>'><%= cat.name %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<div id='message'></div>
|
13
|
+
|
14
|
+
<p><input type='button' value='< Back' onclick="window.location='/admin/categories/<%= @category.id %>';" /></p>
|
15
|
+
|
16
|
+
<% content_for :caboose_js do %>
|
17
|
+
<script type='text/javascript'>
|
18
|
+
|
19
|
+
$(document).ready(function() {
|
20
|
+
$('#category_list').sortable({
|
21
|
+
stop: function(event, ui)
|
22
|
+
{
|
23
|
+
$.ajax({
|
24
|
+
url: '/admin/categories/<%= @category.id %>/children/sort-order',
|
25
|
+
type: 'put',
|
26
|
+
data: {
|
27
|
+
category_ids: $.map($('#category_list').sortable('toArray'), function(str, j) { return parseInt(str.replace('category_', '')); })
|
28
|
+
}
|
29
|
+
});
|
30
|
+
}
|
31
|
+
});
|
32
|
+
});
|
33
|
+
|
34
|
+
</script>
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
<% content_for :caboose_css do %>
|
38
|
+
<style>
|
39
|
+
|
40
|
+
#category_list {
|
41
|
+
list-style: none;
|
42
|
+
margin: 0;
|
43
|
+
padding: 0;
|
44
|
+
width: 350px;
|
45
|
+
}
|
46
|
+
#category_list li {
|
47
|
+
box-sizing: border-box;
|
48
|
+
border-top: 1px solid #ccc;
|
49
|
+
border-bottom: 1px solid #ccc;
|
50
|
+
cursor: pointer;
|
51
|
+
cursor: grab;
|
52
|
+
display: block;
|
53
|
+
padding: 6px;
|
54
|
+
width: 100%;
|
55
|
+
}
|
56
|
+
|
57
|
+
#category_list li.selected {
|
58
|
+
background: #3e9aff;
|
59
|
+
border-color: #fff;
|
60
|
+
color: #fff;
|
61
|
+
}
|
62
|
+
|
63
|
+
</style>
|
64
|
+
<% end %>
|
@@ -39,6 +39,7 @@
|
|
39
39
|
<tr>
|
40
40
|
<%= raw @pager.sortable_table_headings({
|
41
41
|
'id' => 'ID',
|
42
|
+
'order_number' => 'Order Number',
|
42
43
|
'customer_id' => 'Customer',
|
43
44
|
'date_created' => 'Date Created',
|
44
45
|
'total' => 'Total',
|
@@ -49,6 +50,7 @@
|
|
49
50
|
<% @orders.each do |order| %>
|
50
51
|
<tr onclick="window.location='/admin/orders/<%= order.id %>';">
|
51
52
|
<td><%= raw order.id %></td>
|
53
|
+
<td><%= raw order.order_number %></td>
|
52
54
|
<td>
|
53
55
|
<% if order.customer.nil? %>
|
54
56
|
Unknown
|
data/config/routes.rb
CHANGED
@@ -495,16 +495,20 @@ Caboose::Engine.routes.draw do
|
|
495
495
|
# Categories
|
496
496
|
#=============================================================================
|
497
497
|
|
498
|
-
|
499
|
-
|
500
|
-
get "/admin/categories
|
501
|
-
get
|
502
|
-
get "/admin/categories
|
503
|
-
get
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
498
|
+
|
499
|
+
|
500
|
+
get "/admin/categories" => "categories#admin_index"
|
501
|
+
get "/admin/categories/new" => "categories#admin_new"
|
502
|
+
get "/admin/categories/options" => "categories#admin_options"
|
503
|
+
get '/admin/categories/status-options' => 'categories#admin_status_options'
|
504
|
+
get "/admin/categories/:id/sort-children" => "categories#admin_sort_children"
|
505
|
+
put "/admin/categories/:id/children/sort-order" => "categories#admin_update_sort_order"
|
506
|
+
get "/admin/categories/:id/products/json" => "categories#admin_category_products"
|
507
|
+
get "/admin/categories/:id" => "categories#admin_edit"
|
508
|
+
put "/admin/categories/:id" => "categories#admin_update"
|
509
|
+
post "/admin/categories/:id" => "categories#admin_update"
|
510
|
+
post "/admin/categories" => "categories#admin_add"
|
511
|
+
delete "/admin/categories/:id" => "categories#admin_delete"
|
508
512
|
|
509
513
|
#=============================================================================
|
510
514
|
# Orders
|
data/lib/caboose/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.189
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -729,6 +729,7 @@ files:
|
|
729
729
|
- app/views/caboose/categories/admin_edit.html.erb
|
730
730
|
- app/views/caboose/categories/admin_index.html.erb
|
731
731
|
- app/views/caboose/categories/admin_new.html.erb
|
732
|
+
- app/views/caboose/categories/admin_sort_children.html.erb
|
732
733
|
- app/views/caboose/checkout/_address_form.html.erb
|
733
734
|
- app/views/caboose/checkout/_billing_form.html.erb
|
734
735
|
- app/views/caboose/checkout/_cart.html.erb
|