Skip to content
Browse files

adopting avatars_for_rails 0.2.0

  • Loading branch information...
1 parent 624df8f commit f82af732f5923cfc1b6bf8c1feeb74b29fcde78b @jaime1988 jaime1988 committed Jun 24, 2011
View
BIN app/assets/images/pbar-ani.gif
Deleted file not rendered
View
8 app/assets/javascripts/avatars.js
@@ -1,8 +0,0 @@
-$(document).ready( function() {
- //Full Caption Sliding (Hidden to Visible)
- $('.boxgrid.captionfull').hover( function() {
- $(".cover", this).stop().animate({top:'61px'},{queue:false,duration:160});
- }, function() {
- $(".cover", this).stop().animate({top:'104px'},{queue:false,duration:160});
- });
-});
View
163 app/assets/javascripts/jquery.Jcrop.min.js
@@ -1,163 +0,0 @@
-/**
- * Jcrop v.0.9.8 (minimized)
- * (c) 2008 Kelly Hallman and DeepLiquid.com
- * More information: http://deepliquid.com/content/Jcrop.html
- * Released under MIT License - this header must remain with code
- */
-
-
-(function($){$.Jcrop=function(obj,opt)
-{var obj=obj,opt=opt;if(typeof(obj)!=='object')obj=$(obj)[0];if(typeof(opt)!=='object')opt={};if(!('trackDocument'in opt))
-{opt.trackDocument=$.browser.msie?false:true;if($.browser.msie&&$.browser.version.split('.')[0]=='8')
-opt.trackDocument=true;}
-if(!('keySupport'in opt))
-opt.keySupport=$.browser.msie?false:true;var defaults={trackDocument:false,baseClass:'jcrop',addClass:null,bgColor:'black',bgOpacity:.6,borderOpacity:.4,handleOpacity:.5,handlePad:5,handleSize:9,handleOffset:5,edgeMargin:14,aspectRatio:0,keySupport:true,cornerHandles:true,sideHandles:true,drawBorders:true,dragEdges:true,boxWidth:0,boxHeight:0,boundary:8,animationDelay:20,swingSpeed:3,allowSelect:true,allowMove:true,allowResize:true,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){}};var options=defaults;setOptions(opt);var $origimg=$(obj);var $img=$origimg.clone().removeAttr('id').css({position:'absolute'});$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide();presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({position:'relative',backgroundColor:options.bgColor}).insertAfter($origimg).append($img);;if(options.addClass)$div.addClass(options.addClass);var $img2=$('<img />').attr('src',$img.attr('src')).css('position','absolute').width(boundx).height(boundy);var $img_holder=$('<div />').width(pct(100)).height(pct(100)).css({zIndex:310,position:'absolute',overflow:'hidden'}).append($img2);var $hdl_holder=$('<div />').width(pct(100)).height(pct(100)).css('zIndex',320);var $sel=$('<div />').css({position:'absolute',zIndex:300}).insertBefore($img).append($img_holder,$hdl_holder);var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:'absolute',top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var xlimit,ylimit,xmin,ymin;var xscale,yscale,enabled=true;var docOffset=getPos($img),btndown,lastcurs,dimmed,animating,shift_down;var Coords=function()
-{var x1=0,y1=0,x2=0,y2=0,ox,oy;function setPressed(pos)
-{var pos=rebound(pos);x2=x1=pos[0];y2=y1=pos[1];};function setCurrent(pos)
-{var pos=rebound(pos);ox=pos[0]-x2;oy=pos[1]-y2;x2=pos[0];y2=pos[1];};function getOffset()
-{return[ox,oy];};function moveOffset(offset)
-{var ox=offset[0],oy=offset[1];if(0>x1+ox)ox-=ox+x1;if(0>y1+oy)oy-=oy+y1;if(boundy<y2+oy)oy+=boundy-(y2+oy);if(boundx<x2+ox)ox+=boundx-(x2+ox);x1+=ox;x2+=ox;y1+=oy;y2+=oy;};function getCorner(ord)
-{var c=getFixed();switch(ord)
-{case'ne':return[c.x2,c.y];case'nw':return[c.x,c.y];case'se':return[c.x2,c.y2];case'sw':return[c.x,c.y2];}};function getFixed()
-{if(!options.aspectRatio)return getRect();var aspect=options.aspectRatio,min_x=options.minSize[0]/xscale,min_y=options.minSize[1]/yscale,max_x=options.maxSize[0]/xscale,max_y=options.maxSize[1]/yscale,rw=x2-x1,rh=y2-y1,rwa=Math.abs(rw),rha=Math.abs(rh),real_ratio=rwa/rha,xx,yy;if(max_x==0){max_x=boundx*10}
-if(max_y==0){max_y=boundy*10}
-if(real_ratio<aspect)
-{yy=y2;w=rha*aspect;xx=rw<0?x1-w:w+x1;if(xx<0)
-{xx=0;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}
-else if(xx>boundx)
-{xx=boundx;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1;}}
-else
-{xx=x2;h=rwa/aspect;yy=rh<0?y1-h:y1+h;if(yy<0)
-{yy=0;w=Math.abs((yy-y1)*aspect);xx=rw<0?x1-w:w+x1;}
-else if(yy>boundy)
-{yy=boundy;w=Math.abs(yy-y1)*aspect;xx=rw<0?x1-w:w+x1;}}
-if(xx>x1){if(xx-x1<min_x){xx=x1+min_x;}else if(xx-x1>max_x){xx=x1+max_x;}
-if(yy>y1){yy=y1+(xx-x1)/aspect;}else{yy=y1-(xx-x1)/aspect;}}else if(xx<x1){if(x1-xx<min_x){xx=x1-min_x}else if(x1-xx>max_x){xx=x1-max_x;}
-if(yy>y1){yy=y1+(x1-xx)/aspect;}else{yy=y1-(x1-xx)/aspect;}}
-if(xx<0){x1-=xx;xx=0;}else if(xx>boundx){x1-=xx-boundx;xx=boundx;}
-if(yy<0){y1-=yy;yy=0;}else if(yy>boundy){y1-=yy-boundy;yy=boundy;}
-return last=makeObj(flipCoords(x1,y1,xx,yy));};function rebound(p)
-{if(p[0]<0)p[0]=0;if(p[1]<0)p[1]=0;if(p[0]>boundx)p[0]=boundx;if(p[1]>boundy)p[1]=boundy;return[p[0],p[1]];};function flipCoords(x1,y1,x2,y2)
-{var xa=x1,xb=x2,ya=y1,yb=y2;if(x2<x1)
-{xa=x2;xb=x1;}
-if(y2<y1)
-{ya=y2;yb=y1;}
-return[Math.round(xa),Math.round(ya),Math.round(xb),Math.round(yb)];};function getRect()
-{var xsize=x2-x1;var ysize=y2-y1;if(xlimit&&(Math.abs(xsize)>xlimit))
-x2=(xsize>0)?(x1+xlimit):(x1-xlimit);if(ylimit&&(Math.abs(ysize)>ylimit))
-y2=(ysize>0)?(y1+ylimit):(y1-ylimit);if(ymin&&(Math.abs(ysize)<ymin))
-y2=(ysize>0)?(y1+ymin):(y1-ymin);if(xmin&&(Math.abs(xsize)<xmin))
-x2=(xsize>0)?(x1+xmin):(x1-xmin);if(x1<0){x2-=x1;x1-=x1;}
-if(y1<0){y2-=y1;y1-=y1;}
-if(x2<0){x1-=x2;x2-=x2;}
-if(y2<0){y1-=y2;y2-=y2;}
-if(x2>boundx){var delta=x2-boundx;x1-=delta;x2-=delta;}
-if(y2>boundy){var delta=y2-boundy;y1-=delta;y2-=delta;}
-if(x1>boundx){var delta=x1-boundy;y2-=delta;y1-=delta;}
-if(y1>boundy){var delta=y1-boundy;y2-=delta;y1-=delta;}
-return makeObj(flipCoords(x1,y1,x2,y2));};function makeObj(a)
-{return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]};};return{flipCoords:flipCoords,setPressed:setPressed,setCurrent:setCurrent,getOffset:getOffset,moveOffset:moveOffset,getCorner:getCorner,getFixed:getFixed};}();var Selection=function()
-{var start,end,dragmode,awake,hdep=370;var borders={};var handle={};var seehandles=false;var hhs=options.handleOffset;if(options.drawBorders){borders={top:insertBorder('hline').css('top',$.browser.msie?px(-1):px(0)),bottom:insertBorder('hline'),left:insertBorder('vline'),right:insertBorder('vline')};}
-if(options.dragEdges){handle.t=insertDragbar('n');handle.b=insertDragbar('s');handle.r=insertDragbar('e');handle.l=insertDragbar('w');}
-options.sideHandles&&createHandles(['n','s','e','w']);options.cornerHandles&&createHandles(['sw','nw','ne','se']);function insertBorder(type)
-{var jq=$('<div />').css({position:'absolute',opacity:options.borderOpacity}).addClass(cssClass(type));$img_holder.append(jq);return jq;};function dragDiv(ord,zi)
-{var jq=$('<div />').mousedown(createDragger(ord)).css({cursor:ord+'-resize',position:'absolute',zIndex:zi});$hdl_holder.append(jq);return jq;};function insertHandle(ord)
-{return dragDiv(ord,hdep++).css({top:px(-hhs+1),left:px(-hhs+1),opacity:options.handleOpacity}).addClass(cssClass('handle'));};function insertDragbar(ord)
-{var s=options.handleSize,o=hhs,h=s,w=s,t=o,l=o;switch(ord)
-{case'n':case's':w=pct(100);break;case'e':case'w':h=pct(100);break;}
-return dragDiv(ord,hdep++).width(w).height(h).css({top:px(-t+1),left:px(-l+1)});};function createHandles(li)
-{for(i in li)handle[li[i]]=insertHandle(li[i]);};function moveHandles(c)
-{var midvert=Math.round((c.h/2)-hhs),midhoriz=Math.round((c.w/2)-hhs),north=west=-hhs+1,east=c.w-hhs,south=c.h-hhs,x,y;'e'in handle&&handle.e.css({top:px(midvert),left:px(east)})&&handle.w.css({top:px(midvert)})&&handle.s.css({top:px(south),left:px(midhoriz)})&&handle.n.css({left:px(midhoriz)});'ne'in handle&&handle.ne.css({left:px(east)})&&handle.se.css({top:px(south),left:px(east)})&&handle.sw.css({top:px(south)});'b'in handle&&handle.b.css({top:px(south)})&&handle.r.css({left:px(east)});};function moveto(x,y)
-{$img2.css({top:px(-y),left:px(-x)});$sel.css({top:px(y),left:px(x)});};function resize(w,h)
-{$sel.width(w).height(h);};function refresh()
-{var c=Coords.getFixed();Coords.setPressed([c.x,c.y]);Coords.setCurrent([c.x2,c.y2]);updateVisible();};function updateVisible()
-{if(awake)return update();};function update()
-{var c=Coords.getFixed();resize(c.w,c.h);moveto(c.x,c.y);options.drawBorders&&borders['right'].css({left:px(c.w-1)})&&borders['bottom'].css({top:px(c.h-1)});seehandles&&moveHandles(c);awake||show();options.onChange(unscale(c));};function show()
-{$sel.show();$img.css('opacity',options.bgOpacity);awake=true;};function release()
-{disableHandles();$sel.hide();$img.css('opacity',1);awake=false;};function showHandles()
-{if(seehandles)
-{moveHandles(Coords.getFixed());$hdl_holder.show();}};function enableHandles()
-{seehandles=true;if(options.allowResize)
-{moveHandles(Coords.getFixed());$hdl_holder.show();return true;}};function disableHandles()
-{seehandles=false;$hdl_holder.hide();};function animMode(v)
-{(animating=v)?disableHandles():enableHandles();};function done()
-{animMode(false);refresh();};var $track=newTracker().mousedown(createDragger('move')).css({cursor:'move',position:'absolute',zIndex:360})
-$img_holder.append($track);disableHandles();return{updateVisible:updateVisible,update:update,release:release,refresh:refresh,setCursor:function(cursor){$track.css('cursor',cursor);},enableHandles:enableHandles,enableOnly:function(){seehandles=true;},showHandles:showHandles,disableHandles:disableHandles,animMode:animMode,done:done};}();var Tracker=function()
-{var onMove=function(){},onDone=function(){},trackDoc=options.trackDocument;if(!trackDoc)
-{$trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp);}
-function toFront()
-{$trk.css({zIndex:450});if(trackDoc)
-{$(document).mousemove(trackMove).mouseup(trackUp);}}
-function toBack()
-{$trk.css({zIndex:290});if(trackDoc)
-{$(document).unbind('mousemove',trackMove).unbind('mouseup',trackUp);}}
-function trackMove(e)
-{onMove(mouseAbs(e));};function trackUp(e)
-{e.preventDefault();e.stopPropagation();if(btndown)
-{btndown=false;onDone(mouseAbs(e));options.onSelect(unscale(Coords.getFixed()));toBack();onMove=function(){};onDone=function(){};}
-return false;};function activateHandlers(move,done)
-{btndown=true;onMove=move;onDone=done;toFront();return false;};function setCursor(t){$trk.css('cursor',t);};$img.before($trk);return{activateHandlers:activateHandlers,setCursor:setCursor};}();var KeyManager=function()
-{var $keymgr=$('<input type="radio" />').css({position:'absolute',left:'-30px'}).keypress(parseKey).blur(onBlur),$keywrap=$('<div />').css({position:'absolute',overflow:'hidden'}).append($keymgr);function watchKeys()
-{if(options.keySupport)
-{$keymgr.show();$keymgr.focus();}};function onBlur(e)
-{$keymgr.hide();};function doNudge(e,x,y)
-{if(options.allowMove){Coords.moveOffset([x,y]);Selection.updateVisible();};e.preventDefault();e.stopPropagation();};function parseKey(e)
-{if(e.ctrlKey)return true;shift_down=e.shiftKey?true:false;var nudge=shift_down?10:1;switch(e.keyCode)
-{case 37:doNudge(e,-nudge,0);break;case 39:doNudge(e,nudge,0);break;case 38:doNudge(e,0,-nudge);break;case 40:doNudge(e,0,nudge);break;case 27:Selection.release();break;case 9:return true;}
-return nothing(e);};if(options.keySupport)$keywrap.insertBefore($img);return{watchKeys:watchKeys};}();function px(n){return''+parseInt(n)+'px';};function pct(n){return''+parseInt(n)+'%';};function cssClass(cl){return options.baseClass+'-'+cl;};function getPos(obj)
-{var pos=$(obj).offset();return[pos.left,pos.top];};function mouseAbs(e)
-{return[(e.pageX-docOffset[0]),(e.pageY-docOffset[1])];};function myCursor(type)
-{if(type!=lastcurs)
-{Tracker.setCursor(type);lastcurs=type;}};function startDragMode(mode,pos)
-{docOffset=getPos($img);Tracker.setCursor(mode=='move'?mode:mode+'-resize');if(mode=='move')
-return Tracker.activateHandlers(createMover(pos),doneSelect);var fc=Coords.getFixed();var opp=oppLockCorner(mode);var opc=Coords.getCorner(oppLockCorner(opp));Coords.setPressed(Coords.getCorner(opp));Coords.setCurrent(opc);Tracker.activateHandlers(dragmodeHandler(mode,fc),doneSelect);};function dragmodeHandler(mode,f)
-{return function(pos){if(!options.aspectRatio)switch(mode)
-{case'e':pos[1]=f.y2;break;case'w':pos[1]=f.y2;break;case'n':pos[0]=f.x2;break;case's':pos[0]=f.x2;break;}
-else switch(mode)
-{case'e':pos[1]=f.y+1;break;case'w':pos[1]=f.y+1;break;case'n':pos[0]=f.x+1;break;case's':pos[0]=f.x+1;break;}
-Coords.setCurrent(pos);Selection.update();};};function createMover(pos)
-{var lloc=pos;KeyManager.watchKeys();return function(pos)
-{Coords.moveOffset([pos[0]-lloc[0],pos[1]-lloc[1]]);lloc=pos;Selection.update();};};function oppLockCorner(ord)
-{switch(ord)
-{case'n':return'sw';case's':return'nw';case'e':return'nw';case'w':return'ne';case'ne':return'sw';case'nw':return'se';case'se':return'nw';case'sw':return'ne';};};function createDragger(ord)
-{return function(e){if(options.disabled)return false;if((ord=='move')&&!options.allowMove)return false;btndown=true;startDragMode(ord,mouseAbs(e));e.stopPropagation();e.preventDefault();return false;};};function presize($obj,w,h)
-{var nw=$obj.width(),nh=$obj.height();if((nw>w)&&w>0)
-{nw=w;nh=(w/$obj.width())*$obj.height();}
-if((nh>h)&&h>0)
-{nh=h;nw=(h/$obj.height())*$obj.width();}
-xscale=$obj.width()/nw;yscale=$obj.height()/nh;$obj.width(nw).height(nh);};function unscale(c)
-{return{x:parseInt(c.x*xscale),y:parseInt(c.y*yscale),x2:parseInt(c.x2*xscale),y2:parseInt(c.y2*yscale),w:parseInt(c.w*xscale),h:parseInt(c.h*yscale)};};function doneSelect(pos)
-{var c=Coords.getFixed();if(c.w>options.minSelect[0]&&c.h>options.minSelect[1])
-{Selection.enableHandles();Selection.done();}
-else
-{Selection.release();}
-Tracker.setCursor(options.allowSelect?'crosshair':'default');};function newSelection(e)
-{if(options.disabled)return false;if(!options.allowSelect)return false;btndown=true;docOffset=getPos($img);Selection.disableHandles();myCursor('crosshair');var pos=mouseAbs(e);Coords.setPressed(pos);Tracker.activateHandlers(selectDrag,doneSelect);KeyManager.watchKeys();Selection.update();e.stopPropagation();e.preventDefault();return false;};function selectDrag(pos)
-{Coords.setCurrent(pos);Selection.update();};function newTracker()
-{var trk=$('<div></div>').addClass(cssClass('tracker'));$.browser.msie&&trk.css({opacity:0,backgroundColor:'white'});return trk;};function animateTo(a)
-{var x1=a[0]/xscale,y1=a[1]/yscale,x2=a[2]/xscale,y2=a[3]/yscale;if(animating)return;var animto=Coords.flipCoords(x1,y1,x2,y2);var c=Coords.getFixed();var animat=initcr=[c.x,c.y,c.x2,c.y2];var interv=options.animationDelay;var x=animat[0];var y=animat[1];var x2=animat[2];var y2=animat[3];var ix1=animto[0]-initcr[0];var iy1=animto[1]-initcr[1];var ix2=animto[2]-initcr[2];var iy2=animto[3]-initcr[3];var pcent=0;var velocity=options.swingSpeed;Selection.animMode(true);var animator=function()
-{return function()
-{pcent+=(100-pcent)/velocity;animat[0]=x+((pcent/100)*ix1);animat[1]=y+((pcent/100)*iy1);animat[2]=x2+((pcent/100)*ix2);animat[3]=y2+((pcent/100)*iy2);if(pcent<100)animateStart();else Selection.done();if(pcent>=99.8)pcent=100;setSelectRaw(animat);};}();function animateStart()
-{window.setTimeout(animator,interv);};animateStart();};function setSelect(rect)
-{setSelectRaw([rect[0]/xscale,rect[1]/yscale,rect[2]/xscale,rect[3]/yscale]);};function setSelectRaw(l)
-{Coords.setPressed([l[0],l[1]]);Coords.setCurrent([l[2],l[3]]);Selection.update();};function setOptions(opt)
-{if(typeof(opt)!='object')opt={};options=$.extend(options,opt);if(typeof(options.onChange)!=='function')
-options.onChange=function(){};if(typeof(options.onSelect)!=='function')
-options.onSelect=function(){};};function tellSelect()
-{return unscale(Coords.getFixed());};function tellScaled()
-{return Coords.getFixed();};function setOptionsNew(opt)
-{setOptions(opt);interfaceUpdate();};function disableCrop()
-{options.disabled=true;Selection.disableHandles();Selection.setCursor('default');Tracker.setCursor('default');};function enableCrop()
-{options.disabled=false;interfaceUpdate();};function cancelCrop()
-{Selection.done();Tracker.activateHandlers(null,null);};function destroy()
-{$div.remove();$origimg.show();};function interfaceUpdate(alt)
-{options.allowResize?alt?Selection.enableOnly():Selection.enableHandles():Selection.disableHandles();Tracker.setCursor(options.allowSelect?'crosshair':'default');Selection.setCursor(options.allowMove?'move':'default');$div.css('backgroundColor',options.bgColor);if('setSelect'in options){setSelect(opt.setSelect);Selection.done();delete(options.setSelect);}
-if('trueSize'in options){xscale=options.trueSize[0]/boundx;yscale=options.trueSize[1]/boundy;}
-xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if('outerImage'in options)
-{$img.attr('src',options.outerImage);delete(options.outerImage);}
-Selection.refresh();};$hdl_holder.hide();interfaceUpdate(true);var api={animateTo:animateTo,setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale];},getWidgetSize:function(){return[boundx,boundy];},release:Selection.release,destroy:destroy};$origimg.data('Jcrop',api);return api;};$.fn.Jcrop=function(options)
-{function attachWhenDone(from)
-{var loadsrc=options.useImg||from.src;var img=new Image();img.onload=function(){$.Jcrop(from,options);};img.src=loadsrc;};if(typeof(options)!=='object')options={};this.each(function()
-{if($(this).data('Jcrop'))
-{if(options=='api')return $(this).data('Jcrop');else $(this).data('Jcrop').setOptions(options);}
-else attachWhenDone(this);});return this;};})(jQuery);
View
259 app/assets/javascripts/jquery.fileupload-ui.js
@@ -1,259 +0,0 @@
-/*
- * jQuery File Upload User Interface Plugin 3.2.2
- *
- * Copyright 2010, Sebastian Tschan, AQUANTUM
- * Licensed under the MIT license:
- * http://creativecommons.org/licenses/MIT/
- *
- * https://blueimp.net
- * http://www.aquantum.de
- */
-
-/*jslint browser: true */
-/*global jQuery */
-
-(function ($) {
-
- var UploadHandler,
- methods;
-
- UploadHandler = function (container, options) {
- var uploadHandler = this,
- undef = 'undefined',
- func = 'function',
- dragOverTimeout,
- isDropZoneEnlarged;
-
- this.dropZone = container;
- this.progressSelector = '.file_upload_progress div';
- this.cancelSelector = '.file_upload_cancel div';
- this.cssClassSmall = 'file_upload_small';
- this.cssClassLarge = 'file_upload_large';
- this.cssClassHighlight = 'file_upload_highlight';
- this.dropEffect = 'highlight';
- this.uploadTable = this.downloadTable = $();
-
- this.buildUploadRow = this.buildDownloadRow = function () {
- return null;
- };
-
- this.addNode = function (parentNode, node, callBack) {
- if (node) {
- node.css('display', 'none').appendTo(parentNode).fadeIn(function () {
- if (typeof callBack === func) {
- try {
- callBack();
- } catch (e) {
- // Fix endless exception loop:
- $(this).stop();
- throw e;
- }
- }
- });
- } else if (typeof callBack === func) {
- callBack();
- }
- };
-
- this.removeNode = function (node, callBack) {
- if (node) {
- node.fadeOut(function () {
- $(this).remove();
- if (typeof callBack === func) {
- try {
- callBack();
- } catch (e) {
- // Fix endless exception loop:
- $(this).stop();
- throw e;
- }
- }
- });
- } else if (typeof callBack === func) {
- callBack();
- }
- };
-
- this.onAbort = function (event, files, index, xhr, handler) {
- uploadHandler.removeNode(handler.uploadRow);
- };
-
- this.cancelUpload = function (event, files, index, xhr, handler) {
- var readyState = xhr.readyState;
- xhr.abort();
- // If readyState is below 2, abort() has no effect:
- if (isNaN(readyState) || readyState < 2) {
- handler.onAbort(event, files, index, xhr, handler);
- }
- };
-
- this.initProgressBar = function (node, value) {
- if (typeof node.progressbar === func) {
- return node.progressbar({
- value: value
- });
- } else {
- var progressbar = $('<progress value="' + value + '" max="100"/>').appendTo(node);
- progressbar.progressbar = function (key, value) {
- progressbar.attr('value', value);
- };
- return progressbar;
- }
- };
-
- this.initUploadRow = function (event, files, index, xhr, handler, callBack) {
- var uploadRow = handler.uploadRow = uploadHandler.buildUploadRow(files, index);
- if (uploadRow) {
- handler.progressbar = uploadHandler.initProgressBar(
- uploadRow.find(uploadHandler.progressSelector),
- (xhr.upload ? 0 : 100)
- );
- uploadRow.find(uploadHandler.cancelSelector).click(function (e) {
- uploadHandler.cancelUpload(e, files, index, xhr, handler);
- });
- }
- uploadHandler.addNode(uploadHandler.uploadTable, uploadRow, callBack);
- };
-
- this.initUpload = function (event, files, index, xhr, handler, callBack) {
- uploadHandler.initUploadRow(event, files, index, xhr, handler, function () {
- if (typeof uploadHandler.beforeSend === func) {
- uploadHandler.beforeSend(event, files, index, xhr, handler, callBack);
- } else {
- callBack();
- }
- });
- };
-
- this.onProgress = function (event, files, index, xhr, handler) {
- if (handler.progressbar) {
- handler.progressbar.progressbar(
- 'value',
- parseInt(event.loaded / event.total * 100, 10)
- );
- }
- };
-
- this.parseResponse = function (xhr) {
- if (typeof xhr.responseText !== undef) {
- return $.parseJSON(xhr.responseText);
- } else {
- // Instead of an XHR object, an iframe is used for legacy browsers:
- return $.parseJSON(xhr.contents().text());
- }
- };
-
- this.initDownloadRow = function (event, files, index, xhr, handler, callBack) {
- var json, downloadRow;
- try {
- json = handler.response = uploadHandler.parseResponse(xhr);
- downloadRow = handler.downloadRow = uploadHandler.buildDownloadRow(json);
- uploadHandler.addNode(uploadHandler.downloadTable, downloadRow, callBack);
- } catch (e) {
- if (typeof uploadHandler.onError === func) {
- handler.originalEvent = event;
- uploadHandler.onError(e, files, index, xhr, handler);
- } else {
- throw e;
- }
- }
- };
-
- this.onLoad = function (event, files, index, xhr, handler) {
- uploadHandler.removeNode(handler.uploadRow, function () {
- uploadHandler.initDownloadRow(event, files, index, xhr, handler, function () {
- if (typeof uploadHandler.onComplete === func) {
- uploadHandler.onComplete(event, files, index, xhr, handler);
- }
- });
- });
- };
-
- this.dropZoneEnlarge = function () {
- if (!isDropZoneEnlarged) {
- if (typeof uploadHandler.dropZone.switchClass === func) {
- uploadHandler.dropZone.switchClass(
- uploadHandler.cssClassSmall,
- uploadHandler.cssClassLarge
- );
- } else {
- uploadHandler.dropZone.addClass(uploadHandler.cssClassLarge);
- uploadHandler.dropZone.removeClass(uploadHandler.cssClassSmall);
- }
- isDropZoneEnlarged = true;
- }
- };
-
- this.dropZoneReduce = function () {
- if (typeof uploadHandler.dropZone.switchClass === func) {
- uploadHandler.dropZone.switchClass(
- uploadHandler.cssClassLarge,
- uploadHandler.cssClassSmall
- );
- } else {
- uploadHandler.dropZone.addClass(uploadHandler.cssClassSmall);
- uploadHandler.dropZone.removeClass(uploadHandler.cssClassLarge);
- }
- isDropZoneEnlarged = false;
- };
-
- this.onDocumentDragEnter = function (event) {
- uploadHandler.dropZoneEnlarge();
- };
-
- this.onDocumentDragOver = function (event) {
- if (dragOverTimeout) {
- clearTimeout(dragOverTimeout);
- }
- dragOverTimeout = setTimeout(function () {
- uploadHandler.dropZoneReduce();
- }, 200);
- };
-
- this.onDragEnter = this.onDragLeave = function (event) {
- uploadHandler.dropZone.toggleClass(uploadHandler.cssClassHighlight);
- };
-
- this.onDrop = function (event) {
- if (dragOverTimeout) {
- clearTimeout(dragOverTimeout);
- }
- if (uploadHandler.dropEffect && typeof uploadHandler.dropZone.effect === func) {
- uploadHandler.dropZone.effect(uploadHandler.dropEffect, function () {
- uploadHandler.dropZone.removeClass(uploadHandler.cssClassHighlight);
- uploadHandler.dropZoneReduce();
- });
- } else {
- uploadHandler.dropZone.removeClass(uploadHandler.cssClassHighlight);
- uploadHandler.dropZoneReduce();
- }
- };
-
- $.extend(this, options);
- };
-
- methods = {
- init : function (options) {
- return this.each(function () {
- $(this).fileUpload(new UploadHandler($(this), options));
- });
- },
-
- destroy : function (namespace) {
- return this.each(function () {
- $(this).fileUpload('destroy', namespace);
- });
- }
- };
-
- $.fn.fileUploadUI = function (method) {
- if (methods[method]) {
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
- } else if (typeof method === 'object' || !method) {
- return methods.init.apply(this, arguments);
- } else {
- $.error('Method ' + method + ' does not exist on jQuery.fileUploadUI');
- }
- };
-
-}(jQuery));
View
475 app/assets/javascripts/jquery.fileupload.js
@@ -1,475 +0,0 @@
-/*
- * jQuery File Upload Plugin 3.4
- *
- * Copyright 2010, Sebastian Tschan, AQUANTUM
- * Licensed under the MIT license:
- * http://creativecommons.org/licenses/MIT/
- *
- * https://blueimp.net
- * http://www.aquantum.de
- */
-
-/*jslint browser: true */
-/*global File, FileReader, FormData, unescape, jQuery */
-
-(function ($) {
-
- var FileUpload,
- methods;
-
- FileUpload = function (container) {
- var fileUpload = this,
- uploadForm = (container.is('form') ? container : container.find('form').first()),
- fileInput = uploadForm.find('input:file').first(),
- settings = {
- namespace: 'file_upload',
- cssClass: 'file_upload',
- dragDropSupport: true,
- dropZone: container,
- url: uploadForm.attr('action'),
- method: uploadForm.attr('method'),
- fieldName: fileInput.attr('name'),
- multipart: true,
- multiFileRequest: false,
- formData: function () {
- return uploadForm.serializeArray();
- },
- withCredentials: false,
- forceIframeUpload: false
- },
- documentListeners = {},
- dropZoneListeners = {},
- fileInputListeners = {},
- undef = 'undefined',
- func = 'function',
- num = 'number',
- protocolRegExp = /^http(s)?:\/\//,
-
- MultiLoader = function (callBack, numberComplete) {
- var loaded = 0;
- this.complete = function () {
- loaded += 1;
- if (loaded === numberComplete) {
- callBack();
- }
- };
- },
-
- isXHRUploadCapable = function () {
- return typeof XMLHttpRequest !== undef && typeof File !== undef && (
- !settings.multipart || typeof FormData !== undef || typeof FileReader !== undef
- );
- },
-
- initEventHandlers = function () {
- if (settings.dragDropSupport) {
- if (typeof settings.onDocumentDragEnter === func) {
- documentListeners['dragenter.' + settings.namespace] = settings.onDocumentDragEnter;
- }
- if (typeof settings.onDocumentDragLeave === func) {
- documentListeners['dragleave.' + settings.namespace] = settings.onDocumentDragLeave;
- }
- documentListeners['dragover.' + settings.namespace] = fileUpload.onDocumentDragOver;
- documentListeners['drop.' + settings.namespace] = fileUpload.onDocumentDrop;
- $(document).bind(documentListeners);
- if (typeof settings.onDragEnter === func) {
- dropZoneListeners['dragenter.' + settings.namespace] = settings.onDragEnter;
- }
- if (typeof settings.onDragLeave === func) {
- dropZoneListeners['dragleave.' + settings.namespace] = settings.onDragLeave;
- }
- dropZoneListeners['dragover.' + settings.namespace] = fileUpload.onDragOver;
- dropZoneListeners['drop.' + settings.namespace] = fileUpload.onDrop;
- settings.dropZone.bind(dropZoneListeners);
- }
- fileInputListeners['change.' + settings.namespace] = fileUpload.onChange;
- fileInput.bind(fileInputListeners);
- },
-
- removeEventHandlers = function () {
- $.each(documentListeners, function (key, value) {
- $(document).unbind(key, value);
- });
- $.each(dropZoneListeners, function (key, value) {
- settings.dropZone.unbind(key, value);
- });
- $.each(fileInputListeners, function (key, value) {
- fileInput.unbind(key, value);
- });
- },
-
- initUploadEventHandlers = function (files, index, xhr, settings) {
- if (typeof settings.onProgress === func) {
- xhr.upload.onprogress = function (e) {
- settings.onProgress(e, files, index, xhr, settings);
- };
- }
- if (typeof settings.onLoad === func) {
- xhr.onload = function (e) {
- settings.onLoad(e, files, index, xhr, settings);
- };
- }
- if (typeof settings.onAbort === func) {
- xhr.onabort = function (e) {
- settings.onAbort(e, files, index, xhr, settings);
- };
- }
- if (typeof settings.onError === func) {
- xhr.onerror = function (e) {
- settings.onError(e, files, index, xhr, settings);
- };
- }
- },
-
- getFormData = function (settings) {
- if (typeof settings.formData === func) {
- return settings.formData();
- } else if ($.isArray(settings.formData)) {
- return settings.formData;
- } else if (settings.formData) {
- var formData = [];
- $.each(settings.formData, function (name, value) {
- formData.push({name: name, value: value});
- });
- return formData;
- }
- return [];
- },
-
- isSameDomain = function (url) {
- if (protocolRegExp.test(url)) {
- var host = location.host,
- indexStart = location.protocol.length + 2,
- index = url.indexOf(host, indexStart),
- pathIndex = index + host.length;
- if ((index === indexStart || index === url.indexOf('@', indexStart) + 1) &&
- (url.length === pathIndex || $.inArray(url.charAt(pathIndex), ['/', '?', '#']) !== -1)) {
- return true;
- }
- return false;
- }
- return true;
- },
-
- nonMultipartUpload = function (file, xhr, sameDomain) {
- if (sameDomain) {
- xhr.setRequestHeader('X-File-Name', unescape(encodeURIComponent(file.name)));
- }
- xhr.setRequestHeader('Content-Type', file.type);
- xhr.send(file);
- },
-
- formDataUpload = function (files, xhr, settings) {
- var formData = new FormData(),
- i;
- $.each(getFormData(settings), function (index, field) {
- formData.append(field.name, field.value);
- });
- for (i = 0; i < files.length; i += 1) {
- formData.append(settings.fieldName, files[i]);
- }
- xhr.send(formData);
- },
-
- loadFileContent = function (file, callBack) {
- var fileReader = new FileReader();
- fileReader.onload = function (e) {
- file.content = e.target.result;
- callBack();
- };
- fileReader.readAsBinaryString(file);
- },
-
- buildMultiPartFormData = function (boundary, files, fields) {
- var doubleDash = '--',
- crlf = '\r\n',
- formData = '';
- $.each(fields, function (index, field) {
- formData += doubleDash + boundary + crlf +
- 'Content-Disposition: form-data; name="' +
- unescape(encodeURIComponent(field.name)) +
- '"' + crlf + crlf +
- unescape(encodeURIComponent(field.value)) + crlf;
- });
- $.each(files, function (index, file) {
- formData += doubleDash + boundary + crlf +
- 'Content-Disposition: form-data; name="' +
- unescape(encodeURIComponent(settings.fieldName)) +
- '"; filename="' + unescape(encodeURIComponent(file.name)) + '"' + crlf +
- 'Content-Type: ' + file.type + crlf + crlf +
- file.content + crlf;
- });
- formData += doubleDash + boundary + doubleDash + crlf;
- return formData;
- },
-
- fileReaderUpload = function (files, xhr, settings) {
- var boundary = '----MultiPartFormBoundary' + (new Date()).getTime(),
- loader,
- i;
- xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
- loader = new MultiLoader(function () {
- xhr.sendAsBinary(buildMultiPartFormData(
- boundary,
- files,
- getFormData(settings)
- ));
- }, files.length);
- for (i = 0; i < files.length; i += 1) {
- loadFileContent(files[i], loader.complete);
- }
- },
-
- upload = function (files, index, xhr, settings) {
- var sameDomain = isSameDomain(settings.url),
- filesToUpload;
- initUploadEventHandlers(files, index, xhr, settings);
- xhr.open(settings.method, settings.url, true);
- if (sameDomain) {
- xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
- } else if (settings.withCredentials) {
- xhr.withCredentials = true;
- }
- if (!settings.multipart) {
- nonMultipartUpload(files[index], xhr, sameDomain);
- } else {
- if (typeof index === num) {
- filesToUpload = [files[index]];
- } else {
- filesToUpload = files;
- }
- if (typeof FormData !== undef) {
- formDataUpload(filesToUpload, xhr, settings);
- } else if (typeof FileReader !== undef) {
- fileReaderUpload(filesToUpload, xhr, settings);
- } else {
- $.error('Browser does neither support FormData nor FileReader interface');
- }
- }
- },
-
- handleUpload = function (event, files, index) {
- var xhr = new XMLHttpRequest(),
- uploadSettings = $.extend({}, settings);
- if (typeof settings.initUpload === func) {
- settings.initUpload(
- event,
- files,
- index,
- xhr,
- uploadSettings,
- function () {
- upload(files, index, xhr, uploadSettings);
- }
- );
- } else {
- upload(files, index, xhr, uploadSettings);
- }
- },
-
- handleFiles = function (event, files) {
- var i;
- if (settings.multiFileRequest) {
- handleUpload(event, files);
- } else {
- for (i = 0; i < files.length; i += 1) {
- handleUpload(event, files, i);
- }
- }
- },
-
- legacyUploadFormDataInit = function (input, settings) {
- var formData = getFormData(settings);
- uploadForm.find(':input').not(':disabled')
- .attr('disabled', true)
- .addClass(settings.namespace + '_disabled');
- $.each(formData, function (index, field) {
- $('<input type="hidden"/>')
- .attr('name', field.name)
- .val(field.value)
- .addClass(settings.namespace + '_form_data')
- .insertBefore(fileInput);
- });
- input.insertAfter(fileInput);
- },
-
- legacyUploadFormDataReset = function (input, settings) {
- input.remove();
- uploadForm.find('.' + settings.namespace + '_disabled')
- .removeAttr('disabled')
- .removeClass(settings.namespace + '_disabled');
- uploadForm.find('.' + settings.namespace + '_form_data').remove();
- },
-
- legacyUpload = function (input, iframe, settings) {
- iframe
- .unbind('abort')
- .bind('abort', function (e) {
- iframe.readyState = 0;
- // javascript:false as iframe src prevents warning popups on HTTPS in IE6
- // concat is used here to prevent the "Script URL" JSLint error:
- iframe.unbind('load').attr('src', 'javascript'.concat(':false;'));
- if (typeof settings.onAbort === func) {
- settings.onAbort(e, [{name: input.val(), type: null, size: null}], 0, iframe, settings);
- }
- })
- .unbind('load')
- .bind('load', function (e) {
- iframe.readyState = 4;
- if (typeof settings.onLoad === func) {
- settings.onLoad(e, [{name: input.val(), type: null, size: null}], 0, iframe, settings);
- }
- });
- uploadForm
- .attr('action', settings.url)
- .attr('target', iframe.attr('name'));
- legacyUploadFormDataInit(input, settings);
- iframe.readyState = 2;
- uploadForm.get(0).submit();
- legacyUploadFormDataReset(input, settings);
- },
-
- handleLegacyUpload = function (event, input) {
- // javascript:false as iframe src prevents warning popups on HTTPS in IE6:
- var iframe = $('<iframe src="javascript:false;" style="display:none" name="iframe_' +
- settings.namespace + '_' + (new Date()).getTime() + '"></iframe>'),
- uploadSettings = $.extend({}, settings);
- iframe.readyState = 0;
- iframe.abort = function () {
- iframe.trigger('abort');
- };
- iframe.bind('load', function () {
- iframe.unbind('load');
- if (typeof settings.initUpload === func) {
- settings.initUpload(
- event,
- [{name: input.val(), type: null, size: null}],
- 0,
- iframe,
- uploadSettings,
- function () {
- legacyUpload(input, iframe, uploadSettings);
- }
- );
- } else {
- legacyUpload(input, iframe, uploadSettings);
- }
- }).appendTo(uploadForm);
- },
-
- resetFileInput = function () {
- var inputClone = fileInput.clone(true);
- $('<form/>').append(inputClone).get(0).reset();
- fileInput.replaceWith(inputClone);
- fileInput = inputClone;
- };
-
- this.onDocumentDragOver = function (e) {
- if (typeof settings.onDocumentDragOver === func &&
- settings.onDocumentDragOver(e) === false) {
- return false;
- }
- e.preventDefault();
- };
-
- this.onDocumentDrop = function (e) {
- if (typeof settings.onDocumentDrop === func &&
- settings.onDocumentDrop(e) === false) {
- return false;
- }
- e.preventDefault();
- };
-
- this.onDragOver = function (e) {
- if (typeof settings.onDragOver === func &&
- settings.onDragOver(e) === false) {
- return false;
- }
- var dataTransfer = e.originalEvent.dataTransfer;
- if (dataTransfer) {
- dataTransfer.dropEffect = dataTransfer.effectAllowed = 'copy';
- }
- e.preventDefault();
- };
-
- this.onDrop = function (e) {
- if (typeof settings.onDrop === func &&
- settings.onDrop(e) === false) {
- return false;
- }
- var dataTransfer = e.originalEvent.dataTransfer;
- if (dataTransfer && dataTransfer.files && isXHRUploadCapable()) {
- handleFiles(e, dataTransfer.files);
- }
- e.preventDefault();
- };
-
- this.onChange = function (e) {
- if (typeof settings.onChange === func &&
- settings.onChange(e) === false) {
- return false;
- }
- if (!settings.forceIframeUpload && e.target.files && isXHRUploadCapable()) {
- handleFiles(e, e.target.files);
- } else {
- handleLegacyUpload(e, $(e.target));
- }
- resetFileInput();
- };
-
- this.init = function (options) {
- if (options) {
- $.extend(settings, options);
- }
- if (container.data(settings.namespace)) {
- $.error('FileUpload with namespace "' + settings.namespace + '" already assigned to this element');
- return;
- }
- container
- .data(settings.namespace, fileUpload)
- .addClass(settings.cssClass);
- settings.dropZone.addClass(settings.cssClass);
- initEventHandlers();
- };
-
- this.destroy = function () {
- removeEventHandlers();
- container
- .removeData(settings.namespace)
- .removeClass(settings.cssClass);
- settings.dropZone.removeClass(settings.cssClass);
- };
- };
-
- methods = {
- init : function (options) {
- return this.each(function () {
- (new FileUpload($(this))).init(options);
- });
- },
-
- destroy : function (namespace) {
- return this.each(function () {
- namespace = namespace ? namespace : 'file_upload';
- var fileUpload = $(this).data(namespace);
- if (fileUpload) {
- fileUpload.destroy();
- } else {
- $.error('No FileUpload with namespace "' + namespace + '" assigned to this element');
- }
- });
-
- }
- };
-
- $.fn.fileUpload = function (method) {
- if (methods[method]) {
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
- } else if (typeof method === 'object' || !method) {
- return methods.init.apply(this, arguments);
- } else {
- $.error('Method ' + method + ' does not exist on jQuery.fileUpload');
- }
- };
-
-}(jQuery));
View
815 app/assets/javascripts/jquery.form.js
@@ -1,815 +0,0 @@
-/*!
- * jQuery Form Plugin
- * version: 2.69 (06-APR-2011)
- * @requires jQuery v1.3.2 or later
- *
- * Examples and documentation at: http://malsup.com/jquery/form/
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- */
-;(function($) {
-
-/*
- Usage Note:
- -----------
- Do not use both ajaxSubmit and ajaxForm on the same form. These
- functions are intended to be exclusive. Use ajaxSubmit if you want
- to bind your own submit handler to the form. For example,
-
- $(document).ready(function() {
- $('#myForm').bind('submit', function(e) {
- e.preventDefault(); // <-- important
- $(this).ajaxSubmit({
- target: '#output'
- });
- });
- });
-
- Use ajaxForm when you want the plugin to manage all the event binding
- for you. For example,
-
- $(document).ready(function() {
- $('#myForm').ajaxForm({
- target: '#output'
- });
- });
-
- When using ajaxForm, the ajaxSubmit function will be invoked for you
- at the appropriate time.
-*/
-
-/**
- * ajaxSubmit() provides a mechanism for immediately submitting
- * an HTML form using AJAX.
- */
-$.fn.ajaxSubmit = function(options) {
- // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
- if (!this.length) {
- log('ajaxSubmit: skipping submit process - no element selected');
- return this;
- }
-
- if (typeof options == 'function') {
- options = { success: options };
- }
-
- var action = this.attr('action');
- var url = (typeof action === 'string') ? $.trim(action) : '';
- if (url) {
- // clean url (don't include hash vaue)
- url = (url.match(/^([^#]+)/)||[])[1];
- }
- url = url || window.location.href || '';
-
- options = $.extend(true, {
- url: url,
- success: $.ajaxSettings.success,
- type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
- iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
- }, options);
-
- // hook for manipulating the form data before it is extracted;
- // convenient for use with rich editors like tinyMCE or FCKEditor
- var veto = {};
- this.trigger('form-pre-serialize', [this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
- return this;
- }
-
- // provide opportunity to alter form data before it is serialized
- if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSerialize callback');
- return this;
- }
-
- var n,v,a = this.formToArray(options.semantic);
- if (options.data) {
- options.extraData = options.data;
- for (n in options.data) {
- if(options.data[n] instanceof Array) {
- for (var k in options.data[n]) {
- a.push( { name: n, value: options.data[n][k] } );
- }
- }
- else {
- v = options.data[n];
- v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
- a.push( { name: n, value: v } );
- }
- }
- }
-
- // give pre-submit callback an opportunity to abort the submit
- if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSubmit callback');
- return this;
- }
-
- // fire vetoable 'validate' event
- this.trigger('form-submit-validate', [a, this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
- return this;
- }
-
- var q = $.param(a);
-
- if (options.type.toUpperCase() == 'GET') {
- options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
- options.data = null; // data is null for 'get'
- }
- else {
- options.data = q; // data is the query string for 'post'
- }
-
- var $form = this, callbacks = [];
- if (options.resetForm) {
- callbacks.push(function() { $form.resetForm(); });
- }
- if (options.clearForm) {
- callbacks.push(function() { $form.clearForm(); });
- }
-
- // perform a load on the target only if dataType is not provided
- if (!options.dataType && options.target) {
- var oldSuccess = options.success || function(){};
- callbacks.push(function(data) {
- var fn = options.replaceTarget ? 'replaceWith' : 'html';
- $(options.target)[fn](data).each(oldSuccess, arguments);
- });
- }
- else if (options.success) {
- callbacks.push(options.success);
- }
-
- options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
- var context = options.context || options; // jQuery 1.4+ supports scope context
- for (var i=0, max=callbacks.length; i < max; i++) {
- callbacks[i].apply(context, [data, status, xhr || $form, $form]);
- }
- };
-
- // are there files to upload?
- var fileInputs = $('input:file', this).length > 0;
- var mp = 'multipart/form-data';
- var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
-
- // options.iframe allows user to force iframe mode
- // 06-NOV-09: now defaulting to iframe mode if file input is detected
- if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
- // hack to fix Safari hang (thanks to Tim Molendijk for this)
- // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
- if (options.closeKeepAlive) {
- $.get(options.closeKeepAlive, fileUpload);
- }
- else {
- fileUpload();
- }
- }
- else {
- $.ajax(options);
- }
-
- // fire 'notify' event
- this.trigger('form-submit-notify', [this, options]);
- return this;
-
-
- // private function for handling file uploads (hat tip to YAHOO!)
- function fileUpload() {
- var form = $form[0];
-
- if ($(':input[name=submit],:input[id=submit]', form).length) {
- // if there is an input with a name or id of 'submit' then we won't be
- // able to invoke the submit fn on the form (at least not x-browser)
- alert('Error: Form elements must not have name or id of "submit".');
- return;
- }
-
- var s = $.extend(true, {}, $.ajaxSettings, options);
- s.context = s.context || s;
- var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
- var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" />');
- var io = $io[0];
-
- $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
-
- var xhr = { // mock object
- aborted: 0,
- responseText: null,
- responseXML: null,
- status: 0,
- statusText: 'n/a',
- getAllResponseHeaders: function() {},
- getResponseHeader: function() {},
- setRequestHeader: function() {},
- abort: function() {
- log('aborting upload...');
- var e = 'aborted';
- this.aborted = 1;
- $io.attr('src', s.iframeSrc); // abort op in progress
- xhr.error = e;
- s.error && s.error.call(s.context, xhr, 'error', e);
- g && $.event.trigger("ajaxError", [xhr, s, e]);
- s.complete && s.complete.call(s.context, xhr, 'error');
- }
- };
-
- var g = s.global;
- // trigger ajax global events so that activity/block indicators work like normal
- if (g && ! $.active++) {
- $.event.trigger("ajaxStart");
- }
- if (g) {
- $.event.trigger("ajaxSend", [xhr, s]);
- }
-
- if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
- if (s.global) {
- $.active--;
- }
- return;
- }
- if (xhr.aborted) {
- return;
- }
-
- var timedOut = 0;
-
- // add submitting element to data if we know it
- var sub = form.clk;
- if (sub) {
- var n = sub.name;
- if (n && !sub.disabled) {
- s.extraData = s.extraData || {};
- s.extraData[n] = sub.value;
- if (sub.type == "image") {
- s.extraData[n+'.x'] = form.clk_x;
- s.extraData[n+'.y'] = form.clk_y;
- }
- }
- }
-
- // take a breath so that pending repaints get some cpu time before the upload starts
- function doSubmit() {
- // make sure form attrs are set
- var t = $form.attr('target'), a = $form.attr('action');
-
- // update form attrs in IE friendly way
- form.setAttribute('target',id);
- if (form.getAttribute('method') != 'POST') {
- form.setAttribute('method', 'POST');
- }
- if (form.getAttribute('action') != s.url) {
- form.setAttribute('action', s.url);
- }
-
- // ie borks in some cases when setting encoding
- if (! s.skipEncodingOverride) {
- $form.attr({
- encoding: 'multipart/form-data',
- enctype: 'multipart/form-data'
- });
- }
-
- // support timout
- if (s.timeout) {
- setTimeout(function() { timedOut = true; cb(); }, s.timeout);
- }
-
- // add "extra" data to form if provided in options
- var extraInputs = [];
- try {
- if (s.extraData) {
- for (var n in s.extraData) {
- extraInputs.push(
- $('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
- .appendTo(form)[0]);
- }
- }
-
- // add iframe to doc and submit the form
- $io.appendTo('body');
- io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
- form.submit();
- }
- finally {
- // reset attrs and remove "extra" input elements
- form.setAttribute('action',a);
- if(t) {
- form.setAttribute('target', t);
- } else {
- $form.removeAttr('target');
- }
- $(extraInputs).remove();
- }
- }
-
- if (s.forceSync) {
- doSubmit();
- }
- else {
- setTimeout(doSubmit, 10); // this lets dom updates render
- }
-
- var data, doc, domCheckCount = 50;
-
- function cb() {
- if (xhr.aborted) {
- return;
- }
-
- var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
- if (!doc || doc.location.href == s.iframeSrc) {
- // response not received yet
- if (!timedOut)
- return;
- }
- io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
-
- var ok = true;
- try {
- if (timedOut) {
- throw 'timeout';
- }
-
- var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
- log('isXml='+isXml);
- if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
- if (--domCheckCount) {
- // in some browsers (Opera) the iframe DOM is not always traversable when
- // the onload callback fires, so we loop a bit to accommodate
- log('requeing onLoad callback, DOM not available');
- setTimeout(cb, 250);
- return;
- }
- // let this fall through because server response could be an empty document
- //log('Could not access iframe DOM after mutiple tries.');
- //throw 'DOMException: not available';
- }
-
- //log('response detected');
- xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
- xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
- xhr.getResponseHeader = function(header){
- var headers = {'content-type': s.dataType};
- return headers[header];
- };
-
- var scr = /(json|script)/.test(s.dataType);
- if (scr || s.textarea) {
- // see if user embedded response in textarea
- var ta = doc.getElementsByTagName('textarea')[0];
- if (ta) {
- xhr.responseText = ta.value;
- }
- else if (scr) {
- // account for browsers injecting pre around json response
- var pre = doc.getElementsByTagName('pre')[0];
- var b = doc.getElementsByTagName('body')[0];
- if (pre) {
- xhr.responseText = pre.textContent;
- }
- else if (b) {
- xhr.responseText = b.innerHTML;
- }
- }
- }
- else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
- xhr.responseXML = toXml(xhr.responseText);
- }
-
- data = httpData(xhr, s.dataType, s);
- }
- catch(e){
- log('error caught:',e);
- ok = false;
- xhr.error = e;
- s.error && s.error.call(s.context, xhr, 'error', e);
- g && $.event.trigger("ajaxError", [xhr, s, e]);
- }
-
- if (xhr.aborted) {
- log('upload aborted');
- ok = false;
- }
-
- // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
- if (ok) {
- s.success && s.success.call(s.context, data, 'success', xhr);
- g && $.event.trigger("ajaxSuccess", [xhr, s]);
- }
-
- g && $.event.trigger("ajaxComplete", [xhr, s]);
-
- if (g && ! --$.active) {
- $.event.trigger("ajaxStop");
- }
-
- s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
-
- // clean up
- setTimeout(function() {
- $io.removeData('form-plugin-onload');
- $io.remove();
- xhr.responseXML = null;
- }, 100);
- }
-
- var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
- if (window.ActiveXObject) {
- doc = new ActiveXObject('Microsoft.XMLDOM');
- doc.async = 'false';
- doc.loadXML(s);
- }
- else {
- doc = (new DOMParser()).parseFromString(s, 'text/xml');
- }
- return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
- };
- var parseJSON = $.parseJSON || function(s) {
- return window['eval']('(' + s + ')');
- };
-
- var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
- var ct = xhr.getResponseHeader('content-type') || '',
- xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
- data = xml ? xhr.responseXML : xhr.responseText;
-
- if (xml && data.documentElement.nodeName === 'parsererror') {
- $.error && $.error('parsererror');
- }
- if (s && s.dataFilter) {
- data = s.dataFilter(data, type);
- }
- if (typeof data === 'string') {
- if (type === 'json' || !type && ct.indexOf('json') >= 0) {
- data = parseJSON(data);
- } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
- $.globalEval(data);
- }
- }
- return data;
- };
- }
-};
-
-/**
- * ajaxForm() provides a mechanism for fully automating form submission.
- *
- * The advantages of using this method instead of ajaxSubmit() are:
- *
- * 1: This method will include coordinates for <input type="image" /> elements (if the element
- * is used to submit the form).
- * 2. This method will include the submit element's name/value data (for the element that was
- * used to submit the form).
- * 3. This method binds the submit() method to the form for you.
- *
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
- * passes the options argument along after properly binding events for submit elements and
- * the form itself.
- */
-$.fn.ajaxForm = function(options) {
- // in jQuery 1.3+ we can fix mistakes with the ready state
- if (this.length === 0) {
- var o = { s: this.selector, c: this.context };
- if (!$.isReady && o.s) {
- log('DOM not ready, queuing ajaxForm');
- $(function() {
- $(o.s,o.c).ajaxForm(options);
- });
- return this;
- }
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
- return this;
- }
-
- return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
- if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
- e.preventDefault();
- $(this).ajaxSubmit(options);
- }
- }).bind('click.form-plugin', function(e) {
- var target = e.target;
- var $el = $(target);
- if (!($el.is(":submit,input:image"))) {
- // is this a child element of the submit el? (ex: a span within a button)
- var t = $el.closest(':submit');
- if (t.length == 0) {
- return;
- }
- target = t[0];
- }
- var form = this;
- form.clk = target;
- if (target.type == 'image') {
- if (e.offsetX != undefined) {
- form.clk_x = e.offsetX;
- form.clk_y = e.offsetY;
- } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
- var offset = $el.offset();
- form.clk_x = e.pageX - offset.left;
- form.clk_y = e.pageY - offset.top;
- } else {
- form.clk_x = e.pageX - target.offsetLeft;
- form.clk_y = e.pageY - target.offsetTop;
- }
- }
- // clear form vars
- setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
- });
-};
-
-// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
-$.fn.ajaxFormUnbind = function() {
- return this.unbind('submit.form-plugin click.form-plugin');
-};
-
-/**
- * formToArray() gathers form element data into an array of objects that can
- * be passed to any of the following ajax functions: $.get, $.post, or load.
- * Each object in the array has both a 'name' and 'value' property. An example of
- * an array for a simple login form might be:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * It is this array that is passed to pre-submit callback functions provided to the
- * ajaxSubmit() and ajaxForm() methods.
- */
-$.fn.formToArray = function(semantic) {
- var a = [];
- if (this.length === 0) {
- return a;
- }
-
- var form = this[0];
- var els = semantic ? form.getElementsByTagName('*') : form.elements;
- if (!els) {
- return a;
- }
-
- var i,j,n,v,el,max,jmax;
- for(i=0, max=els.length; i < max; i++) {
- el = els[i];
- n = el.name;
- if (!n) {
- continue;
- }
-
- if (semantic && form.clk && el.type == "image") {
- // handle image inputs on the fly when semantic == true
- if(!el.disabled && form.clk == el) {
- a.push({name: n, value: $(el).val()});
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- continue;
- }
-
- v = $.fieldValue(el, true);
- if (v && v.constructor == Array) {
- for(j=0, jmax=v.length; j < jmax; j++) {
- a.push({name: n, value: v[j]});
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- a.push({name: n, value: v});
- }
- }
-
- if (!semantic && form.clk) {
- // input type=='image' are not found in elements array! handle it here
- var $input = $(form.clk), input = $input[0];
- n = input.name;
- if (n && !input.disabled && input.type == 'image') {
- a.push({name: n, value: $input.val()});
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- }
- return a;
-};
-
-/**
- * Serializes form data into a 'submittable' string. This method will return a string
- * in the format: name1=value1&amp;name2=value2
- */
-$.fn.formSerialize = function(semantic) {
- //hand off to jQuery.param for proper encoding
- return $.param(this.formToArray(semantic));
-};
-
-/**
- * Serializes all field elements in the jQuery object into a query string.
- * This method will return a string in the format: name1=value1&amp;name2=value2
- */
-$.fn.fieldSerialize = function(successful) {
- var a = [];
- this.each(function() {
- var n = this.name;
- if (!n) {
- return;
- }
- var v = $.fieldValue(this, successful);
- if (v && v.constructor == Array) {
- for (var i=0,max=v.length; i < max; i++) {
- a.push({name: n, value: v[i]});
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- a.push({name: this.name, value: v});
- }
- });
- //hand off to jQuery.param for proper encoding
- return $.param(a);
-};
-
-/**
- * Returns the value(s) of the element in the matched set. For example, consider the following form:
- *
- * <form><fieldset>
- * <input name="A" type="text" />
- * <input name="A" type="text" />
- * <input name="B" type="checkbox" value="B1" />
- * <input name="B" type="checkbox" value="B2"/>
- * <input name="C" type="radio" value="C1" />
- * <input name="C" type="radio" value="C2" />
- * </fieldset></form>
- *
- * var v = $(':text').fieldValue();
- * // if no values are entered into the text inputs
- * v == ['','']
- * // if values entered into the text inputs are 'foo' and 'bar'
- * v == ['foo','bar']
- *
- * var v = $(':checkbox').fieldValue();
- * // if neither checkbox is checked
- * v === undefined
- * // if both checkboxes are checked
- * v == ['B1', 'B2']
- *
- * var v = $(':radio').fieldValue();
- * // if neither radio is checked
- * v === undefined
- * // if first radio is checked
- * v == ['C1']
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true. If this value is false the value(s)
- * for each element is returned.
- *
- * Note: This method *always* returns an array. If no valid value can be determined the
- * array will be empty, otherwise it will contain one or more values.
- */
-$.fn.fieldValue = function(successful) {
- for (var val=[], i=0, max=this.length; i < max; i++) {
- var el = this[i];
- var v = $.fieldValue(el, successful);
- if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
- continue;
- }
- v.constructor == Array ? $.merge(val, v) : val.push(v);
- }
- return val;
-};
-
-/**
- * Returns the value of the field element.
- */
-$.fieldValue = function(el, successful) {
- var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
- if (successful === undefined) {
- successful = true;
- }
-
- if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
- (t == 'checkbox' || t == 'radio') && !el.checked ||
- (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
- tag == 'select' && el.selectedIndex == -1)) {
- return null;
- }
-
- if (tag == 'select') {
- var index = el.selectedIndex;
- if (index < 0) {
- return null;
- }
- var a = [], ops = el.options;
- var one = (t == 'select-one');
- var max = (one ? index+1 : ops.length);
- for(var i=(one ? index : 0); i < max; i++) {
- var op = ops[i];
- if (op.selected) {
- var v = op.value;
- if (!v) { // extra pain for IE...
- v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
- }
- if (one) {
- return v;
- }
- a.push(v);
- }
- }
- return a;
- }
- return $(el).val();
-};
-
-/**
- * Clears the form data. Takes the following actions on the form's input fields:
- * - input text fields will have their 'value' property set to the empty string
- * - select elements will have their 'selectedIndex' property set to -1
- * - checkbox and radio inputs will have their 'checked' property set to false
- * - inputs of type submit, button, reset, and hidden will *not* be effected
- * - button elements will *not* be effected
- */
-$.fn.clearForm = function() {
- return this.each(function() {
- $('input,select,textarea', this).clearFields();
- });
-};
-
-/**
- * Clears the selected form elements.
- */
-$.fn.clearFields = $.fn.clearInputs = function() {
- return this.each(function() {
- var t = this.type, tag = this.tagName.toLowerCase();
- if (t == 'text' || t == 'password' || tag == 'textarea') {
- this.value = '';
- }
- else if (t == 'checkbox' || t == 'radio') {
- this.checked = false;
- }
- else if (tag == 'select') {
- this.selectedIndex = -1;
- }
- });
-};
-
-/**
- * Resets the form data. Causes all form elements to be reset to their original value.
- */
-$.fn.resetForm = function() {
- return this.each(function() {
- // guard against an input with the name of 'reset'
- // note that IE reports the reset function as an 'object'
- if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
- this.reset();
- }
- });
-};
-
-/**
- * Enables or disables any matching elements.
- */
-$.fn.enable = function(b) {
- if (b === undefined) {
- b = true;
- }
- return this.each(function() {
- this.disabled = !b;
- });
-};
-
-/**
- * Checks/unchecks any matching checkboxes or radio buttons and
- * selects/deselects and matching option elements.
- */
-$.fn.selected = function(select) {
- if (select === undefined) {
- select = true;
- }
- return this.each(function() {
- var t = this.type;
- if (t == 'checkbox' || t == 'radio') {
- this.checked = select;
- }
- else if (this.tagName.toLowerCase() == 'option') {
- var $sel = $(this).parent('select');
- if (select && $sel[0] && $sel[0].type == 'select-one') {
- // deselect all other options
- $sel.find('option').selected(false);
- }
- this.selected = select;
- }
- });
-};
-
-// helper fn for console logging
-// set $.fn.ajaxSubmit.debug to true to enable debug logging
-function log() {
- if ($.fn.ajaxSubmit.debug) {
- var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
- if (window.console && window.console.log) {
- window.console.log(msg);
- }
- else if (window.opera && window.opera.postError) {
- window.opera.postError(msg);
- }
- }
-};
-
-})(jQuery);
View
79 app/assets/stylesheets/avatars.css
@@ -1,79 +0,0 @@
-/******************** Common ***********************/
-
-/******************** Avatars ***********************/
-.avatars {
- padding-left: 10px;
-}
-.avatar {
- float:left;
- position:relative;
-}
-.avatar .actions {
-}
-.avatar .delete_avatar {
- position:absolute;
- top:5px;
- right:5px;
- display:none;
-}
-.avatar .default {
- border: 5px solid #2A3890;
-}
-.avatar .non_default {
- border: 5px solid #E0EEF5;
-}
-/******************** New form ***********************/
-.new_logo_form {
-}
-/******************** Slide Effect ***********************/
-.boxgrid {
- width: 104px;
- height: 104px;
- float:left;
- overflow: hidden;
- position: relative;
-}
-.boxgrid img {
- position: absolute;
- top: 0;
- left: 0;
- border: 0;
-}
-.boxcaption {
- top: 104px;
- left: 5px;
- float: left;
- position: absolute;
- background: #E0EEF5;
- opacity: .8;
- width: 84px;
- height: 28px;
- /* For IE 5-7 */
- filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
- /* For IE 8 */
- -MS-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
-}
-.captionfull .boxcaption {
- top: 104px;
- left: 5px;
- padding: 5px;
-}
-/**************** Crop **************/
-#precropDiv {
- width:499px;
- display:inline-block;
- padding: 0px 30px 0px 29px;
-}
-#precropPrev {
- vertical-align:top;
- display:inline-block;
- /*padding: 5px 4px 5px 4px;*/
-}
-#precropPrevImg {
- width:100px;
- height:100px;
- overflow:hidden;
- margin-left:30px;
- border: 1px solid #E0EEF5;
-}
-
View
35 app/assets/stylesheets/jquery.Jcrop.css
@@ -1,35 +0,0 @@
-/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */
-.jcrop-holder { text-align: left; }
-
-.jcrop-vline, .jcrop-hline
-{
- font-size: 0;
- position: absolute;
- background: white url('Jcrop.gif') top left repeat;
-}
-.jcrop-vline { height: 100%; width: 1px !important; }
-.jcrop-hline { width: 100%; height: 1px !important; }
-.jcrop-handle {
- font-size: 1px;
- width: 7px !important;
- height: 7px !important;
- border: 1px #eee solid;
- background-color: #333;
- *width: 9px;
- *height: 9px;
-}
-
-.jcrop-tracker { width: 100%; height: 100%; }
-
-.custom .jcrop-vline,
-.custom .jcrop-hline
-{
- background: yellow;
-}
-.custom .jcrop-handle
-{
- border-color: black;
- background-color: #C7BB00;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
View
73 app/assets/stylesheets/jquery.fileupload-ui.css
@@ -1,73 +0,0 @@
-.file_upload {
- position: relative;
- overflow: hidden;
- direction: ltr;
- cursor: pointer;
- text-align: center;
- color: #333;
- font-weight: bold;
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
- border-radius: 10px;
- width: 200px;
- height: 30px;
- line-height: 30px;
- background: palegreen;
- border: 1px solid limegreen;
-}
-
-.file_upload_small {
- width: 200px;
- height: 30px;
- line-height: 30px;
- font-size: auto;
- background: palegreen;
- border: 1px solid limegreen;
-}
-
-.file_upload_large {
- width: 100%;
- height: 150px;
- line-height: 150px;
- font-size: 20px;
- background: palegreen;
- border: 1px solid limegreen;
-}
-
-.file_upload_highlight {
- background: lawngreen;
-}
-
-.file_upload input {
- position: absolute;
- top: 0;
- right: 0;
- margin: 0;
- border: 300px solid transparent;
- opacity: 0;
- -ms-filter: 'alpha(opacity=0)';
- filter: alpha(opacity=0);
- -o-transform: translate(-300px, -300px) scale(10);
- -moz-transform: translate(-800px, 0) scale(10);
- cursor: pointer;
-}
-
-.file_upload iframe, .file_upload button {
- display: none;
-}
-
-.file_upload_progress .ui-progressbar-value {
- background: url(../../images/pbar-ani.gif);
-}
-
-.file_upload_progress div {
- width: 150px;
- height: 15px;
-}
-
-.file_upload_cancel div {
- cursor: pointer;
-}
-.files{
- margin-left: 20px;
-}
View
3 app/views/avatars/index.html.erb
@@ -2,11 +2,12 @@
<% content_for :headers do %>
<%= stylesheet_link_tag "avatars.css", :media => "screen, projection" %>
- <%= javascript_include_tag 'avatars.js' %>
<%= javascript_include_tag 'jquery.Jcrop.min' %>
<%= javascript_include_tag 'jquery.form' %>
<%= javascript_include_tag 'jquery.fileupload' %>
<%= javascript_include_tag 'jquery.fileupload-ui' %>
+ <%= javascript_include_tag 'avatars.js' %>
+
<%= stylesheet_link_tag "jquery.Jcrop", :media => "screen, projection" %>
<%= stylesheet_link_tag "avatars", :media => "screen, projection" %><br/>
<%= stylesheet_link_tag "jquery.fileupload-ui", :media => "screen, projection" %>
View
15 app/views/avatars/update.js.erb
@@ -0,0 +1,15 @@
+$("#avatar_img_<%= old_id %>").removeClass("default");
+$("#avatar_img_<%= old_id %>").addClass("non_default");
+$("#avatar_link_<%= old_id %>").show();
+
+$("#avatar_img_<%= new_id %>").removeClass("non_default");
+$("#avatar_img_<%= new_id %>").addClass("default");
+$("#avatar_link_<%= new_id %>").hide();
+
+representation_path = $("#avatar_img_<%= new_id %>").attr('src').replace("/profile/", "/representation/");
+
+$('#current_user_avatar_img').attr('src', representation_path);
+$('#current_subject_avatar_img').css('background-image', "url('" + representation_path +"')");
+
+
+
View
8 app/views/layouts/_representation.html.erb
@@ -1,5 +1,9 @@
<div id="current_user_info">
- <%= link_to(image_tag(current_user.logo.url(:representation), :width => 20, :height => 20, :class => 'menu_icon'), current_user) %>
+ <% if current_user == current_subject %>
+ <%= link_to(image_tag(current_user.logo.url(:representation), :width => 20, :height => 20, :class => 'menu_icon', :id=> 'current_user_avatar_img'), current_user) %>
+ <% else %>
+ <%= link_to(image_tag(current_user.logo.url(:representation), :width => 20, :height => 20, :class => 'menu_icon'), current_user) %>
+ <% end %>
<%= link_to(current_user.name, current_user) %>
<%= t('representation.action') %>
@@ -10,7 +14,7 @@
<div id="representations_menu">
<ul class="sf-menu" >
<li id="representation_li">
- <a href="#" class="sf-with-ul" style="background: transparent url('<%= image_path current_subject.logo.url(:representation)%>') no-repeat left top;"><%= current_subject.name %><span class="sf-sub-indicator"> »</span></a>
+ <a href="#" class="sf-with-ul" id="current_subject_avatar_img" style="background: transparent url('<%= image_path current_subject.logo.url(:representation)%>') no-repeat left top;"><%= current_subject.name %><span class="sf-sub-indicator"> »</span></a>
<ul>
<% representations.each do |representation| %>
<li>

0 comments on commit f82af73

Please sign in to comment.
Something went wrong with that request. Please try again.