spree_core 0.70.0 → 0.70.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -210,7 +210,7 @@ $(document).ready(function(){
210
210
  $.each($('table.sortable tbody tr'), function(position, obj){
211
211
  reg = /(\w+_?)+_(\d+)/;
212
212
  parts = reg.exec($(obj).attr('id'));
213
- if (parts) {
213
+ if (parts) {
214
214
  positions['positions['+parts[2]+']'] = position;
215
215
  type = parts[1];
216
216
  }
@@ -227,3 +227,9 @@ $(document).ready(function(){
227
227
  });
228
228
 
229
229
  });
230
+
231
+ jQuery(document).ready(function() {
232
+ $('div.alert a.dismiss').click(function() {
233
+ $(this).parent().fadeOut();
234
+ });
235
+ });
@@ -588,3 +588,31 @@ span.handle{
588
588
  width:14px;
589
589
  height:15px;
590
590
  }
591
+
592
+ .alert {
593
+ -moz-border-radius: 5px;
594
+ -webkit-border-radius: 5px;
595
+ border-radius: 5px;
596
+ font-size: 1.3em;
597
+ margin-bottom: 1em;
598
+ padding: 0.8em;
599
+ }
600
+ .alert a.dismiss {
601
+ float:right;
602
+ font-size: 0.8em;
603
+ }
604
+ .alert.release {
605
+ background: #ccddff url(../images/shadow_top.png) 0px -50px repeat-x;
606
+ color: #556699;
607
+ border: 1px solid #99aacc;
608
+ }
609
+ .alert.security {
610
+ background: #f4b4b4 url(../images/shadow_top.png) 0px -50px repeat-x;
611
+ color: #000000;
612
+ border: 1px solid #e75b5b;
613
+ }
614
+ .alert.news {
615
+ background: #ccffd4 url(../images/shadow_top.png) 0px -50px repeat-x;
616
+ color: #000000;
617
+ border: 1px solid #66ff7e;
618
+ }
@@ -1,12 +1,42 @@
1
1
  class Admin::BaseController < Spree::BaseController
2
2
  ssl_required
3
3
 
4
+ before_filter :check_alerts if Rails.env.production?
5
+
4
6
  helper :search
5
7
  helper 'admin/navigation'
6
8
  layout 'admin'
7
9
 
8
10
  protected
9
-
11
+ def check_alerts
12
+ return unless current_user and should_check_alerts?
13
+
14
+ unless session.has_key? :alerts
15
+ begin
16
+ session[:alerts] = Spree::Alert.current(request.host)
17
+ filter_dismissed_alerts
18
+ Spree::Config.set :last_check_for_spree_alerts => DateTime.now.to_s
19
+ rescue
20
+ session[:alerts] = nil
21
+ end
22
+ end
23
+ end
24
+
25
+ def should_check_alerts?
26
+ return false if not Spree::Config[:check_for_spree_alerts]
27
+
28
+ last_check = Spree::Config[:last_check_for_spree_alerts]
29
+ return true if last_check.blank?
30
+
31
+ DateTime.parse(last_check) < 12.hours.ago
32
+ end
33
+
34
+ def filter_dismissed_alerts
35
+ return unless session[:alerts]
36
+ dismissed = (Spree::Config[:dismissed_spree_alerts] || '').split(',')
37
+ session[:alerts].reject! { |a| dismissed.include? a.id.to_s }
38
+ end
39
+
10
40
  def flash_message_for(object, event_sym)
11
41
  resource_desc = object.class.model_name.human
12
42
  resource_desc += " \"#{object.name}\"" if object.respond_to?(:name)
@@ -18,4 +18,13 @@ class Admin::GeneralSettingsController < Admin::BaseController
18
18
  redirect_to admin_general_settings_path
19
19
  end
20
20
 
21
+ def dismiss_alert
22
+ if request.xhr? and params[:alert_id]
23
+ dismissed = Spree::Config[:dismissed_spree_alerts] || ''
24
+ Spree::Config.set :dismissed_spree_alerts => dismissed.split(',').push(params[:alert_id]).join(',')
25
+ filter_dismissed_alerts
26
+ render :nothing => true
27
+ end
28
+ end
29
+
21
30
  end
@@ -39,6 +39,9 @@ class AppConfiguration < Configuration
39
39
  preference :allow_checkout_on_gateway_error, :boolean, :default => false
40
40
  preference :select_taxons_from_tree, :boolean, :default => false # provide opportunity to select taxons from tree instead of search with autocomplete
41
41
  preference :max_level_in_taxons_menu, :integer, :default => 1 # maximum nesting level in taxons menu
42
+ preference :check_for_spree_alerts, :boolean, :default => true
43
+ preference :dismissed_spree_alerts, :string, :default => ''
44
+ preference :last_check_for_spree_alerts, :string, :default => nil
42
45
 
43
46
  validates :name, :presence => true, :uniqueness => true
44
47
 
@@ -0,0 +1,13 @@
1
+ class Spree::Alert < ActiveResource::Base
2
+ self.site = "http://alerts.spreecommerce.com/"
3
+ self.format = :json
4
+
5
+ def self.current(host)
6
+ find(:all, :params => { :version => Spree.version,
7
+ :name => Spree::Config[:site_name],
8
+ :host => host,
9
+ :rails_env => Rails.env,
10
+ :rails_version => Rails.version })
11
+ end
12
+ end
13
+
@@ -0,0 +1,6 @@
1
+ <div class="alert <%= alert.severity.downcase %>">
2
+ <%= alert.message %> <%= link_to alert.url_name, alert.url if alert.url %>
3
+ <%= link_to 'X', dismiss_alert_admin_general_settings_path(:alert_id => alert.id),
4
+ :remote => true, :method => :post, :class => 'dismiss' %>
5
+ </div>
6
+
@@ -40,6 +40,8 @@
40
40
  <div class="flash notice"><%= notice %></div>
41
41
  <% end %>
42
42
 
43
+ <%= render :partial => 'admin/shared/alert', :collection => session[:alerts] %>
44
+
43
45
  <%= yield %>
44
46
 
45
47
  <% if content_for?(:sidebar) %>
@@ -937,6 +937,8 @@ en:
937
937
  ssl_will_be_used_in_production_mode: "SSL will be used in production mode"
938
938
  ssl_will_not_be_used_in_development_and_test_modes: "SSL will not be used in development and test mode if necessary."
939
939
  ssl_will_not_be_used_in_production_mode: "SSL will not be used in production mode"
940
+ spree_alert_checking: "Check for Spree security and release alerts"
941
+ spree_alert_not_checking: "Not checking for Spree security and release alerts"
940
942
  start: Start
941
943
  start_date: Valid from
942
944
  state: State
data/config/routes.rb CHANGED
@@ -159,7 +159,11 @@ Rails.application.routes.draw do
159
159
  end
160
160
  end
161
161
 
162
- resource :general_settings
162
+ resource :general_settings do
163
+ collection do
164
+ post :dismiss_alert
165
+ end
166
+ end
163
167
 
164
168
  resources :taxonomies do
165
169
  member do
@@ -56,15 +56,25 @@ Disallow: /users
56
56
  template "app/assets/stylesheets/admin/all.css"
57
57
  end
58
58
 
59
+ def create_overrides_directory
60
+ empty_directory "app/overrides"
61
+ end
62
+
59
63
  def configure_application
60
64
  application <<-APP
61
65
  config.middleware.use "SeoAssist"
62
66
  config.middleware.use "RedirectLegacyProductUrl"
63
67
 
64
68
  config.to_prepare do
69
+ #loads application's model / class decorators
65
70
  Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
66
71
  Rails.configuration.cache_classes ? require(c) : load(c)
67
72
  end
73
+
74
+ #loads application's deface view overrides
75
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
76
+ Rails.application.config.cache_classes ? require(c) : load(c)
77
+ end
68
78
  end
69
79
  APP
70
80
 
@@ -55,7 +55,7 @@ module SpreeCore
55
55
  end
56
56
 
57
57
  # sets the manifests / assets to be precompiled
58
- initializer "spree.assets.precompile", :group => :assets do |app|
58
+ initializer "spree.assets.precompile" do |app|
59
59
  app.config.assets.precompile += ['store/all.*', 'admin/all.*', 'admin/spree_dash.*', 'admin/orders/edit_form.js', 'jqPlot/excanvas.min.js', 'admin/images/new.js']
60
60
  end
61
61
 
@@ -1,5 +1,5 @@
1
1
  module Spree
2
2
  def self.version
3
- "0.70.0"
3
+ "0.70.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 263
4
+ hash: 261
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 70
9
- - 0
10
- version: 0.70.0
9
+ - 1
10
+ version: 0.70.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Schofield
@@ -15,12 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-07 00:00:00 Z
18
+ date: 2011-10-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- type: :runtime
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
22
  none: false
25
23
  requirements:
26
24
  - - "="
@@ -31,12 +29,12 @@ dependencies:
31
29
  - 1
32
30
  - 4
33
31
  version: 0.1.4
34
- version_requirements: *id001
35
- name: acts_as_list
36
- - !ruby/object:Gem::Dependency
32
+ requirement: *id001
37
33
  type: :runtime
38
34
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
35
+ name: acts_as_list
36
+ - !ruby/object:Gem::Dependency
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
38
  none: false
41
39
  requirements:
42
40
  - - "="
@@ -47,12 +45,12 @@ dependencies:
47
45
  - 6
48
46
  - 8
49
47
  version: 1.6.8
50
- version_requirements: *id002
51
- name: nested_set
52
- - !ruby/object:Gem::Dependency
48
+ requirement: *id002
53
49
  type: :runtime
54
50
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
51
+ name: nested_set
52
+ - !ruby/object:Gem::Dependency
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
54
  none: false
57
55
  requirements:
58
56
  - - "="
@@ -63,12 +61,12 @@ dependencies:
63
61
  - 1
64
62
  - 1
65
63
  version: 0.1.1
66
- version_requirements: *id003
67
- name: rd_find_by_param
68
- - !ruby/object:Gem::Dependency
64
+ requirement: *id003
69
65
  type: :runtime
70
66
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
67
+ name: rd_find_by_param
68
+ - !ruby/object:Gem::Dependency
69
+ version_requirements: &id004 !ruby/object:Gem::Requirement
72
70
  none: false
73
71
  requirements:
74
72
  - - ">="
@@ -79,12 +77,12 @@ dependencies:
79
77
  - 0
80
78
  - 14
81
79
  version: 1.0.14
82
- version_requirements: *id004
83
- name: jquery-rails
84
- - !ruby/object:Gem::Dependency
80
+ requirement: *id004
85
81
  type: :runtime
86
82
  prerelease: false
87
- requirement: &id005 !ruby/object:Gem::Requirement
83
+ name: jquery-rails
84
+ - !ruby/object:Gem::Dependency
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
88
86
  none: false
89
87
  requirements:
90
88
  - - "="
@@ -95,12 +93,12 @@ dependencies:
95
93
  - 5
96
94
  - 1
97
95
  version: 1.5.1
98
- version_requirements: *id005
99
- name: highline
100
- - !ruby/object:Gem::Dependency
96
+ requirement: *id005
101
97
  type: :runtime
102
98
  prerelease: false
103
- requirement: &id006 !ruby/object:Gem::Requirement
99
+ name: highline
100
+ - !ruby/object:Gem::Dependency
101
+ version_requirements: &id006 !ruby/object:Gem::Requirement
104
102
  none: false
105
103
  requirements:
106
104
  - - "="
@@ -111,12 +109,12 @@ dependencies:
111
109
  - 0
112
110
  - 3
113
111
  version: 1.0.3
114
- version_requirements: *id006
115
- name: stringex
116
- - !ruby/object:Gem::Dependency
112
+ requirement: *id006
117
113
  type: :runtime
118
114
  prerelease: false
119
- requirement: &id007 !ruby/object:Gem::Requirement
115
+ name: stringex
116
+ - !ruby/object:Gem::Dependency
117
+ version_requirements: &id007 !ruby/object:Gem::Requirement
120
118
  none: false
121
119
  requirements:
122
120
  - - "="
@@ -127,12 +125,12 @@ dependencies:
127
125
  - 0
128
126
  - 1
129
127
  version: 1.0.1
130
- version_requirements: *id007
131
- name: state_machine
132
- - !ruby/object:Gem::Dependency
128
+ requirement: *id007
133
129
  type: :runtime
134
130
  prerelease: false
135
- requirement: &id008 !ruby/object:Gem::Requirement
131
+ name: state_machine
132
+ - !ruby/object:Gem::Dependency
133
+ version_requirements: &id008 !ruby/object:Gem::Requirement
136
134
  none: false
137
135
  requirements:
138
136
  - - "="
@@ -143,12 +141,12 @@ dependencies:
143
141
  - 0
144
142
  - 0
145
143
  version: 1.0.0
146
- version_requirements: *id008
147
- name: faker
148
- - !ruby/object:Gem::Dependency
144
+ requirement: *id008
149
145
  type: :runtime
150
146
  prerelease: false
151
- requirement: &id009 !ruby/object:Gem::Requirement
147
+ name: faker
148
+ - !ruby/object:Gem::Dependency
149
+ version_requirements: &id009 !ruby/object:Gem::Requirement
152
150
  none: false
153
151
  requirements:
154
152
  - - "="
@@ -159,12 +157,12 @@ dependencies:
159
157
  - 4
160
158
  - 1
161
159
  version: 2.4.1
162
- version_requirements: *id009
163
- name: paperclip
164
- - !ruby/object:Gem::Dependency
160
+ requirement: *id009
165
161
  type: :runtime
166
162
  prerelease: false
167
- requirement: &id010 !ruby/object:Gem::Requirement
163
+ name: paperclip
164
+ - !ruby/object:Gem::Dependency
165
+ version_requirements: &id010 !ruby/object:Gem::Requirement
168
166
  none: false
169
167
  requirements:
170
168
  - - ">="
@@ -173,12 +171,12 @@ dependencies:
173
171
  segments:
174
172
  - 0
175
173
  version: "0"
176
- version_requirements: *id010
177
- name: rd_resource_controller
178
- - !ruby/object:Gem::Dependency
174
+ requirement: *id010
179
175
  type: :runtime
180
176
  prerelease: false
181
- requirement: &id011 !ruby/object:Gem::Requirement
177
+ name: rd_resource_controller
178
+ - !ruby/object:Gem::Dependency
179
+ version_requirements: &id011 !ruby/object:Gem::Requirement
182
180
  none: false
183
181
  requirements:
184
182
  - - "="
@@ -189,12 +187,12 @@ dependencies:
189
187
  - 1
190
188
  - 1
191
189
  version: 1.1.1
192
- version_requirements: *id011
193
- name: meta_search
194
- - !ruby/object:Gem::Dependency
190
+ requirement: *id011
195
191
  type: :runtime
196
192
  prerelease: false
197
- requirement: &id012 !ruby/object:Gem::Requirement
193
+ name: meta_search
194
+ - !ruby/object:Gem::Dependency
195
+ version_requirements: &id012 !ruby/object:Gem::Requirement
198
196
  none: false
199
197
  requirements:
200
198
  - - "="
@@ -205,12 +203,12 @@ dependencies:
205
203
  - 17
206
204
  - 0
207
205
  version: 1.17.0
208
- version_requirements: *id012
209
- name: activemerchant
210
- - !ruby/object:Gem::Dependency
206
+ requirement: *id012
211
207
  type: :runtime
212
208
  prerelease: false
213
- requirement: &id013 !ruby/object:Gem::Requirement
209
+ name: activemerchant
210
+ - !ruby/object:Gem::Dependency
211
+ version_requirements: &id013 !ruby/object:Gem::Requirement
214
212
  none: false
215
213
  requirements:
216
214
  - - "="
@@ -221,12 +219,12 @@ dependencies:
221
219
  - 1
222
220
  - 1
223
221
  version: 3.1.1
224
- version_requirements: *id013
225
- name: rails
226
- - !ruby/object:Gem::Dependency
222
+ requirement: *id013
227
223
  type: :runtime
228
224
  prerelease: false
229
- requirement: &id014 !ruby/object:Gem::Requirement
225
+ name: rails
226
+ - !ruby/object:Gem::Dependency
227
+ version_requirements: &id014 !ruby/object:Gem::Requirement
230
228
  none: false
231
229
  requirements:
232
230
  - - ">="
@@ -237,23 +235,25 @@ dependencies:
237
235
  - 12
238
236
  - 4
239
237
  version: 0.12.4
240
- version_requirements: *id014
241
- name: kaminari
242
- - !ruby/object:Gem::Dependency
238
+ requirement: *id014
243
239
  type: :runtime
244
240
  prerelease: false
245
- requirement: &id015 !ruby/object:Gem::Requirement
241
+ name: kaminari
242
+ - !ruby/object:Gem::Dependency
243
+ version_requirements: &id015 !ruby/object:Gem::Requirement
246
244
  none: false
247
245
  requirements:
248
246
  - - ">="
249
247
  - !ruby/object:Gem::Version
250
- hash: 5
248
+ hash: 3
251
249
  segments:
252
250
  - 0
253
- - 6
254
- - 1
255
- version: 0.6.1
256
- version_requirements: *id015
251
+ - 7
252
+ - 0
253
+ version: 0.7.0
254
+ requirement: *id015
255
+ type: :runtime
256
+ prerelease: false
257
257
  name: deface
258
258
  description: Required dependency for Spree
259
259
  email: sean@railsdog.com
@@ -510,6 +510,7 @@ files:
510
510
  - app/models/shipment.rb
511
511
  - app/models/shipping_category.rb
512
512
  - app/models/shipping_method.rb
513
+ - app/models/spree/alert.rb
513
514
  - app/models/state.rb
514
515
  - app/models/state_event.rb
515
516
  - app/models/tax_category.rb
@@ -621,6 +622,7 @@ files:
621
622
  - app/views/admin/shared/_additional_field.html.erb
622
623
  - app/views/admin/shared/_address.html.erb
623
624
  - app/views/admin/shared/_address_form.html.erb
625
+ - app/views/admin/shared/_alert.html.erb
624
626
  - app/views/admin/shared/_calculator_fields.html.erb
625
627
  - app/views/admin/shared/_configuration_menu.html.erb
626
628
  - app/views/admin/shared/_destroy.js.erb