spree_backend 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend/admin.js.erb +3 -1
  3. data/app/assets/javascripts/spree/backend/checkouts/edit.js +0 -11
  4. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +4 -1
  5. data/app/assets/javascripts/spree/backend/payments/new.js +42 -12
  6. data/app/assets/javascripts/spree/backend/select_payments.js.coffee +7 -0
  7. data/app/assets/javascripts/spree/backend/shipments.js.erb +1 -1
  8. data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +2 -2
  9. data/app/assets/stylesheets/spree/backend/sections/_users.scss +5 -0
  10. data/app/assets/stylesheets/spree/backend/spree_admin.scss +1 -0
  11. data/app/controllers/spree/admin/base_controller.rb +2 -0
  12. data/app/controllers/spree/admin/payments_controller.rb +9 -4
  13. data/app/controllers/spree/admin/promotions_controller.rb +18 -0
  14. data/app/controllers/spree/admin/resource_controller.rb +6 -37
  15. data/app/controllers/spree/admin/shipping_methods_controller.rb +1 -1
  16. data/app/controllers/spree/admin/stock_locations_controller.rb +11 -5
  17. data/app/controllers/spree/admin/users_controller.rb +159 -0
  18. data/app/views/spree/admin/orders/_risk_analysis.html.erb +1 -1
  19. data/app/views/spree/admin/orders/_shipment.html.erb +1 -1
  20. data/app/views/spree/admin/payments/_form.html.erb +11 -5
  21. data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +20 -18
  22. data/app/views/spree/admin/promotions/index.html.erb +42 -0
  23. data/app/views/spree/admin/shared/_destroy.js.erb +0 -1
  24. data/app/views/spree/admin/shared/_tabs.html.erb +3 -0
  25. data/app/views/spree/admin/shared/_translations.html.erb +5 -0
  26. data/app/views/spree/admin/users/_addresses_form.html.erb +19 -0
  27. data/app/views/spree/admin/users/_form.html.erb +37 -0
  28. data/app/views/spree/admin/users/_sidebar.html.erb +36 -0
  29. data/app/views/spree/admin/users/_user_page_actions.html.erb +5 -0
  30. data/app/views/spree/admin/users/addresses.html.erb +24 -0
  31. data/app/views/spree/admin/users/edit.html.erb +55 -0
  32. data/app/views/spree/admin/users/index.html.erb +53 -0
  33. data/app/views/spree/admin/users/items.html.erb +74 -0
  34. data/app/views/spree/admin/users/new.html.erb +23 -0
  35. data/app/views/spree/admin/users/orders.html.erb +57 -0
  36. data/app/views/spree/admin/variants/_split.js.erb +3 -3
  37. data/config/routes.rb +11 -0
  38. data/lib/spree/backend/action_callbacks.rb +1 -1
  39. data/lib/spree/backend/callbacks.rb +47 -0
  40. data/lib/spree/backend/engine.rb +2 -0
  41. data/lib/spree/backend.rb +2 -0
  42. metadata +21 -7
@@ -1,15 +1,14 @@
1
1
  <fieldset class="no-border-bottom">
2
2
  <div class="field" data-hook="previous_cards">
3
- <% @previous_cards.each do |card| %>
4
- <label><%= radio_button_tag :card, card.id, card == @previous_cards.first %> <%= card.display_number %><br /></label>
3
+ <% if previous_cards.any? %>
4
+ <% previous_cards.each do |card| %>
5
+ <label><%= radio_button_tag :card, card.id, card == previous_cards.first %> <%= card.display_number %><br /></label>
6
+ <% end %>
7
+ <label><%= radio_button_tag :card, 'new', false, { id: "card_new#{payment_method.id}" } %> <%= Spree.t(:use_new_cc) %></label>
5
8
  <% end %>
6
- <label><%= radio_button_tag :card, 'new', @previous_cards.none? %> <%= Spree.t(:use_new_cc) %></label>
7
9
  </div>
8
- <div id="card_form" data-hook>
9
- <div class="nine columns">
10
- <%= image_tag 'credit_cards/credit_card.gif', :id => 'credit-card-image' %>
11
- </div>
12
10
 
11
+ <div id="card_form<%= payment_method.id %>" data-hook>
13
12
  <% param_prefix = "payment_source[#{payment_method.id}]" %>
14
13
 
15
14
  <div class="clear"></div>
@@ -17,9 +16,9 @@
17
16
  <div class="alpha four columns">
18
17
  <div data-hook="card_number">
19
18
  <div class="field">
20
- <%= hidden_field_tag "#{param_prefix}[cc_type]", '', {:id => 'cc_type'} %>
21
- <%= label_tag 'card_number', raw(Spree.t(:card_number) + content_tag(:span, ' *', :class => 'required')) %>
22
- <%= text_field_tag "#{param_prefix}[number]", '', :class => 'required fullwidth', :id => 'card_number', :maxlength => 19 %>
19
+ <%= hidden_field_tag "#{param_prefix}[cc_type]", '', {class: 'ccType'} %>
20
+ <%= label_tag "card_number#{payment_method.id}", raw(Spree.t(:card_number) + content_tag(:span, ' *', :class => 'required')) %>
21
+ <%= text_field_tag "#{param_prefix}[number]", '', :class => 'required fullwidth cardNumber', :id => "card_number#{payment_method.id}", :maxlength => 19 %>
23
22
  <span id="card_type" style="display:none;">
24
23
  ( <span id="looks_like" ><%= Spree.t(:card_type_is) %> <span id="type"></span></span>
25
24
  <span id="unrecognized"><%= Spree.t(:unrecognized_card_type) %></span>
@@ -31,28 +30,31 @@
31
30
  <div class="alpha four columns">
32
31
  <div data-hook="card_name">
33
32
  <div class="field">
34
- <%= label_tag 'card_name', raw(Spree.t(:name) + content_tag(:span, ' *', :class => 'required')) %>
35
- <%= text_field_tag "#{param_prefix}[name]", '', :class => 'required fullwidth', :id => 'card_name', :maxlength => 19 %>
33
+ <%= label_tag "card_name#{payment_method.id}", raw(Spree.t(:name) + content_tag(:span, ' *', :class => 'required')) %>
34
+ <%= text_field_tag "#{param_prefix}[name]", '', id: "card_name#{payment_method.id}", class: 'required fullwidth', maxlength: 19 %>
36
35
  </div>
37
36
  </div>
38
37
  </div>
39
38
  <div class="three columns">
40
39
  <div data-hook="card_expiration" class="field">
41
- <%= label_tag 'card_expiry', raw(Spree.t(:expiration) + content_tag(:span, ' *', :class => 'required')) %><br>
42
- <%= text_field_tag "#{param_prefix}[expiry]", '', :id => 'card_expiry', :class => "required", :placeholder => "MM / YY" %>
40
+ <%= label_tag "card_expiry#{payment_method.id}", raw(Spree.t(:expiration) + content_tag(:span, ' *', :class => 'required')) %><br>
41
+ <%= text_field_tag "#{param_prefix}[expiry]", '', id: "card_expiry#{payment_method.id}", class: "required cardExpiry", placeholder: "MM / YY" %>
43
42
  </div>
44
43
  </div>
45
44
  <div class="omega two columns">
46
45
  <div data-hook="card_code" class="field">
47
- <%= label_tag 'card_code', raw(Spree.t(:card_code) + content_tag(:span, ' *', :class => "required")) %>
48
- <%= text_field_tag "#{param_prefix}[verification_value]", '', :class => 'required fullwidth', :size => 5, :id => 'card_code' %>
49
- <a href="/content/cvv" class="info" target="_blank" id="cvv_link">
46
+ <%= label_tag "card_code#{payment_method.id}", raw(Spree.t(:card_code) + content_tag(:span, ' *', :class => "required")) %>
47
+ <%= text_field_tag "#{param_prefix}[verification_value]", '', id: "card_code#{payment_method.id}", class: 'required fullwidth cardCode', size: 5 %>
48
+ <a href="/content/cvv" class="info cvvLink" target="_blank">
50
49
  (<%= Spree.t(:what_is_this) %>)
51
50
  </a>
52
51
  </div>
53
52
  </div>
54
53
 
54
+ <div class="nine columns">
55
+ <%= image_tag 'credit_cards/credit_card.gif', :class => 'credit-card-image' %>
56
+ </div>
57
+
55
58
  <div class="clear"></div>
56
59
  </div>
57
-
58
60
  </fieldset>
@@ -8,6 +8,48 @@
8
8
  </li>
9
9
  <% end %>
10
10
 
11
+ <% content_for :table_filter_title do %>
12
+ <%= Spree.t(:search) %>
13
+ <% end %>
14
+
15
+ <% content_for :table_filter do %>
16
+ <div data-hook="admin_promotions_index_search">
17
+ <%= search_form_for [:admin, @search] do |f| %>
18
+ <div class="five columns">
19
+ <div class="field">
20
+ <%= label_tag nil, 'name' %>
21
+ <%= f.text_field :name_cont, tabindex: 1 %>
22
+ </div>
23
+ </div>
24
+
25
+ <div class="five columns">
26
+ <div class="field">
27
+ <%= label_tag nil, 'code' %>
28
+ <%= f.text_field :code_cont, tabindex: 1 %>
29
+ </div>
30
+ </div>
31
+
32
+ <div class="five columns">
33
+ <div class="field">
34
+ <%= label_tag nil, 'path' %>
35
+ <%= f.text_field :path_cont, tabindex: 1 %>
36
+ </div>
37
+ </div>
38
+
39
+ <div class="clearfix"></div>
40
+
41
+ <div class="actions filter-actions">
42
+ <div data-hook="admin_promotions_index_search_buttons">
43
+ <%= button Spree.t(:filter_results), 'icon-search' %>
44
+ </div>
45
+ </div>
46
+ <% end %>
47
+ </div>
48
+ <% end %>
49
+
50
+
51
+ <%= paginate @promotions %>
52
+
11
53
  <% if @promotions.any? %>
12
54
  <table class="index">
13
55
  <colgroup>
@@ -1,6 +1,5 @@
1
1
  <% success = flash.discard(:success)
2
2
  if success %>
3
- console.log(show_flash)
4
3
  show_flash('success', "<%= success %>")
5
4
  <% end %>
6
5
 
@@ -11,3 +11,6 @@
11
11
  <% if can? :admin, Spree::Promotion %>
12
12
  <%= tab(:promotions, :url => spree.admin_promotions_path, :icon => 'icon-bullhorn') %>
13
13
  <% end %>
14
+ <% if Spree.user_class && can?(:admin, Spree.user_class) %>
15
+ <%= tab(:users, :url => spree.admin_users_path, :icon => 'icon-user') %>
16
+ <% end %>
@@ -18,6 +18,7 @@
18
18
  :scope => 'date_picker',
19
19
  :default => 0).to_i,
20
20
  :find_a_taxon => Spree.t(:find_a_taxon),
21
+ :item_stock_placeholder => Spree.t(:choose_location),
21
22
  :loading => Spree.t(:loading),
22
23
  :month_names => I18n.t(:month_names, :scope => :date).reject(&:blank?),
23
24
  :more => Spree.t(:more),
@@ -40,3 +41,7 @@
40
41
  }.to_json
41
42
  %>
42
43
  </script>
44
+
45
+ <% if I18n.locale != :en %>
46
+ <%= javascript_include_tag "select2_locale_#{I18n.locale}" %>
47
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <div data-hook="bill_address_wrapper" class="alpha six columns">
2
+ <fieldset class="no-border-bottom">
3
+ <legend align="center"><%= Spree.t(:billing_address) %></legend>
4
+ <%= f.fields_for :bill_address, (@user.bill_address || Spree::Address.default(@user, "bill")) do |ba_form| %>
5
+ <% ba_form.object ||= Spree::Address.new(country: Spree::Country.new) %>
6
+ <%= render :partial => 'spree/admin/shared/address_form', :locals => { :f => ba_form, :type => "billing" } %>
7
+ <% end %>
8
+ </fieldset>
9
+ </div>
10
+
11
+ <div data-hook="ship_address_wrapper" class="alpha six columns">
12
+ <fieldset class="no-border-bottom">
13
+ <legend align="center"><%= Spree.t(:shipping_address) %></legend>
14
+ <%= f.fields_for :ship_address, (@user.ship_address || Spree::Address.default(@user, "ship")) do |sa_form| %>
15
+ <% sa_form.object ||= Spree::Address.new(country: Spree::Country.new) %>
16
+ <%= render :partial => 'spree/admin/shared/address_form', :locals => { :f => sa_form, :type => "shipping" } %>
17
+ <% end %>
18
+ </fieldset>
19
+ </div>
@@ -0,0 +1,37 @@
1
+ <div data-hook="admin_user_form_fields" class="row">
2
+ <div class="alpha six columns">
3
+ <%= f.field_container :email do %>
4
+ <%= f.label :email, Spree.t(:email) %>
5
+ <%= f.email_field :email, :class => 'fullwidth' %>
6
+ <%= error_message_on :user, :email %>
7
+ <% end %>
8
+
9
+ <div data-hook="admin_user_form_roles" class="field">
10
+ <%= label_tag nil, Spree.t(:roles) %>
11
+ <ul>
12
+ <% @roles.each do |role| %>
13
+ <li>
14
+ <%= check_box_tag 'user[spree_role_ids][]', role.id, @user.spree_roles.include?(role), :id => "user_spree_role_#{role.name}" %>
15
+ <%= label_tag role.name %>
16
+ </li>
17
+ <% end %>
18
+ </ul>
19
+ <%= hidden_field_tag 'user[spree_role_ids][]', '' %>
20
+ </div>
21
+
22
+ </div>
23
+
24
+ <div class="omega six columns">
25
+ <%= f.field_container :password do %>
26
+ <%= f.label :password, Spree.t(:password) %>
27
+ <%= f.password_field :password, :class => 'fullwidth' %>
28
+ <%= f.error_message_on :password %>
29
+ <% end %>
30
+
31
+ <%= f.field_container :password do %>
32
+ <%= f.label :password_confirmation, Spree.t(:confirm_password) %>
33
+ <%= f.password_field :password_confirmation, :class => 'fullwidth' %>
34
+ <%= f.error_message_on :password_confirmation %>
35
+ <% end %>
36
+ </div>
37
+ </div>
@@ -0,0 +1,36 @@
1
+ <% content_for :sidebar_title do %>
2
+ <%= Spree.t(:"admin.user.user_information") %>
3
+ <% end %>
4
+
5
+ <% content_for :sidebar do %>
6
+ <nav class="menu">
7
+ <ul data-hook="admin_user_tab_options">
8
+ <li<%== ' class="active"' if current == :account %>>
9
+ <%= link_to_with_icon 'icon-user', Spree.t(:"admin.user.account"), edit_admin_user_path(@user) %>
10
+ </li>
11
+ <li<%== ' class="active"' if current == :address %>>
12
+ <%= link_to_with_icon 'icon-user', Spree.t(:"admin.user.addresses"), addresses_admin_user_path(@user) %>
13
+ </li>
14
+ <li<%== ' class="active"' if current == :orders %>>
15
+ <%= link_to_with_icon 'icon-shopping-cart', Spree.t(:"admin.user.orders"), orders_admin_user_path(@user) %>
16
+ </li>
17
+ <li<%== ' class="active"' if current == :items %>>
18
+ <%= link_to_with_icon 'icon-edit', Spree.t(:"admin.user.items"), items_admin_user_path(@user) %>
19
+ </li>
20
+ </ul>
21
+
22
+ <fieldset data-hook="admin_user_lifetime_stats">
23
+ <legend><%= Spree.t(:lifetime_stats) %></legend>
24
+ <dl id="user-lifetime-stats">
25
+ <dt><%= Spree.t(:total_sales) %>:</dt>
26
+ <dd><%= @user.display_lifetime_value.to_html %></dd>
27
+ <dt><%= Spree.t(:num_orders) %>:</dt>
28
+ <dd><%= @user.order_count.to_i %></dd>
29
+ <dt><%= Spree.t(:average_order_value) %>:</dt>
30
+ <dd><%= @user.display_average_order_value.to_html %></dd>
31
+ <dt><%= Spree.t(:member_since) %>:</dt>
32
+ <dd><%= l @user.created_at.to_date %></dd>
33
+ </dl>
34
+ </fieldset>
35
+ </nav>
36
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% content_for :page_actions do %>
2
+ <li>
3
+ <%= button_link_to Spree.t(:back_to_users_list), spree.admin_users_path, :icon => 'icon-arrow-left' %>
4
+ </li>
5
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <% content_for :page_title do %>
2
+ <%= link_to "#{Spree.t(:editing_user)} #{@user.email}", edit_admin_user_url(@user) %>
3
+ <% end %>
4
+
5
+ <%= render :partial => 'spree/admin/users/sidebar', :locals => { :current => :address } %>
6
+ <%= render :partial => 'spree/admin/users/user_page_actions' %>
7
+
8
+ <fieldset data-hook="admin_user_addresses" id="admin_user_edit_addresses" class="alpha twelve columns">
9
+ <legend><%= Spree.t('addresses', :scope => 'admin.user') %></legend>
10
+
11
+ <div data-hook="admin_user_edit_form_header">
12
+ <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
13
+ </div>
14
+
15
+ <div data-hook="admin_user_address_edit_form">
16
+ <%= form_for [:admin, @user], as: :user, url: addresses_admin_user_url(@user), method: :put do |f| %>
17
+ <%= render :partial => 'addresses_form', :locals => { :f => f } %>
18
+
19
+ <div data-hook="admin_user_edit_form_button">
20
+ <%= render :partial => 'spree/admin/shared/edit_resource_links', :locals => { :collection_url => admin_users_url } %>
21
+ </div>
22
+ <% end %>
23
+ </div>
24
+ </fieldset>
@@ -0,0 +1,55 @@
1
+ <% content_for :page_title do %>
2
+ <%= link_to "#{Spree.t(:editing_user)} #{@user.email}", edit_admin_user_url(@user) %>
3
+ <% end %>
4
+
5
+ <%= render :partial => 'spree/admin/users/sidebar', :locals => { :current => :account } %>
6
+ <%= render :partial => 'spree/admin/users/user_page_actions' %>
7
+
8
+ <fieldset data-hook="admin_user_edit_general_settings" class="alpha twelve columns">
9
+ <legend><%= Spree.t(:general_settings) %></legend>
10
+
11
+ <div data-hook="admin_user_edit_form_header">
12
+ <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
13
+ </div>
14
+
15
+ <div data-hook="admin_user_edit_form">
16
+ <%= form_for [:admin, @user], as: :user, url: admin_user_url(@user), method: :put do |f| %>
17
+ <%= render :partial => 'form', :locals => { :f => f } %>
18
+
19
+ <div data-hook="admin_user_edit_form_button">
20
+ <%= render :partial => 'spree/admin/shared/edit_resource_links', :locals => { :collection_url => admin_users_url } %>
21
+ </div>
22
+ <% end %>
23
+ </div>
24
+ </fieldset>
25
+
26
+ <fieldset data-hook="admin_user_api_key" id="admin_user_edit_api_key" class="alpha twelve columns">
27
+ <legend><%= Spree.t('access', :scope => 'api') %></legend>
28
+
29
+ <% if @user.spree_api_key.present? %>
30
+ <div class="field">
31
+ <div id="current-api-key"><%= Spree.t('key', :scope => 'api') %>: <%= @user.spree_api_key %></div>
32
+ </div>
33
+ <div class="filter-actions actions">
34
+ <%= form_tag spree.clear_api_key_admin_user_path(@user), :method => :put do %>
35
+ <%= button Spree.t('clear_key', :scope => 'api'), 'icon-trash' %>
36
+ <% end %>
37
+
38
+ <span class="or"><%= Spree.t(:or)%></span>
39
+
40
+ <%= form_tag spree.generate_api_key_admin_user_path(@user), :method => :put do %>
41
+ <%= button Spree.t('regenerate_key', :scope => 'api'), 'icon-refresh' %>
42
+ <% end %>
43
+ </div>
44
+
45
+ <% else %>
46
+
47
+ <div class="no-objects-found"><%= Spree.t('no_key', :scope => 'api') %></div>
48
+
49
+ <div class="filter-actions actions">
50
+ <%= form_tag spree.generate_api_key_admin_user_path(@user), :method => :put do %>
51
+ <%= button Spree.t('generate_key', :scope => 'api'), 'icon-key' %>
52
+ <% end %>
53
+ </div>
54
+ <% end %>
55
+ </fieldset>
@@ -0,0 +1,53 @@
1
+ <% content_for :page_title do %>
2
+ <%= Spree.t(:listing_users) %>
3
+ <% end %>
4
+
5
+ <% content_for :page_actions do %>
6
+ <li>
7
+ <%= button_link_to Spree.t(:new_user), new_admin_user_url, :icon => 'icon-plus', :id => 'admin_new_user_link' %>
8
+ </li>
9
+ <% end %>
10
+
11
+ <table class="index" id="listing_users" data-hook>
12
+ <colgroup>
13
+ <col style="width: 85%">
14
+ <col style="width: 15%">
15
+ </colgroup>
16
+ <thead>
17
+ <tr data-hook="admin_users_index_headers">
18
+ <th><%= sort_link @search,:email, Spree.t(:user), {}, {:title => 'users_email_title'} %></th>
19
+ <th data-hook="admin_users_index_header_actions" class="actions"></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody>
23
+ <% @users.each do |user|%>
24
+ <tr id="<%= spree_dom_id user %>" data-hook="admin_users_index_rows" class="<%= cycle('odd', 'even')%>">
25
+ <td class='user_email'><%=link_to user.email, edit_admin_user_url(user) %></td>
26
+ <td data-hook="admin_users_index_row_actions" class="actions">
27
+ <%= link_to_edit user, :no_text => true %>
28
+ <%= link_to_delete user, :no_text => true %>
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ </tbody>
33
+ </table>
34
+
35
+ <%= paginate @users %>
36
+
37
+ <% content_for :sidebar_title do %>
38
+ <%= Spree.t(:search) %>
39
+ <% end %>
40
+
41
+ <% content_for :sidebar do %>
42
+ <div class="box align-center" data-hook="admin_users_index_search">
43
+ <%= search_form_for [:admin, @search], url: admin_users_url do |f| %>
44
+ <div class="field">
45
+ <%= f.label Spree.t(:email) %> <br>
46
+ <%= f.text_field :email_cont, :class => 'fullwidth' %>
47
+ </div>
48
+ <div data-hook="admin_users_index_search_buttons">
49
+ <%= button Spree.t(:search), 'icon-search' %>
50
+ </div>
51
+ <% end %>
52
+ </div>
53
+ <% end %>
@@ -0,0 +1,74 @@
1
+ <% content_for :page_title do %>
2
+ <%= link_to "#{Spree.t(:"admin.user.items_purchased")} #{@user.email}", edit_admin_user_url(@user) %>
3
+ <% end %>
4
+
5
+ <%= render :partial => 'spree/admin/users/sidebar', :locals => { :current => :items } %>
6
+ <%= render :partial => 'spree/admin/users/user_page_actions' %>
7
+
8
+ <fieldset data-hook="admin_user_items_purchased" class="alpha twelve columns">
9
+ <legend><%= Spree.t(:"admin.user.items_purchased") %></legend>
10
+
11
+ <%= paginate @orders %>
12
+
13
+ <% if @orders.any? %>
14
+ <%# TODO add search interface %>
15
+ <table class="stock-contents index" id="listing_items" data-hook="stock-contents">
16
+ <colgroup>
17
+ <col style="width: 10%;" />
18
+ <col style="width: 10%;" />
19
+ <col style="width: 30%;" />
20
+ <col style="width: 8%;" />
21
+ <col style="width: 8%;" />
22
+ <col style="width: 10%;" />
23
+ <col style="width: 14%;" />
24
+ </colgroup>
25
+
26
+ <thead>
27
+ <th><%= sort_link @search, :completed_at, I18n.t(:completed_at, :scope => 'activerecord.attributes.spree/order'), {}, {:title => 'orders_completed_at_title'} %></th>
28
+ <th colspan=2><%= Spree.t(:description) %></th>
29
+ <th><%= I18n.t(:price, :scope => 'activerecord.attributes.spree/line_item') %></th>
30
+ <th><%= I18n.t(:quantity, :scope => 'activerecord.attributes.spree/line_item') %></th>
31
+ <th><%= Spree.t(:total) %></th>
32
+ <th><%= sort_link @search, :state, I18n.t(:state, :scope => 'activerecord.attributes.spree/order'), {}, {:title => 'orders_state_title'} %></th>
33
+ <th><%= sort_link @search, :number, Spree.t(:order_num, :scope => 'admin.user'), {}, {:title => 'orders_number_title'} %></th>
34
+ </thead>
35
+
36
+ <tbody>
37
+ <% @orders.each do |order| %>
38
+ <% order.line_items.each do |item| %>
39
+ <tr class="stock-item" data-item-quantity="<%= item.quantity %>">
40
+ <td class="align-center order-completed-at"><%= l(order.completed_at.to_date) if order.completed_at %></td>
41
+ <td class="item-image">
42
+ <%= mini_image(item.variant) %>
43
+ </td>
44
+ <td class="item-name">
45
+ <%= item.product.name %><br><%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %>
46
+ <% if item.variant.sku.present? %>
47
+ <strong><%= Spree.t(:sku) %>:</strong> <%= item.variant.sku %>
48
+ <% end %>
49
+ </td>
50
+ <td class="align-center item-price"><%= item.single_money.to_html %></td>
51
+ <td class="align-center item-quantity"><%= item.quantity %></td>
52
+ <td class="align-center item-total"><%= item.money.to_html %></td>
53
+ <td class="align-center order-state">
54
+ <div class="state <%= order.state.downcase %>"><%= Spree.t("order_state.#{order.state.downcase}") %></div>
55
+ <% if order.payment_state %>
56
+ <div class="state <%= order.payment_state %>"><%= link_to Spree.t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) %></div>
57
+ <% end %>
58
+ <% if Spree::Order.checkout_step_names.include?(:delivery) && order.shipment_state %>
59
+ <div class="state <%= order.shipment_state %>"><%= Spree.t("shipment_states.#{order.shipment_state}") %></div>
60
+ <% end %>
61
+ </td>
62
+ <td class="align-center order-number"><%= link_to order.number, edit_admin_order_url(order) %></td>
63
+ </tr>
64
+ <% end %>
65
+ <% end %>
66
+ </table>
67
+ <% else %>
68
+ <div class="alpha twelve columns no-objects-found">
69
+ <%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/order')) %>,
70
+ <%= link_to Spree.t(:add_one), spree.new_admin_order_path %>!
71
+ </div>
72
+ <% end %>
73
+ <%= paginate @orders %>
74
+ </fieldset>
@@ -0,0 +1,23 @@
1
+ <% content_for :page_title do %>
2
+ <%= Spree.t(:new_user) %>
3
+ <% end %>
4
+
5
+ <% content_for :page_actions do %>
6
+ <li>
7
+ <%= button_link_to Spree.t(:back_to_users_list), spree.admin_users_path, :icon => 'icon-arrow-left' %>
8
+ </li>
9
+ <% end %>
10
+
11
+ <div data-hook="admin_user_new_form_header">
12
+ <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
13
+ </div>
14
+
15
+ <div data-hook="admin_user_new_form">
16
+ <%= form_for [:admin, @user], url: admin_users_url, method: :post do |f| %>
17
+ <%= render :partial => 'form', :locals => { :f => f } %>
18
+
19
+ <div data-hook="admin_user_new_form_buttons">
20
+ <%= render :partial => 'spree/admin/shared/new_resource_links' %>
21
+ </div>
22
+ <% end %>
23
+ </div>
@@ -0,0 +1,57 @@
1
+ <% content_for :page_title do %>
2
+ <%= link_to "#{Spree.t(:"admin.user.order_history")} #{@user.email}", edit_admin_user_url(@user) %>
3
+ <% end %>
4
+
5
+ <%= render :partial => 'spree/admin/users/sidebar', :locals => { :current => :orders } %>
6
+ <%= render :partial => 'spree/admin/users/user_page_actions' %>
7
+
8
+ <fieldset data-hook="admin_user_order_history" class="alpha twelve columns">
9
+ <legend><%= Spree.t(:"admin.user.order_history") %></legend>
10
+
11
+ <%= paginate @orders %>
12
+
13
+ <% if @orders.any? %>
14
+ <%# TODO add search interface %>
15
+ <table class="index responsive" id="listing_orders" data-hook>
16
+ <colgroup>
17
+ <col style="width: 25%;">
18
+ <col style="width: 25%;">
19
+ <col style="width: 25%;">
20
+ <col style="width: 25%;">
21
+ </colgroup>
22
+ <thead>
23
+ <tr data-hook="admin_orders_index_headers">
24
+ <th><%= sort_link @search, :completed_at, I18n.t(:completed_at, :scope => 'activerecord.attributes.spree/order'), {}, {:title => 'orders_completed_at_title'} %></th>
25
+ <th><%= sort_link @search, :number, I18n.t(:number, :scope => 'activerecord.attributes.spree/order'), {}, {:title => 'orders_number_title'} %></th>
26
+ <th><%= sort_link @search, :state, I18n.t(:state, :scope => 'activerecord.attributes.spree/order'), {}, {:title => 'orders_state_title'} %></th>
27
+ <th><%= sort_link @search, :total, I18n.t(:total, :scope => 'activerecord.attributes.spree/order'), {}, {:title => 'orders_total_title'} %></th>
28
+ </tr>
29
+ </thead>
30
+ <tbody>
31
+ <% @orders.each do |order| %>
32
+ <tr data-hook="admin_orders_index_rows" class="state-<%= order.state.downcase %> <%= cycle('odd', 'even') %>">
33
+ <td class="align-center order-completed-at"><%= l(order.completed_at.to_date) if order.completed_at %></td>
34
+ <td class="align-center order-number"><%= link_to order.number, edit_admin_order_path(order) %></td>
35
+ <td class="align-center order-state">
36
+ <div class="state <%= order.state.downcase %>"><%= Spree.t("order_state.#{order.state.downcase}") %></div>
37
+ <% if order.payment_state %>
38
+ <div class="state <%= order.payment_state %>"><%= link_to Spree.t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) %></div>
39
+ <% end %>
40
+ <% if Spree::Order.checkout_step_names.include?(:delivery) && order.shipment_state %>
41
+ <div class="state <%= order.shipment_state %>"><%= Spree.t("shipment_states.#{order.shipment_state}") %></div>
42
+ <% end %>
43
+ </td>
44
+ <td class="align-center order-total"><%= order.display_total.to_html %></td>
45
+ </tr>
46
+ <% end %>
47
+ </tbody>
48
+ </table>
49
+ <% else %>
50
+ <div class="alpha twelve columns no-objects-found">
51
+ <%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/order')) %>,
52
+ <%= link_to Spree.t(:add_one), spree.new_admin_order_path %>!
53
+ </div>
54
+ <% end %>
55
+
56
+ <%= paginate @orders %>
57
+ </fieldset>
@@ -1,17 +1,17 @@
1
1
  <script type='text/template' id='variant_split_template'>
2
2
  <tr class='stock-item-split' data-variant-id='{{variant.id}}'>
3
3
  <td colspan='2'>
4
- Move {{variant.name}} to:
4
+ <%=Spree.t("move_variant_to", default: "Move {{variant.name}} to")%>
5
5
  </td>
6
6
  <td colspan='2'>
7
7
  <select name="item_stock_location" id='item_stock_location' style='width:100%;'>
8
8
  <option></option>
9
- <optgroup label="Existing Shipments">
9
+ <optgroup label="<%=Spree.t('existing_shipments')%>">
10
10
  {{#each shipments}}
11
11
  <option data-shipment-number='{{this.number}}' value='{{this.stock_location_id}}'>{{this.stock_location.name}}({{this.number}})</option>
12
12
  {{/each}}
13
13
  </optgroup>
14
- <optgroup label="New Shipment At Location">
14
+ <optgroup label="<%=Spree.t('new_shipment_at_location')%>">
15
15
  {{#each variant.stock_items}}
16
16
  <option data-new-shipment='true' value='{{this.stock_location_id}}'>{{this.stock_location_name}}</option>
17
17
  {{/each}}
data/config/routes.rb CHANGED
@@ -146,5 +146,16 @@ Spree::Core::Engine.add_routes do
146
146
  resource :mail_method, :only => [:edit, :update] do
147
147
  post :testmail, :on => :collection
148
148
  end
149
+
150
+ resources :users do
151
+ member do
152
+ get :orders
153
+ get :items
154
+ get :addresses
155
+ put :addresses
156
+ end
157
+
158
+ end
159
+
149
160
  end
150
161
  end
@@ -21,6 +21,6 @@ module Spree
21
21
  def fails(method)
22
22
  @fails_methods << method
23
23
  end
24
- end
25
24
 
25
+ end
26
26
  end
@@ -0,0 +1,47 @@
1
+ module Spree
2
+ module Backend
3
+ module Callbacks
4
+ extend ActiveSupport::Concern
5
+
6
+ module ClassMethods
7
+
8
+ attr_accessor :callbacks
9
+
10
+ protected
11
+
12
+ def new_action
13
+ @callbacks ||= {}
14
+ @callbacks[:new_action] ||= Spree::ActionCallbacks.new
15
+ end
16
+
17
+ def create
18
+ @callbacks ||= {}
19
+ @callbacks[:create] ||= Spree::ActionCallbacks.new
20
+ end
21
+
22
+ def update
23
+ @callbacks ||= {}
24
+ @callbacks[:update] ||= Spree::ActionCallbacks.new
25
+ end
26
+
27
+ def destroy
28
+ @callbacks ||= {}
29
+ @callbacks[:destroy] ||= Spree::ActionCallbacks.new
30
+ end
31
+ end
32
+
33
+ protected
34
+
35
+ def invoke_callbacks(action, callback_type)
36
+ callbacks = self.class.callbacks || {}
37
+ return if callbacks[action].nil?
38
+ case callback_type.to_sym
39
+ when :before then callbacks[action].before_methods.each {|method| send method }
40
+ when :after then callbacks[action].after_methods.each {|method| send method }
41
+ when :fails then callbacks[action].fails_methods.each {|method| send method }
42
+ end
43
+ end
44
+
45
+ end
46
+ end
47
+ end