Rails flash messages with AJAX requests & twitter-bootstrap 2.3
Forked from https://gist.github.com/linjunpop/3410235 Based on Stackoverflow answer: http://stackoverflow.com/a/10167659/656428
License: MIT
# encoding: UTF-8 | |
# this file lives at /config/application.yml | |
# Add application configuration variables here, as shown below. | |
#### Facebook #### | |
# https://developers.facebook.com/ | |
# FACEBOOK_KEY: '' | |
# FACEBOOK_SECRET: '' |
<script type="text/javascript"> | |
//fixes issue https://code.google.com/p/gdata-issues/issues/detail?id=4919 by switching to http for Firefox < 26 | |
//you need jQuery < 1.9 or the jQuery.migrate plugin - http://api.jquery.com/jQuery.browser/ | |
//add this code after the form | |
if ($.browser.mozilla && $.browser.version < 26){ | |
$('form').attr('action', 'THE_URL_WITH_HTTP_INSTEAD_OF_HTTPS'); | |
} | |
</script> |
/* jquery fallback function in case a browser doesn't support the maxlength attribute for textareas */ | |
/* | |
based on code by http://that-matt.com/2008/07/textarea-maxlength-with-jquery/ | |
*/ | |
function count_chars(textarea){ | |
var max = parseInt(textarea.attr('maxlength')); | |
textarea.parent().find('.charsRemaining').html('<b>' + (max - textarea.val().length) + '</b> characters remaining.'); | |
} |
Rails flash messages with AJAX requests & twitter-bootstrap 2.3
Forked from https://gist.github.com/linjunpop/3410235 Based on Stackoverflow answer: http://stackoverflow.com/a/10167659/656428
License: MIT
#FIXXME OpenID still not working | |
if Rails.env.production? | |
#overwriting omniauth-347a66e3d4f1/oa-core/lib/omniauth/strategy.rb | |
module OmniAuth | |
module Strategy | |
def full_host | |
uri = URI.parse(request.url) | |
uri.path = '' |
#making .irbrc posted at http://www.tech-angels.fr/post/963080350/improve-irb-and-fix-it-on-mac-os-x | |
#work with rails3 | |
require 'rubygems' | |
#rails3: be sure to include wirble and hirb in your Gemfile | |
require 'wirble' | |
require 'hirb' | |
Wirble.init | |
Wirble.colorize | |
# hirb (active record output format in table) |