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
(($) -> | |
$.fn.valign = (max_width, max_height) -> | |
@each (i) -> | |
$.each $(this).children(), (j,el) -> | |
img = $(el).children()[0] | |
ph = Math.floor((max_width - $(img).width()) / 2) | |
pv = Math.floor((max_height - $(img).height()) / 2) | |
div = $('<div></div>').css('padding',"#{pv}px #{ph}px") | |
$(img).wrap(div) |
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
<%= form_for(@promotion, :html => { :multipart => true }) do |f| %> | |
<%= select_tag 'owner', grouped_owners_for_select %> | |
<% end %> |
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
# make sure engine classes load first. | |
# @see http://stackoverflow.com/questions/5045068/extending-controllers-of-a-rails-3-engine-in-the-main-app/5100825 | |
require 'active_support/dependencies' | |
module ActiveSupport::Dependencies | |
alias_method :require_or_load_without_multiple, :require_or_load | |
def require_or_load(file_name, const_path = nil) | |
if file_name.starts_with?(Rails.root.to_s + '/app') | |
relative_name = file_name.gsub(Rails.root.to_s, '') | |
@engine_paths ||= CologyCom::Application.railties.engines.collect{|engine| engine.config.root.to_s } | |
@engine_paths.each do |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
$(function(){ | |
if (!Modernizr.input.placeholder){ | |
$('input[type=text]').clearValue(); | |
} | |
}); | |
$.fn.clearValue = function() { | |
var element = this; | |
var defaultStr = $(this).attr('placeholder'); | |
$(this).val(defaultStr); | |
return this.focus(function() { |
NewerOlder