spree_backend 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/admin/admin.js.erb +13 -20
  3. data/app/assets/javascripts/admin/payments/edit.js.coffee +148 -0
  4. data/app/assets/javascripts/admin/progress.coffee +4 -4
  5. data/app/assets/javascripts/admin/stock_movement.js.coffee +17 -0
  6. data/app/assets/javascripts/admin/stock_transfer.js.coffee +3 -5
  7. data/app/assets/javascripts/admin/variant_autocomplete.js.erb +7 -6
  8. data/app/assets/stylesheets/admin/components/_navigation.scss +8 -2
  9. data/app/assets/stylesheets/admin/plugins/_select2.scss +6 -1
  10. data/app/assets/stylesheets/admin/shared/_forms.scss +1 -0
  11. data/app/assets/stylesheets/admin/shared/_layout.scss +1 -0
  12. data/app/assets/stylesheets/admin/shared/_tables.scss +1 -1
  13. data/app/controllers/spree/admin/base_controller.rb +1 -1
  14. data/app/controllers/spree/admin/orders_controller.rb +1 -1
  15. data/app/helpers/spree/admin/base_helper.rb +1 -1
  16. data/app/helpers/spree/admin/stock_movements_helper.rb +7 -0
  17. data/app/views/spree/admin/orders/_add_product.html.erb +1 -0
  18. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
  19. data/app/views/spree/admin/payments/_list.html.erb +2 -2
  20. data/app/views/spree/admin/payments/source_views/_gateway.html.erb +5 -15
  21. data/app/views/spree/admin/products/new.html.erb +1 -1
  22. data/app/views/spree/admin/promotion_rules/create.js.erb +1 -0
  23. data/app/views/spree/admin/prototypes/show.html.erb +1 -1
  24. data/app/views/spree/admin/shared/_routes.html.erb +2 -1
  25. data/app/views/spree/admin/shared/_translations.html.erb +6 -3
  26. data/app/views/spree/admin/stock_movements/_form.html.erb +5 -4
  27. data/app/views/spree/admin/stock_movements/index.html.erb +3 -1
  28. data/app/views/spree/admin/taxons/edit.html.erb +1 -1
  29. data/app/views/spree/admin/variants/_autocomplete.js.erb +6 -51
  30. data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +41 -0
  31. data/app/views/spree/layouts/admin.html.erb +1 -1
  32. metadata +9 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d5d1d087b80b4d4ccb804eb2282ee51a8abdb20
4
- data.tar.gz: 821bef1778e272492e163c1e983fcddbd9fec6fe
3
+ metadata.gz: 1f934ea7b74849f1c8eeef773b4de7db93103009
4
+ data.tar.gz: 47e055d89c1c186254ddb60eaecbed7b422c0cbc
5
5
  SHA512:
6
- metadata.gz: a2a653988067c0e6dc42a69ebfe7f95074f93caa8217a32fc0684c2dc79406d546961743b17e6fa1365325d5d79b3a322f498d951e18b3e15e2c839a2cefc11b
7
- data.tar.gz: 72f6eec30e2ab2bcd16718c65fc91d71d0e820e7e9120e3a9a26c46983e584746b238e7a239b0f0316459c4e5daadcdf2a366944107863bd70c1ba7e4757865b
6
+ metadata.gz: 9aec6aad45c261c02bb7d2024fbc33cf824d0fc1024bfa63fe4a1d6f7e4b4a8d85bafdab323e35302f40620a6704907016dad6f6ecdcb447d758da906840dba0
7
+ data.tar.gz: dd42ef7b330a7bee18080f7839d88a70b311eabcc6d17465671772fc9636cb74e3abf89758a1d14641a55072b8dc27eed14123b9f791238082880e3a0f0c771f
@@ -31,18 +31,16 @@ jQuery(function($) {
31
31
  smartPlacement: true,
32
32
  fadeInTime: 50,
33
33
  fadeOutTime: 50,
34
- intentPollInterval: 300
35
34
  });
36
35
 
37
- $('.with-tip').on({
38
- powerTipPreRender: function(){
39
- $('#powerTip').addClass($(this).attr("data-action"));
40
- $('#powerTip').addClass($(this).attr("data-tip-color"));
41
- },
42
- powerTipClose: function(){
43
- $('#powerTip').removeClass($(this).attr("data-action"))
44
- }
45
- });
36
+ $('body')
37
+ .on('powerTipPreRender', '.with-tip', function() {
38
+ $('#powerTip').addClass($(this).data('action'));
39
+ $('#powerTip').addClass($(this).data('tip-color'));
40
+ })
41
+ .on('powerTipClose', '.with-tip', function() {
42
+ $('#powerTip').removeClass($(this).data('action'));
43
+ })
46
44
 
47
45
  // Make flash messages dissapear
48
46
  setTimeout('$(".flash").fadeOut()', 5000);
@@ -81,17 +79,12 @@ jQuery(function($) {
81
79
  $.fn.visible = function(cond) { this[cond ? 'show' : 'hide' ]() };
82
80
 
83
81
  show_flash_error = function(message) {
84
- error_div = $('.flash.error');
85
- if (error_div.length > 0) {
86
- error_div.html(message);
87
- error_div.show();
88
- } else {
89
- if ($("#content .toolbar").length > 0) {
90
- $("#content .toolbar").before('<div class="flash error">' + message + '</div>');
91
- } else {
92
- $("#content h1").before('<div class="flash error">' + message + '</div>');
93
- }
82
+ var error_div = $('.flash.error');
83
+ if (error_div.length == 0) {
84
+ error_div = $('<div class="flash error" />');
85
+ $('#wrapper').prepend(error_div);
94
86
  }
87
+ error_div.html(message).show().fadeOut(5000);
95
88
  }
96
89
 
97
90
  // Apply to individual radio button that makes another element visible when checked
@@ -0,0 +1,148 @@
1
+ jQuery ($) ->
2
+ # Payment model
3
+ class Payment
4
+ constructor: (id) ->
5
+ @url = Spree.url("#{Spree.routes.payments_api}/#{id}.json")
6
+ @json = $.getJSON @url.toString(), (data) =>
7
+ @data = data
8
+
9
+ if_pending: (callback) ->
10
+ @json.done (data) ->
11
+ callback() if data.state is 'pending'
12
+
13
+ update: (attributes, success) ->
14
+ jqXHR = $.ajax
15
+ type: 'PUT'
16
+ url: @url.toString()
17
+ data: { payment: attributes }
18
+ jqXHR.done (data) =>
19
+ @data = data
20
+ jqXHR.fail ->
21
+ response = $.parseJSON(jqXHR.responseText)
22
+ show_flash_error(response.error)
23
+
24
+ amount: -> @data.amount
25
+ display_amount: -> @data.display_amount
26
+
27
+ # Payment base view
28
+ class PaymentView
29
+ constructor: (@$el, @payment) ->
30
+ @render()
31
+
32
+ render: ->
33
+ @add_action_button()
34
+
35
+ show: ->
36
+ @remove_buttons()
37
+ new ShowPaymentView(@$el, @payment)
38
+
39
+ edit: ->
40
+ @remove_buttons()
41
+ new EditPaymentView(@$el, @payment)
42
+
43
+ add_action_button: ->
44
+ @$actions().prepend @$new_button(@action)
45
+
46
+ remove_buttons: ->
47
+ @$buttons().remove()
48
+
49
+ $new_button: (action) ->
50
+ $('<a />')
51
+ .attr
52
+ class: "icon-#{action} icon_link no-text with-tip"
53
+ title: Spree.translations[action]
54
+ .data
55
+ action: action
56
+ .one
57
+ click: (event) ->
58
+ event.preventDefault()
59
+ mousedown: ->
60
+ $(@).data('clicked', true)
61
+ mouseup: =>
62
+ @[action]()
63
+ .powerTip
64
+ smartPlacement: true
65
+ fadeInTime: 50
66
+ fadeOutTime: 50
67
+
68
+ $buttons: ->
69
+ @$actions().find(".icon-#{@action}, .icon-cancel")
70
+
71
+ $actions: ->
72
+ @$el.find('.actions')
73
+
74
+ $amount: ->
75
+ @$el.find('td.amount')
76
+
77
+ # Payment show view
78
+ class ShowPaymentView extends PaymentView
79
+ action: 'edit'
80
+
81
+ render: ->
82
+ super
83
+ @set_actions_display()
84
+ @show_actions()
85
+ @show_amount()
86
+
87
+ set_actions_display: ->
88
+ width = @$actions().width()
89
+ @$actions().width(width).css('text-align', 'left')
90
+
91
+ show_actions: ->
92
+ @$actions().find('a').show()
93
+
94
+ show_amount: ->
95
+ amount = $('<span />')
96
+ .html(@payment.display_amount())
97
+ .one('click', => @edit().$input().focus())
98
+ @$amount().html(amount)
99
+
100
+ # Payment edit view
101
+ class EditPaymentView extends PaymentView
102
+ action: 'save'
103
+
104
+ render: ->
105
+ super
106
+ @hide_actions()
107
+ @edit_amount()
108
+ @add_cancel_button()
109
+
110
+ add_cancel_button: ->
111
+ @$actions().append @$new_button('cancel')
112
+
113
+ hide_actions: ->
114
+ @$actions().find('a').not(@$buttons()).hide()
115
+
116
+ edit_amount: ->
117
+ amount = @$amount()
118
+ amount.html(@$new_input(amount.find('span').width()))
119
+
120
+ save: (event) ->
121
+ @payment.update(amount: @$input().val())
122
+ .done(=> @show())
123
+
124
+ cancel: @::show
125
+
126
+ $new_input: (width) ->
127
+ amount = @constructor.normalize_amount(@payment.display_amount())
128
+ $('<input />')
129
+ .attr(id: 'amount', value: amount)
130
+ .width(width)
131
+ .one
132
+ blur: =>
133
+ clicked = (@$buttons().filter -> $(@).data('clicked')).length
134
+ @save() unless clicked
135
+ .css('text-align': 'right')
136
+
137
+ $input: ->
138
+ @$amount().find('input')
139
+
140
+ @normalize_amount: (amount) ->
141
+ separator = Spree.translations.currency_separator
142
+ amount.replace(///[^\d#{separator}]///g, '')
143
+
144
+ # Attach ShowPaymentView to each pending payment in the table
145
+ $('.admin tr[data-hook=payments_row]').each ->
146
+ $el = $(@)
147
+ payment = new Payment($el.attr('id').match(/\d+$/))
148
+ payment.if_pending -> new ShowPaymentView($el, payment)
@@ -16,12 +16,12 @@ $(document).ready ->
16
16
  top: 'auto'
17
17
  left: 'auto'
18
18
 
19
- target = document.getElementById("spinner")
19
+ target = document.getElementById("spinner")
20
20
 
21
21
  $(document).ajaxStart ->
22
- $("#progress").fadeIn()
23
- spinner = new Spinner(opts).spin(target)
22
+ $("#progress").stop(true, true).fadeIn()
23
+ spinner = new Spinner(opts).spin(target)
24
24
 
25
25
  $(document).ajaxStop ->
26
- $("#progress").fadeOut()
26
+ $("#progress").fadeOut()
27
27
 
@@ -0,0 +1,17 @@
1
+ jQuery ->
2
+ $('#stock_movement_stock_item_id').select2
3
+ placeholder: "Find a stock item" # translate
4
+ ajax:
5
+ url: Spree.url(Spree.routes.stock_items_api)
6
+ data: (term, page) ->
7
+ q:
8
+ variant_product_name_cont: term
9
+ per_page: 50
10
+ page: page
11
+ results: (data, page) ->
12
+ more = (page * 50) < data.count
13
+ return { results: data.stock_items, more: more }
14
+ formatResult: (stock_item) ->
15
+ variantTemplate({ variant: stock_item.variant })
16
+ formatSelection: (stock_item) ->
17
+ "#{stock_item.variant.name} (#{stock_item.variant.options_text})"
@@ -30,7 +30,7 @@ $ ->
30
30
 
31
31
  $('#transfer_receive_stock').change (event) => @receive_stock_change(event)
32
32
 
33
- $.getJSON Spree.routes.stock_locations_api, (data) =>
33
+ $.getJSON Spree.url(Spree.routes.stock_locations_api), (data) =>
34
34
  @locations = (location for location in data.stock_locations)
35
35
  @force_receive_stock() if @locations.length < 2
36
36
 
@@ -92,13 +92,13 @@ $ ->
92
92
  if @cached_variants?
93
93
  @populate_select @cached_variants
94
94
  else
95
- $.getJSON Spree.routes.variants_api, (data) =>
95
+ $.getJSON Spree.url(Spree.routes.variants_api), (data) =>
96
96
  @cached_variants = _.map(data.variants, (variant) -> new TransferVariant(variant))
97
97
  @populate_select @cached_variants
98
98
 
99
99
  _refresh_transfer_stock_items: ->
100
100
  stock_location_id = $('#transfer_source_location_id').val()
101
- $.getJSON Spree.routes.stock_locations_api + "/#{stock_location_id}/stock_items", (data) =>
101
+ $.getJSON Spree.url(Spree.routes.stock_locations_api + "/#{stock_location_id}/stock_items"), (data) =>
102
102
  @populate_select _.map(data.stock_items, (stock_item) -> new TransferStockItem(stock_item))
103
103
 
104
104
  populate_select: (variants) ->
@@ -177,5 +177,3 @@ $ ->
177
177
  transfer_locations = new TransferLocations
178
178
  transfer_variants = new TransferVariants
179
179
  transfer_add_variants = new TransferAddVariants
180
-
181
-
@@ -54,14 +54,15 @@ $(document).ready(function() {
54
54
 
55
55
  //handle delete click
56
56
  $('a.delete-item').click(function(){
57
- var del = $(this);
58
- var shipment_number = del.data('shipment-number');
59
- var variant_id = del.data('variant-id');
57
+ if (confirm(Spree.translations.are_you_sure_delete)) {
58
+ var del = $(this);
59
+ var shipment_number = del.data('shipment-number');
60
+ var variant_id = del.data('variant-id');
60
61
 
61
- toggleItemEdit();
62
-
63
- adjustItems(shipment_number, variant_id, 0);
62
+ toggleItemEdit();
64
63
 
64
+ adjustItems(shipment_number, variant_id, 0);
65
+ }
65
66
  });
66
67
  }
67
68
  });
@@ -63,12 +63,18 @@ nav.menu {
63
63
  #admin-menu {
64
64
  background-color: $color-3;
65
65
 
66
+ ul{
67
+ display: table;
68
+ table-layout: fixed;
69
+ width: 100%;
70
+ }
71
+
66
72
  li {
67
- min-width: 90px;
73
+ display: table-cell;
68
74
 
69
75
  a {
70
76
  display: block;
71
- padding: 25px 20px;
77
+ padding: 25px 15px;
72
78
  color: $color-1 !important;
73
79
  text-transform: uppercase;
74
80
  position: relative;
@@ -105,6 +105,11 @@
105
105
  li {
106
106
  font-size: 85% !important;
107
107
 
108
+
109
+ &:nth-child(odd) {
110
+ background: #efefef;
111
+ }
112
+
108
113
  &.select2-highlighted {
109
114
  .select2-result-label {
110
115
  &, h6 {
@@ -131,7 +136,7 @@
131
136
  }
132
137
 
133
138
  .select2-highlighted {
134
- background-color: $color-sel-bg;
139
+ background-color: $color-sel-bg !important;
135
140
  }
136
141
  }
137
142
 
@@ -62,6 +62,7 @@ button, .button {
62
62
  color: $color-btn-text;
63
63
  text-transform: uppercase;
64
64
  font-weight: 600 !important;
65
+ white-space: nowrap;
65
66
 
66
67
  &:before {
67
68
  font-weight: normal !important;
@@ -75,6 +75,7 @@
75
75
  }
76
76
  .page-actions {
77
77
  text-align: right;
78
+ line-height: 38px;
78
79
  form {
79
80
  display: inline-block;
80
81
  }
@@ -84,7 +84,7 @@ table {
84
84
  background-color: $color-notice;
85
85
  color: $color-1;
86
86
  }
87
- .icon-edit:hover, .icon-capture:hover, .icon-ok:hover, .icon-plus:hover {
87
+ .icon-edit:hover, .icon-capture:hover, .icon-ok:hover, .icon-plus:hover, .icon-save:hover {
88
88
  background-color: $color-success;
89
89
  color: $color-1;
90
90
  }
@@ -19,7 +19,7 @@ module Spree
19
19
  if respond_to?(:model_class, true) && model_class
20
20
  record = model_class
21
21
  else
22
- record = Object
22
+ record = controller_name.to_sym
23
23
  end
24
24
  authorize! :admin, record
25
25
  authorize! action, record
@@ -83,7 +83,7 @@ module Spree
83
83
  # TODO - possible security check here but right now any admin can before any transition (and the state machine
84
84
  # itself will make sure transitions are not applied in the wrong state)
85
85
  event = params[:e]
86
- if @order.send("#{event}")
86
+ if @order.state_events.include?(event.to_sym) && @order.send("#{event}")
87
87
  flash[:success] = Spree.t(:order_updated)
88
88
  else
89
89
  flash[:error] = Spree.t(:cannot_perform_operation)
@@ -24,7 +24,7 @@ module Spree
24
24
 
25
25
  def datepicker_field_value(date)
26
26
  unless date.blank?
27
- l(date, :format => Spree.t('date_picker.format'))
27
+ l(date, :format => Spree.t('date_picker.format', default: '%Y/%m/%d'))
28
28
  else
29
29
  nil
30
30
  end
@@ -8,6 +8,13 @@ module Spree
8
8
  ""
9
9
  end
10
10
  end
11
+
12
+ def display_variant(stock_movement)
13
+ variant = stock_movement.stock_item.variant
14
+ output = variant.name
15
+ output += "<br>(#{variant.options_text})" unless variant.options_text.blank?
16
+ output.html_safe
17
+ end
11
18
  end
12
19
  end
13
20
  end
@@ -1,4 +1,5 @@
1
1
  <%= render :partial => "spree/admin/variants/autocomplete", :formats => :js %>
2
+ <%= render :partial => "spree/admin/variants/autocomplete_stock", :formats => :js %>
2
3
 
3
4
  <div id="add-line-item" data-hook>
4
5
  <fieldset class="no-border-bottom">
@@ -25,7 +25,7 @@
25
25
  <%= link_to '', '#', :class => 'cancel-item icon_link icon-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :style => 'display: none' %>
26
26
  <%= link_to '', '#', :class => 'edit-item icon_link icon-edit no-text with-tip', :data => {:action => 'edit'}, :title => Spree.t('edit') %>
27
27
  <%= link_to '', '#', :class => 'split-item icon_link icon-resize-horizontal no-text with-tip', :data => {:action => 'split', 'variant-id' => item.variant.id}, :title => Spree.t('split') %>
28
- <%= link_to '', '#', :class => 'delete-item icon-trash no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'remove', :confirm => Spree.t(:are_you_sure)}, :title => Spree.t('delete') %>
28
+ <%= link_to '', '#', :class => 'delete-item icon-trash no-text with-tip', :data => {'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'remove' }, :title => Spree.t('delete') %>
29
29
  <% end %>
30
30
  </td>
31
31
  <% end %>
@@ -10,9 +10,9 @@
10
10
  </thead>
11
11
  <tbody>
12
12
  <% payments.each do |payment| %>
13
- <tr data-hook="payments_row" class="<%= cycle('odd', 'even')%>">
13
+ <tr id="<%= dom_id(payment) %>" data-hook="payments_row" class="<%= cycle('odd', 'even')%>">
14
14
  <td><%= pretty_time(payment.created_at) %></td>
15
- <td class='align-center'><%= payment.display_amount.to_html %></td>
15
+ <td class="align-center amount"><%= payment.display_amount.to_html %></td>
16
16
  <td class="align-center"><%= link_to payment_method_name(payment), spree.admin_order_payment_path(@order, 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">
@@ -2,28 +2,18 @@
2
2
  <legend align="center"><%= Spree.t(:credit_card) %></legend>
3
3
 
4
4
  <div class="row">
5
- <div class="alpha six columns">
5
+ <div class="alpha six columns">
6
6
  <dl>
7
+ <dt><%= Spree.t(:card_type) %>:</dt>
8
+ <dd><%= payment.source.cc_type %></dd>
9
+
7
10
  <dt><%= Spree.t(:card_number) %>:</dt>
8
11
  <dd><%= payment.source.display_number %></dd>
9
12
 
10
13
  <dt><%= Spree.t(:expiration) %>:</dt>
11
14
  <dd><%= payment.source.month %>/<%= payment.source.year %></dd>
12
-
13
- <dt><%= Spree.t(:card_code) %>:</dt>
14
- <dd><%= payment.source.verification_value %></dd>
15
15
  </dl>
16
16
  </div>
17
-
18
- <div class="omega six columns">
19
- <dl>
20
- <dt><%= Spree.t(:maestro_or_solo_cards) %>:</dt>
21
- <dd><%= payment.source.issue_number %></dd>
22
-
23
- <dt><%= Spree.t(:start_date) %>:</dt>
24
- <dd><%= payment.source.start_month %>/<%= payment.source.start_year %></dd>
25
- </dl>
26
- </div>
27
17
  </div>
28
18
 
29
- </fieldset>
19
+ </fieldset>
@@ -34,7 +34,7 @@
34
34
  <div class="four columns">
35
35
  <%= f.field_container :price do %>
36
36
  <%= f.label :price, Spree.t(:master_price) %> <span class="required">*</span><br />
37
- <%= f.text_field :price, :class => 'fullwidth' %>
37
+ <%= f.text_field :price, :value => number_to_currency(@product.price, :unit => ''), :class => 'fullwidth' %>
38
38
  <%= f.error_message_on :price %>
39
39
  <% end %>
40
40
  </div>
@@ -5,3 +5,4 @@ $('.product_picker').productAutocomplete();
5
5
  $('.user_picker').userAutocomplete();
6
6
 
7
7
  $('#promotion_rule_type').html('<%= escape_javascript options_for_promotion_rule_types(@promotion) %>');
8
+ $('#promotion_rule_type').select2();
@@ -1,5 +1,5 @@
1
1
  <% if @prototype.option_types.present? %>
2
- <h2>Variants</h2>
2
+ <h2><%= Spree.t(:variants) %></h2>
3
3
 
4
4
  <ul class="product-prototype-options">
5
5
  <% @prototype.option_types.each do |ot| %>
@@ -9,5 +9,6 @@
9
9
  Spree.routes.checkouts_api = "<%= spree.api_checkouts_url(:format => 'json') %>";
10
10
  Spree.routes.stock_locations_api = "<%= spree.api_stock_locations_url(:format => 'json') %>";
11
11
  Spree.routes.variants_api = "<%= spree.api_variants_url(:format => 'json') %>";
12
-
12
+ Spree.routes.payments_api = "<%= spree.api_order_payments_url(:format => 'json') if params[:order_id] %>";
13
+ Spree.routes.stock_items_api = "<%= spree.api_stock_location_stock_items_url(:format => 'json') if params[:stock_location_id] %>";
13
14
  </script>
@@ -10,8 +10,10 @@
10
10
  :choose_a_customer => Spree.t(:choose_a_customer),
11
11
  :confirm_delete => Spree.t(:confirm_delete),
12
12
  :cut => Spree.t(:cut),
13
- :destroy => Spree.t(:destroy),
14
- :edit => Spree.t(:edit),
13
+ :destroy => Spree.t(:destroy, :scope => :actions),
14
+ :edit => Spree.t(:edit, :scope => :actions),
15
+ :save => Spree.t(:save, :scope => :actions),
16
+ :cancel => Spree.t(:cancel, :scope => :actions),
15
17
  :first_day => Spree.t(:first_day,
16
18
  :scope => 'date_picker',
17
19
  :default => 0).to_i,
@@ -31,7 +33,8 @@
31
33
  :type_to_search => Spree.t(:type_to_search),
32
34
  :taxon_placeholder => Spree.t(:taxon_placeholder),
33
35
  :variant_placeholder => Spree.t(:variant_placeholder),
34
- :value => Spree.t(:value)
36
+ :value => Spree.t(:value),
37
+ :currency_separator => I18n.t('number.currency.format.separator'),
35
38
  }.to_json
36
39
  %>
37
40
  </script>
@@ -1,13 +1,14 @@
1
1
  <div data-hook="admin_stock_movements_form_fields" class="row">
2
- <div class="alpha four columns">
2
+ <div class="alpha twelve columns">
3
3
  <%= f.field_container :quantity do %>
4
4
  <%= f.label :quantity, Spree.t(:quantity) %>
5
- <%= f.text_field :quantity, :class => 'fullwidth' %>
5
+ <%= f.text_field :quantity %>
6
6
  <% end %>
7
7
  <%= f.field_container :stock_item_id do %>
8
8
  <%= f.label :stock_item_id, Spree.t(:stock_item_id) %>
9
- <%= collection_select 'stock_movement', 'stock_item_id', stock_location.stock_items, :id, :variant_name,
10
- { selected: @stock_movement.stock_item_id }, class: 'select2 fullwidth' %>
9
+ <%= f.text_field 'stock_item_id', :class => 'fullwidth' %>
11
10
  <% end %>
12
11
  </div>
13
12
  </div>
13
+
14
+ <%= render :partial => "spree/admin/variants/autocomplete", :formats => :js %>
@@ -30,7 +30,9 @@
30
30
  <tbody>
31
31
  <% @stock_movements.each do |stock_movement|%>
32
32
  <tr id="<%= spree_dom_id stock_movement %>" data-hook="admin_stock_movements_index_rows" class="<%= cycle('odd', 'even')%>">
33
- <td class="align-center"><%= stock_movement.stock_item.variant_name %></td>
33
+ <td class="align-center">
34
+ <%= display_variant(stock_movement) %>
35
+ </td>
34
36
  <td class="align-center"><%= stock_movement.quantity %></td>
35
37
  <td class="align-center"><%= pretty_originator(stock_movement) %></td>
36
38
  </tr>
@@ -10,7 +10,7 @@
10
10
  </li>
11
11
  <% end %>
12
12
 
13
- <% # Because otherwise the form would attempt to use to_param of @taxon %>
13
+ <%# Because otherwise the form would attempt to use to_param of @taxon %>
14
14
  <% form_url = admin_taxonomy_taxon_path(@taxonomy.id, @taxon.id) %>
15
15
  <%= form_for [:admin, @taxonomy, @taxon], :method => :put, :url => form_url, :html => { :multipart => true } do |f| %>
16
16
  <%= render 'form', :f => f %>
@@ -12,59 +12,14 @@
12
12
 
13
13
  <h6 class="variant-name">{{variant.name}}</h6>
14
14
 
15
- <ul class='variant-data'>
16
- <li class='variant-sku'><strong><%= Spree.t(:sku) %>:</strong> {{variant.sku}}</li>
17
- </ul>
18
-
19
15
  {{#if variant.option_values}}
20
- <ul class='variant-options'>
21
- {{#each variant.option_values}}
22
- <li><strong>{{this.option_type.presentation}}:</strong> {{this.presentation}}</li>
23
- {{/each}}
24
- </ul>
16
+ {{#each variant.option_values}}
17
+ <strong>{{this.option_type_presentation}}:</strong> {{this.presentation}}<br>
18
+ {{/each}}
25
19
  {{/if}}
20
+
21
+ <strong><%= Spree.t(:sku) %>:</strong> {{variant.sku}}
26
22
 
27
23
  </div>
28
24
  </div>
29
- </script>
30
-
31
- <script type='text/template' id='variant_autocomplete_stock_template'>
32
- <fieldset>
33
- <legend align="center"><%= Spree.t(:select_stock) %></legend>
34
- <table class="stock-levels" data-hook="stock-levels">
35
- <colgroup>
36
- <col style="width: 30%;" />
37
- <col style="width: 40%;" />
38
- <col style="width: 20%;" />
39
- <col style="width: 10%;" />
40
- </colgroup>
41
- <thead>
42
- <th><%= Spree.t(:location) %></th>
43
- <th><%= Spree.t(:count_on_hand) %></th>
44
- <th><%= Spree.t(:quantity) %></th>
45
- <th class="actions"></th>
46
- </thead>
47
- <tbody>
48
- {{#each variant.stock_items}}
49
- <tr>
50
- <td>{{this.stock_location_name}}</td>
51
- {{#if this.available}}
52
- <td>
53
- {{this.count_on_hand}}
54
- {{#if this.backorderable}} (<%= Spree.t(:backorders_allowed) %>) {{/if}}
55
- </td>
56
- <td>
57
- <input class="quantity" id="stock_item_quantity" data-stock-location-id="{{this.stock_location_id}}" type="number" min="1" value="1">
58
- </td>
59
- <td class="actions">
60
- <button class="add_variant no-text icon-plus icon_link with-tip" data-stock-location-id="{{this.stock_location_id}}" title="<%= Spree.t(:add) %>" data-action="add"></button>
61
- </td>
62
- {{else}}
63
- <td><%= Spree.t(:out_of_stock) %></td>
64
- <td>0</td>
65
- {{/if}}
66
- </tr>
67
- {{/each}}
68
- </tbody>
69
- </fieldset>
70
- </script>
25
+ </script>
@@ -0,0 +1,41 @@
1
+
2
+ <script type='text/template' id='variant_autocomplete_stock_template'>
3
+ <fieldset>
4
+ <legend align="center"><%= Spree.t(:select_stock) %></legend>
5
+ <table class="stock-levels" data-hook="stock-levels">
6
+ <colgroup>
7
+ <col style="width: 30%;" />
8
+ <col style="width: 40%;" />
9
+ <col style="width: 20%;" />
10
+ <col style="width: 10%;" />
11
+ </colgroup>
12
+ <thead>
13
+ <th><%= Spree.t(:location) %></th>
14
+ <th><%= Spree.t(:count_on_hand) %></th>
15
+ <th><%= Spree.t(:quantity) %></th>
16
+ <th class="actions"></th>
17
+ </thead>
18
+ <tbody>
19
+ {{#each variant.stock_items}}
20
+ <tr>
21
+ <td>{{this.stock_location_name}}</td>
22
+ {{#if this.available}}
23
+ <td>
24
+ {{this.count_on_hand}}
25
+ {{#if this.backorderable}} (<%= Spree.t(:backorders_allowed) %>) {{/if}}
26
+ </td>
27
+ <td>
28
+ <input class="quantity" id="stock_item_quantity" data-stock-location-id="{{this.stock_location_id}}" type="number" min="1" value="1">
29
+ </td>
30
+ <td class="actions">
31
+ <button class="add_variant no-text icon-plus icon_link with-tip" data-stock-location-id="{{this.stock_location_id}}" title="<%= Spree.t(:add) %>" data-action="add"></button>
32
+ </td>
33
+ {{else}}
34
+ <td><%= Spree.t(:out_of_stock) %></td>
35
+ <td>0</td>
36
+ {{/if}}
37
+ </tr>
38
+ {{/each}}
39
+ </tbody>
40
+ </fieldset>
41
+ </script>
@@ -45,7 +45,7 @@
45
45
  <nav id="admin-menu" data-hook>
46
46
  <div class="container">
47
47
  <div class="sixteen columns main-menu-wrapper">
48
- <ul data-hook="admin_tabs" class="inline-menu fullwidth-menu">
48
+ <ul data-hook="admin_tabs" class="fullwidth-menu">
49
49
  <%= render :partial => 'spree/admin/shared/tabs' %>
50
50
  </ul>
51
51
  </div>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-16 00:00:00.000000000 Z
11
+ date: 2013-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.5
19
+ version: 2.0.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.5
26
+ version: 2.0.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_api
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.5
33
+ version: 2.0.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.5
40
+ version: 2.0.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: jquery-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -148,6 +148,7 @@ files:
148
148
  - app/assets/javascripts/admin/option_type_autocomplete.js.erb
149
149
  - app/assets/javascripts/admin/orders/edit.js
150
150
  - app/assets/javascripts/admin/orders/edit_form.js
151
+ - app/assets/javascripts/admin/payments/edit.js.coffee
151
152
  - app/assets/javascripts/admin/payments/new.js
152
153
  - app/assets/javascripts/admin/product_picker.js
153
154
  - app/assets/javascripts/admin/progress.coffee
@@ -157,6 +158,7 @@ files:
157
158
  - app/assets/javascripts/admin/spree_backend.js
158
159
  - app/assets/javascripts/admin/states.js
159
160
  - app/assets/javascripts/admin/stock_management.js.coffee
161
+ - app/assets/javascripts/admin/stock_movement.js.coffee
160
162
  - app/assets/javascripts/admin/stock_transfer.js.coffee
161
163
  - app/assets/javascripts/admin/taxon_autocomplete.js.erb
162
164
  - app/assets/javascripts/admin/taxon_tree_menu.js.coffee
@@ -436,6 +438,7 @@ files:
436
438
  - app/views/spree/admin/trackers/index.html.erb
437
439
  - app/views/spree/admin/trackers/new.html.erb
438
440
  - app/views/spree/admin/variants/_autocomplete.js.erb
441
+ - app/views/spree/admin/variants/_autocomplete_stock.js.erb
439
442
  - app/views/spree/admin/variants/_form.html.erb
440
443
  - app/views/spree/admin/variants/_split.js.erb
441
444
  - app/views/spree/admin/variants/edit.html.erb