caboose-cms 0.5.64 → 0.5.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/admin.js +1 -1
- data/app/assets/javascripts/caboose/admin_edit_order.js +724 -0
- data/app/assets/javascripts/caboose/cart2.js +4 -4
- data/app/assets/javascripts/caboose/model/index_table.js +122 -80
- data/app/assets/stylesheets/caboose/admin_main.css +8 -0
- data/app/controllers/caboose/application_controller.rb +1 -1
- data/app/controllers/caboose/block_type_sources_controller.rb +1 -1
- data/app/controllers/caboose/block_types_controller.rb +1 -1
- data/app/controllers/caboose/calendars_controller.rb +1 -1
- data/app/controllers/caboose/cart_controller.rb +8 -1
- data/app/controllers/caboose/checkout_controller.rb +17 -9
- data/app/controllers/caboose/line_items_controller.rb +135 -0
- data/app/controllers/caboose/order_packages_controller.rb +304 -0
- data/app/controllers/caboose/orders_controller.rb +31 -74
- data/app/controllers/caboose/pages_controller.rb +2 -1
- data/app/controllers/caboose/product_images_controller.rb +11 -0
- data/app/controllers/caboose/products_controller.rb +25 -8
- data/app/controllers/caboose/shipping_addresses_controller.rb +46 -0
- data/app/controllers/caboose/shipping_packages_controller.rb +125 -54
- data/app/controllers/caboose/sites_controller.rb +2 -79
- data/app/controllers/caboose/smtp_controller.rb +52 -0
- data/app/controllers/caboose/store_controller.rb +94 -0
- data/app/controllers/caboose/vendors_controller.rb +25 -4
- data/app/models/caboose/address.rb +1 -3
- data/app/models/caboose/caboose_plugin.rb +1 -1
- data/app/models/caboose/category.rb +18 -0
- data/app/models/caboose/core_plugin.rb +21 -19
- data/app/models/caboose/order.rb +12 -7
- data/app/models/caboose/order_package.rb +5 -2
- data/app/models/caboose/order_transaction.rb +25 -0
- data/app/models/caboose/page.rb +1 -1
- data/app/models/caboose/schema.rb +50 -22
- data/app/models/caboose/shipping_calculator.rb +26 -30
- data/app/models/caboose/shipping_package.rb +45 -5
- data/app/models/caboose/store_config.rb +18 -6
- data/app/models/caboose/tax_calculator.rb +6 -5
- data/app/views/caboose/blocks/admin_edit.html.erb +1 -1
- data/app/views/caboose/line_items/admin_new.html.erb +100 -0
- data/app/views/caboose/orders/admin_edit.html.erb +21 -247
- data/app/views/caboose/orders/admin_edit_old.html.erb +155 -0
- data/app/views/caboose/orders/admin_new.html.erb +8 -23
- data/app/views/caboose/products/#Untitled-1# +0 -0
- data/app/views/caboose/products/admin_edit_images.html.erb +20 -4
- data/app/views/caboose/products/admin_index.html.erb +9 -3
- data/app/views/caboose/products/admin_sort.html.erb +138 -142
- data/app/views/caboose/roles/index.html.erb +1 -1
- data/app/views/caboose/shipping_packages/admin_edit.html.erb +52 -137
- data/app/views/caboose/shipping_packages/admin_index.html.erb +56 -19
- data/app/views/caboose/sites/_admin_header.html.erb +3 -5
- data/app/views/caboose/sites/admin_edit.html.erb +5 -3
- data/app/views/caboose/smtp/admin_edit.html.erb +41 -0
- data/app/views/caboose/station/index.html.erb +1 -1
- data/app/views/caboose/store/admin_edit.html.erb +96 -0
- data/app/views/caboose/vendors/admin_edit.html.erb +7 -3
- data/app/views/layouts/caboose/_station.html.erb +1 -1
- data/config/routes.rb +67 -25
- data/lib/caboose/engine.rb +1 -1
- data/lib/caboose/version.rb +1 -1
- metadata +28 -5
- data/app/views/caboose/shipping_packages/admin_new.html.erb +0 -33
- data/app/views/caboose/sites/admin_edit_smtp_config.html.erb +0 -51
- data/app/views/caboose/sites/admin_edit_store_config.html.erb +0 -77
@@ -19,7 +19,7 @@ Cart.prototype = {
|
|
19
19
|
$.ajax({
|
20
20
|
url: '/cart/items',
|
21
21
|
success: function(resp) {
|
22
|
-
that.order = resp
|
22
|
+
that.order = resp;
|
23
23
|
that.print();
|
24
24
|
}
|
25
25
|
});
|
@@ -44,9 +44,9 @@ Cart.prototype = {
|
|
44
44
|
);
|
45
45
|
|
46
46
|
$.each(this.order.line_items, function(i, li) {
|
47
|
-
var v = li.variant;
|
48
|
-
var
|
49
|
-
|
47
|
+
var v = li.variant;
|
48
|
+
var p = v.product;
|
49
|
+
var img = v.images ? v.images[0] : (p.featured_image ? p.featured_image : false);
|
50
50
|
img = img ? $('<img/>').attr('src', img.urls.tiny) : ' ';
|
51
51
|
|
52
52
|
tbody.append($('<tr/>')
|
@@ -170,7 +170,7 @@ IndexTable.prototype = {
|
|
170
170
|
this.parse_querystring();
|
171
171
|
|
172
172
|
var that = this;
|
173
|
-
var $el = $('#' + this.container + '
|
173
|
+
var $el = $('#' + this.container + '_table_container').length > 0 ? $('#' + this.container + '_table_container') : $('#' + this.container);
|
174
174
|
$el.html("<p class='loading'>Refreshing...</p>");
|
175
175
|
$.ajax({
|
176
176
|
url: that.refresh_url,
|
@@ -214,52 +214,66 @@ IndexTable.prototype = {
|
|
214
214
|
{
|
215
215
|
var that = this;
|
216
216
|
|
217
|
-
if (that.models == null || that.models.length == 0)
|
217
|
+
//if (that.models == null || that.models.length == 0)
|
218
|
+
//{
|
219
|
+
// $('#' + that.container).empty()
|
220
|
+
// .append($('<p/>').append(that.new_model_link()))
|
221
|
+
// .append($('<div/>').attr('id', that.container + '_new_form_container'))
|
222
|
+
// .append($('<p/>').append(that.no_models_text));
|
223
|
+
// return;
|
224
|
+
//}
|
225
|
+
|
226
|
+
var model_count = that.models ? that.models.length : 0;
|
227
|
+
var table = that.no_models_text;
|
228
|
+
var pager_div = '';
|
229
|
+
|
230
|
+
if (model_count > 0)
|
218
231
|
{
|
219
|
-
$('
|
220
|
-
|
221
|
-
.append(
|
222
|
-
|
223
|
-
|
232
|
+
var tbody = $('<tbody/>').append(this.table_headers());
|
233
|
+
$.each(that.models, function(i, m) {
|
234
|
+
tbody.append(that.table_row(m));
|
235
|
+
});
|
236
|
+
table = $('<table/>').addClass('data').css('margin-bottom', '10px').append(tbody);
|
237
|
+
pager_div = this.pager_div();
|
224
238
|
}
|
225
|
-
|
226
|
-
var tbody = $('<tbody/>').append(this.table_headers());
|
227
|
-
$.each(that.models, function(i, m) {
|
228
|
-
tbody.append(that.table_row(m));
|
229
|
-
});
|
230
|
-
var table = $('<table/>').addClass('data').css('margin-bottom', '10px').append(tbody);
|
231
|
-
var pager_div = this.pager_div();
|
232
239
|
|
233
|
-
if ($('#' + this.container + '
|
240
|
+
if ($('#' + this.container + '_table_container').length > 0)
|
234
241
|
{
|
235
|
-
$('#' + this.container + '_table_container').empty().append(table);
|
236
|
-
$('#' + this.container + '_pager').empty().append(pager_div);
|
237
|
-
$('#' + this.container + '
|
242
|
+
$('#' + this.container + '_table_container' ).empty().append(table);
|
243
|
+
$('#' + this.container + '_pager' ).empty().append(pager_div);
|
244
|
+
$('#' + this.container + '_toggle_columns' ).show();
|
245
|
+
$('#' + this.container + '_bulk_delete' ).show();
|
246
|
+
$('#' + this.container + '_bulk_edit' ).show();
|
247
|
+
$('#' + this.container + '_duplicate' ).show();
|
238
248
|
}
|
239
249
|
else
|
240
250
|
{
|
241
|
-
var columns = this.column_checkboxes();
|
242
251
|
var controls = $('<p/>');
|
243
|
-
|
244
|
-
|
245
|
-
if (this.
|
246
|
-
if (this.allow_bulk_import ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_import').val('
|
247
|
-
|
248
|
-
$('
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
)
|
253
|
-
.append($('<div/>').attr('id', that.container + '_new_form_container'))
|
254
|
-
.append($('<div/>').attr('id', that.container + '_columns').append(columns))
|
255
|
-
.append($('<div/>').attr('id', that.container + '_table_container').append(table))
|
256
|
-
.append($('<div/>').attr('id', that.container + '_pager').append(pager_div))
|
252
|
+
controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_new' ).val(that.new_model_text ).click(function(e) { that.new_form(); })).append(' ');
|
253
|
+
controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_toggle_columns' ).val('Show/Hide Columns' ).click(function(e) { that.toggle_columns(); })).append(' ');
|
254
|
+
if (this.allow_bulk_edit ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_edit' ).val('Bulk Edit' ).click(function(e) { that.bulk_edit(); })).append(' ');
|
255
|
+
if (this.allow_bulk_import ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_import' ).val('Import' ).click(function(e) { that.bulk_import(); })).append(' ');
|
256
|
+
if (this.allow_duplicate ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_duplicate' ).val('Duplicate' ).click(function(e) { that.duplicate(); })).append(' ');
|
257
|
+
if (this.allow_bulk_delete ) controls.append($('<input/>').attr('type', 'button').attr('id', this.container + '_bulk_delete' ).val('Delete' ).click(function(e) { that.bulk_delete(); })).append(' ');
|
258
|
+
|
259
|
+
var c = $('#' + that.container);
|
260
|
+
c.empty()
|
261
|
+
.append($('<div/>').attr('id', that.container + '_controls').append(controls))
|
257
262
|
.append($('<div/>').attr('id', that.container + '_message'))
|
258
|
-
.append(
|
259
|
-
|
263
|
+
.append($('<div/>').attr('id', that.container + '_table_container').append(table))
|
264
|
+
.append($('<div/>').attr('id', that.container + '_pager').append(pager_div));
|
265
|
+
|
266
|
+
if (model_count == 0)
|
267
|
+
{
|
268
|
+
$('#' + that.container + '_toggle_columns').hide();
|
269
|
+
$('#' + that.container + '_bulk_edit' ).hide();
|
270
|
+
$('#' + that.container + '_duplicate' ).hide();
|
271
|
+
$('#' + that.container + '_bulk_delete' ).hide();
|
272
|
+
$('#' + that.container + '_pager' ).hide();
|
273
|
+
}
|
260
274
|
}
|
261
275
|
|
262
|
-
if (that.quick_edit_model_id)
|
276
|
+
if (model_count > 0 && that.quick_edit_model_id)
|
263
277
|
{
|
264
278
|
var m = that.model_for_id(that.quick_edit_model_id);
|
265
279
|
$.each(that.fields, function(j, field) {
|
@@ -408,7 +422,7 @@ IndexTable.prototype = {
|
|
408
422
|
column_checkboxes: function()
|
409
423
|
{
|
410
424
|
var that = this;
|
411
|
-
var div = $('<div/>').attr('id', that.container + '_columns');
|
425
|
+
var div = $('<div/>').attr('id', that.container + '_columns').addClass('note');
|
412
426
|
$.each(this.fields, function(i, field) {
|
413
427
|
var input = $('<input/>')
|
414
428
|
.attr('type', 'checkbox')
|
@@ -465,24 +479,31 @@ IndexTable.prototype = {
|
|
465
479
|
cols[col] = checked;
|
466
480
|
localStorage.setItem(this.container + '_cols', JSON.stringify(cols));
|
467
481
|
},
|
482
|
+
|
483
|
+
toggle_columns: function()
|
484
|
+
{
|
485
|
+
var that = this;
|
486
|
+
var columns = that.column_checkboxes();
|
487
|
+
that.show_message(columns, 'toggle_columns');
|
488
|
+
},
|
468
489
|
|
469
490
|
bulk_edit: function()
|
470
491
|
{
|
471
492
|
var that = this;
|
472
493
|
if (this.model_ids.length == 0)
|
473
|
-
{
|
474
|
-
|
494
|
+
{
|
495
|
+
that.show_message("<p class='note error'>Please select at least one row.</p>", 'bulk_edit_select_row');
|
475
496
|
return;
|
476
497
|
}
|
477
|
-
var div = $('<div/>')
|
498
|
+
var div = $('<div/>').addClass('note')
|
478
499
|
.append($('<h2/>').html('Bulk Edit Jobs'))
|
479
500
|
.append($('<p/>').html('Any change you make the fields below will apply to all the selected rows.'));
|
480
501
|
$.each(this.fields, function(i, field) {
|
481
502
|
if (field.bulk_edit == true)
|
482
503
|
div.append($('<p/>').append($('<div/>').attr('id', 'bulkmodel_1_' + field.name)));
|
483
504
|
});
|
484
|
-
div.append($('<input/>').attr('type','button').val('Finished').click(function() {
|
485
|
-
|
505
|
+
div.append($('<p/>').append($('<input/>').attr('type','button').val('Finished').click(function() { that.hide_message(); })));
|
506
|
+
that.show_message(div, 'bulk_edit_form');
|
486
507
|
|
487
508
|
var params = this.model_ids.map(function(model_id) { return 'model_ids[]=' + model_id; }).join('&');
|
488
509
|
var attribs = [];
|
@@ -511,7 +532,7 @@ IndexTable.prototype = {
|
|
511
532
|
var that = this;
|
512
533
|
if (this.model_ids.length == 0)
|
513
534
|
{
|
514
|
-
|
535
|
+
that.show_message("<p class='note error'>Please select at least one row.</p>", 'bulk_delete_select_row');
|
515
536
|
return;
|
516
537
|
}
|
517
538
|
if (!confirm)
|
@@ -519,8 +540,8 @@ IndexTable.prototype = {
|
|
519
540
|
var p = $('<p/>').addClass('note').addClass('warning')
|
520
541
|
.append('Are you sure you want to delete the selected rows? ')
|
521
542
|
.append($('<input/>').attr('type','button').val('Yes').click(function() { that.bulk_delete(true); })).append(' ')
|
522
|
-
.append($('<input/>').attr('type','button').val('No').click(function() {
|
523
|
-
|
543
|
+
.append($('<input/>').attr('type','button').val('No').click(function() { that.hide_message(); }));
|
544
|
+
that.show_message(p, 'bulk_delete_confirm');
|
524
545
|
return;
|
525
546
|
}
|
526
547
|
var params = this.model_ids.map(function(model_id) { return 'model_ids[]=' + model_id; }).join('&');
|
@@ -532,7 +553,7 @@ IndexTable.prototype = {
|
|
532
553
|
model_ids: that.model_ids
|
533
554
|
},
|
534
555
|
success: function(resp) {
|
535
|
-
|
556
|
+
that.hide_message();
|
536
557
|
that.refresh();
|
537
558
|
}
|
538
559
|
});
|
@@ -555,16 +576,16 @@ IndexTable.prototype = {
|
|
555
576
|
.append($('<textarea/>').attr('id', that.container + '_bulk_import_data').attr('placeholder', 'CSV Data').css('width', '100%').css('height', '150px'))
|
556
577
|
)
|
557
578
|
.append($('<p/>')
|
558
|
-
.append($('<input/>').attr('type','button').val('Cancel').click(function() {
|
579
|
+
.append($('<input/>').attr('type','button').val('Cancel').click(function() { that.hide_message(); })).append(' ')
|
559
580
|
.append($('<input/>').attr('type','button').val('Add').click(function() { that.bulk_import($('#' + that.container + '_bulk_import_data').val(), $('#' + that.container + '_bulk_import_data_url').val()); }))
|
560
581
|
);
|
561
582
|
if (that.bulk_import_fields)
|
562
583
|
div.append($('<p/>').css('font-size', '75%').html("Format: " + that.bulk_import_fields.join(', ')));
|
563
584
|
|
564
|
-
|
585
|
+
that.show_message(div, 'bulk_import_form');
|
565
586
|
return;
|
566
587
|
}
|
567
|
-
|
588
|
+
that.show_message("<p class='loading'>Adding...</p>", 'bulk_import_loading');
|
568
589
|
$.ajax({
|
569
590
|
url: this.bulk_import_url,
|
570
591
|
type: 'post',
|
@@ -574,11 +595,11 @@ IndexTable.prototype = {
|
|
574
595
|
},
|
575
596
|
success: function(resp) {
|
576
597
|
if (resp.error)
|
577
|
-
|
598
|
+
that.show_message("<p class='note error'>" + resp.error + "</p>", 'bulk_import_error');
|
578
599
|
else
|
579
600
|
{
|
580
|
-
|
581
|
-
setTimeout(function() {
|
601
|
+
that.show_message("<p class='note success'>Added successfully.</p>", 'bulk_import_success');
|
602
|
+
setTimeout(function() { that.hide_message(); }, 3000);
|
582
603
|
that.refresh();
|
583
604
|
}
|
584
605
|
}
|
@@ -599,13 +620,13 @@ IndexTable.prototype = {
|
|
599
620
|
if (this.model_ids.length == 0)
|
600
621
|
{
|
601
622
|
var p = $('<p/>').addClass('note error').html("Please select a row.");
|
602
|
-
|
623
|
+
that.show_message(p, 'duplicate_select_row');
|
603
624
|
return;
|
604
625
|
}
|
605
626
|
if (this.model_ids.length > 1)
|
606
627
|
{
|
607
628
|
var p = $('<p/>').addClass('note error').html("Please select a single row.");
|
608
|
-
|
629
|
+
that.show_message(p, 'duplicate_select_single_row');
|
609
630
|
return;
|
610
631
|
}
|
611
632
|
if (!count)
|
@@ -614,19 +635,19 @@ IndexTable.prototype = {
|
|
614
635
|
.append('How many times do you want this duplicated?')
|
615
636
|
.append($('<input/>').attr('type', 'text').attr('id', 'count').css('width', '50'))
|
616
637
|
.append('<br />')
|
617
|
-
.append($('<input/>').attr('type', 'button').val('Cancel').click(function(e) {
|
638
|
+
.append($('<input/>').attr('type', 'button').val('Cancel').click(function(e) { that.hide_message(); })).append(' ')
|
618
639
|
.append($('<input/>').attr('type', 'button').val('Duplicate').click(function(e) { that.duplicate($('#count').val()); return false; }));
|
619
|
-
|
640
|
+
that.show_message(p, 'duplicate_form');
|
620
641
|
return;
|
621
642
|
}
|
622
|
-
|
643
|
+
that.show_message("<p class='loading'>Duplicating...</p>", 'duplicate_loading');
|
623
644
|
$.ajax({
|
624
645
|
url: that.duplicate_url(that.model_ids[0], that),
|
625
646
|
type: 'post',
|
626
647
|
data: { count: count },
|
627
648
|
success: function(resp) {
|
628
|
-
if (resp.error)
|
629
|
-
if (resp.success) {
|
649
|
+
if (resp.error) that.show_message("<p class='note error'>" + resp.error + "</p>", 'duplicate_error');
|
650
|
+
if (resp.success) { that.hide_message(); that.refresh(); }
|
630
651
|
}
|
631
652
|
});
|
632
653
|
},
|
@@ -740,34 +761,51 @@ IndexTable.prototype = {
|
|
740
761
|
return $('<a/>').attr('href', '#').html(that.new_model_text).click(function(e) { e.preventDefault(); that.new_form(); });
|
741
762
|
},
|
742
763
|
|
743
|
-
|
744
|
-
|
764
|
+
hide_message: function() {
|
765
|
+
var that = this;
|
766
|
+
$('#' + that.container + '_message').slideUp(function() { $('#' + that.container + '_message').empty().css('margin-bottom', 0); });
|
767
|
+
that.current_message = false
|
768
|
+
},
|
769
|
+
|
770
|
+
current_message: false,
|
771
|
+
show_message: function(el, name) {
|
745
772
|
var that = this;
|
746
|
-
if (
|
773
|
+
if (that.current_message == name)
|
747
774
|
{
|
748
|
-
$('#' + that.container + '
|
749
|
-
|
750
|
-
});
|
775
|
+
$('#' + that.container + '_message').slideUp(function() { $('#' + that.container + '_message').empty().css('margin-bottom', 0); });
|
776
|
+
that.current_message = false;
|
751
777
|
return;
|
752
|
-
}
|
753
|
-
|
778
|
+
}
|
779
|
+
if (!$('#' + that.container + '_message').is(':empty'))
|
780
|
+
{
|
781
|
+
$('#' + that.container + '_message').slideUp(function() { $('#' + that.container + '_message').empty().append(el).css('margin-bottom', '10px').slideDown(); });
|
782
|
+
that.current_message = name;
|
783
|
+
return;
|
784
|
+
}
|
785
|
+
else
|
786
|
+
{
|
787
|
+
$('#' + that.container + '_message').hide().empty().append(el).css('margin-bottom', '10px').slideDown();
|
788
|
+
that.current_message = name;
|
789
|
+
}
|
790
|
+
},
|
791
|
+
|
792
|
+
new_form: function()
|
793
|
+
{
|
794
|
+
var that = this;
|
754
795
|
var form = $('<form/>').attr('id', 'new_form')
|
755
796
|
.append($('<input/>').attr('type', 'hidden').attr('name', 'authenticity_token').val(that.form_authenticity_token));
|
756
797
|
$.each(this.new_model_fields, function(i, f) {
|
757
798
|
form.append($('<p/>').append($('<input/>').attr('type', 'text').attr('name', f.name).attr('placeholder', f.nice_name).css('width', '' + f.width + 'px')));
|
758
799
|
});
|
759
|
-
form
|
760
|
-
|
761
|
-
.append($('<
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
)
|
766
|
-
|
767
|
-
|
768
|
-
.append($('<h2/>').css('margin-top', 0).css('padding-top', 0).html(that.new_model_text))
|
769
|
-
.append(form)
|
770
|
-
).slideDown();
|
800
|
+
form.append($('<div/>').attr('id', that.container + '_new_message'));
|
801
|
+
form.append($('<p>')
|
802
|
+
.append($('<input/>').attr('type', 'button').val('Cancel').click(function(e) { that.hide_message(); })).append(' ')
|
803
|
+
.append($('<input/>').attr('type', 'submit').val('Add').click(function(e) { that.add_model(); return false; }))
|
804
|
+
);
|
805
|
+
var div = $('<div/>').addClass('note')
|
806
|
+
.append($('<h2/>').css('margin-top', 0).css('padding-top', 0).html(that.new_model_text))
|
807
|
+
.append(form);
|
808
|
+
that.show_message(div);
|
771
809
|
},
|
772
810
|
|
773
811
|
add_model: function()
|
@@ -780,7 +818,11 @@ IndexTable.prototype = {
|
|
780
818
|
data: $('#new_form').serialize(),
|
781
819
|
success: function(resp) {
|
782
820
|
if (resp.error) $('#' + that.container + '_new_message').html("<p class='note error'>" + resp.error + "</p>");
|
783
|
-
if (resp.redirect || resp.refresh || resp.success)
|
821
|
+
if (resp.redirect || resp.refresh || resp.success)
|
822
|
+
{
|
823
|
+
that.hide_message();
|
824
|
+
that.refresh();
|
825
|
+
}
|
784
826
|
}
|
785
827
|
});
|
786
828
|
},
|
@@ -13,7 +13,7 @@ module Caboose
|
|
13
13
|
return if !user_is_allowed('calendars', 'view')
|
14
14
|
render :file => 'caboose/extras/error_invalid_site' and return if @site.nil?
|
15
15
|
|
16
|
-
@calendars = Calendar.reorder(:name).all
|
16
|
+
@calendars = Calendar.where(:site_id => @site.id).reorder(:name).all
|
17
17
|
render :layout => 'caboose/admin'
|
18
18
|
end
|
19
19
|
|
@@ -7,7 +7,14 @@ module Caboose
|
|
7
7
|
|
8
8
|
# GET /cart/items
|
9
9
|
def list
|
10
|
-
render :json =>
|
10
|
+
render :json => @order.as_json(:include => [
|
11
|
+
{ :line_items => { :include => { :variant => { :include => :product }}}},
|
12
|
+
{ :order_packages => { :include => [:shipping_package, :shipping_method] }},
|
13
|
+
:customer,
|
14
|
+
:shipping_address,
|
15
|
+
:billing_address,
|
16
|
+
:order_transactions
|
17
|
+
])
|
11
18
|
end
|
12
19
|
|
13
20
|
# GET /cart/item-count
|
@@ -237,15 +237,23 @@ module Caboose
|
|
237
237
|
def authnet_relay
|
238
238
|
Caboose.log("Authorize.net relay, order #{params[:x_invoice_id]}")
|
239
239
|
|
240
|
-
order = Caboose::Order.find(params[:x_invoice_num])
|
241
|
-
|
242
|
-
|
240
|
+
order = Caboose::Order.find(params[:x_invoice_num])
|
241
|
+
ot = Caboose::OrderTransaction.new(
|
242
|
+
:order_id => order.id,
|
243
|
+
:date_processed => DateTime.now.utc,
|
244
|
+
:transaction_type => Caboose::OrderTransaction::TYPE_AUTHORIZE
|
245
|
+
)
|
246
|
+
ot.success = params[:x_response_code] && params[:x_response_code] == '1'
|
247
|
+
ot.transaction_id = params[:x_trans_id] if params[:x_trans_id]
|
248
|
+
ot.auth_code = params[:x_auth_code] if params[:x_auth_code]
|
249
|
+
ot.response_code = params[:x_response_code] if params[:x_response_code]
|
250
|
+
ot.amount = order.total
|
251
|
+
ot.save
|
243
252
|
|
244
|
-
|
253
|
+
error = nil
|
254
|
+
if ot.success
|
245
255
|
order.financial_status = 'authorized'
|
246
256
|
order.status = 'pending'
|
247
|
-
order.date_authorized = DateTime.now
|
248
|
-
order.auth_amount = order.total
|
249
257
|
|
250
258
|
# Send out emails
|
251
259
|
OrdersMailer.customer_new_order(order).deliver
|
@@ -254,14 +262,14 @@ module Caboose
|
|
254
262
|
# Emit order event
|
255
263
|
Caboose.plugin_hook('order_authorized', order)
|
256
264
|
else
|
257
|
-
order.financial_status = 'unauthorized'
|
265
|
+
order.financial_status = 'unauthorized'
|
258
266
|
error = "There was a problem processing your payment."
|
259
267
|
end
|
260
|
-
|
268
|
+
|
261
269
|
order.save
|
262
270
|
|
263
271
|
@url = params[:x_after_relay]
|
264
|
-
@url << (success ? "?success=1" : "?error=#{error}")
|
272
|
+
@url << (ot.success ? "?success=1" : "?error=#{error}")
|
265
273
|
|
266
274
|
render :layout => false
|
267
275
|
end
|