spree_backend 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/admin/admin.js.erb +10 -9
  3. data/app/assets/javascripts/admin/line_items.js.coffee +61 -0
  4. data/app/assets/javascripts/admin/payments/edit.js.coffee +1 -1
  5. data/app/assets/javascripts/admin/product_picker.js +2 -1
  6. data/app/assets/javascripts/admin/progress.coffee +2 -2
  7. data/app/assets/javascripts/admin/shipments.js.erb +242 -0
  8. data/app/assets/javascripts/admin/variant_autocomplete.js.erb +0 -244
  9. data/app/assets/javascripts/admin/variant_management.js.coffee +10 -0
  10. data/app/assets/stylesheets/admin/sections/_log_entries.scss +17 -0
  11. data/app/assets/stylesheets/admin/spree_admin.scss +1 -0
  12. data/app/assets/stylesheets/admin/spree_backend.css +1 -1
  13. data/app/controllers/spree/admin/images_controller.rb +1 -1
  14. data/app/controllers/spree/admin/log_entries_controller.rb +19 -0
  15. data/app/controllers/spree/admin/mail_methods_controller.rb +1 -8
  16. data/app/controllers/spree/admin/orders/customer_details_controller.rb +4 -0
  17. data/app/controllers/spree/admin/orders_controller.rb +9 -14
  18. data/app/controllers/spree/admin/payments_controller.rb +4 -0
  19. data/app/controllers/spree/admin/products_controller.rb +7 -11
  20. data/app/controllers/spree/admin/reports_controller.rb +20 -4
  21. data/app/controllers/spree/admin/resource_controller.rb +6 -3
  22. data/app/controllers/spree/admin/taxons_controller.rb +1 -2
  23. data/app/controllers/spree/admin/variants_including_master_controller.rb +15 -0
  24. data/app/helpers/spree/admin/base_helper.rb +1 -1
  25. data/app/helpers/spree/admin/navigation_helper.rb +5 -2
  26. data/app/helpers/spree/admin/orders_helper.rb +42 -0
  27. data/app/helpers/spree/admin/stock_movements_helper.rb +5 -1
  28. data/app/views/spree/admin/log_entries/_credit_card.html.erb +4 -0
  29. data/app/views/spree/admin/log_entries/index.html.erb +28 -0
  30. data/app/views/spree/admin/mail_methods/_form.html.erb +2 -2
  31. data/app/views/spree/admin/orders/_form.html.erb +9 -1
  32. data/app/views/spree/admin/orders/_line_items.html.erb +46 -0
  33. data/app/views/spree/admin/orders/_risk_analysis.html.erb +47 -0
  34. data/app/views/spree/admin/orders/_shipment.html.erb +11 -3
  35. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +7 -3
  36. data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
  37. data/app/views/spree/admin/orders/customer_details/edit.html.erb +7 -9
  38. data/app/views/spree/admin/orders/index.html.erb +11 -5
  39. data/app/views/spree/admin/payment_methods/_form.html.erb +0 -2
  40. data/app/views/spree/admin/payments/_list.html.erb +2 -2
  41. data/app/views/spree/admin/payments/show.html.erb +2 -1
  42. data/app/views/spree/admin/products/_add_stock_form.html.erb +1 -1
  43. data/app/views/spree/admin/products/_form.html.erb +0 -1
  44. data/app/views/spree/admin/products/stock.html.erb +10 -1
  45. data/app/views/spree/admin/shared/_destroy.js.erb +5 -14
  46. data/app/views/spree/admin/shared/_head.html.erb +6 -2
  47. data/app/views/spree/admin/shared/_order_tabs.html.erb +4 -4
  48. data/app/views/spree/admin/variants/update.js.erb +1 -0
  49. data/config/routes.rb +3 -0
  50. data/vendor/assets/javascripts/spin.js +356 -296
  51. metadata +29 -19
@@ -10,15 +10,13 @@
10
10
  <li><%= button_link_to Spree.t(:back_to_orders_list), admin_orders_path, :icon => 'icon-arrow-left' %></li>
11
11
  <% end %>
12
12
 
13
- <% if @order.cart? %>
14
- <div id="select-customer" data-hook>
15
- <fieldset class="no-border-bottom">
16
- <legend align="center"><%= Spree.t(:customer_search) %></legend>
17
- <%= hidden_field_tag :customer_search, nil, :class => 'fullwidth title' %>
18
- <%= render :partial => "spree/admin/orders/customer_details/autocomplete", :formats => :js %>
19
- </fieldset>
20
- </div>
21
- <% end %>
13
+ <div id="select-customer" data-hook>
14
+ <fieldset class="no-border-bottom">
15
+ <legend align="center"><%= Spree.t(:customer_search) %></legend>
16
+ <%= hidden_field_tag :customer_search, nil, :class => 'fullwidth title' %>
17
+ <%= render :partial => "spree/admin/orders/customer_details/autocomplete", :formats => :js %>
18
+ </fieldset>
19
+ </div>
22
20
 
23
21
  <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @order } %>
24
22
 
@@ -37,7 +37,7 @@
37
37
 
38
38
  <div class="four columns">
39
39
  <div class="field">
40
- <%= label_tag nil, Spree.t(:order_number) %>
40
+ <%= label_tag nil, Spree.t(:order_number, :number => '') %>
41
41
  <%= f.text_field :number_cont %>
42
42
  </div>
43
43
  <div class="field">
@@ -60,7 +60,7 @@
60
60
  <div class="omega four columns">
61
61
  <div class="field checkbox">
62
62
  <label>
63
- <%= f.check_box :completed_at_not_null, {:checked => @show_only_completed}, '1', '' %>
63
+ <%= f.check_box :completed_at_not_null, {:checked => @show_only_completed}, '1', '0' %>
64
64
  <%= Spree.t(:show_only_complete_orders) %>
65
65
  </label>
66
66
  </div>
@@ -87,7 +87,9 @@
87
87
  <col style="width: 10%;">
88
88
  <col style="width: 10%;">
89
89
  <col style="width: 12%;">
90
- <col style="width: 12%;">
90
+ <% if Spree::Order.checkout_step_names.include?(:delivery) %>
91
+ <col style="width: 12%;">
92
+ <% end %>
91
93
  <col style="width: 25%;">
92
94
  <col style="width: 10%;">
93
95
  <col style="width: 8%;">
@@ -102,7 +104,9 @@
102
104
  <th><%= sort_link @search, :number, I18n.t(:number, :scope => 'activerecord.attributes.spree/order') %></th>
103
105
  <th><%= sort_link @search, :state, I18n.t(:state, :scope => 'activerecord.attributes.spree/order') %></th>
104
106
  <th><%= sort_link @search, :payment_state, I18n.t(:payment_state, :scope => 'activerecord.attributes.spree/order') %></th>
105
- <th><%= sort_link @search, :shipment_state, I18n.t(:shipment_state, :scope => 'activerecord.attributes.spree/order') %></th>
107
+ <% if Spree::Order.checkout_step_names.include?(:delivery) %>
108
+ <th><%= sort_link @search, :shipment_state, I18n.t(:shipment_state, :scope => 'activerecord.attributes.spree/order') %></th>
109
+ <% end %>
106
110
  <th><%= sort_link @search, :email, I18n.t(:email, :scope => 'activerecord.attributes.spree/order') %></th>
107
111
  <th><%= sort_link @search, :total, I18n.t(:total, :scope => 'activerecord.attributes.spree/order') %></th>
108
112
  <th data-hook="admin_orders_index_header_actions" class="actions"></th>
@@ -115,7 +119,9 @@
115
119
  <td class="align-center"><%= link_to order.number, edit_admin_order_path(order) %></td>
116
120
  <td class="align-center"><span class="state <%= order.state.downcase %>"><%= Spree.t("order_state.#{order.state.downcase}") %></span></td>
117
121
  <td class="align-center"><span class="state <%= order.payment_state %>"><%= link_to Spree.t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) if order.payment_state %></span></td>
118
- <td class="align-center"><span class="state <%= order.shipment_state %>"><%= Spree.t("shipment_states.#{order.shipment_state}") if order.shipment_state %></span></td>
122
+ <% if Spree::Order.checkout_step_names.include?(:delivery) %>
123
+ <td class="align-center"><span class="state <%= order.shipment_state %>"><%= Spree.t("shipment_states.#{order.shipment_state}") if order.shipment_state %></span></td>
124
+ <% end %>
119
125
  <td><%= mail_to order.email %></td>
120
126
  <td class="align-center"><%= order.display_total.to_html %></td>
121
127
  <td class='actions align-center' data-hook="admin_orders_index_row_actions">
@@ -1,5 +1,3 @@
1
- <% # Usage of old-style form helpers in this file is INTENTIONAL
2
- # For reasons, see commit 3e981c7. %>
3
1
  <div data-hook="admin_payment_method_form_fields">
4
2
 
5
3
  <div data-hook="payment_method">
@@ -11,9 +11,9 @@
11
11
  <tbody>
12
12
  <% payments.each do |payment| %>
13
13
  <tr id="<%= dom_id(payment) %>" data-hook="payments_row" class="<%= cycle('odd', 'even')%>">
14
- <td><%= pretty_time(payment.created_at) %></td>
14
+ <td><%= link_to pretty_time(payment.created_at), spree.admin_order_payment_path(@order, payment) %></td>
15
15
  <td class="align-center amount"><%= payment.display_amount.to_html %></td>
16
- <td class="align-center"><%= link_to payment_method_name(payment), spree.admin_order_payment_path(@order, payment) %></td>
16
+ <td class="align-center"><%= payment_method_name(payment) %></td>
17
17
  <td class="align-center"> <span class="state <%= payment.state %>"><%= Spree.t(payment.state, :scope => :payment_states, :default => payment.state.capitalize) %></span></td>
18
18
  <td class="actions">
19
19
  <% payment.actions.each do |action| %>
@@ -8,11 +8,12 @@
8
8
  <% end %>
9
9
 
10
10
  <% content_for :page_actions do %>
11
+ <li><%= button_link_to Spree.t(:logs), spree.admin_order_payment_log_entries_url(@order, @payment), :icon => 'icon-archive' %></li>
11
12
  <li><%= button_link_to Spree.t(:back_to_payments_list), spree.admin_order_payments_url(@order), :icon => 'icon-arrow-left' %></li>
12
13
  <% end %>
13
14
 
14
15
  <%= render :partial => "spree/admin/payments/source_views/#{@payment.payment_method.method_type}", :locals => { :payment => @payment.source.is_a?(Spree::Payment) ? @payment.source : @payment } %>
15
16
 
16
17
  <div data-hook="amount" class="align-center">
17
- <h5><%= label_tag nil, Spree.t(:amount) %>: <span class="green"><%= @payment.amount %></span> </h5>
18
+ <h5><%= label_tag nil, Spree.t(:amount) %>: <span class="green"><%= @payment.display_amount.to_html %></span> </h5>
18
19
  </div>
@@ -20,7 +20,7 @@
20
20
  <div class="five columns omega">
21
21
  <%= f.field_container :variant_id do %>
22
22
  <%= label_tag 'variant_id', Spree.t(:variant) %>
23
- <%= select_tag 'variant_id', options_from_collection_for_select(@variants, :id, :sku),
23
+ <%= select_tag 'variant_id', options_from_collection_for_select(@variants, :id, :sku_and_options_text),
24
24
  class: 'select2 fullwidth' %>
25
25
  <% end %>
26
26
  </div>
@@ -101,7 +101,6 @@
101
101
  <% end %>
102
102
  </div>
103
103
 
104
- <!-- <h2><%= Spree.t(:metadata) %></h2> -->
105
104
  <div data-hook="admin_product_form_meta" class="alpha omega twelve columns">
106
105
  <%= f.field_container :meta_keywords do %>
107
106
  <%= f.label :meta_keywords, Spree.t(:meta_keywords) %>
@@ -28,11 +28,20 @@
28
28
  <% if variant.stock_items.present? %>
29
29
  <tr id="<%= spree_dom_id variant %>" data-hook="admin_product_stock_management_index_rows" class="<%= cycle('odd', 'even') %>">
30
30
  <td class="align-center">
31
- <%= variant.sku %>
31
+ <%= variant.sku_and_options_text %>
32
32
  <br>
33
33
  <% if variant.images.present? %>
34
34
  <%= image_tag variant.images.first.attachment.url(:mini) %>
35
35
  <% end %>
36
+ <br/>
37
+ <%= form_tag admin_product_variants_including_master_path(@product, variant, format: :js), method: :put, class: 'toggle_variant_track_inventory' do %>
38
+ <%= check_box_tag 'track_inventory', 1, variant.track_inventory?,
39
+ class: 'track_inventory_checkbox' %>
40
+ <%= Spree.t(:track_inventory) %>
41
+ <%= hidden_field_tag 'variant[track_inventory]', variant.track_inventory?,
42
+ class: 'variant_track_inventory',
43
+ id: "variant_track_inventory_#{variant.id}" %>
44
+ <% end %>
36
45
  </td>
37
46
  <td colspan="4" class="stock_location_info">
38
47
  <table>
@@ -1,16 +1,7 @@
1
- notice_div = $('.flash.notice');
2
- <% notice = flash.discard(:notice)
3
- if notice %>
4
- if (notice_div.length > 0) {
5
- notice_div.html("<%= notice %>");
6
- notice_div.show();
7
- } else {
8
- if ($("#content .toolbar").length > 0) {
9
- $("#content .toolbar").before('<div class="flash notice"><%= notice %></div>');
10
- } else {
11
- $("#content h1").before('<div class="flash notice"><%= notice %></div>');
12
- }
13
- } <%
14
- end %>
1
+ <% success = flash.discard(:success)
2
+ if success %>
3
+ console.log(show_flash)
4
+ show_flash('success', "<%= success %>")
5
+ <% end %>
15
6
 
16
7
  <%= render :partial => '/spree/admin/shared/update_order_state' if @order %>
@@ -3,8 +3,12 @@
3
3
  <%= csrf_meta_tags %>
4
4
 
5
5
  <title>
6
- <%= "Spree #{Spree.t('administration')}: " %>
7
- <%= Spree.t(controller.controller_name, :default => controller.controller_name.titleize) %>
6
+ <% if content_for? :title %>
7
+ <%= yield :title %>
8
+ <% else %>
9
+ <%= "Spree #{Spree.t('administration')}: " %>
10
+ <%= Spree.t(controller.controller_name, :default => controller.controller_name.titleize) %>
11
+ <% end %>
8
12
  </title>
9
13
 
10
14
  <!-- Get "Open Sans" font from Google -->
@@ -27,7 +27,7 @@
27
27
  <dt data-hook><%= Spree.t(:total) %>:</dt>
28
28
  <dd id='order_total'><%= @order.display_total.to_html %></dd>
29
29
 
30
-
30
+
31
31
  <% if @order.completed? %>
32
32
  <dt><%= Spree.t(:shipment) %>: </dt>
33
33
  <dd id='shipment_status'><span class="state <%= @order.shipment_state %>"><%= Spree.t(@order.shipment_state, :scope => :shipment_states, :default => [:missing, "none"]) %></span></dd>
@@ -52,17 +52,17 @@
52
52
  <%= link_to_with_icon 'icon-user', Spree.t(:customer_details), admin_order_customer_url(@order) %>
53
53
  </li>
54
54
  <% end %>
55
- <% if can? :index, @order.adjustments %>
55
+ <% if can? :index, Spree::Adjustment %>
56
56
  <li<%== ' class="active"' if current == 'Adjustments' %>>
57
57
  <%= link_to_with_icon 'icon-cogs', Spree.t(:adjustments), admin_order_adjustments_url(@order) %>
58
58
  </li>
59
59
  <% end %>
60
- <% if can? :index, @order.payments && @payment_required %>
60
+ <% if can? :index, Spree::Payment && @payment_required %>
61
61
  <li<%== ' class="active"' if current == 'Payments' %>>
62
62
  <%= link_to_with_icon 'icon-credit-card', Spree.t(:payments), admin_order_payments_url(@order) %>
63
63
  </li>
64
64
  <% end %>
65
- <% if can? :index, @order.return_authorizations %>
65
+ <% if can? :index, Spree::ReturnAuthorization %>
66
66
  <% if @order.completed? %>
67
67
  <li<%== ' class="active"' if current == 'Return Authorizations' %>>
68
68
  <%= link_to_with_icon 'icon-share-alt', Spree.t(:return_authorizations), admin_order_return_authorizations_url(@order) %>
@@ -0,0 +1 @@
1
+ <%= @object.as_json %>
data/config/routes.rb CHANGED
@@ -38,6 +38,7 @@ Spree::Core::Engine.add_routes do
38
38
  post :update_positions
39
39
  end
40
40
  end
41
+ resources :variants_including_master, :only => [:update]
41
42
  end
42
43
 
43
44
  get '/variants/search', :to => "variants#search", :as => :search_variants
@@ -97,6 +98,8 @@ Spree::Core::Engine.add_routes do
97
98
  member do
98
99
  put :fire
99
100
  end
101
+
102
+ resources :log_entries
100
103
  end
101
104
  end
102
105