caboose-cms 0.9.20 → 0.9.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/caboose/admin_products.js +6 -6
- data/app/controllers/caboose/subscriptions_controller.rb +2 -1
- data/app/models/caboose/product.rb +2 -2
- data/app/views/caboose/subscriptions/admin_edit.html.erb +1 -1
- data/app/views/caboose/variants/admin_edit.html.erb +1 -1
- data/lib/caboose/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b8773e74ab7649b25fbeacaf41ce486ec13a8df
|
4
|
+
data.tar.gz: e762a637d32dda18e888bd4c2ab4a6fcbe29de29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61601f5df2c4ce0c7e81d41072777ce7849cbe34ea8b5de1672de6723961193213b6cba55c85f22b66ae801a1b04575bf9fcb7fef9b47c35a6a6927b3fa7c13f
|
7
|
+
data.tar.gz: 440bc247d52eaf1088fdf42424516468ae8f03f9e41c3487f6b9095a316a1b9edb4326f3483801a9ae8d2b127059d76f4e27d7ce14931459bbbfdbfbca1a1269
|
@@ -46,26 +46,26 @@ function add_variant(product_id)
|
|
46
46
|
})
|
47
47
|
}
|
48
48
|
|
49
|
-
function delete_variant(variant_id, confirm)
|
49
|
+
function delete_variant(product_id, variant_id, confirm)
|
50
50
|
{
|
51
51
|
if (!confirm)
|
52
52
|
{
|
53
53
|
var p = $('<p/>')
|
54
54
|
.addClass('note error')
|
55
55
|
.append("Are you sure you want to delete the variant?<br />This can't be undone.<br /><br />")
|
56
|
-
.append($("<input/>").attr('type', 'button').val('Confirm').click(function() { delete_variant(variant_id, true); }))
|
56
|
+
.append($("<input/>").attr('type', 'button').val('Confirm').click(function() { delete_variant(product_id, variant_id, true); }))
|
57
57
|
.append(' ')
|
58
58
|
.append($("<input/>").attr('type', 'button').val('Cancel').click(function() { cancel_delete_variant(variant_id); }));
|
59
|
-
|
59
|
+
$('#message').html(p);
|
60
60
|
return;
|
61
61
|
}
|
62
|
-
|
62
|
+
$('#message').html("<p class='loading'>Deleting product...</p>");
|
63
63
|
$.ajax({
|
64
|
-
url: '/admin/variants/' + variant_id,
|
64
|
+
url: '/admin/products/' + product_id + '/variants/' + variant_id,
|
65
65
|
type: 'delete',
|
66
66
|
success: function(resp) {
|
67
67
|
if (resp.error)
|
68
|
-
|
68
|
+
$('#message').html("<p class='note error'>" + resp.error + "</p>");
|
69
69
|
if (resp.redirect)
|
70
70
|
window.location = resp.redirect;
|
71
71
|
}
|
@@ -25,6 +25,7 @@ module Caboose
|
|
25
25
|
return if !user_is_allowed('subscriptions', 'view')
|
26
26
|
|
27
27
|
pager = PageBarGenerator.new(params, {
|
28
|
+
'site_id' => @site.id,
|
28
29
|
'variant_id' => '',
|
29
30
|
'user_id' => params[:user_id] ? params[:user_id] : '',
|
30
31
|
'date_started_gte' => '',
|
@@ -138,7 +139,7 @@ module Caboose
|
|
138
139
|
case params[:field]
|
139
140
|
when 'variant'
|
140
141
|
arr = Variant.joins(:product).where("store_products.site_id = ? and is_subscription = ?", @site.id, true).reorder("store_products.title").all
|
141
|
-
options = arr.collect{ |v| { 'value' => v.id, 'text' => v.product.title }}
|
142
|
+
options = arr.collect{ |v| { 'value' => v.id, 'text' => "#{v.product.title} - #{v.alternate_id}" }}
|
142
143
|
when 'status'
|
143
144
|
options = [
|
144
145
|
{ 'value' => Subscription::STATUS_ACTIVE , 'text' => 'Active' },
|
@@ -120,8 +120,8 @@ module Caboose
|
|
120
120
|
min = 100000
|
121
121
|
max = 0
|
122
122
|
|
123
|
-
self.variants.each do |variant|
|
124
|
-
next if variant.nil? || variant.price.nil? || variant.price <= 0
|
123
|
+
self.variants.each do |variant|
|
124
|
+
next if variant.nil? || variant.price.nil? || variant.price <= 0 || variant.status != Variant::STATUS_ACTIVE
|
125
125
|
price = variant.on_sale? ? variant.sale_price : variant.price
|
126
126
|
min = price if price < min
|
127
127
|
max = price if price > max
|
@@ -23,7 +23,7 @@ $(document).ready(function() {
|
|
23
23
|
update_url: '/admin/users/<%= @edituser.id %>/subscriptions/<%= @subscription.id %>',
|
24
24
|
authenticity_token: '<%= form_authenticity_token %>',
|
25
25
|
attributes: [
|
26
|
-
{ name: 'variant_id' , nice_name: 'Variant' , type: 'select' , value: <%= raw Caboose.json(@subscription.variant_id ) %>, width: 400 , options_url: '/admin/subscriptions/
|
26
|
+
{ name: 'variant_id' , nice_name: 'Variant' , type: 'select' , value: <%= raw Caboose.json(@subscription.variant_id ) %>, width: 400 , options_url: '/admin/subscriptions/variant-options' },
|
27
27
|
{ name: 'date_started' , nice_name: 'Date Started' , type: 'date' , value: <%= raw Caboose.json(@subscription.date_started ) %>, width: 400 , date_format: 'Y-m-d' },
|
28
28
|
{ name: 'date_started_full' , nice_name: 'Date Started Full' , type: 'date' , value: <%= raw Caboose.json(@subscription.date_started_full ) %>, width: 400 , date_format: 'Y-m-d' },
|
29
29
|
{ name: 'status' , nice_name: 'Status' , type: 'select' , value: <%= raw Caboose.json(@subscription.status ) %>, width: 400 , options_url: '/admin/subscriptions/status-options' }
|
@@ -73,7 +73,7 @@ v = @variant
|
|
73
73
|
|
74
74
|
<h2>Delete Variant</h2>
|
75
75
|
<div id='message'></div>
|
76
|
-
<p><input type='button' value='Delete Variant' onclick="delete_variant(<%= v.id %>);" /></p>
|
76
|
+
<p><input type='button' value='Delete Variant' onclick="delete_variant(<%= p.id %>, <%= v.id %>);" /></p>
|
77
77
|
|
78
78
|
<%= render :partial => 'caboose/products/admin_footer' %>
|
79
79
|
|
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.9.
|
4
|
+
version: 0.9.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|