This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
html = %(<div class="field_with_errors">#{html_tag}</div>).html_safe | |
# add nokogiri gem to Gemfile | |
elements = Nokogiri::HTML::DocumentFragment.parse(html_tag).css "label, input" | |
elements.each do |e| | |
if e.node_name.eql? 'label' | |
html = %(<div class="clearfix error">#{e}</div>).html_safe | |
elsif e.node_name.eql? 'input' | |
if instance.error_message.kind_of?(Array) | |
html = %(<div class="clearfix error">#{html_tag}<span class="help-inline"> #{instance.error_message.join(',')}</span></div>).html_safe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file goes in config/initializers | |
require 'bootstrap_form_builder' | |
# Make this the default Form Builder. You can delete this if you don't want form_for to use | |
# the bootstrap form builder by default | |
ActionView::Base.default_form_builder = BootstrapFormBuilder::FormBuilder | |
# Add in our FormHelper methods, so you can use bootstrap_form_for. | |
ActionView::Base.send :include, BootstrapFormBuilder::FormHelper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MobileSite | |
def self.included(base) | |
base.class_eval do | |
# Uncomment for JQM Integration | |
#rescue_from ActionView::MissingTemplate, :with => :view_unavailable | |
before_filter :set_mobile_preferences | |
before_filter :redirect_to_mobile_if_applicable | |
before_filter :set_mobile_view_path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleExternalLinks: function() { | |
var hostName = window.location.hostname; | |
var links = document.getElementsByTagName("a"); | |
for(var i = 0; i < links.length; i++) { | |
if(links[i].href.indexOf(hostName) == -1) { | |
var curTitle = (links[i].getAttribute("title")) ? links[i].getAttribute("title") + " - ": ""; | |
links[i].setAttribute("target", "_blank"); | |
links[i].setAttribute("title", curTitle + "opens in new window"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************** | |
* Flash Player Detection (taken from sifr ) | |
**********************************************/ | |
var hasFlash = function(){ | |
var nRequiredVersion = 9; | |
if(navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Windows") > -1){ | |
document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & ' + nRequiredVersion + '))) \n</script\> \n'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************ | |
* Clickables (big block targets) | |
***********************************/ | |
var Clickables = Class.create({ | |
initialize: function(options) { | |
selector = $$(options.selector) || $$(".clickables"); | |
this.clickable = options.clickable || "li"; | |
this.hoverclass = options.hoverclass || "over"; |
NewerOlder