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 +4 -4
- data/app/controllers/caboose/variant_limits_controller.rb +10 -0
- data/app/views/caboose/users/_admin_header.html.erb +1 -1
- data/app/views/caboose/variant_limits/admin_edit.html.erb +20 -22
- data/app/views/caboose/variant_limits/admin_user_index.html.erb +38 -0
- data/lib/caboose/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 283e17b034bdd0cb3bc0a343d592141a4febd4aa
|
4
|
+
data.tar.gz: bfb91798884a5bfbab943eca89738fb9083979b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
<
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
{
|
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 %>
|
data/lib/caboose/version.rb
CHANGED
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.
|
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
|