solidus_backend 1.0.0.pre2 → 1.0.0.pre3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_backend might be problematic. Click here for more details.

Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend/gateway.js.coffee +21 -0
  3. data/app/assets/javascripts/spree/backend/shipments.js.erb +6 -2
  4. data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +27 -43
  5. data/app/assets/javascripts/spree/backend.js +0 -1
  6. data/app/assets/stylesheets/spree/backend.css +0 -2
  7. data/app/controllers/spree/admin/base_controller.rb +0 -7
  8. data/app/controllers/spree/admin/orders_controller.rb +8 -1
  9. data/app/controllers/spree/admin/payments_controller.rb +8 -1
  10. data/app/controllers/spree/admin/root_controller.rb +9 -1
  11. data/app/controllers/spree/admin/stock_transfers_controller.rb +25 -4
  12. data/app/controllers/spree/admin/users_controller.rb +4 -1
  13. data/app/views/spree/admin/cancellations/index.html.erb +1 -1
  14. data/app/views/spree/admin/orders/_carton_manifest.html.erb +1 -1
  15. data/app/views/spree/admin/orders/_line_items.html.erb +1 -1
  16. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
  17. data/app/views/spree/admin/orders/cart.html.erb +1 -1
  18. data/app/views/spree/admin/orders/confirm/_shipment_manifest.html.erb +1 -1
  19. data/app/views/spree/admin/orders/customer_details/_form.html.erb +20 -16
  20. data/app/views/spree/admin/orders/edit.html.erb +1 -1
  21. data/app/views/spree/admin/payment_methods/_form.html.erb +17 -8
  22. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +8 -0
  23. data/app/views/spree/admin/payments/source_views/_storecredit.html.erb +21 -0
  24. data/app/views/spree/admin/products/index.html.erb +1 -1
  25. data/app/views/spree/admin/promotion_categories/index.html.erb +11 -5
  26. data/app/views/spree/admin/promotions/index.html.erb +6 -2
  27. data/app/views/spree/admin/promotions/rules/_nth_order.html.erb +7 -0
  28. data/app/views/spree/admin/shared/_head.html.erb +0 -1
  29. data/app/views/spree/admin/shared/_number_field_update_actions.html.erb +5 -3
  30. data/app/views/spree/admin/stock_items/_stock_management.html.erb +1 -1
  31. data/app/views/spree/admin/stock_transfers/_transfer_item_table.html.erb +1 -1
  32. data/app/views/spree/admin/taxonomies/edit.erb +13 -17
  33. data/app/views/spree/admin/users/_form.html.erb +19 -11
  34. data/app/views/spree/admin/users/items.html.erb +1 -1
  35. data/app/views/spree/admin/variants/edit.html.erb +3 -1
  36. data/app/views/spree/admin/variants/index.html.erb +1 -1
  37. data/config/routes.rb +0 -2
  38. data/lib/spree/backend/engine.rb +0 -1
  39. metadata +9 -15
  40. data/app/assets/javascripts/spree/backend/gateway.js +0 -13
  41. data/app/views/spree/admin/payments/_bill_address_form.html.erb +0 -9
  42. data/vendor/assets/images/jquery.alerts/images/help.gif +0 -0
  43. data/vendor/assets/images/jquery.alerts/images/important.gif +0 -0
  44. data/vendor/assets/images/jquery.alerts/images/info.gif +0 -0
  45. data/vendor/assets/images/jquery.alerts/images/title.gif +0 -0
  46. data/vendor/assets/javascripts/jquery.alerts/jquery.alerts.js +0 -235
  47. data/vendor/assets/stylesheets/jquery.alerts/jquery.alerts.css.erb +0 -57
  48. data/vendor/assets/stylesheets/jquery.alerts/jquery.alerts.spree.css +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19e43bc690cae1fd3d31bf43d19a84913c5a362f
4
- data.tar.gz: 28eb88ebb395e74c2749dd64bddc7d38c757d59b
3
+ metadata.gz: 0147cf8388db75d478f5335739307297255bfbe7
4
+ data.tar.gz: 19ede418b138fe3f2ee52212780a874876344f8e
5
5
  SHA512:
6
- metadata.gz: 9d6abcd850e647d41c9429d5b73b04aff715a364c2501e5fb7203cdbe7a8366587037c8c7b98b5069117b310be3d048733df5f029fdf8c2b2be54c3bc28b8f54
7
- data.tar.gz: af36c277c5df47747c78193f357668ff30b2909b59fcedcb11cc11a8c8850749676f624a7331088524f2afa54924542cff1e35f5ad105ae5ddf41a1718a53671
6
+ metadata.gz: 5836d8ac5c63e5d7b192167484a8ab9b18ca05f365e8de30477fd33ee6024710ff077f764a5bcfc363ef43fd89d1cc2cfdde528cfefaeff45fb6a65a729d1428
7
+ data.tar.gz: 04da95b14aafdaa6ecf847c7a60f999cf488b90e565d41a96176c0a84e91c7eaf0be25aff7e61080d2bd3b3929dc9e791611b9fb9620c56eafa22742f42d7e75
@@ -0,0 +1,21 @@
1
+ $ ->
2
+ $gateway_type = $('select.js-gateway-type')
3
+ $preference_source = $('select.js-preference-source')
4
+
5
+ original_gtwy_type = $gateway_type.val()
6
+ original_preference_source = $preference_source.val()
7
+ render = ->
8
+ gateway_type = $gateway_type.val()
9
+ preference_source = $preference_source.val()
10
+
11
+ $('.js-preference-source-wrapper').toggle(gateway_type == original_gtwy_type)
12
+ if gateway_type == original_gtwy_type && preference_source == original_preference_source
13
+ $('.js-gateway-settings').show()
14
+ $('.js-gateway-settings-warning').hide()
15
+ else
16
+ $('.js-gateway-settings').hide()
17
+ $('.js-gateway-settings-warning').show()
18
+
19
+ $gateway_type.change(render)
20
+ $preference_source.change(render)
21
+ render()
@@ -160,9 +160,13 @@ adjustShipmentItems = function(shipment_number, variant_id, quantity){
160
160
  data: {
161
161
  variant_id: variant_id,
162
162
  quantity: new_quantity,
163
+ },
164
+ success: function(response) {
165
+ window.location.reload();
166
+ },
167
+ error: function(response) {
168
+ show_flash('error', response.responseJSON.message);
163
169
  }
164
- }).done(function( msg ) {
165
- window.location.reload();
166
170
  });
167
171
  }
168
172
  }
@@ -1,25 +1,27 @@
1
- handle_ajax_error = (XMLHttpRequest, textStatus, errorThrown) ->
2
- $.jstree.rollback(last_rollback)
3
- $("#ajax_error").show().html("<strong>" + server_error + "</strong><br />" + taxonomy_tree_error)
1
+ base_url = null
2
+
3
+ tree_error_handler = (data) ->
4
+ rollback = data.rlbk
5
+ (XMLHttpRequest, textStatus, errorThrown) ->
6
+ $.jstree.rollback(rollback)
7
+ $("#ajax_error").show().html("<strong>#{server_error}</strong><br />" + taxonomy_tree_error)
4
8
 
5
9
  handle_move = (e, data) ->
6
- last_rollback = data.rlbk
7
10
  position = data.rslt.cp
8
11
  node = data.rslt.o
9
12
  new_parent = data.rslt.np
10
13
 
11
14
  url = "#{base_url}/#{node.prop("id")}"
12
15
  Spree.ajax
13
- type: "POST",
16
+ type: "PUT",
14
17
  dataType: "json",
15
18
  url: url,
16
- data: ({_method: "put", "taxon[parent_id]": new_parent.prop("id"), "taxon[child_index]": position }),
17
- error: handle_ajax_error
19
+ data: ({"taxon[parent_id]": new_parent.prop("id"), "taxon[child_index]": position }),
20
+ error: tree_error_handler(data)
18
21
 
19
22
  true
20
23
 
21
24
  handle_create = (e, data) ->
22
- last_rollback = data.rlbk
23
25
  node = data.rslt.obj
24
26
  name = data.rslt.name
25
27
  position = data.rslt.position
@@ -28,61 +30,50 @@ handle_create = (e, data) ->
28
30
  Spree.ajax
29
31
  type: "POST",
30
32
  dataType: "json",
31
- url: base_url.toString(),
33
+ url: base_url,
32
34
  data: {
33
35
  "taxon[name]": name,
34
36
  "taxon[parent_id]": new_parent.prop("id"),
35
37
  "taxon[child_index]": position,
36
- token: Spree.api_key
37
38
  },
38
- error: handle_ajax_error,
39
+ error: tree_error_handler(data)
39
40
  success: (data,result) ->
40
41
  node.prop('id', data.id)
41
42
 
42
43
  handle_rename = (e, data) ->
43
- last_rollback = data.rlbk
44
44
  node = data.rslt.obj
45
45
  name = data.rslt.new_name
46
46
 
47
47
  url = "#{base_url}/#{node.prop("id")}"
48
48
 
49
49
  Spree.ajax
50
- type: "POST",
50
+ type: "PUT",
51
51
  dataType: "json",
52
52
  url: url,
53
53
  data: {
54
- _method: "put",
55
54
  "taxon[name]": name,
56
55
  },
57
- error: handle_ajax_error
56
+ error: tree_error_handler(data)
58
57
 
59
58
  handle_delete = (e, data) ->
60
- last_rollback = data.rlbk
61
59
  node = data.rslt.obj
62
60
  delete_url = "#{base_url}/#{node.prop("id")}"
63
- jConfirm Spree.translations.are_you_sure_delete, Spree.translations.confirm_delete, (r) ->
64
- if r
65
- Spree.ajax
66
- type: "POST",
67
- dataType: "json",
68
- url: delete_url.toString(),
69
- data: {
70
- _method: "delete",
71
- token: Spree.api_key
72
- },
73
- error: handle_ajax_error
74
- else
75
- $.jstree.rollback(last_rollback)
76
- last_rollback = null
77
-
78
- root = exports ? this
79
- root.setup_taxonomy_tree = (taxonomy_id) ->
61
+ if confirm(Spree.translations.are_you_sure_delete)
62
+ Spree.ajax
63
+ type: "DELETE",
64
+ dataType: "json",
65
+ url: delete_url,
66
+ error: tree_error_handler(data)
67
+ else
68
+ $.jstree.rollback(data.rlbk)
69
+
70
+ @setup_taxonomy_tree = (taxonomy_id) ->
80
71
  if taxonomy_id != undefined
81
72
  # this is defined within admin/taxonomies/edit
82
- root.base_url = Spree.routes.taxonomy_taxons_path
73
+ base_url = Spree.routes.taxonomy_taxons_path
83
74
 
84
75
  Spree.ajax
85
- url: Spree.url(base_url.path().replace("/taxons", "/jstree")).toString(),
76
+ url: base_url.replace("/taxons", "/jstree"),
86
77
  success: (taxonomy) ->
87
78
  last_rollback = null
88
79
 
@@ -90,6 +81,7 @@ root.setup_taxonomy_tree = (taxonomy_id) ->
90
81
  json_data:
91
82
  data: taxonomy,
92
83
  ajax:
84
+ headers: { "X-Spree-Token": Spree.api_key }
93
85
  url: (e) ->
94
86
  "#{base_url}/#{e.prop('id')}/jstree"
95
87
  themes:
@@ -126,11 +118,3 @@ root.setup_taxonomy_tree = (taxonomy_id) ->
126
118
  .bind("rename.jstree", handle_rename)
127
119
  .bind "loaded.jstree", ->
128
120
  $(this).jstree("core").toggle_node($('.jstree-icon').first())
129
-
130
- $("#taxonomy_tree a").on "dblclick", (e) ->
131
- $("#taxonomy_tree").jstree("rename", this)
132
-
133
- # surpress form submit on enter/return
134
- $(document).keypress (e) ->
135
- if e.keyCode == 13
136
- e.preventDefault()
@@ -7,7 +7,6 @@
7
7
  //= require modernizr
8
8
  //= require jquery.cookie
9
9
  //= require jquery.jstree/jquery.jstree
10
- //= require jquery.alerts/jquery.alerts
11
10
  //= require jquery.powertip
12
11
  //= require jquery.vAlign
13
12
  //= require equalize
@@ -3,8 +3,6 @@
3
3
  * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
4
  * the top of the compiled file, but it's generally better to create a new file per style scope.
5
5
 
6
- *= require jquery.alerts/jquery.alerts
7
- *= require jquery.alerts/jquery.alerts.spree
8
6
  *= require responsive-tables
9
7
  *= require normalize
10
8
  *= require skeleton
@@ -55,13 +55,6 @@ module Spree
55
55
  Spree::Backend::Config[:locale]
56
56
  end
57
57
 
58
- def can_not_transition_without_customer_info
59
- unless @order.billing_address.present?
60
- flash[:notice] = Spree.t(:fill_in_customer_info)
61
- redirect_to edit_admin_order_customer_url(@order)
62
- end
63
- end
64
-
65
58
  def lock_order
66
59
  OrderMutex.with_lock!(@order) { yield }
67
60
  rescue Spree::OrderMutex::LockFailed => e
@@ -64,7 +64,7 @@ module Spree
64
64
  end
65
65
 
66
66
  def edit
67
- can_not_transition_without_customer_info
67
+ require_ship_address
68
68
 
69
69
  unless @order.completed?
70
70
  @order.refresh_shipment_rates
@@ -197,6 +197,13 @@ module Spree
197
197
  flash[:error] = Spree.t(:insufficient_stock_for_order)
198
198
  redirect_to cart_admin_order_url(@order)
199
199
  end
200
+
201
+ def require_ship_address
202
+ if @order.ship_address.nil?
203
+ flash[:notice] = Spree.t(:fill_in_customer_info)
204
+ redirect_to edit_admin_order_customer_url(@order)
205
+ end
206
+ end
200
207
  end
201
208
  end
202
209
  end
@@ -5,7 +5,7 @@ module Spree
5
5
  before_filter :load_payment, :except => [:create, :new, :index, :fire]
6
6
  before_filter :load_payment_for_fire, :only => :fire
7
7
  before_filter :load_data
8
- before_filter :can_not_transition_without_customer_info
8
+ before_filter :require_bill_address, only: [:index]
9
9
 
10
10
  respond_to :html
11
11
 
@@ -102,6 +102,13 @@ module Spree
102
102
  def model_class
103
103
  Spree::Payment
104
104
  end
105
+
106
+ def require_bill_address
107
+ if Spree::Config[:order_bill_address_used] && @order.bill_address.nil?
108
+ flash[:notice] = Spree.t(:fill_in_customer_info)
109
+ redirect_to edit_admin_order_customer_url(@order)
110
+ end
111
+ end
105
112
  end
106
113
  end
107
114
  end
@@ -12,8 +12,16 @@ module Spree
12
12
  def admin_root_redirect_path
13
13
  if can?(:display, Spree::Order) && can?(:admin, Spree::Order)
14
14
  spree.admin_orders_path
15
- else
15
+ elsif can?(:admin, :dashboards) && can?(:home, :dashboards)
16
16
  spree.home_admin_dashboards_path
17
+ else
18
+ # Invoke the unauthorized redirect, which will ideally go to the login controller
19
+ # of the users chosen authorization implimentation. For devise this is /admin/login.
20
+ #
21
+ # This is done so devise redirects back to this controller, instead of the one specified
22
+ # below, so this controller can use the user that is required for the path to
23
+ # be calculated.
24
+ raise CanCan::AccessDenied
17
25
  end
18
26
  end
19
27
  end
@@ -7,12 +7,15 @@ module Spree
7
7
  { translation_key: :name, attr_name: :name }
8
8
  ]
9
9
 
10
- before_filter :load_stock_locations, only: [:index, :new]
10
+ before_filter :load_readable_stock_locations, only: :index
11
+ before_filter :load_transferable_stock_locations, only: :new
11
12
  before_filter :load_variant_display_attributes, only: [:receive, :edit, :show, :tracking_info]
12
13
  before_filter :load_destination_stock_locations, only: :edit
13
14
  before_filter :ensure_access_to_stock_location, only: :create
14
15
  before_filter :ensure_receivable_stock_transfer, only: :receive
15
16
 
17
+ create.before :authorize_transfer_attributes!
18
+
16
19
  def receive
17
20
  @received_items = @stock_transfer.transfer_items.received
18
21
  end
@@ -93,12 +96,30 @@ module Spree
93
96
 
94
97
  private
95
98
 
96
- def load_stock_locations
97
- @stock_locations = Spree::StockLocation.accessible_by(current_ability, :index)
99
+ def authorize_transfer_attributes!
100
+ duplicate = @object.dup
101
+ duplicate.assign_attributes(permitted_resource_params)
102
+ authorize! :create, duplicate
103
+ end
104
+
105
+ def accessible_stock_locations
106
+ Spree::StockLocation.accessible_by(current_ability, :index)
107
+ end
108
+
109
+ def transferable_stock_locations
110
+ accessible_stock_locations.accessible_by(current_ability, :transfer)
111
+ end
112
+
113
+ def load_readable_stock_locations
114
+ @stock_locations = accessible_stock_locations
115
+ end
116
+
117
+ def load_transferable_stock_locations
118
+ @stock_locations = transferable_stock_locations
98
119
  end
99
120
 
100
121
  def load_destination_stock_locations
101
- @destination_stock_locations = load_stock_locations.where.not(id: @stock_transfer.source_location_id)
122
+ @destination_stock_locations = transferable_stock_locations.where.not(id: @stock_transfer.source_location_id)
102
123
  end
103
124
 
104
125
  def load_variant_display_attributes
@@ -29,7 +29,10 @@ module Spree
29
29
  flash[:success] = Spree.t(:created_successfully)
30
30
  redirect_to edit_admin_user_url(@user)
31
31
  else
32
- redirect_to new_admin_user_url
32
+ load_roles
33
+ load_stock_locations
34
+
35
+ render :new, status: :unprocessable_entity
33
36
  end
34
37
  end
35
38
 
@@ -25,7 +25,7 @@
25
25
  <% @inventory_units.each do |inventory_unit| %>
26
26
  <tr class="inventory-unit">
27
27
  <td class="inventory-unit-image">
28
- <%= mini_image(inventory_unit.variant) %>
28
+ <%= image_tag inventory_unit.variant.display_image.attachment(:mini) %>
29
29
  </td>
30
30
  <td class="inventory-unit-name">
31
31
  <%= inventory_unit.variant.product.name %><br><%= "(" + variant_options(inventory_unit.variant) + ")" unless inventory_unit.variant.option_values.empty? %>
@@ -1,7 +1,7 @@
1
1
  <% carton.manifest_for_order(order).each do |item| %>
2
2
  <tr class="stock-item" data-item-quantity="<%= item.quantity %>">
3
3
  <td class="item-image">
4
- <%= mini_image(item.variant) %>
4
+ <%= image_tag item.variant.display_image.attachment(:mini) %>
5
5
  </td>
6
6
  <td class="item-name">
7
7
  <%= item.variant.product.name %><br><%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %>
@@ -18,7 +18,7 @@
18
18
  <tbody>
19
19
  <% order.line_items.each do |item| %>
20
20
  <%= content_tag :tr, class: 'line-item', id: "line-item-#{item.id}", data: { line_item_id: item.id } do %>
21
- <td class="line-item-image"><%= mini_image(item.variant) %></td>
21
+ <td class="line-item-image"><%= image_tag item.variant.display_image.attachment(:mini) %></td>
22
22
  <td class="line-item-name">
23
23
  <%= item.variant.product.name %><br><%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %>
24
24
  <% if item.variant.sku.present? %>
@@ -1,7 +1,7 @@
1
1
  <% shipment_manifest.each do |item| %>
2
2
  <tr class="stock-item" data-item-quantity="<%= item.quantity %>">
3
3
  <td class="item-image">
4
- <%= mini_image(item.variant) %>
4
+ <%= image_tag item.variant.display_image.attachment(:mini) %>
5
5
  </td>
6
6
  <td class="item-name">
7
7
  <%= item.variant.product.name %><br><%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %>
@@ -2,7 +2,7 @@
2
2
  <% if can?(:fire, @order) %>
3
3
  <li><%= event_links %></li>
4
4
  <% end %>
5
- <% if can?(:resend, @order) %>
5
+ <% if can?(:resend, @order) && @order.completed? %>
6
6
  <li><%= button_link_to Spree.t(:resend), resend_admin_order_url(@order), :method => :post, :icon => 'email' %></li>
7
7
  <% end %>
8
8
  <% if can?(:admin, Spree::Order) %>
@@ -1,7 +1,7 @@
1
1
  <% shipment.manifest.each do |item| %>
2
2
  <tr class="stock-item" data-item-quantity="<%= item.quantity %>">
3
3
  <td class="item-image">
4
- <%= mini_image(item.variant) %>
4
+ <%= image_tag item.variant.display_image.attachment(:mini) %>
5
5
  </td>
6
6
  <td class="item-name">
7
7
  <%= item.variant.product.name %><br><%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %>
@@ -36,31 +36,35 @@
36
36
  </div>
37
37
  </fieldset>
38
38
 
39
- <div data-hook="bill_address_wrapper" class="alpha six columns">
40
- <fieldset class="no-border-bottom">
41
- <legend align="center"><%= Spree.t(:billing_address) %></legend>
42
- <%= f.fields_for :bill_address do |ba_form| %>
43
- <%= render :partial => 'spree/admin/shared/address_form', :locals => { :f => ba_form, :type => "billing" } %>
44
- <% end %>
45
- </fieldset>
46
- </div>
47
-
48
- <div class="omega six columns" data-hook="ship_address_wrapper">
39
+ <div class="alpha six columns" data-hook="ship_address_wrapper">
49
40
  <fieldset class="no-border-bottom">
50
41
  <legend align="center"><%= Spree.t(:shipping_address) %></legend>
51
42
  <%= f.fields_for :ship_address do |sa_form| %>
52
- <div class="field" style="position: absolute;margin-top: -15px;right: 0;">
53
- <span data-hook="use_billing">
54
- <%= check_box_tag 'order[use_billing]', '1', ((@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address.same_as?(@order.ship_address)) %>
55
- <%= label_tag 'order[use_billing]', Spree.t(:use_billing_address) %>
56
- </span>
57
- </div>
43
+ <% if Spree::Config[:order_bill_address_used] %>
44
+ <div class="field" style="position: absolute;margin-top: -15px;left: 0;">
45
+ <span data-hook="use_billing">
46
+ <%= check_box_tag 'order[use_billing]', '1', ((@order.bill_address.empty? && @order.ship_address.empty?) && @order.bill_address.same_as?(@order.ship_address)) %>
47
+ <%= label_tag 'order[use_billing]', Spree.t(:use_billing_address) %>
48
+ </span>
49
+ </div>
50
+ <% end %>
58
51
 
59
52
  <%= render :partial => 'spree/admin/shared/address_form', :locals => { :f => sa_form, :type => 'shipping' } %>
60
53
  <% end %>
61
54
  </fieldset>
62
55
  </div>
63
56
 
57
+ <% if Spree::Config[:order_bill_address_used] %>
58
+ <div class="omega six columns" data-hook="bill_address_wrapper">
59
+ <fieldset class="no-border-bottom">
60
+ <legend align="center"><%= Spree.t(:billing_address) %></legend>
61
+ <%= f.fields_for :bill_address do |ba_form| %>
62
+ <%= render :partial => 'spree/admin/shared/address_form', :locals => { :f => ba_form, :type => "billing" } %>
63
+ <% end %>
64
+ </fieldset>
65
+ </div>
66
+ <% end %>
67
+
64
68
  <div class="clear"></div>
65
69
 
66
70
  <div class="form-buttons filter-actions actions" data-hook="buttons">
@@ -2,7 +2,7 @@
2
2
  <% if can?(:fire, @order) %>
3
3
  <li><%= event_links %></li>
4
4
  <% end %>
5
- <% if can?(:resend, @order) %>
5
+ <% if can?(:resend, @order) && @order.completed? %>
6
6
  <li><%= button_link_to Spree.t(:resend), resend_admin_order_url(@order), method: :post, icon: 'email' %></li>
7
7
  <% end %>
8
8
  <% if can?(:admin, Spree::Order) %>
@@ -3,17 +3,26 @@
3
3
  <div data-hook="payment_method">
4
4
 
5
5
  <div class="alpha four columns">
6
- <div id="preference-settings" data-hook class="field">
7
- <%= f.label :type, Spree.t(:provider) %>
8
- <%= collection_select(:payment_method, :type, @providers, :to_s, :name, {}, {:id => 'gtwy-type', :class => 'select2 fullwidth'}) %>
6
+ <div id="preference-settings">
7
+ <div class="field">
8
+ <%= f.label :type, Spree.t(:provider) %>
9
+ <%= collection_select(:payment_method, :type, @providers, :to_s, :name, {}, {:id => 'gtwy-type', :class => 'select2 fullwidth js-gateway-type'}) %>
10
+ </div>
9
11
 
10
- <% unless @object.new_record? %>
11
- <%= preference_fields(@object, f) %>
12
+ <div class="field js-preference-source-wrapper">
13
+ <%= label_tag :preference_source, 'Preference Source' %>
14
+ <%= f.select(:preference_source, [[Spree.t(:preference_source_none), nil]] + @object.class.available_preference_sources, {}, class: 'select2 fullwidth js-preference-source') %>
15
+ </div>
12
16
 
13
- <% if @object.respond_to?(:preferences) %>
14
- <div id="gateway-settings-warning" class="info warning"><%= Spree.t(:provider_settings_warning) %></div>
17
+ <div class="gateway-settings js-gateway-settings">
18
+ <% if @object.preference_source.present? %>
19
+ <%= Spree.t :preference_source_using, name: @object.preference_source %>
20
+ <% elsif !@object.new_record? %>
21
+ <%= preference_fields(@object, f) %>
15
22
  <% end %>
16
- <% end %>
23
+ </div>
24
+
25
+ <div class="info warning js-gateway-settings-warning"><%= Spree.t(:provider_settings_warning) %></div>
17
26
  </div>
18
27
  <div data-hook="environment" class="field">
19
28
  <%= label_tag :payment_method_environment, Spree.t(:environment) %>
@@ -52,5 +52,13 @@
52
52
  </div>
53
53
 
54
54
  <div class="clear"></div>
55
+
56
+ <%= label_tag "card_address#{payment_method.id}", Spree.t(:billing_address) %>
57
+ <% address = @order.bill_address || @order.ship_address || Spree::Address.build_default %>
58
+ <%= fields_for "#{param_prefix}[address_attributes]", address do |f| %>
59
+ <%= render :partial => 'spree/admin/shared/address_form', :locals => { :f => f, :type => "billing" } %>
60
+ <% end %>
61
+
62
+ <div class="clear"></div>
55
63
  </div>
56
64
  </fieldset>
@@ -0,0 +1,21 @@
1
+ <fieldset data-hook="store-credit">
2
+ <legend align="center"><%= Spree.t(:store_credit, scope: :store_credit) %></legend>
3
+
4
+ <div class="row">
5
+ <div class="alpha six columns">
6
+ <dl>
7
+ <dt><%= Spree.t(:category) %>:</dt>
8
+ <dd><%= payment.source.category.name%></dd>
9
+
10
+ <dt><%= Spree.t(:memo) %>:</dt>
11
+ <dd><%= payment.source.memo %></dd>
12
+
13
+ <dt><%= Spree.t(:created_by) %>:</dt>
14
+ <dd><%= payment.source.created_by.email %></dd>
15
+
16
+ <dt><%= Spree.t(:issued_on, scope: [:admin, :store_credits]) %>:</dt>
17
+ <dd><%= l payment.source.created_at.to_date %></dd>
18
+ </dl>
19
+ </div>
20
+ </div>
21
+ </fieldset>
@@ -78,7 +78,7 @@
78
78
  <% @collection.each do |product| %>
79
79
  <tr <%== "style='color: red;'" if product.deleted? %> id="<%= spree_dom_id product %>" data-hook="admin_products_index_rows" class="<%= cycle('odd', 'even') %>">
80
80
  <td class="align-center"><%= product.sku rescue '' %></td>
81
- <td class="align-center"><%= mini_image(product) %></td>
81
+ <td class="align-center"><%= image_tag product.display_image.attachment(:mini) %></td>
82
82
  <td><%= link_to product.try(:name), edit_admin_product_path(product) %></td>
83
83
  <td class="align-center"><%= product.display_price.to_html rescue '' %></td>
84
84
  <td class="actions" data-hook="admin_products_index_row_actions">
@@ -3,9 +3,11 @@
3
3
  <% end %>
4
4
 
5
5
  <% content_for :page_actions do %>
6
- <li>
7
- <%= button_link_to Spree.t(:new_promotion_category), spree.new_admin_promotion_category_path, :icon => 'plus' %>
8
- </li>
6
+ <% if can?(:create, Spree::PromotionCategory) %>
7
+ <li>
8
+ <%= button_link_to Spree.t(:new_promotion_category), spree.new_admin_promotion_category_path, :icon => 'plus' %>
9
+ </li>
10
+ <% end %>
9
11
  <% end %>
10
12
 
11
13
  <%= render 'spree/admin/shared/promotion_sub_menu' %>
@@ -27,8 +29,12 @@
27
29
  <td><%= promotion_category.name %></td>
28
30
  <td><%= promotion_category.code%></td>
29
31
  <td class="actions">
30
- <%= link_to_edit promotion_category, :no_text => true %>
31
- <%= link_to_delete promotion_category, :no_text => true %>
32
+ <% if can?(:update, promotion_category) %>
33
+ <%= link_to_edit promotion_category, :no_text => true %>
34
+ <% end %>
35
+ <% if can?(:destroy, promotion_category) %>
36
+ <%= link_to_delete promotion_category, :no_text => true %>
37
+ <% end %>
32
38
  </td>
33
39
  </tr>
34
40
  <% end %>
@@ -93,8 +93,12 @@
93
93
  <td class="align-center"><%= Spree.t(:current_promotion_usage, :count => promotion.usage_count) %></td>
94
94
  <td class="align-center"><%= promotion.expires_at.to_date.to_s(:short_date) if promotion.expires_at %></td>
95
95
  <td class="actions">
96
- <%= link_to_edit promotion, :no_text => true %>
97
- <%= link_to_delete promotion, :no_text => true %>
96
+ <% if can?(:update, promotion) %>
97
+ <%= link_to_edit promotion, :no_text => true %>
98
+ <% end %>
99
+ <% if can?(:destroy, promotion) %>
100
+ <%= link_to_delete promotion, :no_text => true %>
101
+ <% end %>
98
102
  </td>
99
103
  </tr>
100
104
  <% end %>
@@ -0,0 +1,7 @@
1
+ <div class="field alpha four columns">
2
+ <%= Spree.t(:form_text, scope: "promotion_rule_types.nth_order") %>
3
+ </div>
4
+
5
+ <div class="field omega four columns">
6
+ <%= number_field_tag "#{param_prefix}[preferred_nth_order]", promotion_rule.preferred_nth_order, :class => 'fullwidth' %>
7
+ </div>
@@ -21,7 +21,6 @@
21
21
  <%= render "spree/admin/shared/translations" %>
22
22
 
23
23
  <%= javascript_tag do -%>
24
- jQuery.alerts.dialogClass = 'spree';
25
24
  var AUTH_TOKEN = "<%= form_authenticity_token %>";
26
25
  Spree.api_key = "<%= try_spree_current_user.try(:spree_api_key) %>";
27
26
  Spree.env = "<%= Rails.env %>";
@@ -1,3 +1,5 @@
1
- <%= link_to_with_icon 'edit', Spree.t('actions.edit'), '#', no_text: true, data: { action: 'edit', id: resource.id } if can?(:edit, resource) %>
2
- <%= link_to_with_icon 'check', Spree.t('actions.update'), '#', no_text: true, data: update_data.merge(action: 'green', id: resource.id) if can?(:edit, resource) %>
3
- <%= link_to_with_icon 'void', Spree.t('actions.cancel'), '#', no_text: true, data: { action: 'red', id: resource.id } if can?(:edit, resource) %>
1
+ <% if can?(:update, resource) %>
2
+ <%= link_to_with_icon 'edit', Spree.t('actions.edit'), '#', no_text: true, data: { action: 'edit', id: resource.id } %>
3
+ <%= link_to_with_icon 'check', Spree.t('actions.update'), '#', no_text: true, data: update_data.merge(action: 'green', id: resource.id) %>
4
+ <%= link_to_with_icon 'void', Spree.t('actions.cancel'), '#', no_text: true, data: { action: 'red', id: resource.id } %>
5
+ <% end %>
@@ -32,7 +32,7 @@
32
32
  <td class="align-center no-padding" rowspan="<%= row_count %>">
33
33
  <div class='variant-container'>
34
34
  <div class='variant-image'>
35
- <%= image_tag(variant.display_image.attachment(:small)) %>
35
+ <%= image_tag(variant.display_image(fallback: false).attachment(:small)) %>
36
36
  </div>
37
37
  <div class='variant-details'>
38
38
  <table class='stock-variant-field-table'>