caboose-cms 0.7.42 → 0.7.43

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,94 @@
1
+ <%
2
+ config = YAML.load(File.read(Rails.root.join('config', 'aws.yml')))[Rails.env]
3
+ access_key = config['access_key_id']
4
+ secret_key = config['secret_access_key']
5
+ bucket = config['bucket']
6
+ policy = {
7
+ "expiration" => 1.hour.from_now.utc.xmlschema,
8
+ "conditions" => [
9
+ { "bucket" => "#{bucket}-uploads" },
10
+ { "acl" => "public-read" },
11
+ [ "starts-with", "$key", '' ],
12
+ #[ "starts-with", "$Content-Type", 'image/' ],
13
+ [ 'starts-with', '$name', '' ],
14
+ [ 'starts-with', '$Filename', '' ],
15
+ ]
16
+ }
17
+ @policy = Base64.encode64(policy.to_json).gsub(/\n/,'')
18
+ @signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), secret_key, @policy)).gsub("\n","")
19
+ @s3_upload_url = "https://#{bucket}-uploads.s3.amazonaws.com/"
20
+ @aws_access_key_id = access_key
21
+ @top_media_category = Caboose::MediaCategory.top_category(@site.id)
22
+
23
+ %>
24
+ <div id='left_content'>
25
+ <div id='categories'></div>
26
+ </div>
27
+ <div id='right_content'>
28
+ <div id='controls'></div>
29
+ <div id='uploader'></div>
30
+ <div id='media'></div>
31
+ </div>
32
+
33
+ <p style='clear: both;'>&nbsp;</p>
34
+ <p>
35
+ <input type='button' value='Close' onclick="parent.location.reload(true); modal.close();" />
36
+ <input type='button' value='Manage Media' onclick="parent.window.location='/admin/media';" />
37
+ </p>
38
+
39
+ <% content_for :caboose_css do %>
40
+ <%= stylesheet_link_tag 'caboose/admin_block_edit_image' %>
41
+ <%= stylesheet_link_tag 'plupload/jquery.ui.plupload/css/jquery.ui.plupload.css' %>
42
+ <% end %>
43
+
44
+ <% content_for :caboose_js do %>
45
+ <%= javascript_include_tag "caboose/model/all" %>
46
+ <%= javascript_include_tag "caboose/media_browser" %>
47
+ <%= javascript_include_tag 'caboose/jquery-ui.drag-multiple.min.js' %>
48
+
49
+ <%= javascript_include_tag 'plupload/plupload.full.min.js' %>
50
+ <%= javascript_include_tag 'plupload/jquery.ui.plupload/jquery.ui.plupload.js' %>
51
+ <%
52
+ #javascript_include_tag 'plupload/moxie.js'
53
+ #javascript_include_tag 'plupload/plupload.dev.js'
54
+ #javascript_include_tag 'plupload/jquery.ui.plupload/jquery.ui.plupload.js'
55
+ %>
56
+
57
+ <script type='text/javascript'>
58
+
59
+ var modal = false;
60
+ $(window).load(function() {
61
+ modal = new CabooseModal(900);
62
+ });
63
+
64
+ var controller = false;
65
+ $(document).ready(function() {
66
+ b = new MediaBrowser({
67
+ media_id: <% if @media %><%= @media.id %><% else %>false<% end %>,
68
+ authenticity_token: '<%= form_authenticity_token %>',
69
+ top_cat_id: <%= raw Caboose.json(@top_media_category.id) %>,
70
+ cat_id: <% if @media %><%= @media.media_category_id %><% else %><%= @top_media_category.id %><% end %>,
71
+ s3_upload_url: '<%= raw @s3_upload_url %>',
72
+ aws_access_key_id: '<%= raw @aws_access_key_id %>',
73
+ policy: '<%= raw @policy %>',
74
+ signature: '<%= raw @signature %>',
75
+ refresh_unprocessed_images: false,
76
+ select_media: function(browser, media_id) {
77
+ $.ajax({
78
+ url: '/admin/products/<%= @product.id %>/variants/bulk',
79
+ type: 'put',
80
+ data: {
81
+ model_ids: <%= raw Caboose.json(@variants.collect{ |v| v.id }) %>,
82
+ option2_media_id: media_id
83
+ },
84
+ success: function(resp) {
85
+ parent.location.reload(true);
86
+ modal.close();
87
+ }
88
+ });
89
+ },
90
+ });
91
+ });
92
+
93
+ </script>
94
+ <% end %>
@@ -0,0 +1,94 @@
1
+ <%
2
+ config = YAML.load(File.read(Rails.root.join('config', 'aws.yml')))[Rails.env]
3
+ access_key = config['access_key_id']
4
+ secret_key = config['secret_access_key']
5
+ bucket = config['bucket']
6
+ policy = {
7
+ "expiration" => 1.hour.from_now.utc.xmlschema,
8
+ "conditions" => [
9
+ { "bucket" => "#{bucket}-uploads" },
10
+ { "acl" => "public-read" },
11
+ [ "starts-with", "$key", '' ],
12
+ #[ "starts-with", "$Content-Type", 'image/' ],
13
+ [ 'starts-with', '$name', '' ],
14
+ [ 'starts-with', '$Filename', '' ],
15
+ ]
16
+ }
17
+ @policy = Base64.encode64(policy.to_json).gsub(/\n/,'')
18
+ @signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), secret_key, @policy)).gsub("\n","")
19
+ @s3_upload_url = "https://#{bucket}-uploads.s3.amazonaws.com/"
20
+ @aws_access_key_id = access_key
21
+ @top_media_category = Caboose::MediaCategory.top_category(@site.id)
22
+
23
+ %>
24
+ <div id='left_content'>
25
+ <div id='categories'></div>
26
+ </div>
27
+ <div id='right_content'>
28
+ <div id='controls'></div>
29
+ <div id='uploader'></div>
30
+ <div id='media'></div>
31
+ </div>
32
+
33
+ <p style='clear: both;'>&nbsp;</p>
34
+ <p>
35
+ <input type='button' value='Close' onclick="parent.location.reload(true); modal.close();" />
36
+ <input type='button' value='Manage Media' onclick="parent.window.location='/admin/media';" />
37
+ </p>
38
+
39
+ <% content_for :caboose_css do %>
40
+ <%= stylesheet_link_tag 'caboose/admin_block_edit_image' %>
41
+ <%= stylesheet_link_tag 'plupload/jquery.ui.plupload/css/jquery.ui.plupload.css' %>
42
+ <% end %>
43
+
44
+ <% content_for :caboose_js do %>
45
+ <%= javascript_include_tag "caboose/model/all" %>
46
+ <%= javascript_include_tag "caboose/media_browser" %>
47
+ <%= javascript_include_tag 'caboose/jquery-ui.drag-multiple.min.js' %>
48
+
49
+ <%= javascript_include_tag 'plupload/plupload.full.min.js' %>
50
+ <%= javascript_include_tag 'plupload/jquery.ui.plupload/jquery.ui.plupload.js' %>
51
+ <%
52
+ #javascript_include_tag 'plupload/moxie.js'
53
+ #javascript_include_tag 'plupload/plupload.dev.js'
54
+ #javascript_include_tag 'plupload/jquery.ui.plupload/jquery.ui.plupload.js'
55
+ %>
56
+
57
+ <script type='text/javascript'>
58
+
59
+ var modal = false;
60
+ $(window).load(function() {
61
+ modal = new CabooseModal(900);
62
+ });
63
+
64
+ var controller = false;
65
+ $(document).ready(function() {
66
+ b = new MediaBrowser({
67
+ media_id: <% if @media %><%= @media.id %><% else %>false<% end %>,
68
+ authenticity_token: '<%= form_authenticity_token %>',
69
+ top_cat_id: <%= raw Caboose.json(@top_media_category.id) %>,
70
+ cat_id: <% if @media %><%= @media.media_category_id %><% else %><%= @top_media_category.id %><% end %>,
71
+ s3_upload_url: '<%= raw @s3_upload_url %>',
72
+ aws_access_key_id: '<%= raw @aws_access_key_id %>',
73
+ policy: '<%= raw @policy %>',
74
+ signature: '<%= raw @signature %>',
75
+ refresh_unprocessed_images: false,
76
+ select_media: function(browser, media_id) {
77
+ $.ajax({
78
+ url: '/admin/products/<%= @product.id %>/variants/bulk',
79
+ type: 'put',
80
+ data: {
81
+ model_ids: <%= raw Caboose.json(@variants.collect{ |v| v.id }) %>,
82
+ option3_media_id: media_id
83
+ },
84
+ success: function(resp) {
85
+ parent.location.reload(true);
86
+ modal.close();
87
+ }
88
+ });
89
+ },
90
+ });
91
+ });
92
+
93
+ </script>
94
+ <% end %>
@@ -5,9 +5,60 @@ p = @product
5
5
  <%= render :partial => 'caboose/products/admin_header' %>
6
6
 
7
7
  <div id='options'>
8
- <% if p.option1 %><div id='option1_container'><h2><%= p.option1 %></h2><ul id='option1'><% p.option1_values.each do |option| %><li id='values_<%= option %>'><%= option %></li><% end %></ul></div><% end %>
9
- <% if p.option2 %><div id='option2_container'><h2><%= p.option2 %></h2><ul id='option2'><% p.option2_values.each do |option| %><li id='values_<%= option %>'><%= option %></li><% end %></ul></div><% end %>
10
- <% if p.option3 %><div id='option3_container'><h2><%= p.option3 %></h2><ul id='option3'><% p.option3_values.each do |option| %><li id='values_<%= option %>'><%= option %></li><% end %></ul></div><% end %>
8
+ <% if p.option1 %>
9
+ <div id='option1_container'>
10
+ <h2><%= p.option1 %></h2>
11
+ <ul id='option1'>
12
+ <% p.option1_values_with_media.each do |option, m| %>
13
+ <li id='values_<%= option %>'>
14
+ <span class='option_value'><%= option %><span>
15
+ <% if p.option1_media %>
16
+ <div class='media' onclick="caboose_modal_url('/admin/products/<%= @product.id %>/variants/option1-media?option_value=<%= option %>');">
17
+ <% if m %><img src='<%= m.image.url(:tiny) %>' /><% else %>Edit Image<% end %>
18
+ </div>
19
+ <% end %>
20
+ <div class='spacer'></div>
21
+ </li>
22
+ <% end %>
23
+ </ul>
24
+ </div>
25
+ <% end %>
26
+ <% if p.option2 %>
27
+ <div id='option2_container'>
28
+ <h2><%= p.option2 %></h2>
29
+ <ul id='option2'>
30
+ <% p.option2_values_with_media.each do |option, m| %>
31
+ <li id='values_<%= option %>'>
32
+ <span class='option_value'><%= option %><span>
33
+ <% if p.option2_media %>
34
+ <div class='media' onclick="caboose_modal_url('/admin/products/<%= @product.id %>/variants/option2-media?option_value=<%= option %>');">
35
+ <% if m %><img src='<%= m.image.url(:tiny) %>' /><% else %>Edit Image<% end %>
36
+ </div>
37
+ <% end %>
38
+ <div class='spacer'></div>
39
+ </li>
40
+ <% end %>
41
+ </ul>
42
+ </div>
43
+ <% end %>
44
+ <% if p.option3 %>
45
+ <div id='option3_container'>
46
+ <h2><%= p.option3 %></h2>
47
+ <ul id='option3'>
48
+ <% p.option3_values_with_media.each do |option, m| %>
49
+ <li id='values_<%= option %>'>
50
+ <span class='option_value'><%= option %><span>
51
+ <% if p.option3_media %>
52
+ <div class='media' onclick="caboose_modal_url('/admin/products/<%= @product.id %>/variants/option3-media?option_value=<%= option %>');">
53
+ <% if m %><img src='<%= m.image.url(:tiny) %>' /><% else %>Edit Image<% end %>
54
+ </div>
55
+ <% end %>
56
+ <div class='spacer'></div>
57
+ </li>
58
+ <% end %>
59
+ </ul>
60
+ </div>
61
+ <% end %>
11
62
  </div>
12
63
 
13
64
  <div id='message'></div>
@@ -17,8 +68,11 @@ p = @product
17
68
  <% content_for :caboose_css do %>
18
69
  <style type='text/css'>
19
70
  #options div { width: 33%; float: left; }
71
+ #options div.media { width: 100px; float: right; }
72
+ #options div.media img { width: 100px; }
73
+ #options div.spacer { width: auto; float: none; clear: both; }
20
74
  #options ul { margin: 0 10px 0 0; padding: 0; list-style: none; }
21
- #options li { margin: 0; padding: 4px 8px; list-style: none; border: #ccc 1px solid; }
75
+ #options li { margin: 0; padding: 4px 8px; list-style: none; border: #ccc 1px solid; clear: right; }
22
76
  #message { clear: left; }
23
77
  </style>
24
78
  <% end %>
@@ -66,32 +66,34 @@ $(document).ready(function() {
66
66
  allow_duplicate: false,
67
67
  allow_advanced_edit: true,
68
68
  fields: [
69
- <% if p.option1 %>{ show: true , name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , sort: 'option1' , type: 'text' , value: function(v) { return v.option1 }, width: 75, align: 'left' , bulk_edit: true },<% end %>
70
- <% if p.option2 %>{ show: true , name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , sort: 'option2' , type: 'text' , value: function(v) { return v.option2 }, width: 75, align: 'left' , bulk_edit: true },<% end %>
71
- <% if p.option3 %>{ show: true , name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , sort: 'option3' , type: 'text' , value: function(v) { return v.option3 }, width: 75, align: 'left' , bulk_edit: true },<% end %>
72
- { show: true , name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'text' , value: function(v) { return v.status }, width: 75, align: 'left' , bulk_edit: true },
73
- { show: true , name: 'alternate_id' , nice_name: 'Alternate ID' , sort: 'alternate_id' , type: 'text' , value: function(v) { return v.alternate_id }, width: 75, align: 'left' , bulk_edit: true },
74
- { show: true , name: 'sku' , nice_name: 'SKU' , sort: 'sku' , type: 'text' , value: function(v) { return v.sku }, width: 75, align: 'left' , bulk_edit: true },
75
- { show: false , name: 'barcode' , nice_name: 'Barcode' , sort: 'barcode' , type: 'text' , value: function(v) { return v.barcode }, width: 75, align: 'left' , bulk_edit: true },
76
- { show: true , name: 'price' , nice_name: 'Price' , sort: 'price' , type: 'text' , value: function(v) { return v.price }, width: 75, align: 'right' , bulk_edit: true },
77
- { show: true , name: 'sale_price' , nice_name: 'Sale price' , sort: 'sale_price' , type: 'text' , value: function(v) { return v.sale_price }, width: 75, align: 'right' , bulk_edit: true },
78
- { show: false , name: 'date_sale_starts' , nice_name: 'Sale starts' , sort: 'date_sale_starts' , type: 'datetime' , value: function(v) { return v.date_sale_starts }, width: 75, align: 'left' , bulk_edit: true },
79
- { show: false , name: 'date_sale_ends' , nice_name: 'Sale ends' , sort: 'date_sale_ends' , type: 'datetime' , value: function(v) { return v.date_sale_ends }, width: 75, align: 'left' , bulk_edit: true },
80
- { show: true , name: 'quantity_in_stock' , nice_name: 'Quantity' , sort: 'quantity_in_stock' , type: 'text' , value: function(v) { return v.quantity_in_stock }, width: 50, align: 'right' , bulk_edit: true },
81
- { show: false , name: 'weight' , nice_name: 'Weight (<%= sc.weight_unit %>)' , sort: 'weight' , type: 'text' , value: function(v) { return v.weight }, width: 50, align: 'right' , bulk_edit: true },
82
- { show: false , name: 'length' , nice_name: 'Length (<%= sc.length_unit %>)' , sort: 'length' , type: 'text' , value: function(v) { return v.length }, width: 50, align: 'right' , bulk_edit: true },
83
- { show: false , name: 'width' , nice_name: 'Width (<%= sc.length_unit %>)' , sort: 'width' , type: 'text' , value: function(v) { return v.width }, width: 50, align: 'right' , bulk_edit: true },
84
- { show: false , name: 'height' , nice_name: 'Height (<%= sc.length_unit %>)' , sort: 'height' , type: 'text' , value: function(v) { return v.height }, width: 50, align: 'right' , bulk_edit: true },
85
- { show: false , name: 'cylinder' , nice_name: 'Cylinder' , sort: 'cylinder' , type: 'checkbox' , value: function(v) { return v.cylinder }, text: function(v) { return v.cylinder ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
86
- { show: false , name: 'requires_shipping' , nice_name: 'Requires shipping' , sort: 'requires_shipping' , type: 'checkbox' , value: function(v) { return v.requires_shipping }, text: function(v) { return v.requires_shipping ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
87
- { show: false , name: 'taxable' , nice_name: 'Taxable' , sort: 'taxable' , type: 'checkbox' , value: function(v) { return v.taxable }, text: function(v) { return v.taxable ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
88
- { show: false , name: 'allow_backorder' , nice_name: 'Allow backorder' , sort: 'allow_backorder' , type: 'checkbox' , value: function(v) { return v.allow_backorder }, text: function(v) { return v.allow_backorder ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
89
- { show: false , name: 'downloadable' , nice_name: 'Downloadable' , sort: 'downloadable' , type: 'checkbox' , value: function(v) { return v.downloadable }, text: function(v) { return v.downloadable ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
90
- { show: false , name: 'download_path' , nice_name: 'Download path' , sort: 'download_path' , type: 'text' , value: function(v) { return v.download_path }, width: 50, align: 'left' , bulk_edit: true },
91
- { show: false , name: 'flat_rate_shipping' , nice_name: 'Flat rate shipping' , sort: 'flat_rate_shipping' , type: 'checkbox' , value: function(v) { return v.flat_rate_shipping }, text: function(v) { return v.flat_rate_shipping ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
92
- { show: false , name: 'flat_rate_shipping_single' , nice_name: 'Amount (single)' , sort: 'flat_rate_shipping_single' , type: 'text' , value: function(v) { return v.flat_rate_shipping_single }, width: 50, align: 'right' , bulk_edit: true },
93
- { show: false , name: 'flat_rate_shipping_combined' , nice_name: 'Amount (combined)' , sort: 'flat_rate_shipping_combined' , type: 'text' , value: function(v) { return v.flat_rate_shipping_combined }, width: 50, align: 'right' , bulk_edit: true },
94
- { show: false , name: 'flat_rate_shipping_package_method_id' , nice_name: 'Package and method' , sort: 'flat_rate_shipping_package_id' , type: 'select' ,
69
+ <% if p.option1 %>{ show: true , name: 'option1' , nice_name: <%= raw Caboose.json(p.option1) %> , sort: 'option1' , type: 'text' , value: function(v) { return v.option1 }, width: 75, align: 'left' , bulk_edit: true },<% end %>
70
+ <% if p.option2 %>{ show: true , name: 'option2' , nice_name: <%= raw Caboose.json(p.option2) %> , sort: 'option2' , type: 'text' , value: function(v) { return v.option2 }, width: 75, align: 'left' , bulk_edit: true },<% end %>
71
+ <% if p.option3 %>{ show: true , name: 'option3' , nice_name: <%= raw Caboose.json(p.option3) %> , sort: 'option3' , type: 'text' , value: function(v) { return v.option3 }, width: 75, align: 'left' , bulk_edit: true },<% end %>
72
+ { show: true , name: 'status' , nice_name: 'Status' , sort: 'status' , type: 'text' , value: function(v) { return v.status }, width: 75, align: 'left' , bulk_edit: true },
73
+ { show: true , name: 'alternate_id' , nice_name: 'Alternate ID' , sort: 'alternate_id' , type: 'text' , value: function(v) { return v.alternate_id }, width: 75, align: 'left' , bulk_edit: true },
74
+ { show: true , name: 'sku' , nice_name: 'SKU' , sort: 'sku' , type: 'text' , value: function(v) { return v.sku }, width: 75, align: 'left' , bulk_edit: true },
75
+ { show: false , name: 'barcode' , nice_name: 'Barcode' , sort: 'barcode' , type: 'text' , value: function(v) { return v.barcode }, width: 75, align: 'left' , bulk_edit: true },
76
+ { show: true , name: 'cost' , nice_name: 'Cost of Goods' , sort: 'cost' , type: 'text' , value: function(v) { return v.cost }, width: 75, align: 'right' , bulk_edit: true },
77
+ { show: true , name: 'price' , nice_name: 'Price' , sort: 'price' , type: 'text' , value: function(v) { return v.price }, width: 75, align: 'right' , bulk_edit: true },
78
+ { show: true , name: 'sale_price' , nice_name: 'Sale price' , sort: 'sale_price' , type: 'text' , value: function(v) { return v.sale_price }, width: 75, align: 'right' , bulk_edit: true },
79
+ { show: false , name: 'date_sale_starts' , nice_name: 'Sale starts' , sort: 'date_sale_starts' , type: 'datetime' , value: function(v) { return v.date_sale_starts }, width: 75, align: 'left' , bulk_edit: true },
80
+ { show: false , name: 'date_sale_ends' , nice_name: 'Sale ends' , sort: 'date_sale_ends' , type: 'datetime' , value: function(v) { return v.date_sale_ends }, width: 75, align: 'left' , bulk_edit: true },
81
+ { show: false , name: 'clearance' , nice_name: 'On Clearance' , sort: 'clearance' , type: 'checkbox' , value: function(v) { return v.clearance }, text: function(v) { return v.clearance ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
82
+ { show: true , name: 'quantity_in_stock' , nice_name: 'Quantity' , sort: 'quantity_in_stock' , type: 'text' , value: function(v) { return v.quantity_in_stock }, width: 50, align: 'right' , bulk_edit: true },
83
+ { show: false , name: 'weight' , nice_name: 'Weight (<%= sc.weight_unit %>)' , sort: 'weight' , type: 'text' , value: function(v) { return v.weight }, width: 50, align: 'right' , bulk_edit: true },
84
+ { show: false , name: 'length' , nice_name: 'Length (<%= sc.length_unit %>)' , sort: 'length' , type: 'text' , value: function(v) { return v.length }, width: 50, align: 'right' , bulk_edit: true },
85
+ { show: false , name: 'width' , nice_name: 'Width (<%= sc.length_unit %>)' , sort: 'width' , type: 'text' , value: function(v) { return v.width }, width: 50, align: 'right' , bulk_edit: true },
86
+ { show: false , name: 'height' , nice_name: 'Height (<%= sc.length_unit %>)' , sort: 'height' , type: 'text' , value: function(v) { return v.height }, width: 50, align: 'right' , bulk_edit: true },
87
+ { show: false , name: 'cylinder' , nice_name: 'Cylinder' , sort: 'cylinder' , type: 'checkbox' , value: function(v) { return v.cylinder }, text: function(v) { return v.cylinder ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
88
+ { show: false , name: 'requires_shipping' , nice_name: 'Requires shipping' , sort: 'requires_shipping' , type: 'checkbox' , value: function(v) { return v.requires_shipping }, text: function(v) { return v.requires_shipping ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
89
+ { show: false , name: 'taxable' , nice_name: 'Taxable' , sort: 'taxable' , type: 'checkbox' , value: function(v) { return v.taxable }, text: function(v) { return v.taxable ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
90
+ { show: false , name: 'allow_backorder' , nice_name: 'Allow backorder' , sort: 'allow_backorder' , type: 'checkbox' , value: function(v) { return v.allow_backorder }, text: function(v) { return v.allow_backorder ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
91
+ { show: false , name: 'downloadable' , nice_name: 'Downloadable' , sort: 'downloadable' , type: 'checkbox' , value: function(v) { return v.downloadable }, text: function(v) { return v.downloadable ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
92
+ { show: false , name: 'download_path' , nice_name: 'Download path' , sort: 'download_path' , type: 'text' , value: function(v) { return v.download_path }, width: 50, align: 'left' , bulk_edit: true },
93
+ { show: false , name: 'flat_rate_shipping' , nice_name: 'Flat rate shipping' , sort: 'flat_rate_shipping' , type: 'checkbox' , value: function(v) { return v.flat_rate_shipping }, text: function(v) { return v.flat_rate_shipping ? 'Yes' : 'No' }, width: 50, align: 'center' , bulk_edit: true },
94
+ { show: false , name: 'flat_rate_shipping_single' , nice_name: 'Amount (single)' , sort: 'flat_rate_shipping_single' , type: 'text' , value: function(v) { return v.flat_rate_shipping_single }, width: 50, align: 'right' , bulk_edit: true },
95
+ { show: false , name: 'flat_rate_shipping_combined' , nice_name: 'Amount (combined)' , sort: 'flat_rate_shipping_combined' , type: 'text' , value: function(v) { return v.flat_rate_shipping_combined }, width: 50, align: 'right' , bulk_edit: true },
96
+ { show: false , name: 'flat_rate_shipping_package_method_id' , nice_name: 'Package and method' , sort: 'flat_rate_shipping_package_id' , type: 'select' ,
95
97
  value: function(v) { return v.flat_rate_shipping_package_id + '_' + v.flat_rate_shipping_method_id },
96
98
  text: function(v) { return v.flat_rate_shipping_package && v.flat_rate_shipping_method ? v.flat_rate_shipping_package.name + ' - ' + v.flat_rate_shipping_method.service_name : '' },
97
99
  width: 150,
@@ -103,9 +105,10 @@ $(document).ready(function() {
103
105
  <% if @highlight_variant_id %>highlight_id: <%= @highlight_variant_id %>,<% end %>
104
106
  new_model_text: 'New Variant',
105
107
  new_model_fields: [
106
- { name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text', width: 400 },
107
- { name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text', width: 400 },
108
- { name: 'price' , nice_name: 'Price' , type: 'text', width: 400 },
108
+ { name: 'alternate_id' , nice_name: 'Alternate ID' , type: 'text', width: 400 },
109
+ { name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text', width: 400 },
110
+ { name: 'cost' , nice_name: 'Cost of Goods' , type: 'text', width: 400 },
111
+ { name: 'price' , nice_name: 'Price' , type: 'text', width: 400 },
109
112
  <% if p.option1 %>{ name: 'option1', nice_name: <%= raw Caboose.json(p.option1) %>, type: 'text', width: 400 },<% end %>
110
113
  <% if p.option2 %>{ name: 'option2', nice_name: <%= raw Caboose.json(p.option2) %>, type: 'text', width: 400 },<% end %>
111
114
  <% if p.option3 %>{ name: 'option3', nice_name: <%= raw Caboose.json(p.option3) %>, type: 'text', width: 400 },<% end %>
@@ -5,7 +5,8 @@ v = @variant
5
5
  <%= render :partial => 'caboose/products/admin_header' %>
6
6
 
7
7
  <div id='variant_<%= v.id %>_sku'></div>
8
- <div id='variant_<%= v.id %>_barcode'></div>
8
+ <div id='variant_<%= v.id %>_barcode'></div>
9
+ <div id='variant_<%= v.id %>_cost'></div>
9
10
  <div id='variant_<%= v.id %>_price'></div>
10
11
  <div id='variant_<%= v.id %>_quantity_in_stock'></div>
11
12
  <div id='variant_<%= v.id %>_taxable'></div>
@@ -36,7 +37,8 @@ $(document).ready(function() {
36
37
  authenticity_token: '<%= form_authenticity_token %>',
37
38
  attributes: [
38
39
  { name: 'sku' , nice_name: 'SKU' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.sku ) %>, width: 250 },
39
- { name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.barcode ) %>, width: 250 },
40
+ { name: 'barcode' , nice_name: 'Barcode' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.barcode ) %>, width: 250 },
41
+ { name: 'cost' , nice_name: 'Cost of Goods' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.cost ) %>, width: 250 },
40
42
  { name: 'price' , nice_name: 'Price' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.price ) %>, width: 250 },
41
43
  { name: 'quantity_in_stock' , nice_name: 'Quantity' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.quantity_in_stock ) %>, width: 250 },
42
44
  { name: 'weight' , nice_name: 'Weight (grams)' , type: 'text' , align_right: true, value: <%= raw Caboose.json(v.weight ) %>, width: 200 },
@@ -1,5 +1,9 @@
1
1
  Caboose::Engine.routes.draw do
2
2
 
3
+ #if Caboose::use_comment_routes
4
+ # eval(Caboose::CommentRoutes.controller_routes)
5
+ #end
6
+
3
7
  #=============================================================================
4
8
  # Front end
5
9
  #=============================================================================
@@ -580,6 +584,9 @@ Caboose::Engine.routes.draw do
580
584
 
581
585
  get "/admin/products/:product_id/variants" => "variants#admin_index"
582
586
  get "/admin/products/:product_id/variants/json" => "variants#admin_json"
587
+ get "/admin/products/:product_id/variants/option1-media" => "variants#admin_edit_option1_media"
588
+ get "/admin/products/:product_id/variants/option2-media" => "variants#admin_edit_option2_media"
589
+ get "/admin/products/:product_id/variants/option3-media" => "variants#admin_edit_option3_media"
583
590
  get "/admin/products/:product_id/variants/sort-order" => "variants#admin_edit_sort_order"
584
591
  put '/admin/products/:product_id/variants/option1-sort-order' => 'variants#admin_update_option1_sort_order'
585
592
  put '/admin/products/:product_id/variants/option2-sort-order' => 'variants#admin_update_option2_sort_order'
@@ -133,6 +133,9 @@ module Caboose
133
133
  mattr_accessor :uploads_bucket
134
134
  @@uploads_bucket = ''
135
135
 
136
+ mattr_accessor :use_comment_routes
137
+ @@use_comment_routes = true
138
+
136
139
  end
137
140
 
138
141
  # These are used so that both local filestorage and S3 can work without having to change paperclip paths in models
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.7.42'
2
+ VERSION = '0.7.43'
3
3
  end
@@ -3,6 +3,16 @@ require 'aws-sdk'
3
3
 
4
4
  namespace :caboose do
5
5
 
6
+ desc "Show all comment routes in controllers"
7
+ task :routes, [:arg1] => :environment do |t, args|
8
+ puts Caboose::CommentRoutes.controller_routes(args ? args.first : nil)
9
+ end
10
+
11
+ desc "Compare routes in controllers with routes in the routes file"
12
+ task :compare_routes => :environment do
13
+ puts Caboose::CommentRoutes.compare_routes
14
+ end
15
+
6
16
  desc "Verify ELO and ELI roles exist for all sites"
7
17
  task :init_site_users_and_roles => :environment do
8
18
  Caboose::Site.all.each do |site|
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.7.42
4
+ version: 0.7.43
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-12-22 00:00:00.000000000 Z
11
+ date: 2016-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -519,6 +519,7 @@ files:
519
519
  - app/assets/javascripts/caboose/jquery.timepicker.js
520
520
  - app/assets/javascripts/caboose/lodash.min.js
521
521
  - app/assets/javascripts/caboose/main.js
522
+ - app/assets/javascripts/caboose/media_browser.js
522
523
  - app/assets/javascripts/caboose/modal.js
523
524
  - app/assets/javascripts/caboose/modal_integration.js
524
525
  - app/assets/javascripts/caboose/model.form.page.js
@@ -535,6 +536,7 @@ files:
535
536
  - app/assets/javascripts/caboose/model/bound_file.js
536
537
  - app/assets/javascripts/caboose/model/bound_image.js
537
538
  - app/assets/javascripts/caboose/model/bound_image_bak.js
539
+ - app/assets/javascripts/caboose/model/bound_media_image.js
538
540
  - app/assets/javascripts/caboose/model/bound_richtext.js
539
541
  - app/assets/javascripts/caboose/model/bound_s3_image.js
540
542
  - app/assets/javascripts/caboose/model/bound_select.js
@@ -1129,6 +1131,9 @@ files:
1129
1131
  - app/views/caboose/users/new.html.erb
1130
1132
  - app/views/caboose/users/update_pic.html.erb
1131
1133
  - app/views/caboose/variants/admin_edit.html.erb
1134
+ - app/views/caboose/variants/admin_edit_option1_media.html.erb
1135
+ - app/views/caboose/variants/admin_edit_option2_media.html.erb
1136
+ - app/views/caboose/variants/admin_edit_option3_media.html.erb
1132
1137
  - app/views/caboose/variants/admin_edit_sort_order.html.erb
1133
1138
  - app/views/caboose/variants/admin_group.html.erb
1134
1139
  - app/views/caboose/variants/admin_index.html.erb