spree_core 0.30.1 → 0.30.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/base_controller.rb +31 -0
- data/app/models/app_configuration.rb +3 -0
- data/app/models/product_group.rb +8 -4
- data/app/models/spree/alert.rb +13 -0
- data/app/views/admin/general_settings/edit.html.erb +8 -0
- data/app/views/admin/general_settings/show.html.erb +10 -5
- data/app/views/admin/shared/_alert.html.erb +6 -0
- data/app/views/layouts/admin.html.erb +1 -0
- data/config/locales/en.yml +2 -0
- data/config/routes.rb +5 -1
- data/lib/spree_core.rb +1 -1
- data/public/javascripts/admin.js +6 -0
- data/public/stylesheets/admin/admin.css +34 -0
- metadata +57 -23
@@ -1,6 +1,8 @@
|
|
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'
|
@@ -8,6 +10,35 @@ class Admin::BaseController < Spree::BaseController
|
|
8
10
|
before_filter :parse_date_params
|
9
11
|
|
10
12
|
protected
|
13
|
+
def check_alerts
|
14
|
+
return unless current_user and should_check_alerts?
|
15
|
+
|
16
|
+
unless session.has_key? :alerts
|
17
|
+
begin
|
18
|
+
session[:alerts] = Spree::Alert.current(request.host)
|
19
|
+
filter_dismissed_alerts
|
20
|
+
Spree::Config.set :last_check_for_spree_alerts => DateTime.now.to_s
|
21
|
+
rescue
|
22
|
+
session[:alerts] = nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def should_check_alerts?
|
28
|
+
return false if not Spree::Config[:check_for_spree_alerts]
|
29
|
+
|
30
|
+
last_check = Spree::Config[:last_check_for_spree_alerts]
|
31
|
+
return true if last_check.blank?
|
32
|
+
|
33
|
+
DateTime.parse(last_check) < 12.hours.ago
|
34
|
+
end
|
35
|
+
|
36
|
+
def filter_dismissed_alerts
|
37
|
+
return unless session[:alerts]
|
38
|
+
dismissed = (Spree::Config[:dismissed_spree_alerts] || '').split(',')
|
39
|
+
session[:alerts].reject! { |a| dismissed.include? a.id.to_s }
|
40
|
+
end
|
41
|
+
|
11
42
|
def render_js_for_destroy
|
12
43
|
render :partial => "/admin/shared/destroy"
|
13
44
|
flash.notice = nil
|
@@ -35,6 +35,9 @@ class AppConfiguration < Configuration
|
|
35
35
|
preference :cache_static_content, :boolean, :default => true
|
36
36
|
preference :use_content_controller, :boolean, :default => true
|
37
37
|
preference :allow_checkout_on_gateway_error, :boolean, :default => false
|
38
|
+
preference :check_for_spree_alerts, :boolean, :default => true
|
39
|
+
preference :dismissed_spree_alerts, :string, :default => ''
|
40
|
+
preference :last_check_for_spree_alerts, :string, :default => nil
|
38
41
|
|
39
42
|
validates :name, :presence => true, :uniqueness => true
|
40
43
|
|
data/app/models/product_group.rb
CHANGED
@@ -90,10 +90,14 @@ class ProductGroup < ActiveRecord::Base
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def add_scope(scope_name, arguments=[])
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
if scope_name.to_s !~ /eval|send|system|[^a-z0-9_!?]/
|
94
|
+
self.product_scopes << ProductScope.new({
|
95
|
+
:name => scope_name.to_s,
|
96
|
+
:arguments => [*arguments]
|
97
|
+
})
|
98
|
+
else
|
99
|
+
raise ArgumentError.new("'#{scope_name}` can't be used as scope")
|
100
|
+
end
|
97
101
|
self
|
98
102
|
end
|
99
103
|
|
@@ -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
|
+
|
@@ -28,6 +28,14 @@
|
|
28
28
|
</label>
|
29
29
|
</p>
|
30
30
|
|
31
|
+
<p>
|
32
|
+
<label>
|
33
|
+
<input name="preferences[check_for_spree_alerts]" type="hidden" value="0" />
|
34
|
+
<%= check_box_tag('preferences[check_for_spree_alerts]', "1", Spree::Config[:check_for_spree_alerts]) %>
|
35
|
+
<%= t('spree_alert_checking') %>
|
36
|
+
</label>
|
37
|
+
</p>
|
38
|
+
|
31
39
|
<p class="form-buttons">
|
32
40
|
<%= button t('update') %>
|
33
41
|
<%= t("or") %> <%= link_to t("cancel"), admin_general_settings_url %>
|
@@ -4,25 +4,30 @@
|
|
4
4
|
|
5
5
|
<table>
|
6
6
|
<tr>
|
7
|
-
<th scope="row"><%= t("site_name") %>:</th>
|
7
|
+
<th scope="row"><%= t("site_name") %>:</th>
|
8
8
|
<td><%= Spree::Config[:site_name] %></td>
|
9
9
|
</tr>
|
10
10
|
<tr>
|
11
|
-
<th scope="row"><%= t("site_url") %>:</th>
|
11
|
+
<th scope="row"><%= t("site_url") %>:</th>
|
12
12
|
<td><%= Spree::Config[:site_url] %></td>
|
13
13
|
</tr>
|
14
14
|
<tr>
|
15
15
|
<td colspan="2">
|
16
|
-
<%= (Spree::Config[:allow_ssl_in_production] ? t("ssl_will_be_used_in_production_mode") : t("ssl_will_not_be_used_in_production_mode")) %>
|
16
|
+
<%= (Spree::Config[:allow_ssl_in_production] ? t("ssl_will_be_used_in_production_mode") : t("ssl_will_not_be_used_in_production_mode")) %>
|
17
17
|
</td>
|
18
18
|
</tr>
|
19
19
|
<tr>
|
20
20
|
<td colspan="2">
|
21
21
|
<%= (Spree::Config[:allow_ssl_in_development_and_test] ? t("ssl_will_be_used_in_development_and_test_modes") : t("ssl_will_not_be_used_in_development_and_test_modes")) %>
|
22
|
-
</td>
|
22
|
+
</td>
|
23
|
+
</tr>
|
24
|
+
<tr>
|
25
|
+
<td colspan="2">
|
26
|
+
<%= (Spree::Config[:check_for_spree_alerts] ? t("spree_alert_checking") : t("spree_alert_not_checking")) %>
|
27
|
+
</td>
|
23
28
|
</tr>
|
24
29
|
</table>
|
25
30
|
|
26
|
-
<p><%= link_to_with_icon 'edit', t("edit"), edit_admin_general_settings_path %></p>
|
31
|
+
<p><%= link_to_with_icon 'edit', t("edit"), edit_admin_general_settings_path, :id => 'admin_general_settings_link' %></p>
|
27
32
|
|
28
33
|
|
@@ -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
|
+
|
data/config/locales/en.yml
CHANGED
@@ -880,6 +880,8 @@ en:
|
|
880
880
|
ssl_will_be_used_in_production_mode: "SSL will be used in production mode"
|
881
881
|
ssl_will_not_be_used_in_development_and_test_modes: "SSL will not be used in development and test mode if necessary."
|
882
882
|
ssl_will_not_be_used_in_production_mode: "SSL will not be used in production mode"
|
883
|
+
spree_alert_checking: "Check for Spree security and release alerts"
|
884
|
+
spree_alert_not_checking: "Not checking for Spree security and release alerts"
|
883
885
|
start: Start
|
884
886
|
start_date: Valid from
|
885
887
|
state: State
|
data/config/routes.rb
CHANGED
data/lib/spree_core.rb
CHANGED
data/public/javascripts/admin.js
CHANGED
@@ -577,3 +577,37 @@ table#product_scopes tr td table tr td {
|
|
577
577
|
}
|
578
578
|
|
579
579
|
|
580
|
+
span.handle{
|
581
|
+
background-image: url(../../images/reorder.jpg);
|
582
|
+
display: inline-block;
|
583
|
+
width:14px;
|
584
|
+
height:15px;
|
585
|
+
}
|
586
|
+
|
587
|
+
.alert {
|
588
|
+
-moz-border-radius: 5px;
|
589
|
+
-webkit-border-radius: 5px;
|
590
|
+
border-radius: 5px;
|
591
|
+
font-size: 1.3em;
|
592
|
+
margin-bottom: 1em;
|
593
|
+
padding: 0.8em;
|
594
|
+
}
|
595
|
+
.alert a.dismiss {
|
596
|
+
float:right;
|
597
|
+
font-size: 0.8em;
|
598
|
+
}
|
599
|
+
.alert.release {
|
600
|
+
background: #ccddff url(../images/shadow_top.png) 0px -50px repeat-x;
|
601
|
+
color: #556699;
|
602
|
+
border: 1px solid #99aacc;
|
603
|
+
}
|
604
|
+
.alert.security {
|
605
|
+
background: #f4b4b4 url(../images/shadow_top.png) 0px -50px repeat-x;
|
606
|
+
color: #000000;
|
607
|
+
border: 1px solid #e75b5b;
|
608
|
+
}
|
609
|
+
.alert.news {
|
610
|
+
background: #ccffd4 url(../images/shadow_top.png) 0px -50px repeat-x;
|
611
|
+
color: #000000;
|
612
|
+
border: 1px solid #66ff7e;
|
613
|
+
}
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 99
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 30
|
8
|
-
-
|
9
|
-
version: 0.30.
|
9
|
+
- 2
|
10
|
+
version: 0.30.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Sean Schofield
|
@@ -14,16 +15,17 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
18
|
+
date: 2011-10-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: acts_as_list
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
|
-
- - "
|
26
|
+
- - "="
|
26
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 31
|
27
29
|
segments:
|
28
30
|
- 0
|
29
31
|
- 1
|
@@ -35,9 +37,11 @@ dependencies:
|
|
35
37
|
name: rd_awesome_nested_set
|
36
38
|
prerelease: false
|
37
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
38
41
|
requirements:
|
39
|
-
- - "
|
42
|
+
- - "="
|
40
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 15
|
41
45
|
segments:
|
42
46
|
- 1
|
43
47
|
- 4
|
@@ -49,9 +53,11 @@ dependencies:
|
|
49
53
|
name: rd_unobtrusive_date_picker
|
50
54
|
prerelease: false
|
51
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
52
57
|
requirements:
|
53
|
-
- - "
|
58
|
+
- - "="
|
54
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 27
|
55
61
|
segments:
|
56
62
|
- 0
|
57
63
|
- 1
|
@@ -63,9 +69,11 @@ dependencies:
|
|
63
69
|
name: highline
|
64
70
|
prerelease: false
|
65
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
66
73
|
requirements:
|
67
|
-
- - "
|
74
|
+
- - "="
|
68
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 1
|
69
77
|
segments:
|
70
78
|
- 1
|
71
79
|
- 5
|
@@ -77,9 +85,11 @@ dependencies:
|
|
77
85
|
name: stringex
|
78
86
|
prerelease: false
|
79
87
|
requirement: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
80
89
|
requirements:
|
81
|
-
- - "
|
90
|
+
- - "="
|
82
91
|
- !ruby/object:Gem::Version
|
92
|
+
hash: 17
|
83
93
|
segments:
|
84
94
|
- 1
|
85
95
|
- 0
|
@@ -91,9 +101,11 @@ dependencies:
|
|
91
101
|
name: state_machine
|
92
102
|
prerelease: false
|
93
103
|
requirement: &id006 !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
94
105
|
requirements:
|
95
|
-
- - "
|
106
|
+
- - "="
|
96
107
|
- !ruby/object:Gem::Version
|
108
|
+
hash: 51
|
97
109
|
segments:
|
98
110
|
- 0
|
99
111
|
- 9
|
@@ -105,9 +117,11 @@ dependencies:
|
|
105
117
|
name: faker
|
106
118
|
prerelease: false
|
107
119
|
requirement: &id007 !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
108
121
|
requirements:
|
109
|
-
- - "
|
122
|
+
- - "="
|
110
123
|
- !ruby/object:Gem::Version
|
124
|
+
hash: 17
|
111
125
|
segments:
|
112
126
|
- 0
|
113
127
|
- 3
|
@@ -119,9 +133,11 @@ dependencies:
|
|
119
133
|
name: paperclip
|
120
134
|
prerelease: false
|
121
135
|
requirement: &id008 !ruby/object:Gem::Requirement
|
136
|
+
none: false
|
122
137
|
requirements:
|
123
|
-
- - "
|
138
|
+
- - "="
|
124
139
|
- !ruby/object:Gem::Version
|
140
|
+
hash: 113
|
125
141
|
segments:
|
126
142
|
- 2
|
127
143
|
- 3
|
@@ -134,9 +150,11 @@ dependencies:
|
|
134
150
|
name: rd_resource_controller
|
135
151
|
prerelease: false
|
136
152
|
requirement: &id009 !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
137
154
|
requirements:
|
138
155
|
- - ">="
|
139
156
|
- !ruby/object:Gem::Version
|
157
|
+
hash: 3
|
140
158
|
segments:
|
141
159
|
- 0
|
142
160
|
version: "0"
|
@@ -146,14 +164,17 @@ dependencies:
|
|
146
164
|
name: rd_searchlogic
|
147
165
|
prerelease: false
|
148
166
|
requirement: &id010 !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
149
168
|
requirements:
|
150
|
-
- - "
|
169
|
+
- - "="
|
151
170
|
- !ruby/object:Gem::Version
|
171
|
+
hash: 15424115
|
152
172
|
segments:
|
153
173
|
- 3
|
154
174
|
- 0
|
155
175
|
- 0
|
156
|
-
-
|
176
|
+
- rc
|
177
|
+
- 3
|
157
178
|
version: 3.0.0.rc3
|
158
179
|
type: :runtime
|
159
180
|
version_requirements: *id010
|
@@ -161,9 +182,11 @@ dependencies:
|
|
161
182
|
name: activemerchant
|
162
183
|
prerelease: false
|
163
184
|
requirement: &id011 !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
164
186
|
requirements:
|
165
|
-
- - "
|
187
|
+
- - "="
|
166
188
|
- !ruby/object:Gem::Version
|
189
|
+
hash: 9
|
167
190
|
segments:
|
168
191
|
- 1
|
169
192
|
- 7
|
@@ -175,9 +198,11 @@ dependencies:
|
|
175
198
|
name: will_paginate
|
176
199
|
prerelease: false
|
177
200
|
requirement: &id012 !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
178
202
|
requirements:
|
179
|
-
- - "
|
203
|
+
- - "="
|
180
204
|
- !ruby/object:Gem::Version
|
205
|
+
hash: 961915916
|
181
206
|
segments:
|
182
207
|
- 3
|
183
208
|
- 0
|
@@ -189,23 +214,27 @@ dependencies:
|
|
189
214
|
name: rails
|
190
215
|
prerelease: false
|
191
216
|
requirement: &id013 !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
192
218
|
requirements:
|
193
|
-
- - "
|
219
|
+
- - "="
|
194
220
|
- !ruby/object:Gem::Version
|
221
|
+
hash: 15
|
195
222
|
segments:
|
196
223
|
- 3
|
197
224
|
- 0
|
198
|
-
-
|
199
|
-
version: 3.0.
|
225
|
+
- 4
|
226
|
+
version: 3.0.4
|
200
227
|
type: :runtime
|
201
228
|
version_requirements: *id013
|
202
229
|
- !ruby/object:Gem::Dependency
|
203
230
|
name: jquery-rails
|
204
231
|
prerelease: false
|
205
232
|
requirement: &id014 !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
206
234
|
requirements:
|
207
|
-
- - "
|
235
|
+
- - "="
|
208
236
|
- !ruby/object:Gem::Version
|
237
|
+
hash: 19
|
209
238
|
segments:
|
210
239
|
- 0
|
211
240
|
- 2
|
@@ -343,6 +372,7 @@ files:
|
|
343
372
|
- app/models/shipment.rb
|
344
373
|
- app/models/shipping_category.rb
|
345
374
|
- app/models/shipping_method.rb
|
375
|
+
- app/models/spree/alert.rb
|
346
376
|
- app/models/state.rb
|
347
377
|
- app/models/state_event.rb
|
348
378
|
- app/models/state_monitor.rb
|
@@ -471,6 +501,7 @@ files:
|
|
471
501
|
- app/views/admin/shared/_address.html.erb
|
472
502
|
- app/views/admin/shared/_address_form.html.erb
|
473
503
|
- app/views/admin/shared/_adjustments_table.html.erb
|
504
|
+
- app/views/admin/shared/_alert.html.erb
|
474
505
|
- app/views/admin/shared/_calculator_fields.html.erb
|
475
506
|
- app/views/admin/shared/_configuration_menu.html.erb
|
476
507
|
- app/views/admin/shared/_destroy.js.erb
|
@@ -1032,7 +1063,6 @@ files:
|
|
1032
1063
|
- public/stylesheets/jquery.autocomplete.css
|
1033
1064
|
- public/stylesheets/scaffold.css
|
1034
1065
|
- public/stylesheets/screen.css
|
1035
|
-
has_rdoc: true
|
1036
1066
|
homepage: http://spreecommerce.com
|
1037
1067
|
licenses: []
|
1038
1068
|
|
@@ -1042,25 +1072,29 @@ rdoc_options: []
|
|
1042
1072
|
require_paths:
|
1043
1073
|
- lib
|
1044
1074
|
required_ruby_version: !ruby/object:Gem::Requirement
|
1075
|
+
none: false
|
1045
1076
|
requirements:
|
1046
1077
|
- - ">="
|
1047
1078
|
- !ruby/object:Gem::Version
|
1079
|
+
hash: 57
|
1048
1080
|
segments:
|
1049
1081
|
- 1
|
1050
1082
|
- 8
|
1051
1083
|
- 7
|
1052
1084
|
version: 1.8.7
|
1053
1085
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1086
|
+
none: false
|
1054
1087
|
requirements:
|
1055
1088
|
- - ">="
|
1056
1089
|
- !ruby/object:Gem::Version
|
1090
|
+
hash: 3
|
1057
1091
|
segments:
|
1058
1092
|
- 0
|
1059
1093
|
version: "0"
|
1060
1094
|
requirements:
|
1061
1095
|
- none
|
1062
1096
|
rubyforge_project: spree_core
|
1063
|
-
rubygems_version: 1.
|
1097
|
+
rubygems_version: 1.8.10
|
1064
1098
|
signing_key:
|
1065
1099
|
specification_version: 3
|
1066
1100
|
summary: Core e-commerce functionality for the Spree project.
|