Permalink
Browse files

fix js breakage in some browsers due to console.log call failures

- use html5boilerplate's plugins.js

fix sporadically passing specs
  • Loading branch information...
1 parent a65cc72 commit 18aba141cc5cf7bb9db8cc6f33c9619bf62de98d @inertialbit inertialbit committed May 9, 2012
@@ -1,6 +1,6 @@
module ApplicationHelper
include CkeditorHelper
-
+
def top_menu
@top_menu ? @top_menu.body_for_display : "TODO: create the top menu"
end
@@ -27,7 +27,7 @@ def search_box(options = {})
def site_title
@site_title ||= SiteSetting.read_setting('site title') || "A Site [edit me in site settings]"
end
-
+
def blog_title
@blog_title ||= SiteSetting.read_setting('blog title') || "Blog [edit me in site settings]"
end
@@ -93,7 +93,7 @@ def site_footer
end
def user_box(my_options={})
- options = { :include_line_breaks => true, :include_blog_link => true,
+ options = { :include_line_breaks => true, :include_blog_link => true,
:include_events_link => true, :include_wiki_link => true,
:include_forum_link => true,
:link_separator => ' | '
@@ -103,7 +103,7 @@ def user_box(my_options={})
if current_user
out += "Welcome, #{current_user.first_name}! "
if(options[:include_line_breaks])
- out += "<br />"
+ out += "<br />"
end
out += link_to("My Account", account_path) + options[:link_separator].html_safe +
link_to("Logout", user_session_path, :method => :delete,
@@ -135,7 +135,7 @@ def user_box(my_options={})
end
unless other_links.empty?
if(options[:include_line_breaks])
- out += "<br/>"
+ out += "<br/>"
else
out += options[:link_separator]
end
@@ -197,14 +197,15 @@ def uniq_filenames(file_paths_or_names)
end
def javascripts
uniq_filenames(
- host_javascripts +
+ host_javascripts +
behaviors +
['app.js']
)
end
def host_javascripts
list = [
- 'rails', 'lowpro.jquery.js',
+ 'h5bp-plugins',
+ 'rails', 'lowpro.jquery.js',
'jquery.string.1.0-min.js',
'jquery.clonePosition.js',
'jquery.qtip-1.0.0-rc3.js',
@@ -0,0 +1,11 @@
+// usage: log('inside coolFunc', this, arguments);
+// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
+window.log = function f(){ log.history = log.history || []; log.history.push(arguments); if(this.console) { var args = arguments, newarr; args.callee = args.callee.caller; newarr = [].slice.call(args); if (typeof console.log === 'object') log.apply.call(console.log, console, newarr); else console.log.apply(console, newarr);}};
+
+// make it safe to use console.log always
+(function(a){function b(){}for(var c="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),d;!!(d=c.pop());){a[d]=a[d]||b;}})
+(function(){try{console.log();return window.console;}catch(a){return (window.console={});}}());
+
+
+// place any jQuery/helper plugins in here, instead of separate, slower script files.
+
@@ -49,9 +49,9 @@ class Event; extend ActiveModel::Naming; def self.base_class; Event; end end
end
it "should know whether its file actually exists" do
- File.stub(:exists?).with("#{@path}/somefile.txt"){ true }
+ File.stub(:exists?).with(@file_attachment.full_path){ true }
@file_attachment.file_saved?.should be_true
- File.stub(:exists?).with("#{@path}/somefile.txt"){ false }
+ File.stub(:exists?).with(@file_attachment.full_path){ false }
@file_attachment.file_saved?.should be_false
end
@@ -2,6 +2,7 @@
describe SiteSetting do
before(:each) do
+ Rails.cache.clear
@valid_attributes = {
:setting_name => "value for setting_name",
:setting_string_value => "value for setting_string_value",

0 comments on commit 18aba14

Please sign in to comment.