spree_core 1.1.2.rc1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/app/assets/javascripts/admin/admin.js.erb +3 -16
  2. data/app/assets/javascripts/admin/checkouts/edit.js +4 -2
  3. data/app/assets/javascripts/admin/spree_core.js +2 -3
  4. data/app/models/spree/order.rb +0 -4
  5. data/app/views/spree/admin/adjustments/_form.html.erb +12 -11
  6. data/app/views/spree/admin/images/_form.html.erb +17 -15
  7. data/app/views/spree/admin/mail_methods/_form.html.erb +81 -79
  8. data/app/views/spree/admin/option_types/_form.html.erb +12 -10
  9. data/app/views/spree/admin/orders/_add_product.html.erb +5 -2
  10. data/app/views/spree/admin/orders/_form.html.erb +49 -47
  11. data/app/views/spree/admin/orders/customer_details/_form.html.erb +44 -44
  12. data/app/views/spree/admin/payment_methods/_form.html.erb +46 -44
  13. data/app/views/spree/admin/payments/_form.html.erb +13 -11
  14. data/app/views/spree/admin/products/_form.html.erb +89 -87
  15. data/app/views/spree/admin/properties/_form.html.erb +2 -4
  16. data/app/views/spree/admin/prototypes/_form.html.erb +41 -39
  17. data/app/views/spree/admin/return_authorizations/_form.html.erb +67 -65
  18. data/app/views/spree/admin/shared/_head.html.erb +8 -6
  19. data/app/views/spree/admin/shipments/_form.html.erb +65 -63
  20. data/app/views/spree/admin/shipping_categories/_form.html.erb +8 -6
  21. data/app/views/spree/admin/states/_form.html.erb +10 -8
  22. data/app/views/spree/admin/tax_categories/_form.html.erb +16 -12
  23. data/app/views/spree/admin/tax_rates/_form.html.erb +21 -19
  24. data/app/views/spree/admin/taxonomies/_form.html.erb +1 -1
  25. data/app/views/spree/admin/taxons/_form.html.erb +1 -2
  26. data/app/views/spree/admin/trackers/_form.html.erb +29 -27
  27. data/app/views/spree/admin/variants/_form.html.erb +33 -31
  28. data/app/views/spree/admin/zones/_form.html.erb +27 -25
  29. data/lib/spree/core/version.rb +1 -1
  30. metadata +36 -34
  31. data/app/assets/javascripts/admin/spree.routes.js.erb +0 -30
@@ -123,7 +123,7 @@ $.fn.product_autocomplete = function(){
123
123
  return this.each(function() {
124
124
  $(this).autocomplete({
125
125
  source: function(request, response) {
126
- $.get(Spree.routes.admin_products_path({format: 'json'}) + "?q=" + $('#add_product_name').val() + "&authenticity_token=" + encodeURIComponent($('meta[name=csrf-token]').attr("content")), function(data) {
126
+ $.get(Spree.routes.product_search + '?' + jQuery.param({ q: $('#add_product_name').val(), authenticity_token: encodeURIComponent($('meta[name=csrf-token]').attr("content"))}), function(data) {
127
127
  result = prep_product_autocomplete_data(data)
128
128
  response(result);
129
129
  });
@@ -172,25 +172,12 @@ $.fn.objectPicker = function(url){
172
172
  };
173
173
 
174
174
  $.fn.productPicker = function(){
175
- $(this).objectPicker(ajax_urls.product_search_basic_json);
175
+ $(this).objectPicker(Spree.routes.product_search_basic);
176
176
  }
177
177
  $.fn.userPicker = function(){
178
- $(this).objectPicker(ajax_urls.user_search_basic_json);
178
+ $(this).objectPicker(Spree.routes.user_search);
179
179
  }
180
180
 
181
- // Possible defunct
182
- add_fields = function(target, association, content) {
183
- var new_id = new Date().getTime();
184
- var regexp = new RegExp("new_" + association, "g");
185
- $(target).append(content.replace(regexp, new_id));
186
- }
187
-
188
- $('a.remove_fields').on('click', function() {
189
- $(this).prev("input[type=hidden]").val("1");
190
- $(this).closest(".fields").hide();
191
- return false;
192
- });
193
-
194
181
  $(".observe_field").on('change', function() {
195
182
  target = $(this).attr("data-update");
196
183
  ajax_indicator = $(this).attr("data-ajax-indicator") || '#busy_indicator';
@@ -46,7 +46,9 @@ $(document).ready(function(){
46
46
  minChars: 5,
47
47
  delay: 1500,
48
48
  source: function(request, response) {
49
- $.get(Spree.routes.admin_users_path({format: 'json'}) + "?q=" + $("#customer_search").val() + "&authenticity_token=" + encodeURIComponent($('meta[name=csrf-token]').attr("content")), function(data) {
49
+ var params = { q: $('#customer_search').val(),
50
+ authenticity_token: encodeURIComponent($('meta[name=csrf-token]').attr("content")) }
51
+ $.get(Spree.routes.user_search + '&' + jQuery.param(params), function(data) {
50
52
  result = prep_user_autocomplete_data(data)
51
53
  response(result);
52
54
  });
@@ -78,6 +80,7 @@ $(document).ready(function(){
78
80
  $('#user_id').val(ui.item.data['id']);
79
81
  $('#guest_checkout_true').prop("checked", false);
80
82
  $('#guest_checkout_false').prop("checked", true);
83
+ $('#guest_checkout_false').prob("disabled", false);
81
84
  return true;
82
85
  }
83
86
  }).data("autocomplete")._renderItem = function(ul, item) {
@@ -107,7 +110,6 @@ $(document).ready(function(){
107
110
  $('#customer_search').val("");
108
111
  $('#user_id').val("");
109
112
  $('#checkout_email').val("");
110
- $('#guest_checkout_false').prop("disabled", true);
111
113
 
112
114
  $('#order_bill_address_attributes_firstname').val("");
113
115
  $('#order_bill_address_attributes_lastname').val("");
@@ -7,6 +7,5 @@
7
7
  //= require jquery.jstree/jquery.jstree
8
8
  //= require jquery.alerts/jquery.alerts
9
9
  //= require_tree .
10
- function ajax_root_prefix(){
11
- return $('body').data('ajax-root-path');
12
- }
10
+
11
+ var Spree = {};
@@ -413,10 +413,6 @@ module Spree
413
413
  ShippingMethod.all_available(self, display_on)
414
414
  end
415
415
 
416
- def available_payment_methods(display_on = nil)
417
- PaymentMethod.all(display_on)
418
- end
419
-
420
416
  def rate_hash
421
417
  @rate_hash ||= available_shipping_methods(:front_end).collect do |ship_method|
422
418
  next unless cost = ship_method.calculator.compute(self)
@@ -1,12 +1,13 @@
1
- <%= f.field_container :amount do %>
2
- <%= f.label :amount, t(:amount) %> <span class="required">*</span><br />
3
- <%= text_field :adjustment, :amount, {:style => 'width:80px;'} %>
4
- <%= f.error_message_on :amount %>
5
- <% end %>
6
-
7
- <%= f.field_container :label do %>
8
- <%= f.label :label, t(:description) %> <span class="required">*</span><br />
9
- <%= text_field :adjustment, :label, {:style => 'width:180px;'} %>
10
- <%= f.error_message_on :label %>
11
- <% end %>
1
+ <div data-hook="admin_adjustment_form_fields">
2
+ <%= f.field_container :amount do %>
3
+ <%= f.label :amount, t(:amount) %> <span class="required">*</span><br />
4
+ <%= text_field :adjustment, :amount, {:style => 'width:80px;'} %>
5
+ <%= f.error_message_on :amount %>
6
+ <% end %>
12
7
 
8
+ <%= f.field_container :label do %>
9
+ <%= f.label :label, t(:description) %> <span class="required">*</span><br />
10
+ <%= text_field :adjustment, :label, {:style => 'width:180px;'} %>
11
+ <%= f.error_message_on :label %>
12
+ <% end %>
13
+ </div>
@@ -1,16 +1,18 @@
1
- <tr data-hook="file">
2
- <td><%= t(:filename) %>:</td>
3
- <td><%= f.file_field :attachment %></td>
4
- </tr>
5
- <% if @product.has_variants? %>
6
- <tr data-hook="variant">
7
- <td><%= Spree::Variant.model_name.human %>:</td>
8
- <td><%= f.select :viewable_id, @variants %></td>
1
+ <div data-hook="admin_image_form_fields">
2
+ <tr data-hook="file">
3
+ <td><%= t(:filename) %>:</td>
4
+ <td><%= f.file_field :attachment %></td>
9
5
  </tr>
10
- <% else %>
11
- <%= hidden_field_tag :product_id, @product.id %>
12
- <% end %>
13
- <tr data-hook="alt_text">
14
- <td><%= t(:alt_text) %>:</td>
15
- <td><%= f.text_area :alt %></td>
16
- </tr>
6
+ <% if @product.has_variants? %>
7
+ <tr data-hook="variant">
8
+ <td><%= Spree::Variant.model_name.human %>:</td>
9
+ <td><%= f.select :viewable_id, @variants %></td>
10
+ </tr>
11
+ <% else %>
12
+ <%= hidden_field_tag :product_id, @product.id %>
13
+ <% end %>
14
+ <tr data-hook="alt_text">
15
+ <td><%= t(:alt_text) %>:</td>
16
+ <td><%= f.text_area :alt %></td>
17
+ </tr>
18
+ </div>
@@ -1,90 +1,92 @@
1
- <div class="clearfix">
2
- <div class="left" data-hook="general">
3
- <fieldset>
4
- <legend><%= t(:general) %></legend>
5
- <p>
6
- <%= f.label :environment, t(:environment) %><br />
7
- <%= f.collection_select(:environment,
8
- Rails.configuration.database_configuration.keys.sort,
9
- :to_s, :titleize,
10
- {}, {:id => 'gtwy-env'}) %>
11
- </p>
1
+ <div data-hook="admin_mail_method_form_fields">
2
+ <div class="clearfix">
3
+ <div class="left" data-hook="general">
4
+ <fieldset>
5
+ <legend><%= t(:general) %></legend>
6
+ <p>
7
+ <%= f.label :environment, t(:environment) %><br />
8
+ <%= f.collection_select(:environment,
9
+ Rails.configuration.database_configuration.keys.sort,
10
+ :to_s, :titleize,
11
+ {}, {:id => 'gtwy-env'}) %>
12
+ </p>
12
13
 
13
- <p>
14
- <%= f.check_box :preferred_enable_mail_delivery, {:style => "vertical-align:middle;"} %>
15
- <%= f.label :preferred_enable_mail_delivery, t(:enable_mail_delivery) %>
16
- </p>
14
+ <p>
15
+ <%= f.check_box :preferred_enable_mail_delivery, {:style => "vertical-align:middle;"} %>
16
+ <%= f.label :preferred_enable_mail_delivery, t(:enable_mail_delivery) %>
17
+ </p>
17
18
 
18
- <p>
19
- <%= f.label :preferred_mails_from, t(:send_mails_as) %><br />
20
- <%= f.text_field :preferred_mails_from, :size => 40, :maxlength => 256 %>
21
- <br />
22
- <span class="info">
23
- <%= t(:smtp_send_all_emails_as_from_following_address) %>
24
- </span>
25
- </p>
19
+ <p>
20
+ <%= f.label :preferred_mails_from, t(:send_mails_as) %><br />
21
+ <%= f.text_field :preferred_mails_from, :size => 40, :maxlength => 256 %>
22
+ <br />
23
+ <span class="info">
24
+ <%= t(:smtp_send_all_emails_as_from_following_address) %>
25
+ </span>
26
+ </p>
26
27
 
27
- <p>
28
- <%= f.label :preferred_mail_bcc, t(:send_copy_of_all_mails_to) %><br />
29
- <%= f.text_field :preferred_mail_bcc, :size => 40, :maxlength => 256 %>
30
- <br />
31
- <span class="info">
32
- <%= t(:smtp_send_copy_to_this_addresses) %>
33
- </span>
34
- </p>
28
+ <p>
29
+ <%= f.label :preferred_mail_bcc, t(:send_copy_of_all_mails_to) %><br />
30
+ <%= f.text_field :preferred_mail_bcc, :size => 40, :maxlength => 256 %>
31
+ <br />
32
+ <span class="info">
33
+ <%= t(:smtp_send_copy_to_this_addresses) %>
34
+ </span>
35
+ </p>
35
36
 
36
- <p>
37
- <%= f.label :preferred_intercept_email, t(:intercept_email_address) %><br />
38
- <%= f.text_field :preferred_intercept_email, :size => 40, :maxlength => 256 %>
39
- <br />
40
- <span class="info">
41
- <%= t(:intercept_email_instructions) %>
42
- </span>
43
- </p>
37
+ <p>
38
+ <%= f.label :preferred_intercept_email, t(:intercept_email_address) %><br />
39
+ <%= f.text_field :preferred_intercept_email, :size => 40, :maxlength => 256 %>
40
+ <br />
41
+ <span class="info">
42
+ <%= t(:intercept_email_instructions) %>
43
+ </span>
44
+ </p>
44
45
 
45
- </fieldset>
46
+ </fieldset>
46
47
 
47
- </div>
48
+ </div>
48
49
 
49
- <div class="right" data-hook="smtp">
50
+ <div class="right" data-hook="smtp">
50
51
 
51
- <fieldset>
52
- <legend><%= t(:smtp) %></legend>
53
- <p>
54
- <%= f.label :preferred_mail_domain, t(:smtp_domain) %><br />
55
- <%= f.text_field :preferred_mail_domain %>
56
- </p>
57
- <p>
58
- <%= f.label :preferred_mail_host, t(:smtp_mail_host) %><br />
59
- <%= f.text_field :preferred_mail_host %>
60
- </p>
61
- <p>
62
- <%= f.label :preferred_mail_port, t(:smtp_port) %><br />
63
- <%= f.text_field :preferred_mail_port %>
64
- </p>
65
- <p>
66
- <%= f.label :preferred_secure_connection_type, t(:secure_connection_type) %><br />
67
- <%= f.collection_select(:preferred_secure_connection_type,
68
- Spree::MailMethod::SECURE_CONNECTION_TYPES,
69
- :to_s, :to_s,
70
- {}, {'style' => 'width:200px'}) %>
71
- <p>
72
- <%= f.label :preferred_mail_auth_type, t(:smtp_authentication_type) %><br />
73
- <%= f.collection_select(:preferred_mail_auth_type,
74
- Spree::MailMethod::MAIL_AUTH,
75
- :to_s, :to_s,
76
- {}, {'style' => 'width:200px'}) %>
77
- </p>
78
- <p>
79
- <%= f.label :preferred_smtp_username, t(:smtp_username) %><br />
80
- <%= f.text_field :preferred_smtp_username %>
81
- </p>
82
- <p>
83
- <%= f.label :preferred_smtp_password, t(:smtp_password) %><br />
84
- <%= f.password_field :preferred_smtp_password %>
85
- </p>
86
- </fieldset>
52
+ <fieldset>
53
+ <legend><%= t(:smtp) %></legend>
54
+ <p>
55
+ <%= f.label :preferred_mail_domain, t(:smtp_domain) %><br />
56
+ <%= f.text_field :preferred_mail_domain %>
57
+ </p>
58
+ <p>
59
+ <%= f.label :preferred_mail_host, t(:smtp_mail_host) %><br />
60
+ <%= f.text_field :preferred_mail_host %>
61
+ </p>
62
+ <p>
63
+ <%= f.label :preferred_mail_port, t(:smtp_port) %><br />
64
+ <%= f.text_field :preferred_mail_port %>
65
+ </p>
66
+ <p>
67
+ <%= f.label :preferred_secure_connection_type, t(:secure_connection_type) %><br />
68
+ <%= f.collection_select(:preferred_secure_connection_type,
69
+ Spree::MailMethod::SECURE_CONNECTION_TYPES,
70
+ :to_s, :to_s,
71
+ {}, {'style' => 'width:200px'}) %>
72
+ <p>
73
+ <%= f.label :preferred_mail_auth_type, t(:smtp_authentication_type) %><br />
74
+ <%= f.collection_select(:preferred_mail_auth_type,
75
+ Spree::MailMethod::MAIL_AUTH,
76
+ :to_s, :to_s,
77
+ {}, {'style' => 'width:200px'}) %>
78
+ </p>
79
+ <p>
80
+ <%= f.label :preferred_smtp_username, t(:smtp_username) %><br />
81
+ <%= f.text_field :preferred_smtp_username %>
82
+ </p>
83
+ <p>
84
+ <%= f.label :preferred_smtp_password, t(:smtp_password) %><br />
85
+ <%= f.password_field :preferred_smtp_password %>
86
+ </p>
87
+ </fieldset>
87
88
 
88
- </div>
89
+ </div>
89
90
 
91
+ </div>
90
92
  </div>
@@ -1,11 +1,13 @@
1
- <%= f.field_container :name do %>
2
- <%= f.label :name, t(:name) %> <span class="required">*</span><br />
3
- <%= f.text_field :name %>
4
- <%= f.error_message_on :name %>
5
- <% end %>
1
+ <div data-hook="admin_option_type_form_fields">
2
+ <%= f.field_container :name do %>
3
+ <%= f.label :name, t(:name) %> <span class="required">*</span><br />
4
+ <%= f.text_field :name %>
5
+ <%= f.error_message_on :name %>
6
+ <% end %>
6
7
 
7
- <%= f.field_container :presentation do %>
8
- <%= f.label :presentation, t(:presentation) %> <span class="required">*</span><br />
9
- <%= f.text_field :presentation %>
10
- <%= f.error_message_on :presentation %>
11
- <% end %>
8
+ <%= f.field_container :presentation do %>
9
+ <%= f.label :presentation, t(:presentation) %> <span class="required">*</span><br />
10
+ <%= f.text_field :presentation %>
11
+ <%= f.error_message_on :presentation %>
12
+ <% end %>
13
+ </div>
@@ -12,8 +12,11 @@
12
12
  </div>
13
13
  <div style="float: left; width: 15%; padding-top: 17px;" data-hook="add_button">
14
14
  <%= link_to text_for_button_link(t(:add), :icon => 'add'),
15
- admin_order_line_items_url(@order),
16
- {:id => 'add_line_item_to_order', :class => 'button', 'data-update' => 'order-form-wrapper'} %>
15
+ admin_order_line_items_url(@order),
16
+ :method => :post,
17
+ :id => 'add_line_item_to_order',
18
+ :class => 'button',
19
+ 'data-update' => 'order-form-wrapper' %>
17
20
  </div>
18
21
 
19
22
  </fieldset>
@@ -1,54 +1,56 @@
1
- <% if @line_item.try(:errors).present? %>
2
- <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @line_item } %>
3
- <% end %>
1
+ <div data-hook="admin_order_form_fields">
2
+ <% if @line_item.try(:errors).present? %>
3
+ <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @line_item } %>
4
+ <% end %>
4
5
 
5
- <%= form_for @order, :url => admin_order_url(@order), :method => :put do |f| %>
6
- <%= f.hidden_field :number %>
7
- <table class="index">
8
- <tbody id="line-items">
9
- <tr data-hook="admin_order_form_line_items_headers">
10
- <th><%= t(:item_description) %></th>
11
- <th class="price"><%= t(:price) %></th>
12
- <th class="qty"><%= t(:qty) %></th>
13
- <th class="total"><span><%= t(:total) %></span></th>
14
- <th class="orders-actions" data-hook="admin_order_form_line_items_header_actions"></th>
15
- </tr>
16
- <%= f.fields_for :line_items do |li_form| %>
17
- <%= render :partial => 'spree/admin/orders/line_item', :locals => { :f => li_form } %>
18
- <% end %>
19
- </tbody>
20
- <tbody id="subtotal" data-hook="admin_order_form_subtotal">
21
- <tr id="subtotal-row">
22
- <td colspan="3"><b><%= t(:subtotal) %>:</b></td>
23
- <td class="total"><span><%= number_to_currency @order.item_total %></span></td>
24
- <td></td>
25
- </tr>
26
- </tbody>
27
- <tbody id="order-charges" data-hook="admin_order_form_adjustments">
28
- <% @order.adjustments.each do |adjustment| %>
6
+ <%= form_for @order, :url => admin_order_url(@order), :method => :put do |f| %>
7
+ <%= f.hidden_field :number %>
8
+ <table class="index">
9
+ <tbody id="line-items">
10
+ <tr data-hook="admin_order_form_line_items_headers">
11
+ <th><%= t(:item_description) %></th>
12
+ <th class="price"><%= t(:price) %></th>
13
+ <th class="qty"><%= t(:qty) %></th>
14
+ <th class="total"><span><%= t(:total) %></span></th>
15
+ <th class="orders-actions" data-hook="admin_order_form_line_items_header_actions"></th>
16
+ </tr>
17
+ <%= f.fields_for :line_items do |li_form| %>
18
+ <%= render :partial => 'spree/admin/orders/line_item', :locals => { :f => li_form } %>
19
+ <% end %>
20
+ </tbody>
21
+ <tbody id="subtotal" data-hook="admin_order_form_subtotal">
22
+ <tr id="subtotal-row">
23
+ <td colspan="3"><b><%= t(:subtotal) %>:</b></td>
24
+ <td class="total"><span><%= number_to_currency @order.item_total %></span></td>
25
+ <td></td>
26
+ </tr>
27
+ </tbody>
28
+ <tbody id="order-charges" data-hook="admin_order_form_adjustments">
29
+ <% @order.adjustments.each do |adjustment| %>
30
+ <tr>
31
+ <td colspan="3"><strong><%= adjustment.label %></strong></td>
32
+ <td class="total"><span><%= number_to_currency adjustment.amount %></span></td>
33
+ <td></td>
34
+ </tr>
35
+ <% end %>
36
+ </tbody>
37
+ <tbody id="order-total" data-hook="admin_order_form_total">
29
38
  <tr>
30
- <td colspan="3"><strong><%= adjustment.label %></strong></td>
31
- <td class="total"><span><%= number_to_currency adjustment.amount %></span></td>
39
+ <td colspan="3"><b><%= t(:order_total) %>:</b></td>
40
+ <td class="total"><span id="order_total"><%= number_to_currency @order.total %></span></td>
32
41
  <td></td>
33
42
  </tr>
34
- <% end %>
35
- </tbody>
36
- <tbody id="order-total" data-hook="admin_order_form_total">
37
- <tr>
38
- <td colspan="3"><b><%= t(:order_total) %>:</b></td>
39
- <td class="total"><span id="order_total"><%= number_to_currency @order.total %></span></td>
40
- <td></td>
41
- </tr>
42
- </tbody>
43
- </table>
43
+ </tbody>
44
+ </table>
44
45
 
45
- <p class="form-buttons" data-hook="admin_order_form_buttons">
46
- <%= button t(:update) %>
47
- <%= t(:or) %> <%= link_to t(:back), admin_orders_url %>
48
- </p>
46
+ <p class="form-buttons" data-hook="admin_order_form_buttons">
47
+ <%= button t(:update) %>
48
+ <%= t(:or) %> <%= link_to t(:back), admin_orders_url %>
49
+ </p>
49
50
 
50
- <% end %>
51
+ <% end %>
51
52
 
52
- <%= javascript_tag do -%>
53
- <%= render :partial => 'spree/admin/shared/update_order_state', :handlers => [:js] %>
54
- <% end -%>
53
+ <%= javascript_tag do -%>
54
+ <%= render :partial => 'spree/admin/shared/update_order_state', :handlers => [:js] %>
55
+ <% end -%>
56
+ </div>