caboose-cms 0.9.28 → 0.9.29

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: 6e874f1cc3a49bfb9ca519da804aaef5c4da22b2
4
- data.tar.gz: dfd0a6d5d8579bf3e507b6c695b87c971f819946
3
+ metadata.gz: 283e17b034bdd0cb3bc0a343d592141a4febd4aa
4
+ data.tar.gz: bfb91798884a5bfbab943eca89738fb9083979b3
5
5
  SHA512:
6
- metadata.gz: 7d53a02acd2f30c9e96127f450dd23904c6dae8b15ae8dc3567e3fd0e403d832c6f1f674416319325e2dea4546487965962ad0f6994853cd1f04f2951e0d024a
7
- data.tar.gz: 0e24809540ebf8edafed45437328a6403dc156dea7a8ef0a6bcae3fc46cb27ec4d1dbb67d9de3141f8733b90fc6ea86315e004d0f1c3d0bf76a6a324b2686a82
6
+ metadata.gz: 1f2a734ff80bbab2afc20c1c6982ccfc66b42491cab113ecbf1f211f951e802dc575bec807fce8c45ec8b9d544947ef60b12aa4d7e478b71bc47e660ca7f1a41
7
+ data.tar.gz: 4516a5ecdefbf9567ee9d3f1ac5f278d8e10f3fb4170e4586514d63abe3236f1911c64991b41ea7a231cf07b716dac003df151cf16cac4e8f37fce933e6827e1
@@ -3,6 +3,7 @@ module Caboose
3
3
  layout 'caboose/admin'
4
4
 
5
5
  # @route GET /admin/variant-limits/json
6
+ # @route GET /admin/users/:user_id/variant-limits/json
6
7
  def admin_json
7
8
  render :json => false and return if !user_is_allowed_to 'view', 'variantlimits'
8
9
  pager = Caboose::Pager.new(params, {
@@ -23,6 +24,7 @@ module Caboose
23
24
  end
24
25
 
25
26
  # @route GET /admin/variant-limits/:id/json
27
+ # @route GET /admin/users/:user_id/variant-limits/:id/json
26
28
  def admin_json_single
27
29
  render :json => false and return if !user_is_allowed_to 'edit', 'variantlimits'
28
30
  variantlimit = VariantLimit.find(params[:id])
@@ -49,6 +51,7 @@ module Caboose
49
51
  end
50
52
 
51
53
  # @route PUT /admin/variant-limits/:id
54
+ # @route PUT /admin/users/:user_id/variant-limits/:id
52
55
  def admin_update
53
56
  return unless (user_is_allowed_to 'edit', 'variantlimits')
54
57
  resp = Caboose::StdClass.new
@@ -74,9 +77,16 @@ module Caboose
74
77
  end
75
78
 
76
79
  # @route GET /admin/users/:user_id/variant-limits
80
+ def admin_user_index
81
+ return unless (user_is_allowed_to 'edit', 'users')
82
+ @edituser = Caboose::User.find(params[:user_id])
83
+ end
84
+
85
+ # @route GET /admin/users/:user_id/variant-limits/:id
77
86
  def admin_edit
78
87
  return unless (user_is_allowed_to 'edit', 'users')
79
88
  @edituser = Caboose::User.find(params[:user_id])
89
+ @variant_limit = Caboose::VariantLimit.find(params[:id])
80
90
  end
81
91
 
82
92
  # @route_priority 1
@@ -18,7 +18,7 @@ tabs = {
18
18
  if @site.use_store
19
19
  arr = tabs.to_a.insert(1, ['Payment Method', "/admin/users/#{@edituser.id}/payment-method"])
20
20
  tabs = Hash[arr]
21
- arr = tabs.to_a.insert(5, ['Variant Limits', "/admin/users/#{@edituser.id}/variant-limits#user_id=#{@edituser.id}"])
21
+ arr = tabs.to_a.insert(5, ['Variant Limits', "/admin/users/#{@edituser.id}/variant-limits"])
22
22
  tabs = Hash[arr]
23
23
  end
24
24
  if Caboose::Subscription.where(:site_id => @site.id).exists?
@@ -1,6 +1,12 @@
1
1
  <%= render :partial => 'caboose/users/admin_header' %>
2
2
 
3
- <div id='variant-limits'></div>
3
+ <h2>Edit Variant Limit</h2>
4
+ <p><div id='variantlimit_<%= @variant_limit.id %>_variant_id' ></div></p>
5
+ <p><div id='variantlimit_<%= @variant_limit.id %>_min_quantity_value' ></div></p>
6
+ <p><div id='variantlimit_<%= @variant_limit.id %>_min_quantity_func' ></div></p>
7
+ <p><div id='variantlimit_<%= @variant_limit.id %>_max_quantity_value' ></div></p>
8
+ <p><div id='variantlimit_<%= @variant_limit.id %>_max_quantity_func' ></div></p>
9
+ <p><div id='variantlimit_<%= @variant_limit.id %>_current_value' ></div></p>
4
10
 
5
11
  <%= render :partial => 'caboose/users/admin_footer' %>
6
12
 
@@ -9,28 +15,20 @@
9
15
  <script type='text/javascript'>
10
16
 
11
17
  $(document).ready(function() {
12
- var that = this;
13
- var table = new IndexTable({
14
- form_authenticity_token: '<%= form_authenticity_token %>',
15
- container: 'variant-limits',
16
- base_url: '/admin/variant-limits',
17
- allow_bulk_edit: false,
18
- allow_bulk_delete: false,
19
- allow_duplicate: false,
20
- allow_advanced_edit: false,
21
- allow_import: false,
22
- fields: [
23
- { show: true , editable: true, bulk_edit: false, name: 'variant_id' , nice_name: 'Product Variant' , sort: 'variant_id' , type: 'select' , value: function(r) { return r.variant_id }, text: function(r) { return (r.variant ? (r.variant.alternate_id ? r.variant.alternate_id : r.variant.id) : '') }, width: 150, options_url: '/admin/variant-limits/variant-options' },
24
- { show: true , editable: true, bulk_edit: false, name: 'min_quantity' , nice_name: 'Min Qty' , sort: 'min_quantity' , type: 'text' , value: function(r) { return r.min_quantity }, width: 150 },
25
- { show: true , editable: true, bulk_edit: false, name: 'max_quantity' , nice_name: 'Max Qty' , sort: 'max_quantity' , type: 'text' , value: function(r) { return (r.max_quantity == null || r.max_quantity == '' ? 0 : r.max_quantity) }, width: 150 },
26
- { show: true , editable: false, bulk_edit: false, name: 'current_value' , nice_name: 'Purchased' , sort: 'current_value' , type: 'text' , value: function(r) { return (r.current_value ) }, width: 150 }
27
- ],
28
- new_model_text: 'New Variant Limit',
29
- new_model_fields: [
30
- { name: 'variant_id', nice_name: 'Product', type: 'select', width: 400, options_url: '/admin/variant-limits/variant-options' },
31
- { name: 'user_id', nice_name: 'User', type: 'hidden', width: 400, value: <%= @edituser.id %> }
18
+ new ModelBinder({
19
+ name: 'VariantLimit',
20
+ id: <%= @variant_limit.id %>,
21
+ update_url: '/admin/variant-limits/<%= @variant_limit.id %>',
22
+ authenticity_token: '<%= form_authenticity_token %>',
23
+ attributes: [
24
+ { name: 'variant_id' , nice_name: 'Product Variant' , type: 'select' , value: <%= raw Caboose.json(@variant_limit.variant_id ) %>, width: 600 , options_url: '/admin/variant-limits/variant-options' },
25
+ { name: 'min_quantity_value' , nice_name: 'Min Qty Value' , type: 'text' , value: <%= raw Caboose.json(@variant_limit.min_quantity_value ) %>, width: 600 },
26
+ { name: 'min_quantity_func' , nice_name: 'Min Qty Function' , type: 'textarea' , value: <%= raw Caboose.json(@variant_limit.min_quantity_func ) %>, width: 600 , height: 100 },
27
+ { name: 'max_quantity_value' , nice_name: 'Max Qty Value' , type: 'text' , value: <%= raw Caboose.json(@variant_limit.max_quantity_value ) %>, width: 600 },
28
+ { name: 'max_quantity_func' , nice_name: 'Max Qty Function' , type: 'textarea' , value: <%= raw Caboose.json(@variant_limit.max_quantity_func ) %>, width: 600 , height: 100 },
29
+ { name: 'current_value' , nice_name: 'Purchased' , type: 'text' , value: <%= raw Caboose.json(@variant_limit.current_value ) %>, width: 600 }
32
30
  ]
33
- });
31
+ });
34
32
  });
35
33
  </script>
36
34
  <% end %>
@@ -0,0 +1,38 @@
1
+ <%= render :partial => 'caboose/users/admin_header' %>
2
+
3
+ <div id='variant-limits'></div>
4
+
5
+ <%= render :partial => 'caboose/users/admin_footer' %>
6
+
7
+ <% content_for :caboose_js do %>
8
+ <%= javascript_include_tag 'caboose/model/all' %>
9
+ <script type='text/javascript'>
10
+
11
+ $(document).ready(function() {
12
+ var that = this;
13
+ var table = new IndexTable({
14
+ form_authenticity_token: '<%= form_authenticity_token %>',
15
+ container: 'variant-limits',
16
+ base_url: '/admin/users/<%= @edituser.id %>/variant-limits',
17
+ allow_bulk_edit: false,
18
+ allow_bulk_delete: false,
19
+ allow_duplicate: false,
20
+ allow_advanced_edit: true,
21
+ allow_import: false,
22
+ fields: [
23
+ { show: true, editable: true , bulk_edit: false, name: 'variant_id' , nice_name: 'Product Variant' , sort: 'variant_id' , type: 'select' , value: function(r) { return r.variant_id }, width: 150 , text: function(r) { return (r.variant ? (r.variant.alternate_id ? r.variant.alternate_id : r.variant.id) : '') }, options_url: '/admin/variant-limits/variant-options' },
24
+ { show: true, editable: true , bulk_edit: false, name: 'min_quantity_value' , nice_name: 'Min Qty Value' , sort: 'min_quantity_value' , type: 'text' , value: function(r) { return r.min_quantity_value }, width: 150 },
25
+ { show: true, editable: true , bulk_edit: false, name: 'min_quantity_func' , nice_name: 'Min Qty Function' , sort: 'min_quantity_func' , type: 'textarea' , value: function(r) { return r.min_quantity_func }, width: 150 },
26
+ { show: true, editable: true , bulk_edit: false, name: 'max_quantity_value' , nice_name: 'Max Qty Value' , sort: 'max_quantity_value' , type: 'text' , value: function(r) { return r.max_quantity_value }, width: 150 },
27
+ { show: true, editable: true , bulk_edit: false, name: 'max_quantity_func' , nice_name: 'Max Qty Function' , sort: 'max_quantity_func' , type: 'textarea' , value: function(r) { return r.max_quantity_func }, width: 150 },
28
+ { show: true, editable: false, bulk_edit: false, name: 'current_value' , nice_name: 'Purchased' , sort: 'current_value' , type: 'text' , value: function(r) { return r.current_value }, width: 150 }
29
+ ],
30
+ new_model_text: 'New Variant Limit',
31
+ new_model_fields: [
32
+ { name: 'variant_id', nice_name: 'Product', type: 'select', width: 400, options_url: '/admin/variant-limits/variant-options' },
33
+ { name: 'user_id', nice_name: 'User', type: 'hidden', width: 400, value: <%= @edituser.id %> }
34
+ ]
35
+ });
36
+ });
37
+ </script>
38
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.28'
2
+ VERSION = '0.9.29'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.28
4
+ version: 0.9.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
@@ -1240,6 +1240,7 @@ files:
1240
1240
  - app/views/caboose/users/admin_new.html.erb
1241
1241
  - app/views/caboose/users/admin_update_pic.html.erb
1242
1242
  - app/views/caboose/variant_limits/admin_edit.html.erb
1243
+ - app/views/caboose/variant_limits/admin_user_index.html.erb
1243
1244
  - app/views/caboose/variants/admin_edit.html.erb
1244
1245
  - app/views/caboose/variants/admin_edit_option1_media.html.erb
1245
1246
  - app/views/caboose/variants/admin_edit_option2_media.html.erb