From 31839748207006c11882305285bdfdc0c9712e96 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Thu, 14 Oct 2010 14:38:10 -0400 Subject: [PATCH] Added jQuery validation on the contact form via jquery.validate. --- Gemfile | 1 + Gemfile.lock | 7 + app/models/.photo.rb.un~ | Bin 36550 -> 0 bytes app/models/contact.rb | 7 +- app/views/contacts/new.html.erb | 2 +- app/views/layouts/.photos.html.erb.un~ | Bin 33576 -> 0 bytes app/views/layouts/photos.html.erb | 2 +- lib/email_validator.rb | 10 + public/javascripts/.photos.js.un~ | Bin 5025 -> 0 bytes public/javascripts/jquery.validate.js | 16 ++ public/javascripts/photos.js | 20 ++ public/stylesheets/.photos.css.un~ | Bin 57186 -> 0 bytes public/stylesheets/photos.css | 263 +++++++++++++------------ 13 files changed, 201 insertions(+), 127 deletions(-) delete mode 100644 app/models/.photo.rb.un~ delete mode 100644 app/views/layouts/.photos.html.erb.un~ create mode 100644 lib/email_validator.rb delete mode 100644 public/javascripts/.photos.js.un~ create mode 100644 public/javascripts/jquery.validate.js delete mode 100644 public/stylesheets/.photos.css.un~ diff --git a/Gemfile b/Gemfile index c516d89..b5e78ee 100644 --- a/Gemfile +++ b/Gemfile @@ -30,6 +30,7 @@ gem 'sqlite3-ruby', :require => 'sqlite3' # end gem "exception_notification", :git => "git://github.com/rails/exception_notification", :require => 'exception_notifier' +gem 'validates_email_format_of', :git => 'http://github.com/alexdunae/validates_email_format_of.git' gem 'pg' gem 'typus', :git => 'git://github.com/fesplugas/typus.git' gem 'mini_exiftool' diff --git a/Gemfile.lock b/Gemfile.lock index 18aba73..dfd5c7b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,6 +10,12 @@ GIT specs: exception_notification (1.0.0) +GIT + remote: http://github.com/alexdunae/validates_email_format_of.git + revision: 39750a7462028c25c387074744eee4b01d09f5a5 + specs: + validates_email_format_of (1.4.1) + GIT remote: http://github.com/mislav/will_paginate.git revision: b1a5beeec9f56ecbe3594fcdca76d92b6767ce50 @@ -98,4 +104,5 @@ DEPENDENCIES rdiscount sqlite3-ruby typus! + validates_email_format_of! will_paginate! diff --git a/app/models/.photo.rb.un~ b/app/models/.photo.rb.un~ deleted file mode 100644 index 73a28e3b02e1a49deafd2cc952ee2cba2709d5db..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 36550 zcmeI5O^h5z6@b@{Lt@82N$kXq9oy|)+v|;;&91X+l1aSrI{v{fM=jwm8+3 z%3V`E?yh>@d#|f&s%k%8UHtCLwKMg<4Xhv9`Tp;J`IGm){$~2u+jssGz5BB(Z~Xee z*!s7w?~Av7|IKx!fq{WXB{?}DnRSvb*#eF(4aBXne{A6F!GZE`?HAVDBL_~kKmS+6 zl&CL+>{@CdzH{*h2FJj_zjn!mQNI)N_awF1$*&kv=A%0&M<@kSN+Eu;ZBpwxr0$Vh zk_QE(`w886v*>7B1>hiZF>+%4x&khxb?0%~n?ft1pWmu#LCI6fo^ zB-)`sLb(&p2TV>I-j9Om8+nIvnA*-|o?R~Takl%6^EA$Aw4l6CwSe=W-A-BXK(ydf z1nqY;+B~MCk;v6bvs_8j%FNZpq?SgdnR+diOgX)EEs0J}MWyOuWj;A(pMDU$U)349 zP~JgVAc_`ziV*#tA-W;!q~J^-aE`YFqIt3C_})fUIWSUojIw|ZE%=mp=?{@XcW;Ky zc@jv7nWK4Zd@ePTX7x)+Ij!T0!{cMeCvNi3u=7VCZc^3eYLxNL7@(pAuOd*77^wGU zQ1Pb+Bsr+1La6E0>x-||D%FK1RKFaROhHC?V(jMl#Mp3j+j=cm;)+gyjp>Y15WE&G z_>_3*-OC2>#tbmeI{XVH%X{r&$)eg$IPz(~F9xL?PYmNF$(rnfn#!;_Guc$ing?1nY;TBbCt`(3fh4{_( zLTb9Yd90;wq&cDx+^T8~-9S_+#Ba72(I@gW`J5x#?VH>4vz=Ak}dwqI0WXGUx7 z4dBWk!-x4C-aXNRPl=cQ{B6T>bH>sQ;5o9=1K{HwzyN(rwFB4zuu_Q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M0OKRO1^@s6 diff --git a/app/models/contact.rb b/app/models/contact.rb index 876cb5c..4400d39 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -1,8 +1,12 @@ +require 'email_validator' + class Contact include ActiveModel::Validations validates_presence_of :email, :name, :message - + + validates :email, :email => true + attr_accessor :id, :email, :subject, :name, :message def initialize(attributes = {}) @@ -23,4 +27,5 @@ class Contact end return false end + end diff --git a/app/views/contacts/new.html.erb b/app/views/contacts/new.html.erb index 0b4f4b7..38d0232 100644 --- a/app/views/contacts/new.html.erb +++ b/app/views/contacts/new.html.erb @@ -7,7 +7,7 @@
- <%= form_for :contact, :url => { :action => 'create' } do |f| %> + <%= form_for :contact, :url => { :action => 'create' }, :html => { :id => 'contact_form' } do |f| %> <% if flash[:notice] -%>
<%= flash[:notice] %>
<% end -%> diff --git a/app/views/layouts/.photos.html.erb.un~ b/app/views/layouts/.photos.html.erb.un~ deleted file mode 100644 index bbca48eac67d693bae187cb055b9dff7fe9ac480..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33576 zcmeI*%WqUw90%|L%B$s3m8XIXBTycNQlLD_w3LU4$wWz17HsO!8R+29LT4a$ss8}R ze?S**#AG%ueG!a?7-QUEVwAWtx-&5vm-_pjxxYKVJ3XCqG5mJFlU&ZPcgoDUzfaD& zk8|htLgm_fuT7nq{x!4k{$Dfie)9Go503nK_v?3tKmF&yhIQ93-hTh%4=#Rp@*_YiuO7F9rmXowBpyeDbD5!bK6dDh&cH!0D%=q_smCC|q<^IJ>SX}v+ zN@fxNWcB0EK%vonz;R?Ue{X1ed&e;JmSaLJAwXtKZ3)x+k(dsqVFF8+Xa>k)HrJbC zH1S&&KBf#1({afJjwQ5!MD`|-ET)AEUXR&~iPNH06H{I?fdfofBoj!mjtj`Jt{W?i z30crA#5Cq(T1p=ZrfwXv`I zLl!g(=@mNZZEn*$KRI2WuDLGQGK87iyG1R9CwgTMel|m7L9>wI%hC|t2dU=)v4p)8Gh>w7dAU#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qf#fsYr-!7&7fo(^1>T zUJwq5W`oyAMM88#BE8dTkGdxfX>xB0!TqAu&^1w!5Zy2&x;u?%;_wK7gQC&EHBgZd z-7o~YD-EbT+=br((Pr41r$~ry81mei##5ZVfX`jWi<%8uQMVb5D1mm=`UFu&IiK=!PNHRP(BH&S8N#A{q{0pt?Kv z?G^};8I>@EnrdFP{kjAU-Lqt(Cd1cERs4K!8Zu2Yui8!u!V}`dz-y!;A-Z9RG|jxK z`@?~)i-!;#6Rn1>iHd~ih9S{3^Q!nukS$OEo)nE9qu4-2LUh9rXqtJ|geUw?i8jO5 zJViouL-M@a=?ZX~c~#jx!FO6T8MMYJ5~3T1IMd9lioq6oXGDu3Ynmb(KdrsgzFB%M3V7j?gI|mh+Q3(r;pI_-T(#Bsj?J!9`_b+6(c)@vAv>ep< zR))KlWV|9XDk1T{?s!)<`|1+<6!|TS_-P*Ct<`6%<=SMqTpzDirrvOW{XBQw{lUB( zUFf}5E>()zkx2(!E3S3h>-=&Ld5rcJs3|h#CM+JCod(4tAd#S zn0+T?pq>+(0dPYW3DFG+`AdhqI=Rnf "all" %> <%= stylesheet_link_tag "photos", :media => "all" %> <%= stylesheet_link_tag "fancybox", :media => "all" %> - <%= javascript_include_tag 'jquery', 'jrails', 'fancybox', 'photos' %> + <%= javascript_include_tag 'jquery', 'jquery.validate', 'jrails', 'fancybox', 'photos' %> diff --git a/lib/email_validator.rb b/lib/email_validator.rb new file mode 100644 index 0000000..9ea5219 --- /dev/null +++ b/lib/email_validator.rb @@ -0,0 +1,10 @@ +# lib/email_validator.rb +class EmailValidator < ActiveModel::EachValidator + + def validate_each(object, attribute, value) + unless value =~ /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i + object.errors[attribute] << (options[:message] || "is not valid") + end + end + +end diff --git a/public/javascripts/.photos.js.un~ b/public/javascripts/.photos.js.un~ deleted file mode 100644 index 8031eb5568d376bcc132d6f8cf462f57eec7fc95..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5025 zcmeI$ze~eF6bJC@4_kjMZdwJ&P?{9PO$S{&C=?V#aT85b2-HMs3jSII7yki8Py`1D z!TtdbF5>RuC<-Euf*>w}zVGF(Jq1OSQ(nQpXYs?Mp4#a7 z=2c>*ur_(N?H-Ihd8e^O|8D=KGkxI?F~(ZxkddQFjE)YmfKeW-Sij9A@oAdPUWyaq zV#I)taPWAeU zta3yaBBElz0S3%_4T`K~4wUCSd&SI$a*>h&0G=SM`&2V1Zu> z_19>Yz-d+X12|m4*Yxd9$xI|u!rJ3l$*@_fxh{*sHwOOr1T8>Z_mxh2OGn80gS_6t~zsU#%YDPg{H z%v2LoK6{{1{tgp(@?{?T2CT+JCjKSpCzCGqt|uEQ?r*>hOOWdD`^xMWrKy%B_77S7 zZ|K`1vJrWZW;fSNhoy-^;*XCsLNnXwvo^iWJJoS-(yscI3Rk8+8&qrPvJc1ax)IH& diff --git a/public/javascripts/jquery.validate.js b/public/javascripts/jquery.validate.js new file mode 100644 index 0000000..6264866 --- /dev/null +++ b/public/javascripts/jquery.validate.js @@ -0,0 +1,16 @@ +/* + * jQuery validation plug-in 1.7 + * + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ + * http://docs.jquery.com/Plugins/Validation + * + * Copyright (c) 2006 - 2008 Jörn Zaefferer + * + * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ +(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&¶ms.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id ++", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;iWarning: No message defined for "+element.name+"");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery); \ No newline at end of file diff --git a/public/javascripts/photos.js b/public/javascripts/photos.js index 306353b..4187a1f 100644 --- a/public/javascripts/photos.js +++ b/public/javascripts/photos.js @@ -2,4 +2,24 @@ $(document).ready(function() { $('.fancy').fancybox({ 'titlePosition' : 'inside' }); + + if ($('#contact_form').length) { + $('#contact_form').validate({ + rules: { + 'contact[name]': "required", + 'contact[email]': { + required: true, + email: true + }, + 'contact[message]': "required", + + }, + messages: { + 'contact[email]': { + email: "Invalid email address." + } + } + }); + console.info('Validation set.'); + } }); diff --git a/public/stylesheets/.photos.css.un~ b/public/stylesheets/.photos.css.un~ deleted file mode 100644 index b12b810afb4914fde6ef09c8d6c532b484f1ad32..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 57186 zcmeI5OKcry6~~=AN!vX8N}IkXcG~pexPB*bDNSjCKHO613(BLtwr}j)I=-pnv?=K$ zK?s4U03ied7O(=Ti$p>~q7twHi3Kd!0UN}oAT~%WiV&!j^ZRDb+;i_8+Y?W}-8s>x z?|3|Oef0n3e6RWL%#)3yKX_vCzUJFK7yS73xBk@l{+8xj|GB&OhUZScvg^vfBwK#+ z#^cZZ=w8cBu&1YIP>R}sI2)v#$qrC!>6tn=adIQSJ=F8e@3Rvw$Z9HnMG5wv zSWmD1dKf`GfwLU4LTcmWcYGWfO zz>SkHk<#O=P$8xXs|NzBo|F}7LS8AWD-*Hl+RXEFOU)CDvy;h7^Nr>DomrwOERB$> z9iFNYy*!RC==ECYF7HIwYA_+S z)dUDdCuanS>#jx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<{_NSMO02Wam6YrAft~m-N(oC+Q|HF-wb_+qCk{z{ft2p=-pRph z60zm_$>sgC^_k|9e8H!=IGHRq7xR~ZLGcACY7i!I{f3V!Ql++3@dHVzE!77sRqgEV zkdrn@S-GvNf@&+Jl<6pqZKufJ^jaxCPI>mQRE zs`=mdhSeyu9+w%G8h%j=I4A{9-DAsa<13tAlA;Df=cZ~@t;=*>{|nqkTXQ$K>F80LL9m=O(SVHq z2z)2U(+d%*m@b6y8TbY1HL)#V8gDg&oTy{PwP$Gnds&JaFcT@;IpF;mDpatW&9(SN z00#rWi4-7B9QiXMh4!&t~m7z?q>!1>0w?#V=xZm+jL?I8Gdu0<)E8 z)_^)CMGc7jw_rug!68BwW6QA`ei69z(Uu3&WFuz)Hzoyer61AH!@sj}3J713q6S`& z-o^pXMO3I@Wsp7{a`9j>((`zg$h=NY5H2=Z1Wdsiu@R9 zdLB$$kIRJNYkWdx@b&qGs!_Er(`UAA=wlwJ^20Qrufyea6AsMuM9)1V%(`4nBQC}- z>LOR=R5%`m(P=4a@PnDRm#RpWTJMbW8Tdua+V*~R=2qCXH`_RVY@sI4Uz}cO&OEPo z$RTxx56`Wq&laL>yRSc_RFEwVD=O>e4yC3B=XBdN_ fb2EZea!ag^O{ClorK8Rylb^o|x563V-`@N`-Bv0u diff --git a/public/stylesheets/photos.css b/public/stylesheets/photos.css index 109cc69..06f38ef 100644 --- a/public/stylesheets/photos.css +++ b/public/stylesheets/photos.css @@ -3,23 +3,23 @@ body { color: white; font-family: "Helvetica Neue", "Arial", "Helvatica", sans-serif; font-size: 14px; - overflow: hidden; + overflow: hidden; } a { - text-decoration: none; + text-decoration: none; } p a { - display: inline !important; - color: #acf; + display: inline !important; + color: #acf; } p a:hover { - color: #fff; + color: #fff; } #page { - position: absolute; - top: 40%; - margin-top: -230px; - width: 100%; + position: absolute; + top: 40%; + margin-top: -230px; + width: 100%; } #container { padding-top: 20px; @@ -33,12 +33,12 @@ p a:hover { height: 308px; } #header a { - display: block; - height: 308px; - width: 308px; + display: block; + height: 308px; + width: 308px; } #header a:hover { - background: rgba(255,255,255,0.1); + background: rgba(255,255,255,0.1); } #header img { padding: 0; @@ -48,215 +48,230 @@ p a:hover { right: 20px; } #footer { - background: #333; - color: black; - text-align: right; - height: 28px; + background: #333; + color: black; + text-align: right; + height: 28px; } #footer p { - margin: 0 10px; + margin: 0 10px; } .sg-5, .sg-7, .sg-11, .sg-17, .sg-35 { - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; } .sg-5 a, .sg-7 a, .sg-11 a, .sg-17 a, .sg-35 { - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; } .sg-5 { height: 140px; } .sg-5 a { - position: relative; - display: block; - color: white; - height: 140px; - width: 140px; + position: relative; + display: block; + color: white; + height: 140px; + width: 140px; } .sg-7 { - height: 196px; + height: 196px; } .sg-7 a { - position: relative; - display: block; - color: white; - height: 196px; - width: 196px; + position: relative; + display: block; + color: white; + height: 196px; + width: 196px; } .sg-11 { - height: 308px; + height: 308px; } .sg-11 a { - display: block; - height: 308px; - width: 308px; + display: block; + height: 308px; + width: 308px; } .sg-17 { - height: 476px; + height: 476px; } .sg-17 a { - display: block; - width: 476px; - height: 476px; + display: block; + width: 476px; + height: 476px; } .about { - background-color: #99BF00; + background-color: #99BF00; } .portfolio { - background-color: #C03232; + background-color: #C03232; } .contact { - background-color: #777; + background-color: #777; } .about a:focus, .portfolio a:focus, .contact a:focus { - background: rgba(255,255,255,0.1); + background: rgba(255,255,255,0.1); } .about a:hover, .portfolio a:hover, .contact a:hover { - background: rgba(255,255,255,0.2); + background: rgba(255,255,255,0.2); } .about a span, .portfolio a span, .contact a span { - position: absolute; - top: 10px; - right: 20px; + position: absolute; + top: 10px; + right: 20px; } .category { position: relative; } .category a, .photo a { - display: block; + display: block; color: white; text-decoration: none; } .category a .arrow { - position: absolute; - font-size: 2em; - bottom: 20px; + position: absolute; + font-size: 2em; + bottom: 20px; left: 20px; } .category a:focus, .photo a:focus { - background: rgba(255,255,255,0.1); + background: rgba(255,255,255,0.1); } .category a:hover, .photo a:hover { - background: rgba(255,255,255,0.2); + background: rgba(255,255,255,0.2); } .blank-category, .blank-photo { background: #222; outline: 1px dashed #444; } .category h3 { - position: absolute; - top: 16px; - right: 0; - text-align: right; - margin: 0 20px; + position: absolute; + top: 16px; + right: 0; + text-align: right; + margin: 0 20px; font-weight: normal; font-size: 1.1em; - line-height: 1em; + line-height: 1em; } img { } .page-links { - background: #666; + background: #666; } .prev-link, .next-link { - color: white; - font-size: 2em; - position: relative; - display: block; + color: white; + font-size: 2em; + position: relative; + display: block; } .prev-link div, .next-link div { - position: absolute; - bottom: 15px; + position: absolute; + bottom: 15px; } .prev-link div { - left: 20px; + left: 20px; } .next-link div { - right: 20px; + right: 20px; } .prev-link:hover, .next-link:hover { - background: rgba(255,255,255,0.2); + background: rgba(255,255,255,0.2); } .about-content { - background: #444; - color: #ccc; + background: #444; + color: #ccc; } .about-content div { - padding: 15px 20px; + padding: 15px 20px; } .about-content div p { - margin-bottom: 0.6em; - line-height: 1.4em; + margin-bottom: 0.6em; + line-height: 1.4em; } /* FORM */ .contact-form { - background: #ddd; + background: #ddd; } .field_with_errors { - display: inline; + display: inline; } form { - padding: 10px 20px; + padding: 10px 25px; } form p { - margin: 10px 0; + margin: 10px 0; } form p { - color: #555; + color: #555; } form label { - color: #666; - display: block; - width: 100px; - float: left; + color: #666; + display: block; + width: 75px; + float: left; +} +form label.error { + float: none; + display: inline; + color: #990000; + margin-left: 10px; } form textarea { - height: 150px; - width: 315px; + height: 150px; + width: 335px; } form textarea, form input[type='text'] { - font-family:"Helvetica Neue","Arial","Helvatica",sans-serif; - font-size:14px; - padding: 3px; - color: #333; - border: 2px solid #999; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; + font-family:"Helvetica Neue","Arial","Helvatica",sans-serif; + font-size:14px; + padding: 3px; + color: #333; + border: 2px solid #999; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} +form input#contact_name { + width: 175px; +} +form input#contact_email { + width: 175px; +} +form input#contact_subject { + width: 335px; } #alert { - background: #fffeef; - color: #664400; - border-width: 2px 0; - border-style: solid; - border-color: #996600; - padding: 0 10px 2px; - margin-top: 15px; + background: #fffeef; + color: #664400; + border-width: 2px 0; + border-style: solid; + border-color: #996600; + padding: 0 10px 2px; + margin-top: 15px; } #notice { - background: #efffef; - color: #446600; - border-width: 2px 0; - border-style: solid; - border-color: #669900; - padding: 0 10px 2px; - margin-top: 15px; + background: #efffef; + color: #446600; + border-width: 2px 0; + border-style: solid; + border-color: #669900; + padding: 0 10px 2px; + margin-top: 15px; } -.field_with_errors input, .field_with_errors textarea { - background: #ffefef; - border-color: #cc3333 !important; +.field_with_errors input, .field_with_errors textarea, input.error, textarea.error { + background: #ffefef; + border-color: #cc3333 !important; } form input[type='submit'] { - background: #666; - font-family:"Helvetica Neue","Arial","Helvatica",sans-serif; - font-size:14px; - padding: 3px; - color: white; - border: 2px solid #333; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; -} \ No newline at end of file + background: #666; + font-family:"Helvetica Neue","Arial","Helvatica",sans-serif; + font-size:14px; + padding: 3px; + color: white; + border: 2px solid #333; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +}