caboose-cms 0.9.54 → 0.9.55

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: acb66ef2677682c17b78ad9f2d7e3cdfe6257bb5
4
- data.tar.gz: 3483b053afd8087fdcd13f51b3b2fee3fff02fd1
3
+ metadata.gz: 9dc18c2e49fc407aa002965dc15a63e6b7864c11
4
+ data.tar.gz: eef019aa5e4bd43cd13796d400db2d61cc3a8859
5
5
  SHA512:
6
- metadata.gz: 4fa9d77f7095f4fe05b67401991ef29ce3f690a1e7514b763dda6e1afd75ea38d40d29affee605bc6f3dc19b2cb945b597fb12cf5ebf604bb9cbd375698824d1
7
- data.tar.gz: 46cdef18a1b45e330bbbe1ce91ab46b74fbfa1012f4b552a0c52b282127ed07c59448974721f94c7d7254e25ceb7c63eff63a53f6bdab055a4e2e23d39fd289a
6
+ metadata.gz: 7d97e70be118cf75c6c4c4fa2dea38f36f3f90e2742fba4e65eb74f43dc8b12bf8ca1f23fb4a6dff08eac0d1581f5165fd236f23833d4ff5ff0d247593f218af
7
+ data.tar.gz: 91c99bba2178d298a31c68317793b794cd1ddcbda9420c919eaff1bd81c8550db4ae0db95c12fcf9c31587c94e5dd3f18c7f13e7b7341bf878a56924da45484f
@@ -119,7 +119,7 @@ InvoiceController.prototype = {
119
119
  { name: 'tax' , nice_name: 'Tax' , type: 'text' , value: curr(that.invoice.tax) , width: 100, fixed_placeholder: false, align: 'right' , after_update: function() { that.refresh_invoice(); }},
120
120
  { name: 'handling' , nice_name: 'Handling' , type: 'text' , value: curr(that.invoice.handling) , width: 100, fixed_placeholder: false, align: 'right' , after_update: function() { that.refresh_invoice(); }},
121
121
  { name: 'custom_discount' , nice_name: 'Discount' , type: 'text' , value: curr(that.invoice.custom_discount) , width: 100, fixed_placeholder: false, align: 'right' , after_update: function() { that.refresh_invoice(); }},
122
- { name: 'notes' , nice_name: 'Notes (not public)' , type: 'textarea' , value: that.invoice.notes , width: 100, fixed_placeholder: false, align: 'left' , after_update: function() { that.refresh_invoice(); }, height: 50 },
122
+ { name: 'notes' , nice_name: 'Notes (not public)' , type: 'textarea' , value: that.invoice.notes , width: 500, fixed_placeholder: false, align: 'left' , after_update: function() { that.refresh_invoice(); }, height: 100 },
123
123
  { name: 'customer_notes' , nice_name: 'Customer Notes' , type: 'textarea' , value: that.invoice.notes , width: 100, fixed_placeholder: false, align: 'left' , after_update: function() { that.refresh_invoice(); }, height: 50 }
124
124
  ]
125
125
  });
@@ -316,7 +316,8 @@ InvoiceController.prototype = {
316
316
  .append($('<div/>').attr('id', 'invoice_' + that.invoice.id + '_financial_status'))
317
317
  .append($('<div/>').attr('id', 'transactions').attr('align', 'center').append(transactions))
318
318
  );
319
- table.append(tr);
319
+ table.append(tr);
320
+ table.append($('<tr/>').append($('<td/>').attr('align', 'left').html('Internal Notes')).append($('<td/>').attr('align','right').attr('colspan', '2').append($('<div/>').attr('id', 'invoice_' + that.invoice.id + '_notes'))));
320
321
  return table;
321
322
  },
322
323
 
@@ -166,6 +166,20 @@ module Caboose
166
166
  end
167
167
  end
168
168
 
169
+ # @route PUT /admin/categories/:category_id/products/:product_id/add
170
+ def admin_add_product
171
+ resp = Caboose::StdClass.new
172
+ resp.success = false
173
+ cat = Category.find(params[:category_id])
174
+ prod = Product.find(params[:product_id])
175
+ if cat && prod && cat.site_id == prod.site_id
176
+ cm = CategoryMembership.where(:product_id => prod.id, :category_id => cat.id).first
177
+ cm = CategoryMembership.create(:product_id => prod.id, :category_id => cat.id) if cm.nil?
178
+ resp.success = true
179
+ end
180
+ render :json => resp
181
+ end
182
+
169
183
  end
170
184
  end
171
185
 
@@ -275,6 +275,7 @@ module Caboose
275
275
  'vendor_name' => '',
276
276
  'search_like' => '',
277
277
  'category_id' => '',
278
+ 'status' => 'Active',
278
279
  'price' => params[:filters] && params[:filters][:missing_prices] ? 0 : ''
279
280
  }, {
280
281
  'model' => 'Caboose::Product',
@@ -637,6 +638,16 @@ module Caboose
637
638
  def api_index
638
639
  render :json => Product.where(:status => 'Active')
639
640
  end
641
+
642
+ # @route GET /api/products/keyword
643
+ def api_keyword
644
+ query = params[:query]
645
+ resp = Caboose::StdClass.new({'products' => {}})
646
+ if query && !query.blank?
647
+ resp.products = Product.select('title, id').where(:site_id => @site.id).where('title ILIKE (?)',"%#{query}%").order(:title).limit(30)
648
+ end
649
+ render :json => resp
650
+ end
640
651
 
641
652
  # @route GET /api/products/:id
642
653
  def api_details
@@ -649,6 +660,9 @@ module Caboose
649
660
  p = Product.where(:id => params[:id]).first
650
661
  render :json => p ? p.variants : { :error => 'Invalid product ID' }
651
662
  end
663
+
664
+
665
+
652
666
 
653
667
  end
654
668
  end
@@ -9,7 +9,7 @@
9
9
  <h2>Products</h2>
10
10
 
11
11
  <% if @category.products.any? %>
12
- <ul>
12
+ <ul id="cat-products">
13
13
  <% @category.products.each do |product| %>
14
14
  <li><a href="/admin/products/<%= product.id %>/general"><%= product.title %></a></li>
15
15
  <% end %>
@@ -18,6 +18,12 @@
18
18
  <p>This category has no associated products.</p>
19
19
  <% end %>
20
20
 
21
+ <div class="add-form">
22
+ <h5>Add Product to This Category</h5>
23
+ <input type="text" id="product-finder" placeholder="Product name" />
24
+ <ul id="product-results"></ul>
25
+ </div>
26
+ <br /><br />
21
27
  <div id="message"></div>
22
28
  <p>
23
29
  <input type="button" value="< Back" onclick="window.location='/admin/categories';" />
@@ -30,6 +36,12 @@
30
36
  <% content_for :caboose_css do %>
31
37
  <style>
32
38
  .push-below { margin-bottom: 24px; }
39
+ #product-results li {
40
+ cursor: pointer;
41
+ }
42
+ #product-results li:hover {
43
+ color: blue;
44
+ }
33
45
  </style>
34
46
  <% end %>
35
47
 
@@ -53,6 +65,45 @@ $(document).ready(function() {
53
65
  });
54
66
  });
55
67
 
68
+ function add_product_to_category(product_id, title) {
69
+ $.ajax({
70
+ url: '/admin/categories/<%= @category.id %>/products/' + product_id + '/add',
71
+ type: 'put',
72
+ success: function(resp) {
73
+ $("#product-results").html("");
74
+ if ( resp && resp.success ) {
75
+ var a = $("<a />").attr('href','/admin/products' + product_id + '/general').text(title);
76
+ var li = $("<li />").append(a);
77
+ $("#cat-products").append(li);
78
+ $("#message").html("<p class='note success'>Product added to category.</p>");
79
+ }
80
+ }
81
+ });
82
+ }
83
+
84
+ $("#product-finder").keyup(function() {
85
+ var q = $("#product-finder").val();
86
+ var ul = $("#product-results");
87
+ ul.html("");
88
+ if ( q && q != '' ) {
89
+ $.ajax({
90
+ url: '/api/products/keyword',
91
+ data: {
92
+ query: q
93
+ },
94
+ type: 'get',
95
+ success: function(resp) {
96
+ if ( resp && resp.products && resp.products.length > 0 ) {
97
+ $.each(resp.products, function(k,v) {
98
+ var li = $("<li />").attr('onclick',"add_product_to_category(" + v.id + ",'" + v.title + "');return false;").text(v.title);
99
+ ul.append(li);
100
+ });
101
+ }
102
+ }
103
+ });
104
+ }
105
+ });
106
+
56
107
  function delete_category(cat_id, confirm) {
57
108
  if (!confirm) {
58
109
  var p = $('<p/>').addClass('note error').css('margin-bottom', '10px')
@@ -4,7 +4,8 @@
4
4
  <p style="margin: 12px 0">
5
5
  <a href="/admin/store/vendors/new">New Vendor</a><span style="margin: 0 3px">|</span>
6
6
  <a href="/admin/products/sort">Sort Products</a><span style="margin: 0 3px">|</span>
7
- <a href="/admin/products/alternate-ids">Alternate IDs</a><!-- <span style="margin: 0 3px">|</span> -->
7
+ <a href="/admin/products/alternate-ids">Alternate IDs</a><span style="margin: 0 3px">|</span>
8
+ <a href="/admin/products#status=Deleted">Deleted Products</a>
8
9
  <!-- <a href='#'>Search Form</a> -->
9
10
  </p>
10
11
 
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.54'
2
+ VERSION = '0.9.55'
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.54
4
+ version: 0.9.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-07 00:00:00.000000000 Z
11
+ date: 2017-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg