spree_deprecated_user_agents 0.1.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.
- data/.gitignore +9 -0
- data/LICENSE +23 -0
- data/README.md +13 -0
- data/Rakefile +75 -0
- data/Versionfile +1 -0
- data/app/controllers/spree/base_controller_decorator.rb +15 -0
- data/app/views/shared/_warn_ie_6.html.erb +17 -0
- data/config/locales/en-US.yml +8 -0
- data/lib/spree_deprecated_user_agents.rb +17 -0
- data/lib/spree_deprecated_user_agents_hooks.rb +37 -0
- data/lib/tasks/install.rake +25 -0
- data/lib/tasks/spree_deprecated_user_agents.rake +1 -0
- data/public/images/dua_help.gif +0 -0
- data/public/images/dua_important.gif +0 -0
- data/public/images/dua_info.gif +0 -0
- data/public/images/dua_title.gif +0 -0
- data/public/javascripts/jquery.alerts.js +235 -0
- data/public/stylesheets/jquery.alerts.css +57 -0
- data/spec/dua_spec.rb +11 -0
- data/spec/spec_helper.rb +30 -0
- data/spree_deprecated_user_agents.gemspec +18 -0
- metadata +87 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Redistribution and use in source and binary forms, with or without modification,
|
2
|
+
are permitted provided that the following conditions are met:
|
3
|
+
|
4
|
+
* Redistributions of source code must retain the above copyright notice,
|
5
|
+
this list of conditions and the following disclaimer.
|
6
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
7
|
+
this list of conditions and the following disclaimer in the documentation
|
8
|
+
and/or other materials provided with the distribution.
|
9
|
+
* Neither the name of the Rails Dog LLC nor the names of its
|
10
|
+
contributors may be used to endorse or promote products derived from this
|
11
|
+
software without specific prior written permission.
|
12
|
+
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
14
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
15
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
16
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
17
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
18
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
19
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
20
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
21
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
22
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
23
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/packagetask'
|
5
|
+
require 'rake/gempackagetask'
|
6
|
+
|
7
|
+
gemfile = File.expand_path('../spec/test_app/Gemfile', __FILE__)
|
8
|
+
if File.exists?(gemfile) && (%w(spec cucumber).include?(ARGV.first.to_s) || ARGV.size == 0)
|
9
|
+
require 'bundler'
|
10
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
11
|
+
Bundler.setup
|
12
|
+
|
13
|
+
require 'rspec'
|
14
|
+
require 'rspec/core/rake_task'
|
15
|
+
RSpec::Core::RakeTask.new
|
16
|
+
|
17
|
+
require 'cucumber/rake/task'
|
18
|
+
Cucumber::Rake::Task.new do |t|
|
19
|
+
t.cucumber_opts = %w{--format progress}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Default Task"
|
24
|
+
task :default => [:spec, :cucumber ]
|
25
|
+
|
26
|
+
spec = eval(File.read('spree_deprecated_user_agents.gemspec'))
|
27
|
+
|
28
|
+
Rake::GemPackageTask.new(spec) do |p|
|
29
|
+
p.gem_spec = spec
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Release to gemcutter"
|
33
|
+
task :release => :package do
|
34
|
+
require 'rake/gemcutter'
|
35
|
+
Rake::Gemcutter::Tasks.new(spec).define
|
36
|
+
Rake::Task['gem:push'].invoke
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Default Task"
|
40
|
+
task :default => [ :spec ]
|
41
|
+
|
42
|
+
desc "Regenerates a rails 3 app for testing"
|
43
|
+
task :test_app do
|
44
|
+
require '../spree/lib/generators/spree/test_app_generator'
|
45
|
+
class SpreeDeprecatedUserAgentTestAppGenerator < Spree::Generators::TestAppGenerator
|
46
|
+
|
47
|
+
def install_gems
|
48
|
+
inside "test_app" do
|
49
|
+
run 'rake spree_core:install'
|
50
|
+
run 'rake spree_deprecated_user_agents:install'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def migrate_db
|
55
|
+
run_migrations
|
56
|
+
end
|
57
|
+
|
58
|
+
protected
|
59
|
+
def full_path_for_local_gems
|
60
|
+
<<-gems
|
61
|
+
gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "../spree/", "core")}\'
|
62
|
+
gem 'spree_deprecated_user_agents', :path => \'#{File.dirname(__FILE__)}\'
|
63
|
+
gems
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
SpreeDeprecatedUserAgentTestAppGenerator.start
|
68
|
+
end
|
69
|
+
|
70
|
+
namespace :test_app do
|
71
|
+
desc 'Rebuild test and cucumber databases'
|
72
|
+
task :rebuild_dbs do
|
73
|
+
system("cd spec/test_app && rake db:drop db:migrate RAILS_ENV=test && rake db:drop db:migrate RAILS_ENV=cucumber")
|
74
|
+
end
|
75
|
+
end
|
data/Versionfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
"0.50.x" => { :branch => "master" }
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Spree::BaseController.class_eval do
|
2
|
+
before_filter :dua_setup
|
3
|
+
|
4
|
+
private
|
5
|
+
|
6
|
+
def dua_setup
|
7
|
+
if Spree::Config.get(:dua_enabled)
|
8
|
+
unless cookies[:dua_been_warned]
|
9
|
+
@dua_enabled = Spree::Config.get(:dua_enabled) || true
|
10
|
+
@dua_message = Spree::Config.get(:dua_message) || "Your Browser is outdated, please upgrade to the latest version."
|
11
|
+
cookies[:dua_been_warned] = true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% if @dua_enabled %>
|
2
|
+
<script type="text/javascript" charset="utf-8">
|
3
|
+
var isRunningIE6OrBelow = false;
|
4
|
+
</script>
|
5
|
+
|
6
|
+
<!--[if lte IE 6]>
|
7
|
+
<script type="text/javascript">
|
8
|
+
isRunningIE6OrBelow = true;
|
9
|
+
</script>
|
10
|
+
<![endif]-->
|
11
|
+
|
12
|
+
<script language="javascript">
|
13
|
+
if(isRunningIE6OrBelow == true) {
|
14
|
+
jAlert('<%= @dua_message.gsub(/[\r\n]/, '' ) %>');
|
15
|
+
}
|
16
|
+
</script>
|
17
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
dua_enabled: "Deprecate User Agents"
|
4
|
+
dua_message: "Message for deprecated user agents:"
|
5
|
+
deprecated_user_agents: "Deprecated User Agents"
|
6
|
+
deprecated_user_agents_will_be_warned: "Deprecated user agents will be warned."
|
7
|
+
deprecated_user_agents_will_not_be_warned: "Deprecated user agents will not be warned"
|
8
|
+
message_for_deprecated_user_agents: "Message for deprecated user agents:"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spree_core'
|
2
|
+
require 'spree_deprecated_user_agents_hooks'
|
3
|
+
|
4
|
+
module SpreeDeprecatedUserAgents
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
|
7
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
8
|
+
|
9
|
+
def self.activate
|
10
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
|
11
|
+
Rails.env.production? ? require(c) : load(c)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
config.to_prepare &method(:activate).to_proc
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class SpreeDeprecatedUserAgentsHooks < Spree::ThemeSupport::HookListener
|
2
|
+
# custom hooks go here
|
3
|
+
insert_after :admin_general_settings_edit do
|
4
|
+
<<EOT
|
5
|
+
<p>
|
6
|
+
<%= check_box_tag('preferences[dua_enabled]', Spree::Config[:dua_enabled], Spree::Config[:dua_enabled]) %>
|
7
|
+
<label> <%= t("dua_enabled") %></label>
|
8
|
+
</p>
|
9
|
+
<p>
|
10
|
+
<label><%= t("dua_message") %></label><br />
|
11
|
+
<%= text_area_tag('preferences[dua_message]', Spree::Config[:dua_message], :size => "72x10") %>
|
12
|
+
</p>
|
13
|
+
EOT
|
14
|
+
end
|
15
|
+
|
16
|
+
insert_after :admin_general_settings_show do
|
17
|
+
<<EOT
|
18
|
+
<tr>
|
19
|
+
<td colspan="2"><strong><%= t('deprecated_user_agents') %></strong></td>
|
20
|
+
</tr>
|
21
|
+
<tr>
|
22
|
+
<td colspan="2">
|
23
|
+
<%= (Spree::Config[:dua_enabled] ? t("deprecated_user_agents_will_be_warned") : t("deprecated_user_agents_will_not_be_warned")) %>
|
24
|
+
</td>
|
25
|
+
</tr>
|
26
|
+
<tr>
|
27
|
+
<td colspan="2">
|
28
|
+
<%= t("message_for_deprecated_user_agents")%><br />
|
29
|
+
<div style="display: block; border: black 1px solid; height: 300px; width: 600px;">
|
30
|
+
<%= Spree::Config[:dua_message] %>
|
31
|
+
</div>
|
32
|
+
</td>
|
33
|
+
</tr>
|
34
|
+
EOT
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
namespace :spree_deprecated_user_agents do
|
2
|
+
desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
|
3
|
+
task :install do
|
4
|
+
Rake::Task['spree_deprecated_user_agents:install:migrations'].invoke
|
5
|
+
Rake::Task['spree_deprecated_user_agents:install:assets'].invoke
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :install do
|
9
|
+
desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
|
10
|
+
task :migrations do
|
11
|
+
source = File.join(File.dirname(__FILE__), '..', '..', 'db')
|
12
|
+
destination = File.join(Rails.root, 'db')
|
13
|
+
Spree::FileUtilz.mirror_files(source, destination)
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
|
17
|
+
task :assets do
|
18
|
+
source = File.join(File.dirname(__FILE__), '..', '..', 'public')
|
19
|
+
destination = File.join(Rails.root, 'public')
|
20
|
+
puts "INFO: Mirroring assets from #{source} to #{destination}"
|
21
|
+
Spree::FileUtilz.mirror_files(source, destination)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# add custom rake tasks here
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,235 @@
|
|
1
|
+
// jQuery Alert Dialogs Plugin
|
2
|
+
//
|
3
|
+
// Version 1.1
|
4
|
+
//
|
5
|
+
// Cory S.N. LaViska
|
6
|
+
// A Beautiful Site (http://abeautifulsite.net/)
|
7
|
+
// 14 May 2009
|
8
|
+
//
|
9
|
+
// Visit http://abeautifulsite.net/notebook/87 for more information
|
10
|
+
//
|
11
|
+
// Usage:
|
12
|
+
// jAlert( message, [title, callback] )
|
13
|
+
// jConfirm( message, [title, callback] )
|
14
|
+
// jPrompt( message, [value, title, callback] )
|
15
|
+
//
|
16
|
+
// History:
|
17
|
+
//
|
18
|
+
// 1.00 - Released (29 December 2008)
|
19
|
+
//
|
20
|
+
// 1.01 - Fixed bug where unbinding would destroy all resize events
|
21
|
+
//
|
22
|
+
// License:
|
23
|
+
//
|
24
|
+
// This plugin is dual-licensed under the GNU General Public License and the MIT License and
|
25
|
+
// is copyright 2008 A Beautiful Site, LLC.
|
26
|
+
//
|
27
|
+
(function($) {
|
28
|
+
|
29
|
+
$.alerts = {
|
30
|
+
|
31
|
+
// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
|
32
|
+
|
33
|
+
verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
|
34
|
+
horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
|
35
|
+
repositionOnResize: true, // re-centers the dialog on window resize
|
36
|
+
overlayOpacity: .01, // transparency level of overlay
|
37
|
+
overlayColor: '#FFF', // base color of overlay
|
38
|
+
draggable: true, // make the dialogs draggable (requires UI Draggables plugin)
|
39
|
+
okButton: ' OK ', // text for the OK button
|
40
|
+
cancelButton: ' Cancel ', // text for the Cancel button
|
41
|
+
dialogClass: null, // if specified, this class will be applied to all dialogs
|
42
|
+
|
43
|
+
// Public methods
|
44
|
+
|
45
|
+
alert: function(message, title, callback) {
|
46
|
+
if( title == null ) title = 'Alert';
|
47
|
+
$.alerts._show(title, message, null, 'alert', function(result) {
|
48
|
+
if( callback ) callback(result);
|
49
|
+
});
|
50
|
+
},
|
51
|
+
|
52
|
+
confirm: function(message, title, callback) {
|
53
|
+
if( title == null ) title = 'Confirm';
|
54
|
+
$.alerts._show(title, message, null, 'confirm', function(result) {
|
55
|
+
if( callback ) callback(result);
|
56
|
+
});
|
57
|
+
},
|
58
|
+
|
59
|
+
prompt: function(message, value, title, callback) {
|
60
|
+
if( title == null ) title = 'Prompt';
|
61
|
+
$.alerts._show(title, message, value, 'prompt', function(result) {
|
62
|
+
if( callback ) callback(result);
|
63
|
+
});
|
64
|
+
},
|
65
|
+
|
66
|
+
// Private methods
|
67
|
+
|
68
|
+
_show: function(title, msg, value, type, callback) {
|
69
|
+
|
70
|
+
$.alerts._hide();
|
71
|
+
$.alerts._overlay('show');
|
72
|
+
|
73
|
+
$("BODY").append(
|
74
|
+
'<div id="popup_container">' +
|
75
|
+
'<h1 id="popup_title"></h1>' +
|
76
|
+
'<div id="popup_content">' +
|
77
|
+
'<div id="popup_message"></div>' +
|
78
|
+
'</div>' +
|
79
|
+
'</div>');
|
80
|
+
|
81
|
+
if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
|
82
|
+
|
83
|
+
// IE6 Fix
|
84
|
+
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
|
85
|
+
|
86
|
+
$("#popup_container").css({
|
87
|
+
position: pos,
|
88
|
+
zIndex: 99999,
|
89
|
+
padding: 0,
|
90
|
+
margin: 0
|
91
|
+
});
|
92
|
+
|
93
|
+
$("#popup_title").text(title);
|
94
|
+
$("#popup_content").addClass(type);
|
95
|
+
$("#popup_message").text(msg);
|
96
|
+
$("#popup_message").html( $("#popup_message").text().replace(/\n/g, '<br />') );
|
97
|
+
|
98
|
+
$("#popup_container").css({
|
99
|
+
minWidth: $("#popup_container").outerWidth(),
|
100
|
+
maxWidth: $("#popup_container").outerWidth()
|
101
|
+
});
|
102
|
+
|
103
|
+
$.alerts._reposition();
|
104
|
+
$.alerts._maintainPosition(true);
|
105
|
+
|
106
|
+
switch( type ) {
|
107
|
+
case 'alert':
|
108
|
+
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
|
109
|
+
$("#popup_ok").click( function() {
|
110
|
+
$.alerts._hide();
|
111
|
+
callback(true);
|
112
|
+
});
|
113
|
+
$("#popup_ok").focus().keypress( function(e) {
|
114
|
+
if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
|
115
|
+
});
|
116
|
+
break;
|
117
|
+
case 'confirm':
|
118
|
+
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
119
|
+
$("#popup_ok").click( function() {
|
120
|
+
$.alerts._hide();
|
121
|
+
if( callback ) callback(true);
|
122
|
+
});
|
123
|
+
$("#popup_cancel").click( function() {
|
124
|
+
$.alerts._hide();
|
125
|
+
if( callback ) callback(false);
|
126
|
+
});
|
127
|
+
$("#popup_ok").focus();
|
128
|
+
$("#popup_ok, #popup_cancel").keypress( function(e) {
|
129
|
+
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
|
130
|
+
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
|
131
|
+
});
|
132
|
+
break;
|
133
|
+
case 'prompt':
|
134
|
+
$("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
135
|
+
$("#popup_prompt").width( $("#popup_message").width() );
|
136
|
+
$("#popup_ok").click( function() {
|
137
|
+
var val = $("#popup_prompt").val();
|
138
|
+
$.alerts._hide();
|
139
|
+
if( callback ) callback( val );
|
140
|
+
});
|
141
|
+
$("#popup_cancel").click( function() {
|
142
|
+
$.alerts._hide();
|
143
|
+
if( callback ) callback( null );
|
144
|
+
});
|
145
|
+
$("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
|
146
|
+
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
|
147
|
+
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
|
148
|
+
});
|
149
|
+
if( value ) $("#popup_prompt").val(value);
|
150
|
+
$("#popup_prompt").focus().select();
|
151
|
+
break;
|
152
|
+
}
|
153
|
+
|
154
|
+
// Make draggable
|
155
|
+
if( $.alerts.draggable ) {
|
156
|
+
try {
|
157
|
+
$("#popup_container").draggable({ handle: $("#popup_title") });
|
158
|
+
$("#popup_title").css({ cursor: 'move' });
|
159
|
+
} catch(e) { /* requires jQuery UI draggables */ }
|
160
|
+
}
|
161
|
+
},
|
162
|
+
|
163
|
+
_hide: function() {
|
164
|
+
$("#popup_container").remove();
|
165
|
+
$.alerts._overlay('hide');
|
166
|
+
$.alerts._maintainPosition(false);
|
167
|
+
},
|
168
|
+
|
169
|
+
_overlay: function(status) {
|
170
|
+
switch( status ) {
|
171
|
+
case 'show':
|
172
|
+
$.alerts._overlay('hide');
|
173
|
+
$("BODY").append('<div id="popup_overlay"></div>');
|
174
|
+
$("#popup_overlay").css({
|
175
|
+
position: 'absolute',
|
176
|
+
zIndex: 99998,
|
177
|
+
top: '0px',
|
178
|
+
left: '0px',
|
179
|
+
width: '100%',
|
180
|
+
height: $(document).height(),
|
181
|
+
background: $.alerts.overlayColor,
|
182
|
+
opacity: $.alerts.overlayOpacity
|
183
|
+
});
|
184
|
+
break;
|
185
|
+
case 'hide':
|
186
|
+
$("#popup_overlay").remove();
|
187
|
+
break;
|
188
|
+
}
|
189
|
+
},
|
190
|
+
|
191
|
+
_reposition: function() {
|
192
|
+
var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
|
193
|
+
var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
|
194
|
+
if( top < 0 ) top = 0;
|
195
|
+
if( left < 0 ) left = 0;
|
196
|
+
|
197
|
+
// IE6 fix
|
198
|
+
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
|
199
|
+
|
200
|
+
$("#popup_container").css({
|
201
|
+
top: top + 'px',
|
202
|
+
left: left + 'px'
|
203
|
+
});
|
204
|
+
$("#popup_overlay").height( $(document).height() );
|
205
|
+
},
|
206
|
+
|
207
|
+
_maintainPosition: function(status) {
|
208
|
+
if( $.alerts.repositionOnResize ) {
|
209
|
+
switch(status) {
|
210
|
+
case true:
|
211
|
+
$(window).bind('resize', $.alerts._reposition);
|
212
|
+
break;
|
213
|
+
case false:
|
214
|
+
$(window).unbind('resize', $.alerts._reposition);
|
215
|
+
break;
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
}
|
221
|
+
|
222
|
+
// Shortuct functions
|
223
|
+
jAlert = function(message, title, callback) {
|
224
|
+
$.alerts.alert(message, title, callback);
|
225
|
+
}
|
226
|
+
|
227
|
+
jConfirm = function(message, title, callback) {
|
228
|
+
$.alerts.confirm(message, title, callback);
|
229
|
+
};
|
230
|
+
|
231
|
+
jPrompt = function(message, value, title, callback) {
|
232
|
+
$.alerts.prompt(message, value, title, callback);
|
233
|
+
};
|
234
|
+
|
235
|
+
})(jQuery);
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#popup_container {
|
2
|
+
font-family: Arial, sans-serif;
|
3
|
+
font-size: 12px;
|
4
|
+
min-width: 300px; /* Dialog will be no smaller than this */
|
5
|
+
max-width: 600px; /* Dialog will wrap after this width */
|
6
|
+
background: #FFF;
|
7
|
+
border: solid 5px #999;
|
8
|
+
color: #000;
|
9
|
+
-moz-border-radius: 5px;
|
10
|
+
-webkit-border-radius: 5px;
|
11
|
+
border-radius: 5px;
|
12
|
+
}
|
13
|
+
|
14
|
+
#popup_title {
|
15
|
+
font-size: 14px;
|
16
|
+
font-weight: bold;
|
17
|
+
text-align: center;
|
18
|
+
line-height: 1.75em;
|
19
|
+
color: #666;
|
20
|
+
background: #CCC url(images/dua_title.gif) top repeat-x;
|
21
|
+
border: solid 1px #FFF;
|
22
|
+
border-bottom: solid 1px #999;
|
23
|
+
cursor: default;
|
24
|
+
padding: 0em;
|
25
|
+
margin: 0em;
|
26
|
+
}
|
27
|
+
|
28
|
+
#popup_content {
|
29
|
+
background: 16px 16px no-repeat url(images/dua_info.gif);
|
30
|
+
padding: 1em 1.75em;
|
31
|
+
margin: 0em;
|
32
|
+
}
|
33
|
+
|
34
|
+
#popup_content.alert {
|
35
|
+
background-image: url(images/dua_info.gif);
|
36
|
+
}
|
37
|
+
|
38
|
+
#popup_content.confirm {
|
39
|
+
background-image: url(images/dua_important.gif);
|
40
|
+
}
|
41
|
+
|
42
|
+
#popup_content.prompt {
|
43
|
+
background-image: url(images/dua_help.gif);
|
44
|
+
}
|
45
|
+
|
46
|
+
#popup_message {
|
47
|
+
padding-left: 48px;
|
48
|
+
}
|
49
|
+
|
50
|
+
#popup_panel {
|
51
|
+
text-align: center;
|
52
|
+
margin: 1em 0em 0em 1em;
|
53
|
+
}
|
54
|
+
|
55
|
+
#popup_prompt {
|
56
|
+
margin: .5em 0em;
|
57
|
+
}
|
data/spec/dua_spec.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
describe "SpreeDeprecatedUserAgents" do
|
5
|
+
it "is untestable without adding more dependencies and setup" do
|
6
|
+
message =
|
7
|
+
"This will need a javascript capable test browser that can pretend to be
|
8
|
+
IE 6, including processing IE specific preprocessing like:
|
9
|
+
<!--[if lte IE 6]>"
|
10
|
+
end
|
11
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
2
|
+
# from the project root directory.
|
3
|
+
ENV["RAILS_ENV"] ||= 'test'
|
4
|
+
require File.expand_path("../test_app/config/environment", __FILE__)
|
5
|
+
require 'rspec/rails'
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
# == Mock Framework
|
13
|
+
#
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
+
#
|
16
|
+
# config.mock_with :mocha
|
17
|
+
# config.mock_with :flexmock
|
18
|
+
# config.mock_with :rr
|
19
|
+
config.mock_with :rspec
|
20
|
+
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
#config.include Devise::TestHelpers, :type => :controller
|
24
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
25
|
+
# examples within a transaction, comment the following line or assign false
|
26
|
+
# instead of true.
|
27
|
+
config.use_transactional_fixtures = true
|
28
|
+
end
|
29
|
+
|
30
|
+
@configuration ||= AppConfiguration.find_or_create_by_name("Default configuration")
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.platform = Gem::Platform::RUBY
|
3
|
+
s.name = 'spree_deprecated_user_agents'
|
4
|
+
s.version = '0.1.0'
|
5
|
+
s.summary = ''
|
6
|
+
s.description = 'Add (optional) gem description here'
|
7
|
+
s.required_ruby_version = '>= 1.8.7'
|
8
|
+
|
9
|
+
s.author = 'Christopher Maujean'
|
10
|
+
s.email = 'cmaujean@gmail.com'
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.require_path = 'lib'
|
15
|
+
s.requirements << 'none'
|
16
|
+
|
17
|
+
s.add_dependency('spree_core', '>= 0.50.0')
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_deprecated_user_agents
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Christopher Maujean
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-06 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: spree_core
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.50.0
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
description: Add (optional) gem description here
|
28
|
+
email: cmaujean@gmail.com
|
29
|
+
executables: []
|
30
|
+
|
31
|
+
extensions: []
|
32
|
+
|
33
|
+
extra_rdoc_files: []
|
34
|
+
|
35
|
+
files:
|
36
|
+
- .gitignore
|
37
|
+
- LICENSE
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- Versionfile
|
41
|
+
- app/controllers/spree/base_controller_decorator.rb
|
42
|
+
- app/views/shared/_warn_ie_6.html.erb
|
43
|
+
- config/locales/en-US.yml
|
44
|
+
- lib/spree_deprecated_user_agents.rb
|
45
|
+
- lib/spree_deprecated_user_agents_hooks.rb
|
46
|
+
- lib/tasks/install.rake
|
47
|
+
- lib/tasks/spree_deprecated_user_agents.rake
|
48
|
+
- public/images/dua_help.gif
|
49
|
+
- public/images/dua_important.gif
|
50
|
+
- public/images/dua_info.gif
|
51
|
+
- public/images/dua_title.gif
|
52
|
+
- public/javascripts/jquery.alerts.js
|
53
|
+
- public/stylesheets/jquery.alerts.css
|
54
|
+
- spec/dua_spec.rb
|
55
|
+
- spec/spec_helper.rb
|
56
|
+
- spree_deprecated_user_agents.gemspec
|
57
|
+
has_rdoc: true
|
58
|
+
homepage:
|
59
|
+
licenses: []
|
60
|
+
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 1.8.7
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
requirements:
|
79
|
+
- none
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 1.6.2
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: ""
|
85
|
+
test_files:
|
86
|
+
- spec/dua_spec.rb
|
87
|
+
- spec/spec_helper.rb
|