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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d65662059d99a76d7ddcd7aec3b7103266bcd7b2
4
- data.tar.gz: 5374e50d8d027c0fa0be6296efa79797e426cd03
3
+ metadata.gz: 5b8773e74ab7649b25fbeacaf41ce486ec13a8df
4
+ data.tar.gz: e762a637d32dda18e888bd4c2ab4a6fcbe29de29
5
5
  SHA512:
6
- metadata.gz: f9719d772e11d46e2de4f9b3cf7ace2d8818b1eb32cee6c7f5aebb2a503ec6029aab1f968d45d62dbea26b054831d17deb5d6d1edd5c79e9645a56480574963a
7
- data.tar.gz: ec11cf49c859ea8886ec26afc0801c5873abebd44c2dc5d4f6e56c0eebdfde72319a40554fc8f96bc820a09da6aa32d76f4427a3613f4090ed128fd9b3ac30ee
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
- modal.autosize(p);
59
+ $('#message').html(p);
60
60
  return;
61
61
  }
62
- modal.autosize("<p class='loading'>Deleting product...</p>");
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
- modal.autosize("<p class='note error'>" + resp.error + "</p>");
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/subscription-options' },
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
 
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.20'
2
+ VERSION = '0.9.21'
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.9.20
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-10-28 00:00:00.000000000 Z
11
+ date: 2016-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg