spree_backend 2.4.0.rc3 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20e9b9d30543a971ed7797b83d1345b3902e3c5c
4
- data.tar.gz: 50fba7739d5c4ef525b63d3a84a6704814f76217
3
+ metadata.gz: a6b7f7e1b021d4babc31a7b8ecdecef76de49f0b
4
+ data.tar.gz: 53aa1e90ecf3ea1a3f66c4af5e121eda36dbae2a
5
5
  SHA512:
6
- metadata.gz: bccd2cc77112fe4f112d1f2983bbd55c53e77daa4d549b56b53892dce6975b1f33a9c379c264a34f67b7b887abf645b114f38c5c76071667ee5b26a414776157
7
- data.tar.gz: 2c68dc2d57f6d1573bcbbc978ba58b830bd9c6a984606b6d83d25073205fb2bbd01fed73aedf2dd85cbe99efde8f55699170b5810ae0d19b18447ba77026ede4
6
+ metadata.gz: d4dea2af0ee3bfb392f049811c8fcfee71f50c8e1403b01b06257ec62e90ebaea12e7ff88e4a603ea53c513bc0350393472b8e07595b243ed4483543e650e359
7
+ data.tar.gz: 0a47836a0f067fb5f06799593afbee09ea6164d55f729e3b2778f56bb521be8ad43454edee8283517aa2032f441e70abd21d7f3f531ebe9fbe999f8bdef63819
@@ -0,0 +1,13 @@
1
+ $(@).ready( ->
2
+ $('[data-hook=general_settings_clear_cache] #clear_cache').click ->
3
+ $.ajax
4
+ type: 'POST'
5
+ url: '/admin/general_settings/clear_cache'
6
+ success: ->
7
+ show_flash 'success', "Cache was flushed."
8
+ error: (msg) ->
9
+ if msg.responseJSON["error"]
10
+ show_flash 'error', msg.responseJSON["error"]
11
+ else
12
+ show_flash 'error', "There was a problem while flushing cache."
13
+ )
@@ -1,6 +1,8 @@
1
1
  module Spree
2
2
  module Admin
3
3
  class GeneralSettingsController < Spree::Admin::BaseController
4
+ include Spree::Backend::Callbacks
5
+
4
6
  before_action :set_store
5
7
 
6
8
  def edit
@@ -31,6 +33,12 @@ module Spree
31
33
  end
32
34
  end
33
35
 
36
+ def clear_cache
37
+ Rails.cache.clear
38
+ invoke_callbacks(:clear_cache, :after)
39
+ head :no_content
40
+ end
41
+
34
42
  private
35
43
  def store_params
36
44
  params.require(:store).permit(permitted_params)
@@ -33,12 +33,6 @@ module Spree
33
33
  def load_simulated_refunds
34
34
  @reimbursement_objects = @reimbursement.simulate
35
35
  end
36
-
37
- # TODO: Remove this when https://github.com/spree/spree/pull/5158 gets merged in
38
- def permitted_resource_params
39
- params[object_name].present? ? super : ActionController::Parameters.new
40
- end
41
-
42
36
  end
43
37
  end
44
38
  end
@@ -60,6 +60,15 @@
60
60
  </div>
61
61
  <% end %>
62
62
  </fieldset>
63
+ <fieldset class="security no-border-bottom">
64
+ <legend align="center"><%= Spree.t(:clear_cache)%></legend>
65
+ <div>
66
+ <%= Spree.t(:clear_cache_warning) %>
67
+ </div>
68
+ <div class="field" data-hook="general_settings_clear_cache">
69
+ <%= button Spree.t(:clear_cache), '', 'button', id: "clear_cache" %>
70
+ </div>
71
+ </fieldset>
63
72
  </div>
64
73
  <div class="omega six columns">
65
74
  <fieldset class="currency no-border-bottom">
@@ -1,9 +1,11 @@
1
1
  <tr class="option_value fields" id="spree_<%= dom_id(f.object) %>" data-hook="option_value" class="<%= cycle('odd', 'even')%>">
2
- <td class="no-border">
3
- <span class="handle"></span>
4
- <%= f.hidden_field :id %>
5
- </td>
6
- <td class="name"><%= f.text_field :name %></td>
2
+ <% if f.object.persisted? %>
3
+ <td class="no-border">
4
+ <span class="handle"></span>
5
+ <%= f.hidden_field :id %>
6
+ </td>
7
+ <% end %>
8
+ <td colspan="<%= f.object.persisted? ? '' : '2' %>" class="name"><%= f.text_field :name %></td>
7
9
  <td class="presentation"><%= f.text_field :presentation %></td>
8
10
  <td class="actions"><%= link_to_remove_fields Spree.t(:remove), f, :no_text => true %></td>
9
11
  </tr>
@@ -32,15 +32,8 @@
32
32
  </tr>
33
33
  </thead>
34
34
  <tbody id="option_values">
35
- <% if @option_type.option_values.empty? %>
36
- <tr id="none" data-hook="option_none" class="<%= cycle('odd', 'even')%>">
37
- <td colspan="2"><%= Spree.t(:none) %></td>
38
- <td class="actions"></td>
39
- </tr>
40
- <% else %>
41
- <%= f.fields_for :option_values do |option_value_form| %>
42
- <%= render :partial => 'option_value_fields', :locals => { :f => option_value_form } %>
43
- <% end %>
35
+ <%= f.fields_for :option_values, @option_values do |option_value_form| %>
36
+ <%= render :partial => 'option_value_fields', :locals => { :f => option_value_form } %>
44
37
  <% end %>
45
38
  </tbody>
46
39
  </table>
@@ -4,39 +4,30 @@
4
4
 
5
5
  <% content_for :page_actions do %>
6
6
  <li>
7
- <%= button_link_to Spree.t(:new_promotion_category), spree.new_admin_promotion_category_path, icon: 'plus', remote: true, id: 'new_promotion_category_link' %>
7
+ <%= button_link_to Spree.t(:new_promotion_category), spree.new_admin_promotion_category_path, :icon => 'plus' %>
8
8
  </li>
9
9
  <% end %>
10
10
 
11
11
  <%= render 'spree/admin/shared/promotion_sub_menu' %>
12
12
 
13
- <div id="new_promotion_category"></div>
14
-
15
- <% if @promotion_categories.any? %>
16
- <table>
17
- <colgroup>
18
- <col style="width: 85%">
19
- <col style="width: 15%">
20
- </colgroup>
21
- <thead>
22
- <th><%= Spree::PromotionCategory.human_attribute_name :name %></th>
23
- <th class='actions'></th>
24
- </thead>
25
- <tbody>
26
- <% @promotion_categories.each do |promotion_category| %>
27
- <tr>
28
- <td><%= promotion_category.name %></td>
29
- <td class="actions">
30
- <%= link_to_edit promotion_category, :no_text => true %>
31
- <%= link_to_delete promotion_category, :no_text => true %>
32
- </td>
33
- </tr>
34
- <% end %>
35
- </tbody>
36
- </table>
37
- <% else %>
38
- <div class="alpha sixteen columns no-objects-found">
39
- <%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/promotion_category')) %>
40
- <%= link_to Spree.t(:add_one) + '!', spree.new_admin_promotion_category_path, remote: true, id: 'new_promotion_category_link' %>
41
- </div>
42
- <% end %>
13
+ <table>
14
+ <colgroup>
15
+ <col style="width: 85%">
16
+ <col style="width: 15%">
17
+ </colgroup>
18
+ <thead>
19
+ <th><%= Spree::PromotionCategory.human_attribute_name :name %></th>
20
+ <th class='actions'></th>
21
+ </thead>
22
+ <tbody>
23
+ <% @promotion_categories.each do |promotion_category| %>
24
+ <tr>
25
+ <td><%= promotion_category.name %></td>
26
+ <td class="actions">
27
+ <%= link_to_edit promotion_category, :no_text => true %>
28
+ <%= link_to_delete promotion_category, :no_text => true %>
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ </tbody>
33
+ </table>
@@ -99,7 +99,7 @@
99
99
  </tbody>
100
100
  </table>
101
101
  <% else %>
102
- <div class="alpha omega sixteen columns no-objects-found">
102
+ <div class="alpha twelve columns no-objects-found">
103
103
  <%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/promotion')) %>,
104
104
  <%= link_to Spree.t(:add_one), spree.new_admin_promotion_path %>!
105
105
  </div>
@@ -21,9 +21,10 @@
21
21
  <%= f.fields_for :return_items, @form_return_items do |item_fields| %>
22
22
  <% return_item = item_fields.object %>
23
23
  <% inventory_unit = return_item.inventory_unit %>
24
+ <% editable = inventory_unit.shipped? && allow_return_item_changes && return_item.reimbursement.nil? %>
24
25
  <tr>
25
26
  <td class="align-center" class="inventory-unit-checkbox">
26
- <% if inventory_unit.shipped? && allow_return_item_changes %>
27
+ <% if editable %>
27
28
  <%= item_fields.hidden_field :inventory_unit_id %>
28
29
  <%= item_fields.check_box :_destroy, {checked: return_item.persisted?, class: 'add-item', "data-price" => return_item.pre_tax_amount}, '0', '1' %>
29
30
  <% end %>
@@ -37,24 +38,24 @@
37
38
  <%= return_item.display_pre_tax_amount %>
38
39
  </td>
39
40
  <td class="align-center">
40
- <% if inventory_unit.shipped? && allow_return_item_changes %>
41
+ <% if editable %>
41
42
  <%= item_fields.text_field :pre_tax_amount, { class: 'refund-amount-input' } %>
42
43
  <% else %>
43
44
  <%= return_item.display_pre_tax_amount %>
44
45
  <% end %>
45
46
  </td>
46
47
  <td>
47
- <% if inventory_unit.shipped? && allow_return_item_changes %>
48
+ <% if editable %>
48
49
  <%= item_fields.select :preferred_reimbursement_type_id, @reimbursement_types.collect{|r|[r.name.humanize, r.id]}, {include_blank: true}, {class: 'select2 fullwidth'} %>
50
+ <% else %>
51
+ <%= return_item.preferred_reimbursement_type.try(:name) %>
49
52
  <% end %>
50
53
  </td>
51
54
  <td class="align-center">
52
- <% if inventory_unit.shipped? && allow_return_item_changes %>
53
- <% if return_item.exchange_processed? %>
54
- <%= return_item.exchange_variant.options_text %>
55
- <% else %>
56
- <%= item_fields.collection_select :exchange_variant_id, return_item.eligible_exchange_variants, :id, :options_text, { include_blank: true }, { class: "select2 fullwidth return-item-exchange-selection" } %>
57
- <% end %>
55
+ <% if editable %>
56
+ <%= item_fields.collection_select :exchange_variant_id, return_item.eligible_exchange_variants, :id, :options_text, { include_blank: true }, { class: "select2 fullwidth return-item-exchange-selection" } %>
57
+ <% elsif return_item.exchange_processed? %>
58
+ <%= return_item.exchange_variant.options_text %>
58
59
  <% end %>
59
60
  </td>
60
61
  </tr>
data/config/routes.rb CHANGED
@@ -113,6 +113,7 @@ Spree::Core::Engine.add_routes do
113
113
  resource :general_settings do
114
114
  collection do
115
115
  post :dismiss_alert
116
+ post :clear_cache
116
117
  end
117
118
  end
118
119
 
@@ -28,6 +28,11 @@ module Spree
28
28
  @callbacks ||= {}
29
29
  @callbacks[:destroy] ||= Spree::ActionCallbacks.new
30
30
  end
31
+
32
+ def custom_callback(action)
33
+ @callbacks ||= {}
34
+ @callbacks[action] ||= Spree::ActionCallbacks.new
35
+ end
31
36
  end
32
37
 
33
38
  protected
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.4.0.rc3
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-07 00:00:00.000000000 Z
11
+ date: 2014-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.0.rc3
19
+ version: 2.4.0
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.4.0.rc3
26
+ version: 2.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.4.0.rc3
33
+ version: 2.4.0
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.4.0.rc3
40
+ version: 2.4.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: jquery-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -96,6 +96,7 @@ files:
96
96
  - app/assets/javascripts/spree/backend/calculator.js
97
97
  - app/assets/javascripts/spree/backend/checkouts/edit.js
98
98
  - app/assets/javascripts/spree/backend/gateway.js
99
+ - app/assets/javascripts/spree/backend/general_settings.js.coffee
99
100
  - app/assets/javascripts/spree/backend/handlebar_extensions.js
100
101
  - app/assets/javascripts/spree/backend/images/index.js.coffee
101
102
  - app/assets/javascripts/spree/backend/images/new.js.coffee
@@ -317,7 +318,6 @@ files:
317
318
  - app/views/spree/admin/promotion_categories/edit.html.erb
318
319
  - app/views/spree/admin/promotion_categories/index.html.erb
319
320
  - app/views/spree/admin/promotion_categories/new.html.erb
320
- - app/views/spree/admin/promotion_categories/new.js.erb
321
321
  - app/views/spree/admin/promotion_rules/create.js.erb
322
322
  - app/views/spree/admin/promotion_rules/destroy.js.erb
323
323
  - app/views/spree/admin/promotions/_actions.html.erb
@@ -553,9 +553,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
553
553
  version: 1.9.3
554
554
  required_rubygems_version: !ruby/object:Gem::Requirement
555
555
  requirements:
556
- - - ">"
556
+ - - ">="
557
557
  - !ruby/object:Gem::Version
558
- version: 1.3.1
558
+ version: '0'
559
559
  requirements:
560
560
  - none
561
561
  rubyforge_project: spree_backend
@@ -1,5 +0,0 @@
1
- $("#new_promotion_category").html('<%= escape_javascript(render template: "spree/admin/promotion_categories/new", formats: [:html], handlers: [:erb]) %>');
2
- <% unless Rails.env.test? %>
3
- $('.select2').select2();
4
- <% end %>
5
- $("#new_promotion_category_link").parent().hide();