uploader 0.2.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. data/Gemfile +13 -0
  2. data/README.rdoc +7 -2
  3. data/Rakefile +3 -3
  4. data/VERSION +1 -1
  5. data/app/controllers/uploader/uploads_controller.rb +2 -2
  6. data/app/helpers/uploader_helper.rb +51 -3
  7. data/app/views/uploads/_uploadify.html.erb +16 -0
  8. data/lib/active_record/acts/uploader_upload.rb +7 -6
  9. data/lib/daemons/amazonaws.rb +1 -1
  10. data/lib/uploader/middleware/flash_session_cookie_middleware.rb +4 -3
  11. data/lib/uploader/tasks.rb +1 -1
  12. data/locales/ar.yml +12 -12
  13. data/locales/bg.yml +13 -13
  14. data/locales/ca.yml +13 -13
  15. data/locales/cs.yml +13 -13
  16. data/locales/da.yml +8 -8
  17. data/locales/de.yml +12 -12
  18. data/locales/el.yml +16 -16
  19. data/locales/en.yml +2 -2
  20. data/locales/es.yml +12 -12
  21. data/locales/et.yml +14 -14
  22. data/locales/fa.yml +15 -15
  23. data/locales/fi.yml +14 -14
  24. data/locales/fr.yml +12 -12
  25. data/locales/gl.yml +15 -15
  26. data/locales/hi.yml +15 -15
  27. data/locales/hr.yml +13 -13
  28. data/locales/hu.yml +13 -13
  29. data/locales/id.yml +8 -8
  30. data/locales/it.yml +16 -16
  31. data/locales/iw.yml +12 -12
  32. data/locales/ja.yml +16 -16
  33. data/locales/ko.yml +13 -13
  34. data/locales/lt.yml +10 -10
  35. data/locales/lv.yml +11 -11
  36. data/locales/mt.yml +13 -13
  37. data/locales/nl.yml +8 -8
  38. data/locales/no.yml +8 -8
  39. data/locales/pl.yml +13 -13
  40. data/locales/pt-PT.yml +13 -13
  41. data/locales/ro.yml +13 -13
  42. data/locales/ru.yml +13 -13
  43. data/locales/sk.yml +14 -14
  44. data/locales/sl.yml +13 -13
  45. data/locales/sq.yml +13 -13
  46. data/locales/sr.yml +14 -14
  47. data/locales/sv.yml +6 -6
  48. data/locales/th.yml +18 -18
  49. data/locales/tl.yml +11 -11
  50. data/locales/tr.yml +15 -15
  51. data/locales/uk.yml +14 -14
  52. data/locales/vi.yml +12 -12
  53. data/locales/zh-CN.yml +11 -11
  54. data/locales/zh-TW.yml +11 -11
  55. data/locales/zh.yml +11 -11
  56. data/public/images/{SWFUploadButton.png → swfupload/SWFUploadButton.png} +0 -0
  57. data/public/images/{cancelbutton.gif → swfupload/cancelbutton.gif} +0 -0
  58. data/public/images/uploadify/cancel.png +0 -0
  59. data/public/javascripts/jquery/jquery.uploadify.min.js +26 -0
  60. data/public/javascripts/swf/swfobject.js +4 -0
  61. data/public/stylesheets/uploadify.css +53 -0
  62. data/public/swf/expressInstall.swf +0 -0
  63. data/public/swf/uploadify.swf +0 -0
  64. data/rails/init.rb +9 -1
  65. data/test/rails_root/app/controllers/application_controller.rb +4 -0
  66. data/test/rails_root/app/controllers/default_controller.rb +5 -0
  67. data/test/rails_root/app/models/upload.rb +26 -0
  68. data/test/rails_root/app/models/user.rb +11 -1
  69. data/test/rails_root/app/views/default/index.html.erb +6 -0
  70. data/test/rails_root/app/views/default/uploadify.html.erb +17 -0
  71. data/test/rails_root/config/environment.rb +1 -1
  72. data/test/rails_root/config/environments/test.rb +2 -8
  73. data/test/rails_root/config/routes.rb +1 -1
  74. data/test/rails_root/lib/daemons/amazonaws.rb +1 -1
  75. data/test/rails_root/public/images/cancelbutton.gif +0 -0
  76. data/test/rails_root/public/images/swfupload/SWFUploadButton.png +0 -0
  77. data/test/rails_root/public/images/swfupload/cancelbutton.gif +0 -0
  78. data/test/rails_root/public/images/uploadify/cancel.png +0 -0
  79. data/test/rails_root/public/javascripts/jquery/jquery-ui.js +763 -273
  80. data/test/rails_root/public/javascripts/jquery/jquery.js +150 -15
  81. data/test/rails_root/public/javascripts/jquery/jquery.uploadify.min.js +26 -0
  82. data/test/rails_root/public/javascripts/swf/swfobject.js +4 -0
  83. data/test/rails_root/public/javascripts/swfupload/swfupload.cookies.js +2 -2
  84. data/test/rails_root/public/javascripts/swfupload/swfupload.js +325 -136
  85. data/test/rails_root/public/javascripts/swfupload/swfupload.proxy.js +96 -0
  86. data/test/rails_root/public/javascripts/swfupload/swfupload.queue.js +83 -61
  87. data/test/rails_root/public/javascripts/swfupload/swfupload.speed.js +346 -0
  88. data/test/rails_root/public/javascripts/swfupload/swfupload.swfobject.js +4 -3
  89. data/test/rails_root/public/stylesheets/uploadify.css +53 -0
  90. data/test/rails_root/public/swf/expressInstall.swf +0 -0
  91. data/test/rails_root/public/swf/swfupload.swf +0 -0
  92. data/test/rails_root/public/swf/swfupload_fp9.swf +0 -0
  93. data/test/rails_root/public/swf/uploadify.swf +0 -0
  94. data/test/rails_root/test/factories.rb +1 -1
  95. data/test/rails_root/test/functional/default_controller_test.rb +20 -1
  96. data/test/rails_root/test/functional/uploads_controller_test.rb +21 -21
  97. data/test/rails_root/test/test_helper.rb +0 -1
  98. data/test/rails_root/test/unit/upload_test.rb +131 -32
  99. data/uploader.gemspec +28 -8
  100. metadata +31 -10
  101. data/locales/pt.yml +0 -17
@@ -38,11 +38,12 @@
38
38
  */
39
39
 
40
40
 
41
- /* SWFObject v2.0 rc4 <http://code.google.com/p/swfobject/>
42
- Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
41
+ /* SWFObject v2.1 <http://code.google.com/p/swfobject/>
42
+ Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
43
43
  This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
44
44
  */
45
- var swfobject=function(){var X="undefined",P="object",a="visibility:visible",e="visibility:hidden",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",V="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,S=false,C=false;var Y=function(){var l=typeof g.getElementById!=X&&typeof g.getElementsByTagName!=X&&typeof g.createElement!=X&&typeof g.appendChild!=X&&typeof g.replaceChild!=X&&typeof g.removeChild!=X&&typeof g.cloneNode!=X,t=[0,0,0],n=null;if(typeof N.plugins!=X&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=X){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var d=function(){if(!Y.w3cdom){return }J(I);if(Y.ie&&Y.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=b("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);U()}}}}catch(j){}}if(Y.webkit&&typeof g.readyState!=X){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){U()}},10)}if(typeof g.addEventListener!=X){g.addEventListener("DOMContentLoaded",U,null)}M(U)}();function U(){if(S){return }if(Y.ie&&Y.win){var m=W("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=X){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=X){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=X){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(Y.pv[0]>0){var k=b(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(Y.webkit&&Y.webkit<312){T(k)}}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(Y.win||Y.mac)){D(H[j])}else{c(k)}}}}A("#"+m,a)}}function T(m){var k=m.getElementsByTagName(P)[0];if(k){var p=W("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(Y.ie&&Y.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=b(i);for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)})}}function D(j){C=true;var o=b(j.id);if(o){if(j.altContentId){var l=b(j.altContentId);if(l){L=l}}else{L=Z(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=Y.ie&&Y.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(Y.ie&&Y.win&&o.readyState!=4){var i=W("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function c(j){if(Y.ie&&Y.win&&j.readyState!=4){var i=W("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(Z(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(Z(j),j)}}function Z(n){var m=W("div");if(Y.win&&Y.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=b(q);if(typeof AE.id==X){AE.id=q}if(Y.ie&&Y.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=b(AE.id)}else{if(Y.webkit&&Y.webkit<312){var AA=W("embed");AA.setAttribute("type",V);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=W(P);s.setAttribute("type",V);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=W("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function b(i){return g.getElementById(i)}function W(i){return g.createElement(i)}function O(k){var j=Y.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(Y.ie&&Y.mac){return }var l=g.getElementsByTagName("head")[0],k=W("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(Y.ie&&Y.win)&&typeof g.createTextNode!=X){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(Y.ie&&Y.win&&typeof g.styleSheets!=X&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}return{registerObject:function(l,i,k){if(!Y.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;A("#"+l,e)},getObjectById:function(l){var i=null;if(Y.w3cdom&&S){var j=b(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=X)){i=j}else{if(typeof k.SetVariable!=X){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!Y.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){A("#"+u,e);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=X){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);A("#"+u,a)})}else{if(m&&!C&&O("6.0.65")&&(Y.win||Y.mac)){A("#"+u,e);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i);A("#"+u,a)})}}},getFlashPlayerVersion:function(){return{major:Y.pv[0],minor:Y.pv[1],release:Y.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(Y.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(Y.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=b(K);if(i){i.parentNode.replaceChild(L,i);L=null;C=false}}}}}();
45
+ var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
46
+
46
47
 
47
48
 
48
49
  var SWFUpload;
@@ -0,0 +1,53 @@
1
+ /*
2
+ Uploadify v2.1.0
3
+ Release Date: August 24, 2009
4
+
5
+ Copyright (c) 2009 Ronnie Garcia, Travis Nickels
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+ .uploadifyQueueItem {
26
+ font: 11px Verdana, Geneva, sans-serif;
27
+ border: 2px solid #E5E5E5;
28
+ background-color: #F5F5F5;
29
+ margin-top: 5px;
30
+ padding: 10px;
31
+ width: 350px;
32
+ }
33
+ .uploadifyError {
34
+ border: 2px solid #FBCBBC !important;
35
+ background-color: #FDE5DD !important;
36
+ }
37
+ .uploadifyQueueItem .cancel {
38
+ float: right;
39
+ }
40
+ .uploadifyProgress {
41
+ background-color: #FFFFFF;
42
+ border-top: 1px solid #808080;
43
+ border-left: 1px solid #808080;
44
+ border-right: 1px solid #C5C5C5;
45
+ border-bottom: 1px solid #C5C5C5;
46
+ margin-top: 10px;
47
+ width: 100%;
48
+ }
49
+ .uploadifyProgressBar {
50
+ background-color: #0099FF;
51
+ width: 1px;
52
+ height: 3px;
53
+ }
@@ -10,5 +10,5 @@ Factory.define :upload do |f|
10
10
  f.creator {|a| a.association(:user)}
11
11
  f.uploadable {|a| a.association(:user)}
12
12
  f.caption { Factory.next(:name) }
13
- f.local ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'public/images/rails.png'), 'image/gif')
13
+ f.local ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'public/images/rails.png'), 'image/png')
14
14
  end
@@ -13,7 +13,7 @@ class DefaultControllerTest < ActionController::TestCase
13
13
  @user = Factory(:user)
14
14
  get :index, :user_id => @user.to_param
15
15
  end
16
- should_respond_with :success
16
+ should respond_with :success
17
17
  should "have a_container_with_a_long_name in the body" do
18
18
  assert @response.body.include?('a_container_with_a_long_name')
19
19
  end
@@ -25,6 +25,25 @@ class DefaultControllerTest < ActionController::TestCase
25
25
  end
26
26
  end
27
27
 
28
+ context 'on GET to uploadify' do
29
+ # The default view calls the upload_form helper. This isn't a great test but
30
+ # it will make sure it doesn't blow up
31
+ setup do
32
+ @user = Factory(:user)
33
+ get :uploadify, :user_id => @user.to_param
34
+ end
35
+ should respond_with :success
36
+ should "have a_container_with_a_long_name in the body" do
37
+ assert @response.body.include?('a_container_with_a_long_name')
38
+ end
39
+ should "have '1310720' in the body" do
40
+ assert @response.body.include?('1310720')
41
+ end
42
+ should "have '*.jpg' in the body" do
43
+ assert @response.body.include?('*.jpg')
44
+ end
45
+ end
46
+
28
47
  end
29
48
 
30
49
  end
@@ -15,8 +15,8 @@ class UploadsControllerTest < ActionController::TestCase
15
15
  setup do
16
16
  post :create, { :upload => { :local => VALID_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
17
17
  end
18
- should_redirect_to("/create_success") { '/create_success' }
19
- should_set_the_flash_to(I18n.t('uploader.successful_upload'))
18
+ should redirect_to("/create_success") { '/create_success' }
19
+ should set_the_flash.to(I18n.t('uploader.successful_upload'))
20
20
  should "create a valid upload" do
21
21
  assert_difference "@user.uploads.count", 1 do
22
22
  post :create, { :upload => { :local => VALID_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
@@ -28,8 +28,8 @@ class UploadsControllerTest < ActionController::TestCase
28
28
  setup do
29
29
  post :create, { :upload => { :local => VALID_TEXT_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
30
30
  end
31
- should_redirect_to("/create_success") { '/create_success' }
32
- should_set_the_flash_to(I18n.t('uploader.successful_upload'))
31
+ should redirect_to("/create_success") { '/create_success' }
32
+ should set_the_flash.to(I18n.t('uploader.successful_upload'))
33
33
  should "create a valid upload" do
34
34
  assert_difference "@user.uploads.count", 1 do
35
35
  post :create, { :upload => { :local => VALID_TEXT_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
@@ -41,8 +41,8 @@ class UploadsControllerTest < ActionController::TestCase
41
41
  setup do
42
42
  post :create, { :upload => { :local => VALID_PDF_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
43
43
  end
44
- should_redirect_to("/create_success") { '/create_success' }
45
- should_set_the_flash_to(I18n.t('uploader.successful_upload'))
44
+ should redirect_to("/create_success") { '/create_success' }
45
+ should set_the_flash.to(I18n.t('uploader.successful_upload'))
46
46
  should "create a valid upload" do
47
47
  assert_difference "@user.uploads.count", 1 do
48
48
  post :create, { :upload => { :local => VALID_PDF_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
@@ -54,8 +54,8 @@ class UploadsControllerTest < ActionController::TestCase
54
54
  setup do
55
55
  post :create, { :upload => { :local => VALID_WORD_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
56
56
  end
57
- should_redirect_to("/create_success") { '/create_success' }
58
- should_set_the_flash_to(I18n.t('uploader.successful_upload'))
57
+ should redirect_to("/create_success") { '/create_success' }
58
+ should set_the_flash.to(I18n.t('uploader.successful_upload'))
59
59
  should "create a valid upload" do
60
60
  assert_difference "@user.uploads.count", 1 do
61
61
  post :create, { :upload => { :local => VALID_WORD_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
@@ -67,8 +67,8 @@ class UploadsControllerTest < ActionController::TestCase
67
67
  setup do
68
68
  post :create, { :upload => { :local => VALID_EXCEL_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
69
69
  end
70
- should_redirect_to("/create_success") { '/create_success' }
71
- should_set_the_flash_to(I18n.t('uploader.successful_upload'))
70
+ should redirect_to("/create_success") { '/create_success' }
71
+ should set_the_flash.to(I18n.t('uploader.successful_upload'))
72
72
  should "create a valid upload" do
73
73
  assert_difference "@user.uploads.count", 1 do
74
74
  post :create, { :upload => { :local => VALID_EXCEL_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
@@ -80,8 +80,8 @@ class UploadsControllerTest < ActionController::TestCase
80
80
  setup do
81
81
  post :create, { :upload => { :local => nil }, :parent_type => 'User', :parent_id => @user.to_param }
82
82
  end
83
- should_redirect_to("/create_failure") { '/create_failure' }
84
- should_set_the_flash_to(/An error occured while uploading the file/)
83
+ should redirect_to("/create_failure") { '/create_failure' }
84
+ should set_the_flash.to(/An error occured while uploading the file/)
85
85
  should "not create file" do
86
86
  assert_difference "@user.uploads.count", 1 do
87
87
  post :create, { :upload => { :local => VALID_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
@@ -90,14 +90,14 @@ class UploadsControllerTest < ActionController::TestCase
90
90
  end
91
91
  end
92
92
  end
93
- context 'on POST to :swfupload' do
93
+ context 'on POST to :multiupload' do
94
94
  setup do
95
- post :swfupload, { :Filedata => VALID_FILE, :parent_type => 'User', :parent_id => @user.to_param }
95
+ post :multiupload, { :Filedata => VALID_FILE, :parent_type => 'User', :parent_id => @user.to_param }
96
96
  end
97
- should_respond_with :success
97
+ should respond_with :success
98
98
  should "add an upload" do
99
99
  assert_difference "Upload.count", 1 do
100
- post :swfupload, { :Filedata => VALID_FILE, :parent_type => 'User', :parent_id => @user.to_param }
100
+ post :multiupload, { :Filedata => VALID_FILE, :parent_type => 'User', :parent_id => @user.to_param }
101
101
  end
102
102
  end
103
103
  end
@@ -107,7 +107,7 @@ class UploadsControllerTest < ActionController::TestCase
107
107
  @controller.stubs(:has_permission_to_upload).returns(false)
108
108
  post :create, { :upload => { :local => VALID_FILE }, :parent_type => 'User', :parent_id => @user.to_param }
109
109
  end
110
- should_redirect_to("/permission_denied") { '/permission_denied' }
110
+ should redirect_to("/permission_denied") { '/permission_denied' }
111
111
  end
112
112
 
113
113
  context 'on DELETE to :destroy' do
@@ -119,8 +119,8 @@ class UploadsControllerTest < ActionController::TestCase
119
119
  setup do
120
120
  delete :destroy, { :id => @upload.to_param }
121
121
  end
122
- should_redirect_to("/destroy_success") { '/destroy_success' }
123
- should_set_the_flash_to(I18n.t('uploader.file_deleted'))
122
+ should redirect_to("/destroy_success") { '/destroy_success' }
123
+ should set_the_flash.to(I18n.t('uploader.file_deleted'))
124
124
  end
125
125
  context "data changes" do
126
126
  should "delete the upload" do
@@ -139,8 +139,8 @@ class UploadsControllerTest < ActionController::TestCase
139
139
  setup do
140
140
  delete :destroy, { :id => @upload.to_param }
141
141
  end
142
- should_redirect_to("/destroy_success") { '/destroy_success' }
143
- should_set_the_flash_to(I18n.t('uploader.file_delete_permission_denied'))
142
+ should redirect_to("/destroy_success") { '/destroy_success' }
143
+ should set_the_flash.to(I18n.t('uploader.file_delete_permission_denied'))
144
144
  end
145
145
  context "data changes" do
146
146
  should "not delete the upload" do
@@ -3,7 +3,6 @@ ENV["RAILS_ENV"] = "test"
3
3
  require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
4
4
 
5
5
  require 'test_help'
6
- gem 'thoughtbot-factory_girl' # from github
7
6
  require 'factory_girl'
8
7
  require 'ruby-debug'
9
8
  require 'mocha'
@@ -1,45 +1,144 @@
1
- require 'test_helper'
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
2
 
3
3
  class UploadTest < ActiveSupport::TestCase
4
4
 
5
- context 'upload instance' do
5
+ context "upload" do
6
+ context 'upload instance' do
6
7
 
7
- should_belong_to :uploadable
8
- should_belong_to :creator
8
+ should belong_to :uploadable
9
+ should belong_to :creator
9
10
 
10
- should_have_attached_file :local
11
- should_have_attached_file :remote
12
- should_not_allow_mass_assignment_of :creator_id, :uploadable_id, :uploadable_type
13
- should_validate_attachment_size :local, :less_than => 10.megabytes
11
+ should_have_attached_file :local
12
+ should_have_attached_file :remote
13
+ should_not allow_mass_assignment_of :creator_id
14
+ should_not allow_mass_assignment_of :uploadable_id
15
+ should_not allow_mass_assignment_of :uploadable_type
16
+ should_validate_attachment_size :local, :less_than => 10.megabytes
14
17
 
15
- should 'use id_partitioning' do
16
- upload = Upload.new
17
- upload.stubs(:id).returns(12345)
18
- upload.local = VALID_FILE
19
- assert_equal "#{RAILS_ROOT}/public/system/locals/000/012/345/original/rails.png", upload.local.path
20
- assert_equal '/system/locals/000/012/345/original/rails.png', upload.local.url(:original, false)
18
+ should 'use id_partitioning' do
19
+ upload = Upload.new
20
+ upload.stubs(:id).returns(12345)
21
+ upload.local = VALID_FILE
22
+ assert_equal "#{RAILS_ROOT}/public/system/locals/000/012/345/original/rails.png", upload.local.path
23
+ assert_equal '/system/locals/000/012/345/original/rails.png', upload.local.url(:original, false)
24
+ end
25
+
26
+ should 'transliterate the filename' do
27
+ upload = Upload.new
28
+ file = fixture_file %Q{IT'sUPPERCASE!AND WeIRD.JPG}
29
+ upload.local = file
30
+ assert_equal 'itsuppercase-and-weird.jpg', upload.local.original_filename
31
+ file.close
32
+ end
33
+
21
34
  end
22
35
 
23
- should 'transliterate the filename' do
24
- upload = Upload.new
25
- file = fixture_file %Q{IT'sUPPERCASE!AND WeIRD.JPG}
26
- upload.local = file
27
- assert_equal 'it-suppercase-and-weird.jpg', upload.local.original_filename
28
- file.close
36
+ context "Named scopes" do
37
+ context "'newest' named scope" do
38
+ setup do
39
+ Upload.delete_all
40
+ @first = Factory(:upload, :created_at => 1.day.ago)
41
+ @second = Factory(:upload, :created_at => 1.week.ago)
42
+ end
43
+ should "sort by created_at" do
44
+ assert_equal @first, Upload.newest[0]
45
+ assert_equal @second, Upload.newest[1]
46
+ end
47
+ end
48
+ context "'recent' named scope" do
49
+ setup do
50
+ Upload.delete_all
51
+ @recent = Factory(:upload)
52
+ @not_recent = Factory(:upload, :created_at => 10.weeks.ago)
53
+ end
54
+ should "get recent" do
55
+ assert Upload.recent.include?(@recent), "since didn't include recent upload"
56
+ end
57
+ should "not get recent" do
58
+ assert !Upload.recent.include?(@not_recent), "since did include recent upload"
59
+ end
60
+ end
61
+ context "'by_filename' named scope" do
62
+ setup do
63
+ Upload.delete_all
64
+ @first = Factory(:upload, :local_file_name => 'a')
65
+ @second = Factory(:upload, :local_file_name => 'b')
66
+ end
67
+ should "sort by name" do
68
+ assert_equal @first, Upload.by_filename[0]
69
+ assert_equal @second, Upload.by_filename[1]
70
+ end
71
+ end
72
+ context "'public' named scope" do
73
+ setup do
74
+ Upload.delete_all
75
+ @first = Factory(:upload, :is_public => true)
76
+ @second = Factory(:upload, :is_public => false)
77
+ end
78
+ should "find public files" do
79
+ assert Upload.public.include?(@first)
80
+ assert !Upload.public.include?(@second)
81
+ end
82
+ end
83
+ context "'pending_s3_migrations' named scope" do
84
+ setup do
85
+ Upload.delete_all
86
+ @first = Factory(:upload)
87
+ @second = Factory(:upload, :remote_file_name => 'test.png')
88
+ end
89
+ should "find pending_s3_migrations entries" do
90
+ assert Upload.pending_s3_migrations.include?(@first)
91
+ assert !Upload.pending_s3_migrations.include?(@second)
92
+ end
93
+ end
94
+ context "'images' named scope" do
95
+ setup do
96
+ Upload.delete_all
97
+ @first = Factory(:upload) # default is png
98
+ @second = Factory(:upload, :local => ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'test/test.doc'), 'application/msword'))
99
+ end
100
+ should "find images" do
101
+ assert Upload.images.include?(@first)
102
+ assert !Upload.images.include?(@second)
103
+ end
104
+ end
105
+ context "'documents' named scope" do
106
+ setup do
107
+ Upload.delete_all
108
+ @first = Factory(:upload, :local => ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'test/test.doc'), 'application/msword'))
109
+ @second = Factory(:upload)
110
+ end
111
+ should "find documents" do
112
+ assert Upload.documents.include?(@first)
113
+ assert !Upload.documents.include?(@second)
114
+ end
115
+ end
116
+ context "'files' named scope" do
117
+ setup do
118
+ Upload.delete_all
119
+ @first = Factory(:upload, :local => ActionController::TestUploadedFile.new(File.join(RAILS_ROOT, 'test/test.pdf'), 'application/pdf'))
120
+ @second = Factory(:upload)
121
+ end
122
+ should "find files (not images)" do
123
+ assert Upload.files.include?(@first)
124
+ assert !Upload.files.include?(@second)
125
+ end
126
+ end
127
+ context "'created_by' named scope" do
128
+ setup do
129
+ Upload.delete_all
130
+ @creator_id = 28
131
+ @first = Factory(:upload, :creator_id => @creator_id)
132
+ @second = Factory(:upload)
133
+ end
134
+ should "find by creator" do
135
+ assert Upload.created_by(@creator_id).include?(@first)
136
+ assert !Upload.created_by(@creator_id).include?(@second)
137
+ end
138
+ end
29
139
  end
30
-
31
- end
32
140
 
33
- # Named scopes
34
- should_have_named_scope :newest_first
35
- should_have_named_scope :alphabetic
36
- should_have_named_scope :recent
37
- should_have_named_scope :public
38
- should_have_named_scope :images
39
- should_have_named_scope :documents
40
- should_have_named_scope :files
41
- should_have_named_scope :since
42
- should_have_named_scope :pending_s3_migration
141
+ end
43
142
 
44
143
  private
45
144
  def fixture_file(name)
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{uploader}
8
- s.version = "0.2.8"
8
+ s.version = "1.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Justin Ball", "David South"]
12
- s.date = %q{2010-08-24}
13
- s.description = %q{Uploader gem that makes it simple add multiple file uploads to your Rails project using SWFUpload and Paperclip}
11
+ s.authors = ["Justin Ball", "Joel Duffin", "David South"]
12
+ s.date = %q{2010-08-30}
13
+ s.description = %q{Uploader gem that makes it simple add multiple file uploads to your Rails project using SWFUpload, Uploadify and Paperclip}
14
14
  s.email = %q{justinball@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc",
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.files = [
20
20
  ".gitignore",
21
+ "Gemfile",
21
22
  "MIT-LICENSE",
22
23
  "README.rdoc",
23
24
  "Rakefile",
@@ -27,6 +28,7 @@ Gem::Specification.new do |s|
27
28
  "app/helpers/uploader_helper.rb",
28
29
  "app/views/uploads/_swf_javascript.html.erb",
29
30
  "app/views/uploads/_swf_upload.html.erb",
31
+ "app/views/uploads/_uploadify.html.erb",
30
32
  "config/uploader_routes.rb",
31
33
  "db/migrate/20090517040220_create_uploads.rb",
32
34
  "lib/active_record/acts/uploader_upload.rb",
@@ -66,7 +68,6 @@ Gem::Specification.new do |s|
66
68
  "locales/no.yml",
67
69
  "locales/pl.yml",
68
70
  "locales/pt-PT.yml",
69
- "locales/pt.yml",
70
71
  "locales/ro.yml",
71
72
  "locales/ru.yml",
72
73
  "locales/sk.yml",
@@ -82,8 +83,6 @@ Gem::Specification.new do |s|
82
83
  "locales/zh-CN.yml",
83
84
  "locales/zh-TW.yml",
84
85
  "locales/zh.yml",
85
- "public/images/SWFUploadButton.png",
86
- "public/images/cancelbutton.gif",
87
86
  "public/images/file_icons/excel.gif",
88
87
  "public/images/file_icons/file.gif",
89
88
  "public/images/file_icons/file.png",
@@ -132,6 +131,11 @@ Gem::Specification.new do |s|
132
131
  "public/images/file_icons/text.gif",
133
132
  "public/images/file_icons/text.png",
134
133
  "public/images/file_icons/word.gif",
134
+ "public/images/swfupload/SWFUploadButton.png",
135
+ "public/images/swfupload/cancelbutton.gif",
136
+ "public/images/uploadify/cancel.png",
137
+ "public/javascripts/jquery/jquery.uploadify.min.js",
138
+ "public/javascripts/swf/swfobject.js",
135
139
  "public/javascripts/swfupload/fileprogress.js",
136
140
  "public/javascripts/swfupload/handlers.js",
137
141
  "public/javascripts/swfupload/swfupload.cookies.js",
@@ -141,8 +145,11 @@ Gem::Specification.new do |s|
141
145
  "public/javascripts/swfupload/swfupload.speed.js",
142
146
  "public/javascripts/swfupload/swfupload.swfobject.js",
143
147
  "public/stylesheets/swfupload.css",
148
+ "public/stylesheets/uploadify.css",
149
+ "public/swf/expressInstall.swf",
144
150
  "public/swf/swfupload.swf",
145
151
  "public/swf/swfupload_fp9.swf",
152
+ "public/swf/uploadify.swf",
146
153
  "rails/init.rb",
147
154
  "tasks/rails.rake",
148
155
  "test/rails_root/.gitignore",
@@ -156,6 +163,7 @@ Gem::Specification.new do |s|
156
163
  "test/rails_root/app/models/upload.rb",
157
164
  "test/rails_root/app/models/user.rb",
158
165
  "test/rails_root/app/views/default/index.html.erb",
166
+ "test/rails_root/app/views/default/uploadify.html.erb",
159
167
  "test/rails_root/app/views/layouts/application.html.erb",
160
168
  "test/rails_root/config/amazon_s3.yml",
161
169
  "test/rails_root/config/boot.rb",
@@ -188,6 +196,7 @@ Gem::Specification.new do |s|
188
196
  "test/rails_root/public/dispatch.rb",
189
197
  "test/rails_root/public/favicon.ico",
190
198
  "test/rails_root/public/images/SWFUploadButton.png",
199
+ "test/rails_root/public/images/cancelbutton.gif",
191
200
  "test/rails_root/public/images/file_icons/excel.gif",
192
201
  "test/rails_root/public/images/file_icons/file.gif",
193
202
  "test/rails_root/public/images/file_icons/file.png",
@@ -237,6 +246,9 @@ Gem::Specification.new do |s|
237
246
  "test/rails_root/public/images/file_icons/text.png",
238
247
  "test/rails_root/public/images/file_icons/word.gif",
239
248
  "test/rails_root/public/images/rails.png",
249
+ "test/rails_root/public/images/swfupload/SWFUploadButton.png",
250
+ "test/rails_root/public/images/swfupload/cancelbutton.gif",
251
+ "test/rails_root/public/images/uploadify/cancel.png",
240
252
  "test/rails_root/public/javascripts/application.js",
241
253
  "test/rails_root/public/javascripts/builder.js",
242
254
  "test/rails_root/public/javascripts/controls.js",
@@ -249,21 +261,29 @@ Gem::Specification.new do |s|
249
261
  "test/rails_root/public/javascripts/jquery/jquery.jgrowl.js",
250
262
  "test/rails_root/public/javascripts/jquery/jquery.js",
251
263
  "test/rails_root/public/javascripts/jquery/jquery.tips.js",
264
+ "test/rails_root/public/javascripts/jquery/jquery.uploadify.min.js",
252
265
  "test/rails_root/public/javascripts/jquery/jrails.js",
253
266
  "test/rails_root/public/javascripts/prototype.js",
254
267
  "test/rails_root/public/javascripts/scriptaculous.js",
255
268
  "test/rails_root/public/javascripts/slider.js",
256
269
  "test/rails_root/public/javascripts/sound.js",
270
+ "test/rails_root/public/javascripts/swf/swfobject.js",
257
271
  "test/rails_root/public/javascripts/swfupload/fileprogress.js",
258
272
  "test/rails_root/public/javascripts/swfupload/handlers.js",
259
273
  "test/rails_root/public/javascripts/swfupload/swfupload.cookies.js",
260
274
  "test/rails_root/public/javascripts/swfupload/swfupload.js",
275
+ "test/rails_root/public/javascripts/swfupload/swfupload.proxy.js",
261
276
  "test/rails_root/public/javascripts/swfupload/swfupload.queue.js",
277
+ "test/rails_root/public/javascripts/swfupload/swfupload.speed.js",
262
278
  "test/rails_root/public/javascripts/swfupload/swfupload.swfobject.js",
263
279
  "test/rails_root/public/robots.txt",
264
280
  "test/rails_root/public/stylesheets/.keep",
265
281
  "test/rails_root/public/stylesheets/swfupload.css",
282
+ "test/rails_root/public/stylesheets/uploadify.css",
283
+ "test/rails_root/public/swf/expressInstall.swf",
266
284
  "test/rails_root/public/swf/swfupload.swf",
285
+ "test/rails_root/public/swf/swfupload_fp9.swf",
286
+ "test/rails_root/public/swf/uploadify.swf",
267
287
  "test/rails_root/script/about",
268
288
  "test/rails_root/script/breakpointer",
269
289
  "test/rails_root/script/console",
@@ -305,7 +325,7 @@ Gem::Specification.new do |s|
305
325
  s.require_paths = ["lib"]
306
326
  s.rubyforge_project = %q{uploader}
307
327
  s.rubygems_version = %q{1.3.7}
308
- s.summary = %q{SWFUpload + Paperclip wrapped in an engine with love.}
328
+ s.summary = %q{Uploadify, SWFUpload + Paperclip wrapped in an engine with love.}
309
329
  s.test_files = [
310
330
  "test/rails_root/app/controllers/application_controller.rb",
311
331
  "test/rails_root/app/controllers/default_controller.rb",