caboose-cms 0.5.64 → 0.5.66

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +8 -8
  2. data/app/assets/javascripts/caboose/admin.js +1 -1
  3. data/app/assets/javascripts/caboose/admin_edit_order.js +724 -0
  4. data/app/assets/javascripts/caboose/cart2.js +4 -4
  5. data/app/assets/javascripts/caboose/model/index_table.js +122 -80
  6. data/app/assets/stylesheets/caboose/admin_main.css +8 -0
  7. data/app/controllers/caboose/application_controller.rb +1 -1
  8. data/app/controllers/caboose/block_type_sources_controller.rb +1 -1
  9. data/app/controllers/caboose/block_types_controller.rb +1 -1
  10. data/app/controllers/caboose/calendars_controller.rb +1 -1
  11. data/app/controllers/caboose/cart_controller.rb +8 -1
  12. data/app/controllers/caboose/checkout_controller.rb +17 -9
  13. data/app/controllers/caboose/line_items_controller.rb +135 -0
  14. data/app/controllers/caboose/order_packages_controller.rb +304 -0
  15. data/app/controllers/caboose/orders_controller.rb +31 -74
  16. data/app/controllers/caboose/pages_controller.rb +2 -1
  17. data/app/controllers/caboose/product_images_controller.rb +11 -0
  18. data/app/controllers/caboose/products_controller.rb +25 -8
  19. data/app/controllers/caboose/shipping_addresses_controller.rb +46 -0
  20. data/app/controllers/caboose/shipping_packages_controller.rb +125 -54
  21. data/app/controllers/caboose/sites_controller.rb +2 -79
  22. data/app/controllers/caboose/smtp_controller.rb +52 -0
  23. data/app/controllers/caboose/store_controller.rb +94 -0
  24. data/app/controllers/caboose/vendors_controller.rb +25 -4
  25. data/app/models/caboose/address.rb +1 -3
  26. data/app/models/caboose/caboose_plugin.rb +1 -1
  27. data/app/models/caboose/category.rb +18 -0
  28. data/app/models/caboose/core_plugin.rb +21 -19
  29. data/app/models/caboose/order.rb +12 -7
  30. data/app/models/caboose/order_package.rb +5 -2
  31. data/app/models/caboose/order_transaction.rb +25 -0
  32. data/app/models/caboose/page.rb +1 -1
  33. data/app/models/caboose/schema.rb +50 -22
  34. data/app/models/caboose/shipping_calculator.rb +26 -30
  35. data/app/models/caboose/shipping_package.rb +45 -5
  36. data/app/models/caboose/store_config.rb +18 -6
  37. data/app/models/caboose/tax_calculator.rb +6 -5
  38. data/app/views/caboose/blocks/admin_edit.html.erb +1 -1
  39. data/app/views/caboose/line_items/admin_new.html.erb +100 -0
  40. data/app/views/caboose/orders/admin_edit.html.erb +21 -247
  41. data/app/views/caboose/orders/admin_edit_old.html.erb +155 -0
  42. data/app/views/caboose/orders/admin_new.html.erb +8 -23
  43. data/app/views/caboose/products/#Untitled-1# +0 -0
  44. data/app/views/caboose/products/admin_edit_images.html.erb +20 -4
  45. data/app/views/caboose/products/admin_index.html.erb +9 -3
  46. data/app/views/caboose/products/admin_sort.html.erb +138 -142
  47. data/app/views/caboose/roles/index.html.erb +1 -1
  48. data/app/views/caboose/shipping_packages/admin_edit.html.erb +52 -137
  49. data/app/views/caboose/shipping_packages/admin_index.html.erb +56 -19
  50. data/app/views/caboose/sites/_admin_header.html.erb +3 -5
  51. data/app/views/caboose/sites/admin_edit.html.erb +5 -3
  52. data/app/views/caboose/smtp/admin_edit.html.erb +41 -0
  53. data/app/views/caboose/station/index.html.erb +1 -1
  54. data/app/views/caboose/store/admin_edit.html.erb +96 -0
  55. data/app/views/caboose/vendors/admin_edit.html.erb +7 -3
  56. data/app/views/layouts/caboose/_station.html.erb +1 -1
  57. data/config/routes.rb +67 -25
  58. data/lib/caboose/engine.rb +1 -1
  59. data/lib/caboose/version.rb +1 -1
  60. metadata +28 -5
  61. data/app/views/caboose/shipping_packages/admin_new.html.erb +0 -33
  62. data/app/views/caboose/sites/admin_edit_smtp_config.html.erb +0 -51
  63. data/app/views/caboose/sites/admin_edit_store_config.html.erb +0 -77
@@ -6,7 +6,7 @@
6
6
  <th>Name</th>
7
7
  </tr>
8
8
  <% @roles.each do |r| %>
9
- <tr onclick="window.location='/admin/roles/<%= r['value'] %>/edit';">
9
+ <tr onclick="window.location='/admin/roles/<%= r['value'] %>';">
10
10
  <td><%= r['text'] %></td>
11
11
  </tr>
12
12
  <% end %>
@@ -1,162 +1,77 @@
1
1
  <%
2
- s = @site
3
- admin_ids = Caboose::SiteMembership.where(:site_id => s.id, :role => Caboose::SiteMembership::ROLE_ADMIN).pluck(:user_id)
4
- user_ids = Caboose::SiteMembership.where(:site_id => s.id, :role => Caboose::SiteMembership::ROLE_USER ).pluck(:user_id)
5
- admin_ids = [] if admin_ids.nil?
6
- user_ids = [] if user_ids.nil?
2
+ sp = @shipping_package
3
+ sc = @site.store_config
7
4
  %>
8
- <%= render :partial => 'caboose/sites/admin_header' %>
9
5
 
10
- <p><div id='site_<%= @site.id %>_name' ></div></p>
11
- <p><div id='site_<%= @site.id %>_description' ></div></p>
12
- <p><div id='site_<%= @site.id %>_under_construction_html' ></div></p>
6
+ <h1>Edit Shipping Packages</h1>
13
7
 
14
- <h2>Domains</h2>
15
- <p><a href='#' onclick="add_domain(<%= @site.id %>);">New Domain</a></p>
16
- <div id='new_domain_container'></div>
17
- <% if @site.domains && @site.domains.count > 0 %>
18
- <table class='data'>
19
- <tr>
20
- <th>Domain</th>
21
- <th>Primary</th>
22
- <th>Under Construction</th>
23
- <th>Delete</th>
24
- </tr>
25
- <% @site.domains.all.each do |d| %>
26
- <tr>
27
- <td><%= d.domain %></td>
28
- <td align='center'><input type='radio' name='primary_domain' <%= d.primary? ? "checked='true'" : '' %> onclick="set_primary_domain(<%= s.id %>, <%= d.id %>);" /></td>
29
- <td align='center'><input type='checkbox' name='under_construction_<%= d.id %>' <%= d.under_construction ? "checked='true'" : '' %> onclick="set_under_construction(<%= s.id %>, <%= d.id %>, $(this).prop('checked'));" /></td>
30
- <td align='center'><input type='button' value='Delete' onclick="delete_domain(<%= @site.id %>, <%= d.id %>);" /></td>
31
- </tr>
32
- <% end %>
33
- </table>
34
- <% else %>
35
- <p>This site doesn't have any domains yet.</p>
36
- <% end %>
37
- <div id='domain_message'></div>
38
-
39
- <h2>Members</h2>
40
- <div id='members'>
41
- <table class='data'>
42
- <tr><th>User</th><th>None</th><th>User</th><th>Admin</th></tr>
43
- <% Caboose::User.reorder('last_name, first_name').all.each do |u| %>
44
- <tr>
45
- <td><%= u.first_name %> <%= u.last_name %> (<%= u.email %>)</td>
46
- <td align='center'><input type='radio' name='user<%= u.id %>' <%= !admin_ids.include?(u.id) && !user_ids.include?(u.id) ? "checked='true'" : '' %> onclick="remove_site_membership(<%= s.id %>, <%= u.id %>);" /></td>
47
- <td align='center'><input type='radio' name='user<%= u.id %>' <%= user_ids.include?(u.id) ? "checked='true'" : '' %> onclick="add_site_membership(<%= s.id %>, <%= u.id %>, 'User');" /></td>
48
- <td align='center'><input type='radio' name='user<%= u.id %>' <%= admin_ids.include?(u.id) ? "checked='true'" : '' %> onclick="add_site_membership(<%= s.id %>, <%= u.id %>, 'Admin');" /></td>
49
- </tr>
50
- <% end %>
51
- </table>
52
- </div>
53
-
54
- <%= render :partial => 'caboose/sites/admin_footer' %>
8
+ <p><div id='shippingpackage_<%= sp.id %>_name' ></div></p>
9
+ <p><div id='shippingpackage_<%= sp.id %>_inside_length' ></div></p>
10
+ <p><div id='shippingpackage_<%= sp.id %>_inside_width' ></div></p>
11
+ <p><div id='shippingpackage_<%= sp.id %>_inside_height' ></div></p>
12
+ <p><div id='shippingpackage_<%= sp.id %>_outside_length' ></div></p>
13
+ <p><div id='shippingpackage_<%= sp.id %>_outside_width' ></div></p>
14
+ <p><div id='shippingpackage_<%= sp.id %>_outside_height' ></div></p>
15
+ <p><div id='shippingpackage_<%= sp.id %>_volume' ></div></p>
16
+ <p><div id='shippingpackage_<%= sp.id %>_empty_weight' ></div></p>
17
+ <p><div id='shippingpackage_<%= sp.id %>_cylinder' ></div></p>
18
+ <p><div id='shippingpackage_<%= sp.id %>_flat_rate_price' ></div></p>
19
+ <p><div id='shippingpackage_<%= sp.id %>_priority' ></div></p>
20
+ <p><div id='shippingpackage_<%= sp.id %>_shipping_method_id' ></div></p>
21
+ <div id='message'></div>
22
+ <p>
23
+ <input type='button' value='< Back' onclick="window.location='/admin/shipping-packages';" />
24
+ <input type='button' value='Delete Shipping Package' onclick="delete_shipping_package(<%= sp.id %>);" />
25
+ </p>
55
26
 
56
27
  <% content_for :caboose_js do %>
57
- <script type="text/javascript">
28
+ <%= javascript_include_tag 'caboose/model/all' %>
29
+ <script type='text/javascript'>
58
30
 
59
31
  $(document).ready(function() {
60
32
  new ModelBinder({
61
- name: 'Site',
62
- id: <%= @site.id %>,
63
- update_url: '/admin/sites/<%= @site.id %>',
33
+ name: 'ShippingPackage',
34
+ id: <%= sp.id %>,
35
+ update_url: '/admin/shipping-packages/<%= sp.id %>',
64
36
  authenticity_token: '<%= form_authenticity_token %>',
65
- attributes: [
66
- { name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@site.name) %>, width: 400 },
67
- { name: 'description' , nice_name: 'Description' , type: 'textarea' , value: <%= raw Caboose.json(@site.description) %>, width: 600, height: 75 },
68
- { name: 'under_construction_html' , nice_name: 'Under Construction HTML' , type: 'textarea' , value: <%= raw Caboose.json(@site.under_construction_html) %>, width: 600, height: 75 }
37
+ attributes: [
38
+ { name: 'name' , nice_name: 'name' , type: 'text' , value: <%= raw Caboose.json(sp.name ) %>, width: 400, align: 'left' },
39
+ { name: 'inside_length' , nice_name: 'Inside Length (<%= sc.length_unit %>)' , type: 'text' , value: <%= raw Caboose.json(sp.inside_length ) %>, width: 400, align: 'right' },
40
+ { name: 'inside_width' , nice_name: 'Inside Width (<%= sc.length_unit %>)' , type: 'text' , value: <%= raw Caboose.json(sp.inside_width ) %>, width: 400, align: 'right' },
41
+ { name: 'inside_height' , nice_name: 'Inside Height (<%= sc.length_unit %>)' , type: 'text' , value: <%= raw Caboose.json(sp.inside_height ) %>, width: 400, align: 'right' },
42
+ { name: 'outside_length' , nice_name: 'Outside Length (<%= sc.length_unit %>)' , type: 'text' , value: <%= raw Caboose.json(sp.outside_length ) %>, width: 400, align: 'right' },
43
+ { name: 'outside_width' , nice_name: 'Outside Width (<%= sc.length_unit %>)' , type: 'text' , value: <%= raw Caboose.json(sp.outside_width ) %>, width: 400, align: 'right' },
44
+ { name: 'outside_height' , nice_name: 'Outside Height (<%= sc.length_unit %>)' , type: 'text' , value: <%= raw Caboose.json(sp.outside_height ) %>, width: 400, align: 'right' },
45
+ { name: 'volume' , nice_name: 'Volume (<%= sc.length_unit %><sup>3</sup>)' , type: 'text' , value: <%= raw Caboose.json(sp.volume ) %>, width: 400, align: 'right' },
46
+ { name: 'empty_weight' , nice_name: 'Empty Weight (<%= sc.weight_unit %>)' , type: 'text' , value: <%= raw Caboose.json(sp.empty_weight ) %>, width: 400, align: 'right' },
47
+ { name: 'cylinder' , nice_name: 'Cylinder' , type: 'text' , value: <%= raw Caboose.json(sp.cylinder ) %>, width: 400, align: 'right' },
48
+ { name: 'flat_rate_price' , nice_name: 'Flat Rate Price' , type: 'text' , value: <%= raw Caboose.json(sp.flat_rate_price ) %>, width: 400, align: 'right' },
49
+ { name: 'priority' , nice_name: 'Priority' , type: 'text' , value: <%= raw Caboose.json(sp.priority ) %>, width: 400, align: 'right' },
50
+ { name: 'shipping_method_id' , nice_name: 'Shipping Methods' , type: 'checkbox-multiple' , value: <%= raw Caboose.json(sp.shipping_methods.collect{ |sm| sm.id }) %>, width: 400, height: 600, options_url: '/admin/shipping-methods/options' }
69
51
  ]
70
52
  });
71
53
  });
72
54
 
73
- function set_under_construction(site_id, domain_id, checked)
55
+ function delete_shipping_package(sp_id, confirm)
74
56
  {
75
- $.ajax({
76
- url: '/admin/sites/' + site_id + '/domains/' + domain_id,
77
- type: 'put',
78
- data: { under_construction: checked ? 1 : 0 }
79
- });
80
- }
81
-
82
- function add_site_membership(site_id, user_id, role)
83
- {
84
- $.ajax({
85
- url: '/admin/sites/' + site_id +'/members',
86
- type: 'post',
87
- data: {
88
- user_id: user_id,
89
- role: role
90
- },
91
- succes: function(resp) {}
92
- });
93
- }
94
-
95
- function remove_site_membership(site_id, user_id)
96
- {
97
- $.ajax({
98
- url: '/admin/sites/' + site_id +'/members/' + user_id,
99
- type: 'delete',
100
- succes: function(resp) {}
101
- });
102
- }
103
-
104
- function add_domain(site_id, domain)
105
- {
106
- if (!domain)
107
- {
108
- var div = $('<div/>')
109
- .append($('<p/>')
110
- .addClass('note warning')
111
- .append("What domain would you like to add?<br />")
112
- .append($('<input/>').attr('type','text').attr('id','new_domain').css('width', '200px')).append(' ')
113
- .append($('<input/>').attr('type','button').val('Add').click(function() { add_domain(site_id, $('#new_domain').val()); })).append(' ')
114
- .append($('<input/>').attr('type','button').val('Cancel').click(function() { $('#new_domain_container').empty(); }))
115
- )
116
- .append($('<div/>').attr('id', 'new_domain_message'));
117
- $('#new_domain_container').empty().append(div);
118
- return;
119
- }
120
- $('#new_domain_message').empty().html("<p class='loading'>Adding domain...</p>");
121
- $.ajax({
122
- url: '/admin/sites/' + site_id + '/domains',
123
- type: 'post',
124
- data: { domain: domain },
125
- success: function(resp) {
126
- if (resp.error) $('#new_domain_message').html("<p class='note error'>" + resp.error + "<br /></p>");
127
- if (resp.refresh) window.location.reload(true);
128
- }
129
- });
130
- }
131
-
132
- function delete_domain(site_id, domain_id, confirm)
133
- {
134
57
  if (!confirm)
135
58
  {
136
- var p = $('<p/>').addClass('note confirm')
137
- .append('Are you sure you want to delete the domain? ')
138
- .append($('<input/>').attr('type','button').val('Yes').click(function() { delete_domain(site_id, domain_id, true); })).append(' ')
139
- .append($('<input/>').attr('type','button').val('No').click(function() { $('#domain_message').empty(); }));
140
- $('#domain_message').empty().append(p);
141
- return;
59
+ var p = $('<p/>')
60
+ .addClass('note warning')
61
+ .append("Are you sure you want to delete the shipping package? ")
62
+ .append($('<input/>').attr('type','button').val('Yes').click(function(e) { delete_shipping_package(sp_id, true); })).append(' ')
63
+ .append($('<input/>').attr('type','button').val('No' ).click(function(e) { $('#message').empty(); }));
64
+ $('#message').empty().append(p);
65
+ return;
142
66
  }
143
- $('#domain_message').html("<p class='loading'>Deleting domain...</p>");
67
+ $('#message').html("<p class='loading'>Deleting shipping package...</p>");
144
68
  $.ajax({
145
- url: '/admin/sites/' + site_id + '/domains/' + domain_id,
69
+ url: '/admin/shipping-packages/' + sp_id,
146
70
  type: 'delete',
147
71
  success: function(resp) {
148
72
  if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
149
- if (resp.refresh) window.location.reload(true);
150
- }
151
- });
152
- }
153
-
154
- function set_primary_domain(site_id, domain_id)
155
- {
156
- $.ajax({
157
- url: '/admin/sites/' + site_id + '/domains/' + domain_id + '/set-primary',
158
- type: 'put',
159
- success: function(resp) {}
73
+ if (resp.redirect) window.location = resp.redirect;
74
+ }
160
75
  });
161
76
  }
162
77
 
@@ -1,40 +1,77 @@
1
- <%= render :partial => 'caboose/sites/admin_header' %>
1
+ <%
2
+ sc = @site.store_config
3
+ %>
2
4
 
3
- <h2>Shipping Packages</h2>
5
+ <h1>Shipping Packages</h1>
4
6
  <div id='shipping_packages'></div>
5
7
 
6
- <%= render :partial => 'caboose/sites/admin_footer' %>
8
+ <p><a href='#' onclick='toggle_standard_dimensions();'>Standard package dimensions</a></p>
9
+ <div id='standard_dimensions'>
10
+ <table class='data'>
11
+ <tr><th>Carrier</th><th>Box</th><th>IL</th><th>IW</th><th>IH</th><th>OL</th><th>OW</th><th>OH</th></tr>
12
+ <tr><td>USPS</td><td>Small Flat Rate Box </td><td align='right'> 5.375</td><td align='right'> 8.625</td><td align='right'> 1.625</td><td align='right'> 5.500</td><td align='right'> 9.000</td><td align='right'> 2.000</td></tr>
13
+ <tr><td>USPS</td><td>Medium Flat Rate Box 1 </td><td align='right'> 11.000</td><td align='right'> 8.500</td><td align='right'> 5.500</td><td align='right'> 11.250</td><td align='right'> 8.750</td><td align='right'> 6.000</td></tr>
14
+ <tr><td>USPS</td><td>Medium Flat Rate Box 2 </td><td align='right'> 11.875</td><td align='right'> 3.375</td><td align='right'> 13.625</td><td align='right'> 12.000</td><td align='right'> 3.500</td><td align='right'> 14.000</td></tr>
15
+ <tr><td>USPS</td><td>Large Flat Rate Box </td><td align='right'> 12.000</td><td align='right'> 12.000</td><td align='right'> 5.500</td><td align='right'> 12.250</td><td align='right'> 12.250</td><td align='right'> 6.000</td></tr>
16
+ </table>
17
+ </div>
7
18
 
8
19
  <% content_for :caboose_js do %>
20
+ <%= javascript_include_tag 'caboose/model/all' %>
9
21
  <script type='text/javascript'>
10
22
 
23
+ function toggle_standard_dimensions()
24
+ {
25
+ var el = $('#standard_dimensions');
26
+ if (el.is(':visible')) el.slideUp();
27
+ else el.slideDown();
28
+ }
29
+
11
30
  $(document).ready(function() {
31
+ $('#standard_dimensions').hide();
12
32
  var that = this;
13
33
  var table = new IndexTable({
14
34
  form_authenticity_token: '<%= form_authenticity_token %>',
15
35
  container: 'shipping_packages',
16
- base_url: '/admin/sites/<%= @site.id %>/shipping-packages',
17
- allow_bulk_edit: false,
36
+ base_url: '/admin/shipping-packages',
37
+ allow_bulk_edit: true,
18
38
  allow_bulk_delete: true,
19
39
  allow_duplicate: false,
20
- allow_advanced_edit: false,
40
+ allow_advanced_edit: true,
21
41
  fields: [
22
- { show: true , name: 'name' , nice_name: 'Shipping Method' , sort: 'shipping_method_id' , type: 'select' , value: function(sp) { return sp.shipping_method_id }, width: 75, align: 'left' },
23
- { show: true , name: 'length' , nice_name: 'Length (in)' , sort: 'length' , type: 'text' , value: function(sp) { return sp.length }, width: 50, align: 'right' },
24
- { show: true , name: 'width' , nice_name: 'Width (in)' , sort: 'width' , type: 'text' , value: function(sp) { return sp.width }, width: 50, align: 'right' },
25
- { show: true , name: 'height' , nice_name: 'Height (in)' , sort: 'height' , type: 'text' , value: function(sp) { return sp.height }, width: 50, align: 'right' },
26
- { show: true , name: 'volume' , nice_name: 'Volume (in<sup>3</sup>)' , sort: 'volume' , type: 'text' , value: function(sp) { return sp.volume }, width: 50, align: 'right' },
27
- { show: true , name: 'flat_rate_price' , nice_name: 'Flat Rate Price' , sort: 'flat_rate_price' , type: 'text' , value: function(sp) { return sp.flat_rate_price }, width: 50, align: 'right' },
28
- { show: true , name: 'priority' , nice_name: 'Priority' , sort: 'priority' , type: 'text' , value: function(sp) { return sp.priority }, width: 50, align: 'right' }
42
+ { show: true , bulk_edit: false , name: 'name' , nice_name: 'name' , sort: 'name' , type: 'text' , value: function(sp) { return sp.name }, width: 75, align: 'left' },
43
+ { show: true , bulk_edit: true , name: 'inside_length' , nice_name: 'Inside Length (<%= sc.length_unit %>)' , sort: 'inside_length' , type: 'text' , value: function(sp) { return sp.inside_length }, width: 50, align: 'right' },
44
+ { show: true , bulk_edit: true , name: 'inside_width' , nice_name: 'Inside Width (<%= sc.length_unit %>)' , sort: 'inside_width' , type: 'text' , value: function(sp) { return sp.inside_width }, width: 50, align: 'right' },
45
+ { show: true , bulk_edit: true , name: 'inside_height' , nice_name: 'Inside Height (<%= sc.length_unit %>)' , sort: 'inside_height' , type: 'text' , value: function(sp) { return sp.inside_height }, width: 50, align: 'right' },
46
+ { show: true , bulk_edit: true , name: 'outside_length' , nice_name: 'Outside Length (<%= sc.length_unit %>)' , sort: 'outside_length' , type: 'text' , value: function(sp) { return sp.outside_length }, width: 50, align: 'right' },
47
+ { show: true , bulk_edit: true , name: 'outside_width' , nice_name: 'Outside Width (<%= sc.length_unit %>)' , sort: 'outside_width' , type: 'text' , value: function(sp) { return sp.outside_width }, width: 50, align: 'right' },
48
+ { show: true , bulk_edit: true , name: 'outside_height' , nice_name: 'Outside Height (<%= sc.length_unit %>)' , sort: 'outside_height' , type: 'text' , value: function(sp) { return sp.outside_height }, width: 50, align: 'right' },
49
+ { show: true , bulk_edit: true , name: 'volume' , nice_name: 'Volume (<%= sc.length_unit %><sup>3</sup>)' , sort: 'volume' , type: 'text' , value: function(sp) { return sp.volume }, width: 50, align: 'right' },
50
+ { show: true , bulk_edit: true , name: 'empty_weight' , nice_name: 'Empty Weight (<%= sc.weight_unit %>)' , sort: 'empty_weight' , type: 'text' , value: function(sp) { return sp.empty_weight }, width: 50, align: 'right' },
51
+ { show: true , bulk_edit: true , name: 'cylinder' , nice_name: 'Cylinder' , sort: 'cylinder' , type: 'text' , value: function(sp) { return sp.cylinder }, width: 50, align: 'right' },
52
+ { show: false , bulk_edit: true , name: 'flat_rate_price' , nice_name: 'Flat Rate Price' , sort: 'flat_rate_price' , type: 'text' , value: function(sp) { return sp.flat_rate_price }, width: 50, align: 'right' },
53
+ { show: false , bulk_edit: true , name: 'priority' , nice_name: 'Priority' , sort: 'priority' , type: 'text' , value: function(sp) { return sp.priority }, width: 50, align: 'right' },
54
+ { show: true , bulk_edit: true , name: 'shipping_method_id' , nice_name: 'Shipping Methods' , sort: 'name' , type: 'checkbox-multiple' ,
55
+ options_url: '/admin/shipping-methods/options',
56
+ value: function(sp) { return sp.shipping_methods.map(function(sm) { return sm.id }); },
57
+ text: function(sp) { return sp.shipping_methods.map(function(sm) { return sm.service_name }).join(', '); },
58
+ width: 400,
59
+ height: 200
60
+ }
29
61
  ],
30
62
  new_model_text: 'New Shipping Package',
31
- new_model_fields: [
32
- { name: 'length' , nice_name: 'Length (in)' , type: 'text' , width: 50 },
33
- { name: 'width' , nice_name: 'Width (in)' , type: 'text' , width: 50 },
34
- { name: 'height' , nice_name: 'Height (in)' , type: 'text' , width: 50 }
63
+ no_models_text: 'There are no shipping packages right now.',
64
+ new_model_fields: [
65
+ { name: 'name' , nice_name: 'Name' , type: 'text' , width: 400 },
66
+ { name: 'inside_length' , nice_name: 'Inside Length (<%= sc.length_unit %>)' , type: 'text' , width: 400 },
67
+ { name: 'inside_width' , nice_name: 'Inside Width (<%= sc.length_unit %>)' , type: 'text' , width: 400 },
68
+ { name: 'inside_height' , nice_name: 'Inside Height (<%= sc.length_unit %>)' , type: 'text' , width: 400 },
69
+ { name: 'outside_length' , nice_name: 'Outside Length (<%= sc.length_unit %>)' , type: 'text' , width: 400 },
70
+ { name: 'outside_width' , nice_name: 'Outside Width (<%= sc.length_unit %>)' , type: 'text' , width: 400 },
71
+ { name: 'outside_height' , nice_name: 'Outside Height (<%= sc.length_unit %>)' , type: 'text' , width: 400 }
35
72
  ],
36
- bulk_import_fields: ['shipping_method_id', 'length', 'width', 'height'],
37
- bulk_import_url: '/admin/sites/<%= @site.id %>/shipping-packages/bulk'
73
+ bulk_import_fields: ['name', 'inside_length', 'inside_width', 'inside_height', 'outside_length', 'outside_width', 'outside_height'],
74
+ bulk_import_url: '/admin/shipping-packages/bulk'
38
75
  });
39
76
  });
40
77
 
@@ -24,11 +24,9 @@
24
24
  <ul id='tabs'>
25
25
  <%
26
26
  tabs = {
27
- 'General' => "/admin/sites/#{@site.id}",
28
- 'Block Types' => "/admin/sites/#{@site.id}/block-types",
29
- 'Store Config' => "/admin/sites/#{@site.id}/store",
30
- 'SMTP Config' => "/admin/sites/#{@site.id}/smtp",
31
- 'Delete Site' => "/admin/sites/#{@site.id}/delete"
27
+ 'General' => "/admin/sites/#{@site.id}",
28
+ 'Block Types' => "/admin/sites/#{@site.id}/block-types",
29
+ 'Delete Site' => "/admin/sites/#{@site.id}/delete"
32
30
  }
33
31
 
34
32
  %>
@@ -10,6 +10,7 @@ user_ids = [] if user_ids.nil?
10
10
  <p><div id='site_<%= @site.id %>_name' ></div></p>
11
11
  <p><div id='site_<%= @site.id %>_description' ></div></p>
12
12
  <p><div id='site_<%= @site.id %>_under_construction_html' ></div></p>
13
+ <p><div id='site_<%= @site.id %>_use_store' ></div></p>
13
14
 
14
15
  <h2>Domains</h2>
15
16
  <p><a href='#' onclick="add_domain(<%= @site.id %>);">New Domain</a></p>
@@ -63,9 +64,10 @@ $(document).ready(function() {
63
64
  update_url: '/admin/sites/<%= @site.id %>',
64
65
  authenticity_token: '<%= form_authenticity_token %>',
65
66
  attributes: [
66
- { name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@site.name) %>, width: 400 },
67
- { name: 'description' , nice_name: 'Description' , type: 'textarea' , value: <%= raw Caboose.json(@site.description) %>, width: 600, height: 75 },
68
- { name: 'under_construction_html' , nice_name: 'Under Construction HTML' , type: 'textarea' , value: <%= raw Caboose.json(@site.under_construction_html) %>, width: 600, height: 75 }
67
+ { name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@site.name) %>, width: 400 },
68
+ { name: 'description' , nice_name: 'Description' , type: 'textarea' , value: <%= raw Caboose.json(@site.description) %>, width: 600, height: 75 },
69
+ { name: 'under_construction_html' , nice_name: 'Under Construction HTML' , type: 'textarea' , value: <%= raw Caboose.json(@site.under_construction_html) %>, width: 600, height: 75 },
70
+ { name: 'use_store' , nice_name: 'Enable Store' , type: 'checkbox' , value: <%= raw Caboose.json(@site.use_store ? true : false) %>, width: 400 }
69
71
  ]
70
72
  });
71
73
  });
@@ -0,0 +1,41 @@
1
+ <%
2
+ sc = @smtp_config
3
+ %>
4
+ <h1>SMTP Config</h1>
5
+
6
+ <p><div id='smtpconfig_<%= sc.id %>_address' ></div></p>
7
+ <p><div id='smtpconfig_<%= sc.id %>_port' ></div></p>
8
+ <p><div id='smtpconfig_<%= sc.id %>_domain' ></div></p>
9
+ <p><div id='smtpconfig_<%= sc.id %>_user_name' ></div></p>
10
+ <p><div id='smtpconfig_<%= sc.id %>_password' ></div></p>
11
+ <p><div id='smtpconfig_<%= sc.id %>_authentication' ></div></p>
12
+ <p><div id='smtpconfig_<%= sc.id %>_enable_starttls_auto' ></div></p>
13
+
14
+ <div id='message'></div>
15
+
16
+ <% content_for :caboose_js do %>
17
+ <%= javascript_include_tag "caboose/model/all" %>
18
+ <script type="text/javascript">
19
+
20
+ $(document).ready(function() {
21
+
22
+ new ModelBinder({
23
+ name: 'SmtpConfig',
24
+ id: <%= sc.id %>,
25
+ update_url: '/admin/smtp',
26
+ authenticity_token: '<%= form_authenticity_token %>',
27
+ attributes: [
28
+ { name: 'address' , nice_name: 'Address' , type: 'text' , value: <%= raw Caboose.json(sc.address ) %>, width: 400 },
29
+ { name: 'port' , nice_name: 'Port' , type: 'text' , value: <%= raw Caboose.json(sc.port ) %>, width: 400 },
30
+ { name: 'domain' , nice_name: 'Domain' , type: 'text' , value: <%= raw Caboose.json(sc.domain ) %>, width: 400 },
31
+ { name: 'user_name' , nice_name: 'Username' , type: 'text' , value: <%= raw Caboose.json(sc.user_name ) %>, width: 400 },
32
+ { name: 'password' , nice_name: 'Password' , type: 'text' , value: <%= raw Caboose.json(sc.password ) %>, width: 400 },
33
+ { name: 'authentication' , nice_name: 'Authentication' , type: 'select' , value: <%= raw Caboose.json(sc.authentication ) %>, width: 400 , options_url: '/admin/smtp/auth-options' },
34
+ { name: 'enable_starttls_auto' , nice_name: 'Enable Start TLS Auto' , type: 'checkbox' , value: <%= raw sc.enable_starttls_auto ? 1 : 0 %>, width: 400 }
35
+ ]
36
+ });
37
+
38
+ });
39
+
40
+ </script>
41
+ <% end %>
@@ -1,5 +1,5 @@
1
1
  <%
2
- @nav = Caboose.plugin_hook('admin_nav', [], @user, @page)
2
+ @nav = Caboose.plugin_hook('admin_nav', [], @user, @page, @site)
3
3
  return_url = session[:caboose_station_return_url].nil? ? '/' : session[:caboose_station_return_url]
4
4
  return_url = '/' if return_url.starts_with?('/admin/') || return_url == '/admin'
5
5
 
@@ -0,0 +1,96 @@
1
+ <%
2
+ sc = @store_config
3
+ %>
4
+ <h1>Edit Store</h1>
5
+
6
+ <p><div id='site_<%= @site.id %>_use_store' ></div></p>
7
+
8
+ <h2>Payment Processor</h2>
9
+ <p><div id='storeconfig_<%= sc.id %>_pp_name' ></div></p>
10
+ <p><div id='storeconfig_<%= sc.id %>_pp_username' ></div></p>
11
+ <p><div id='storeconfig_<%= sc.id %>_pp_password' ></div></p>
12
+
13
+ <h2>Fulfillment Contacts</h2>
14
+ <p><div id='storeconfig_<%= sc.id %>_fulfillment_email' ></div></p>
15
+ <p><div id='storeconfig_<%= sc.id %>_shipping_email' ></div></p>
16
+
17
+ <h2>Dimension Units</h2>
18
+ <p><div id='storeconfig_<%= sc.id %>_length_unit' ></div></p>
19
+ <p><div id='storeconfig_<%= sc.id %>_weight_unit' ></div></p>
20
+
21
+ <h2>Shipping Carriers</h3>
22
+ <p><div id='storeconfig_<%= sc.id %>_ups_username' ></div></p>
23
+ <p><div id='storeconfig_<%= sc.id %>_ups_password' ></div></p>
24
+ <p><div id='storeconfig_<%= sc.id %>_ups_key' ></div></p>
25
+ <p><div id='storeconfig_<%= sc.id %>_ups_origin_account' ></div></p>
26
+ <p><div id='storeconfig_<%= sc.id %>_usps_username' ></div></p>
27
+ <p><div id='storeconfig_<%= sc.id %>_usps_secret_key' ></div></p>
28
+ <p><div id='storeconfig_<%= sc.id %>_usps_publishable_key' ></div></p>
29
+ <p><div id='storeconfig_<%= sc.id %>_fedex_username' ></div></p>
30
+ <p><div id='storeconfig_<%= sc.id %>_fedex_password' ></div></p>
31
+ <p><div id='storeconfig_<%= sc.id %>_fedex_key' ></div></p>
32
+ <p><div id='storeconfig_<%= sc.id %>_fedex_account' ></div></p>
33
+
34
+ <h2>Shipping Origin</h2>
35
+ <p><div id='storeconfig_<%= sc.id %>_origin_country' ></div></p>
36
+ <p><div id='storeconfig_<%= sc.id %>_origin_state' ></div></p>
37
+ <p><div id='storeconfig_<%= sc.id %>_origin_city' ></div></p>
38
+ <p><div id='storeconfig_<%= sc.id %>_origin_zip' ></div></p>
39
+
40
+ <h2>Other</h2>
41
+ <p><div id='storeconfig_<%= sc.id %>_handling_percentage' ></div></p>
42
+
43
+ <div id='message'></div>
44
+
45
+ <% content_for :caboose_js do %>
46
+ <%= javascript_include_tag "caboose/model/all" %>
47
+ <script type="text/javascript">
48
+
49
+ $(document).ready(function() {
50
+
51
+ new ModelBinder({
52
+ name: 'Site',
53
+ id: <%= @site.id %>,
54
+ update_url: '/admin/sites/<%= @site.id %>',
55
+ authenticity_token: '<%= form_authenticity_token %>',
56
+ attributes: [
57
+ { name: 'use_store', nice_name: 'Enable Store', type: 'checkbox', value: <%= raw Caboose.json(@site.use_store ? true : false) %>, width: 400 }
58
+ ]
59
+ });
60
+
61
+ new ModelBinder({
62
+ name: 'StoreConfig',
63
+ id: <%= sc.id %>,
64
+ update_url: '/admin/store',
65
+ authenticity_token: '<%= form_authenticity_token %>',
66
+ attributes: [
67
+ { name: 'pp_name' , nice_name: 'Type' , type: 'select' , value: <%= raw Caboose.json(sc.pp_name ) %>, width: 400 , options_url: '/admin/store/payment-processor-options' },
68
+ { name: 'pp_username' , nice_name: 'Username' , type: 'text' , value: <%= raw Caboose.json(sc.pp_username ) %>, width: 400 },
69
+ { name: 'pp_password' , nice_name: 'Password' , type: 'text' , value: <%= raw Caboose.json(sc.pp_password ) %>, width: 400 },
70
+ { name: 'fulfillment_email' , nice_name: 'Fulfillment Email' , type: 'text' , value: <%= raw Caboose.json(sc.fulfillment_email ) %>, width: 400 },
71
+ { name: 'shipping_email' , nice_name: 'Shipping Email' , type: 'text' , value: <%= raw Caboose.json(sc.shipping_email ) %>, width: 400 },
72
+ { name: 'handling_percentage' , nice_name: 'Handling Percentage' , type: 'text' , value: <%= raw Caboose.json(sc.handling_percentage ) %>, width: 400 },
73
+ { name: 'length_unit' , nice_name: 'Length' , type: 'select' , value: <%= raw Caboose.json(sc.length_unit ) %>, width: 400 , options_url: '/admin/store/length-unit-options' },
74
+ { name: 'weight_unit' , nice_name: 'Weight' , type: 'select' , value: <%= raw Caboose.json(sc.weight_unit ) %>, width: 400 , options_url: '/admin/store/weight-unit-options' },
75
+ { name: 'ups_username' , nice_name: 'UPS Username' , type: 'text' , value: <%= raw Caboose.json(sc.ups_username ) %>, width: 400 },
76
+ { name: 'ups_password' , nice_name: 'UPS Password' , type: 'text' , value: <%= raw Caboose.json(sc.ups_password ) %>, width: 400 },
77
+ { name: 'ups_key' , nice_name: 'UPS Key' , type: 'text' , value: <%= raw Caboose.json(sc.ups_key ) %>, width: 400 },
78
+ { name: 'ups_origin_account' , nice_name: 'UPS Origin Account' , type: 'text' , value: <%= raw Caboose.json(sc.ups_origin_account ) %>, width: 400 },
79
+ { name: 'usps_username' , nice_name: 'USPS Username' , type: 'text' , value: <%= raw Caboose.json(sc.usps_username ) %>, width: 400 },
80
+ { name: 'usps_secret_key' , nice_name: 'USPS Secret Key' , type: 'text' , value: <%= raw Caboose.json(sc.usps_secret_key ) %>, width: 400 },
81
+ { name: 'usps_publishable_key' , nice_name: 'USPS Publishable Key' , type: 'text' , value: <%= raw Caboose.json(sc.usps_publishable_key ) %>, width: 400 },
82
+ { name: 'fedex_username' , nice_name: 'FedEx Username' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_username ) %>, width: 400 },
83
+ { name: 'fedex_password' , nice_name: 'FedEx Password' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_password ) %>, width: 400 },
84
+ { name: 'fedex_key' , nice_name: 'FedEx Key' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_key ) %>, width: 400 },
85
+ { name: 'fedex_account' , nice_name: 'FedEx Account' , type: 'text' , value: <%= raw Caboose.json(sc.fedex_account ) %>, width: 400 },
86
+ { name: 'origin_country' , nice_name: 'Country' , type: 'text' , value: <%= raw Caboose.json(sc.origin_country ) %>, width: 400 },
87
+ { name: 'origin_state' , nice_name: 'State' , type: 'text' , value: <%= raw Caboose.json(sc.origin_state ) %>, width: 400 },
88
+ { name: 'origin_city' , nice_name: 'City' , type: 'text' , value: <%= raw Caboose.json(sc.origin_city ) %>, width: 400 },
89
+ { name: 'origin_zip' , nice_name: 'Zip' , type: 'text' , value: <%= raw Caboose.json(sc.origin_zip ) %>, width: 400 }
90
+ ]
91
+ });
92
+
93
+ });
94
+
95
+ </script>
96
+ <% end %>