ideyabox 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -27,7 +27,9 @@ Hey, people!
27
27
 
28
28
  It's simple like this:
29
29
 
30
- After installation generate all administrative staff
30
+ ### Generating admin layout
31
+
32
+ After installation generate all administrative staff (flag -f is for forced replacement of some files)
31
33
 
32
34
  $ rails g ideyabox:admin -f
33
35
 
@@ -45,6 +47,14 @@ like this
45
47
  root :to => "guests#index"
46
48
  end
47
49
 
50
+ ### Generating admin assets
51
+
52
+ ### Admin Scaffold
53
+
54
+ ### Views for associated images
55
+
56
+ ### Crop functionality
57
+
48
58
  ## TODO
49
59
 
50
60
  1. Add search engine
@@ -2,6 +2,8 @@
2
2
  //= require jquery
3
3
  //= require jquery-ui
4
4
  //= require jquery_ujs
5
+ //= require jquery.Jcrop.min.js
6
+ //= require jquery.color.js
5
7
  //= require swfobject.js
6
8
  //= require jquery.uploadify.min
7
9
  //= require jquery-ui.min.js
@@ -10,9 +12,12 @@
10
12
 
11
13
  //
12
14
  $(document).ready(function(){
15
+
13
16
  $(".chosen_select").chosen();
14
17
  $('.pagination').hide();
15
18
 
19
+
20
+
16
21
  $('.zebra th a').live('click', function () {
17
22
  $.getScript(this.href);
18
23
  return false;
@@ -57,4 +62,23 @@ $(document).ready(function(){
57
62
  data.context.html('<span>Загрузка файла <strong>\'' + file.name + '\'</strong> завершена.</span>');
58
63
  }
59
64
  });
65
+
66
+ $('#rehook').on('click', function(e){
67
+ e.preventDefault();
68
+ $('#unhook').show();
69
+ $(this).hide();
70
+ $('.preview_crop').show();
71
+ $(".cropable").attr('id','cropbox');
72
+ jcropInit();
73
+ });
74
+
75
+ $('#unhook').on('click', function(e){
76
+ e.preventDefault();
77
+ $('#rehook').show();
78
+ $('.preview_crop').hide();
79
+ $(this).hide();
80
+ $(".cropable").removeAttr('id');
81
+ $('.crop_params input').val('');
82
+ });
83
+
60
84
  });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * jquery.Jcrop.min.js v0.9.10 (build:20120429)
3
+ * jQuery Image Cropping Plugin - released under MIT License
4
+ * Copyright (c) 2008-2012 Tapmodo Interactive LLC
5
+ * https://github.com/tapmodo/Jcrop
6
+ */
7
+ (function(a){a.Jcrop=function(b,c){function h(a){return a+"px"}function i(a){return d.baseClass+"-"+a}function j(){return a.fx.step.hasOwnProperty("backgroundColor")}function k(b){var c=a(b).offset();return[c.left,c.top]}function l(a){return[a.pageX-e[0],a.pageY-e[1]]}function m(b){typeof b!="object"&&(b={}),d=a.extend(d,b),a.each(["onChange","onSelect","onRelease","onDblClick"],function(a,b){typeof d[b]!="function"&&(d[b]=function(){})})}function n(a,b){e=k(E),bd.setCursor(a==="move"?a:a+"-resize");if(a==="move")return bd.activateHandlers(p(b),u);var c=ba.getFixed(),d=q(a),f=ba.getCorner(q(d));ba.setPressed(ba.getCorner(d)),ba.setCurrent(f),bd.activateHandlers(o(a,c),u)}function o(a,b){return function(c){if(!d.aspectRatio)switch(a){case"e":c[1]=b.y2;break;case"w":c[1]=b.y2;break;case"n":c[0]=b.x2;break;case"s":c[0]=b.x2}else switch(a){case"e":c[1]=b.y+1;break;case"w":c[1]=b.y+1;break;case"n":c[0]=b.x+1;break;case"s":c[0]=b.x+1}ba.setCurrent(c),bc.update()}}function p(a){var b=a;return be.watchKeys(),function(
8
+ a){ba.moveOffset([a[0]-b[0],a[1]-b[1]]),b=a,bc.update()}}function q(a){switch(a){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 r(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=k(E),X=!0,n(a,l(b)),b.stopPropagation(),b.preventDefault(),!1)}}function s(a,b,c){var d=a.width(),e=a.height();d>b&&b>0&&(d=b,e=b/a.width()*a.height()),e>c&&c>0&&(e=c,d=c/a.height()*a.width()),U=a.width()/d,V=a.height()/e,a.width(d).height(e)}function t(a){return{x:a.x*U,y:a.y*V,x2:a.x2*U,y2:a.y2*V,w:a.w*U,h:a.h*V}}function u(a){var b=ba.getFixed();b.w>d.minSelect[0]&&b.h>d.minSelect[1]?(bc.enableHandles(),bc.done()):bc.release(),bd.setCursor(d.allowSelect?"crosshair":"default")}function v(a){if(d.disabled)return!1;if(!d.allowSelect)return!1;X=!0,e=k(E),bc.disableHandles(),bd.setCursor("crosshair");var b=l(a);return ba.setPressed(b),bc.update(),bd.activateHandlers(w,u),be.watchKeys(),a.stopPropagation
9
+ (),a.preventDefault(),!1}function w(a){ba.setCurrent(a),bc.update()}function z(){var b=a("<div></div>").addClass(i("tracker"));return a.browser.msie&&b.css({opacity:0,backgroundColor:"white"}),b}function bf(a){H.removeClass().addClass(i("holder")).addClass(a)}function bg(a,b){function t(){window.setTimeout(u,l)}var c=a[0]/U,e=a[1]/V,f=a[2]/U,g=a[3]/V;if(Y)return;var h=ba.flipCoords(c,e,f,g),i=ba.getFixed(),j=[i.x,i.y,i.x2,i.y2],k=j,l=d.animationDelay,m=h[0]-j[0],n=h[1]-j[1],o=h[2]-j[2],p=h[3]-j[3],q=0,r=d.swingSpeed;x=k[0],y=k[1],f=k[2],g=k[3],bc.animMode(!0);var s,u=function(){return function(){q+=(100-q)/r,k[0]=x+q/100*m,k[1]=y+q/100*n,k[2]=f+q/100*o,k[3]=g+q/100*p,q>=99.8&&(q=100),q<100?(bi(k),t()):(bc.done(),typeof b=="function"&&b.call(bt))}}();t()}function bh(a){bi([a[0]/U,a[1]/V,a[2]/U,a[3]/V]),d.onSelect.call(bt,t(ba.getFixed())),bc.enableHandles()}function bi(a){ba.setPressed([a[0],a[1]]),ba.setCurrent([a[2],a[3]]),bc.update()}function bj(){return t(ba.getFixed())}function bk(){return ba.getFixed()}function bl
10
+ (a){m(a),bs()}function bm(){d.disabled=!0,bc.disableHandles(),bc.setCursor("default"),bd.setCursor("default")}function bn(){d.disabled=!1,bs()}function bo(){bc.done(),bd.activateHandlers(null,null)}function bp(){H.remove(),B.show(),a(b).removeData("Jcrop")}function bq(a,b){bc.release(),bm();var c=new Image;c.onload=function(){var e=c.width,f=c.height,g=d.boxWidth,h=d.boxHeight;E.width(e).height(f),E.attr("src",a),I.attr("src",a),s(E,g,h),F=E.width(),G=E.height(),I.width(F).height(G),N.width(F+M*2).height(G+M*2),H.width(F).height(G),bb.resize(F,G),bn(),typeof b=="function"&&b.call(bt)},c.src=a}function br(a,b,c){var e=b||d.bgColor;d.bgFade&&j()&&d.fadeTime&&!c?a.animate({backgroundColor:e},{queue:!1,duration:d.fadeTime}):a.css("backgroundColor",e)}function bs(a){d.allowResize?a?bc.enableOnly():bc.enableHandles():bc.disableHandles(),bd.setCursor(d.allowSelect?"crosshair":"default"),bc.setCursor(d.allowMove?"move":"default"),d.hasOwnProperty("trueSize")&&(U=d.trueSize[0]/F,V=d.trueSize[1]/G),d.hasOwnProperty("setSelect"
11
+ )&&(bh(d.setSelect),bc.done(),delete d.setSelect),bb.refresh(),d.bgColor!=O&&(br(d.shade?bb.getShades():H,d.shade?d.shadeColor||d.bgColor:d.bgColor),O=d.bgColor),P!=d.bgOpacity&&(P=d.bgOpacity,d.shade?bb.refresh():bc.setBgOpacity(P)),Q=d.maxSize[0]||0,R=d.maxSize[1]||0,S=d.minSize[0]||0,T=d.minSize[1]||0,d.hasOwnProperty("outerImage")&&(E.attr("src",d.outerImage),delete d.outerImage),bc.refresh()}var d=a.extend({},a.Jcrop.defaults),e,f,g=!1;a.browser.msie&&a.browser.version.split(".")[0]==="6"&&(g=!0),typeof b!="object"&&(b=a(b)[0]),typeof c!="object"&&(c={}),m(c);var A={border:"none",visibility:"visible",margin:0,padding:0,position:"absolute",top:0,left:0},B=a(b),C=!0;if(b.tagName=="IMG"){if(B[0].width!=0&&B[0].height!=0)B.width(B[0].width),B.height(B[0].height);else{var D=new Image;D.src=B[0].src,B.width(D.width),B.height(D.height)}var E=B.clone().removeAttr("id").css(A).show();E.width(B.width()),E.height(B.height()),B.after(E).hide()}else E=B.css(A).show(),C=!1,d.shade===null&&(d.shade=!0);s(E,d.boxWidth,d.
12
+ boxHeight);var F=E.width(),G=E.height(),H=a("<div />").width(F).height(G).addClass(i("holder")).css({position:"relative",backgroundColor:d.bgColor}).insertAfter(B).append(E);d.addClass&&H.addClass(d.addClass);var I=a("<div />"),J=a("<div />").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}),K=a("<div />").width("100%").height("100%").css("zIndex",320),L=a("<div />").css({position:"absolute",zIndex:600}).dblclick(function(){var a=ba.getFixed();d.onDblClick.call(bt,a)}).insertBefore(E).append(J,K);C&&(I=a("<img />").attr("src",E.attr("src")).css(A).width(F).height(G),J.append(I)),g&&L.css({overflowY:"hidden"});var M=d.boundary,N=z().width(F+M*2).height(G+M*2).css({position:"absolute",top:h(-M),left:h(-M),zIndex:290}).mousedown(v),O=d.bgColor,P=d.bgOpacity,Q,R,S,T,U,V,W=!0,X,Y,Z;e=k(E);var _=function(){function a(){var a={},b=["touchstart","touchmove","touchend"],c=document.createElement("div"),d;try{for(d=0;d<b.length;d++){var e=b[d];e="on"+e;var f=e in c;f||(c.setAttribute(e,"return;"
13
+ ),f=typeof c[e]=="function"),a[b[d]]=f}return a.touchstart&&a.touchend&&a.touchmove}catch(g){return!1}}function b(){return d.touchSupport===!0||d.touchSupport===!1?d.touchSupport:a()}return{createDragger:function(a){return function(b){return b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,d.disabled?!1:a==="move"&&!d.allowMove?!1:(X=!0,n(a,l(b)),b.stopPropagation(),b.preventDefault(),!1)}},newSelection:function(a){return a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY,v(a)},isSupported:a,support:b()}}(),ba=function(){function h(d){d=n(d),c=a=d[0],e=b=d[1]}function i(a){a=n(a),f=a[0]-c,g=a[1]-e,c=a[0],e=a[1]}function j(){return[f,g]}function k(d){var f=d[0],g=d[1];0>a+f&&(f-=f+a),0>b+g&&(g-=g+b),G<e+g&&(g+=G-(e+g)),F<c+f&&(f+=F-(c+f)),a+=f,c+=f,b+=g,e+=g}function l(a){var b=m();switch(a){case"ne":return[b.x2,b.y];case"nw":return[b.x,b.y];case"se":return[b.x2,b.y2];case"sw":return[b.x,b.y2]}}function m(){if(!d.aspectRatio
14
+ )return p();var f=d.aspectRatio,g=d.minSize[0]/U,h=d.maxSize[0]/U,i=d.maxSize[1]/V,j=c-a,k=e-b,l=Math.abs(j),m=Math.abs(k),n=l/m,r,s,t,u;return h===0&&(h=F*10),i===0&&(i=G*10),n<f?(s=e,t=m*f,r=j<0?a-t:t+a,r<0?(r=0,u=Math.abs((r-a)/f),s=k<0?b-u:u+b):r>F&&(r=F,u=Math.abs((r-a)/f),s=k<0?b-u:u+b)):(r=c,u=l/f,s=k<0?b-u:b+u,s<0?(s=0,t=Math.abs((s-b)*f),r=j<0?a-t:t+a):s>G&&(s=G,t=Math.abs(s-b)*f,r=j<0?a-t:t+a)),r>a?(r-a<g?r=a+g:r-a>h&&(r=a+h),s>b?s=b+(r-a)/f:s=b-(r-a)/f):r<a&&(a-r<g?r=a-g:a-r>h&&(r=a-h),s>b?s=b+(a-r)/f:s=b-(a-r)/f),r<0?(a-=r,r=0):r>F&&(a-=r-F,r=F),s<0?(b-=s,s=0):s>G&&(b-=s-G,s=G),q(o(a,b,r,s))}function n(a){return a[0]<0&&(a[0]=0),a[1]<0&&(a[1]=0),a[0]>F&&(a[0]=F),a[1]>G&&(a[1]=G),[a[0],a[1]]}function o(a,b,c,d){var e=a,f=c,g=b,h=d;return c<a&&(e=c,f=a),d<b&&(g=d,h=b),[e,g,f,h]}function p(){var d=c-a,f=e-b,g;return Q&&Math.abs(d)>Q&&(c=d>0?a+Q:a-Q),R&&Math.abs(f)>R&&(e=f>0?b+R:b-R),T/V&&Math.abs(f)<T/V&&(e=f>0?b+T/V:b-T/V),S/U&&Math.abs(d)<S/U&&(c=d>0?a+S/U:a-S/U),a<0&&(c-=a,a-=a),b<0&&(e-=b,b-=b),c<0&&
15
+ (a-=c,c-=c),e<0&&(b-=e,e-=e),c>F&&(g=c-F,a-=g,c-=g),e>G&&(g=e-G,b-=g,e-=g),a>F&&(g=a-G,e-=g,b-=g),b>G&&(g=b-G,e-=g,b-=g),q(o(a,b,c,e))}function q(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]}}var a=0,b=0,c=0,e=0,f,g;return{flipCoords:o,setPressed:h,setCurrent:i,getOffset:j,moveOffset:k,getCorner:l,getFixed:m}}(),bb=function(){function f(a,b){e.left.css({height:h(b)}),e.right.css({height:h(b)})}function g(){return i(ba.getFixed())}function i(a){e.top.css({left:h(a.x),width:h(a.w),height:h(a.y)}),e.bottom.css({top:h(a.y2),left:h(a.x),width:h(a.w),height:h(G-a.y2)}),e.right.css({left:h(a.x2),width:h(F-a.x2)}),e.left.css({width:h(a.x)})}function j(){return a("<div />").css({position:"absolute",backgroundColor:d.shadeColor||d.bgColor}).appendTo(c)}function k(){b||(b=!0,c.insertBefore(E),g(),bc.setBgOpacity(1,0,1),I.hide(),l(d.shadeColor||d.bgColor,1),bc.isAwake()?n(d.bgOpacity,1):n(1,1))}function l(a,b){br(p(),a,b)}function m(){b&&(c.remove(),I.show(),b=!1,bc.isAwake()?bc.setBgOpacity(d.bgOpacity
16
+ ,1,1):(bc.setBgOpacity(1,1,1),bc.disableHandles()),br(H,0,1))}function n(a,e){b&&(d.bgFade&&!e?c.animate({opacity:1-a},{queue:!1,duration:d.fadeTime}):c.css({opacity:1-a}))}function o(){d.shade?k():m(),bc.isAwake()&&n(d.bgOpacity)}function p(){return c.children()}var b=!1,c=a("<div />").css({position:"absolute",zIndex:240,opacity:0}),e={top:j(),left:j().height(G),right:j().height(G),bottom:j()};return{update:g,updateRaw:i,getShades:p,setBgColor:l,enable:k,disable:m,resize:f,refresh:o,opacity:n}}(),bc=function(){function k(b){var c=a("<div />").css({position:"absolute",opacity:d.borderOpacity}).addClass(i(b));return J.append(c),c}function l(b,c){var d=a("<div />").mousedown(r(b)).css({cursor:b+"-resize",position:"absolute",zIndex:c}).addClass("ord-"+b);return _.support&&d.bind("touchstart.jcrop",_.createDragger(b)),K.append(d),d}function m(a){var b=d.handleSize;return l(a,c++).css({opacity:d.handleOpacity}).width(b).height(b).addClass(i("handle"))}function n(a){return l(a,c++).addClass("jcrop-dragbar")}function o
17
+ (a){var b;for(b=0;b<a.length;b++)g[a[b]]=n(a[b])}function p(a){var b,c;for(c=0;c<a.length;c++){switch(a[c]){case"n":b="hline";break;case"s":b="hline bottom";break;case"e":b="vline right";break;case"w":b="vline"}e[a[c]]=k(b)}}function q(a){var b;for(b=0;b<a.length;b++)f[a[b]]=m(a[b])}function s(a,b){d.shade||I.css({top:h(-b),left:h(-a)}),L.css({top:h(b),left:h(a)})}function u(a,b){L.width(a).height(b)}function v(){var a=ba.getFixed();ba.setPressed([a.x,a.y]),ba.setCurrent([a.x2,a.y2]),w()}function w(a){if(b)return x(a)}function x(a){var c=ba.getFixed();u(c.w,c.h),s(c.x,c.y),d.shade&&bb.updateRaw(c),b||A(),a?d.onSelect.call(bt,t(c)):d.onChange.call(bt,t(c))}function y(a,c,e){if(!b&&!c)return;d.bgFade&&!e?E.animate({opacity:a},{queue:!1,duration:d.fadeTime}):E.css("opacity",a)}function A(){L.show(),d.shade?bb.opacity(P):y(P,!0),b=!0}function B(){F(),L.hide(),d.shade?bb.opacity(1):y(1),b=!1,d.onRelease.call(bt)}function C(){j&&K.show()}function D(){j=!0;if(d.allowResize)return K.show(),!0}function F(){j=!1,K.hide(
18
+ )}function G(a){Y===a?F():D()}function H(){G(!1),v()}var b,c=370,e={},f={},g={},j=!1;d.dragEdges&&a.isArray(d.createDragbars)&&o(d.createDragbars),a.isArray(d.createHandles)&&q(d.createHandles),d.drawBorders&&a.isArray(d.createBorders)&&p(d.createBorders),a(document).bind("touchstart.jcrop-ios",function(b){a(b.currentTarget).hasClass("jcrop-tracker")&&b.stopPropagation()});var M=z().mousedown(r("move")).css({cursor:"move",position:"absolute",zIndex:360});return _.support&&M.bind("touchstart.jcrop",_.createDragger("move")),J.append(M),F(),{updateVisible:w,update:x,release:B,refresh:v,isAwake:function(){return b},setCursor:function(a){M.css("cursor",a)},enableHandles:D,enableOnly:function(){j=!0},showHandles:C,disableHandles:F,animMode:G,setBgOpacity:y,done:H}}(),bd=function(){function f(){N.css({zIndex:450}),_.support&&a(document).bind("touchmove.jcrop",k).bind("touchend.jcrop",m),e&&a(document).bind("mousemove.jcrop",h).bind("mouseup.jcrop",i)}function g(){N.css({zIndex:290}),a(document).unbind(".jcrop")}function h
19
+ (a){return b(l(a)),!1}function i(a){return a.preventDefault(),a.stopPropagation(),X&&(X=!1,c(l(a)),bc.isAwake()&&d.onSelect.call(bt,t(ba.getFixed())),g(),b=function(){},c=function(){}),!1}function j(a,d){return X=!0,b=a,c=d,f(),!1}function k(a){return a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY,h(a)}function m(a){return a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY,i(a)}function n(a){N.css("cursor",a)}var b=function(){},c=function(){},e=d.trackDocument;return e||N.mousemove(h).mouseup(i).mouseout(i),E.before(N),{activateHandlers:j,setCursor:n}}(),be=function(){function e(){d.keySupport&&(b.show(),b.focus())}function f(a){b.hide()}function h(a,b,c){d.allowMove&&(ba.moveOffset([b,c]),bc.updateVisible(!0)),a.preventDefault(),a.stopPropagation()}function i(a){if(a.ctrlKey||a.metaKey)return!0;Z=a.shiftKey?!0:!1;var b=Z?10:1;switch(a.keyCode){case 37:h(a,-b,0);break;case 39:h(a,b,0);break;case 38:h(a,0,-b);break;case 40
20
+ :h(a,0,b);break;case 27:d.allowSelect&&bc.release();break;case 9:return!0}return!1}var b=a('<input type="radio" />').css({position:"fixed",left:"-120px",width:"12px"}),c=a("<div />").css({position:"absolute",overflow:"hidden"}).append(b);return d.keySupport&&(b.keydown(i).blur(f),g||!d.fixedSupport?(b.css({position:"absolute",left:"-20px"}),c.append(b).insertBefore(E)):b.insertBefore(E)),{watchKeys:e}}();_.support&&N.bind("touchstart.jcrop",_.newSelection),K.hide(),bs(!0);var bt={setImage:bq,animateTo:bg,setSelect:bh,setOptions:bl,tellSelect:bj,tellScaled:bk,setClass:bf,disable:bm,enable:bn,cancel:bo,release:bc.release,destroy:bp,focus:be.watchKeys,getBounds:function(){return[F*U,G*V]},getWidgetSize:function(){return[F,G]},getScaleFactor:function(){return[U,V]},getOptions:function(){return d},ui:{holder:H,selection:L}};return a.browser.msie&&H.bind("selectstart",function(){return!1}),B.data("Jcrop",bt),bt},a.fn.Jcrop=function(b,c){var d;return this.each(function(){if(a(this).data("Jcrop")){if(b==="api")return a
21
+ (this).data("Jcrop");a(this).data("Jcrop").setOptions(b)}else this.tagName=="IMG"?a.Jcrop.Loader(this,function(){a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d)}):(a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d))}),this},a.Jcrop.Loader=function(b,c,d){function g(){f.complete?(e.unbind(".jcloader"),a.isFunction(c)&&c.call(f)):window.setTimeout(g,50)}var e=a(b),f=e[0];e.bind("load.jcloader",g).bind("error.jcloader",function(b){e.unbind(".jcloader"),a.isFunction(d)&&d.call(f)}),f.complete&&a.isFunction(c)&&(e.unbind(".jcloader"),c.call(f))},a.Jcrop.defaults={allowSelect:!0,allowMove:!0,allowResize:!0,trackDocument:!0,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:.6,bgFade:!1,borderOpacity:.4,handleOpacity:.5,handleSize:7,aspectRatio:0,keySupport:!0,createHandles:["n","s","e","w","nw","ne","se","sw"],createDragbars:["n","s","e","w"],createBorders:["n","s","e","w"],drawBorders:!0,dragEdges:!0,fixedSupport:!0,
22
+ touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}}})(jQuery);
@@ -0,0 +1,123 @@
1
+ /*
2
+ * jQuery Color Animations
3
+ * Copyright 2007 John Resig
4
+ * Released under the MIT and GPL licenses.
5
+ */
6
+
7
+ (function(jQuery){
8
+
9
+ // We override the animation for all of these color styles
10
+ jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
11
+ jQuery.fx.step[attr] = function(fx){
12
+ if ( fx.state == 0 ) {
13
+ fx.start = getColor( fx.elem, attr );
14
+ fx.end = getRGB( fx.end );
15
+ }
16
+
17
+ fx.elem.style[attr] = "rgb(" + [
18
+ Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
19
+ Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
20
+ Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
21
+ ].join(",") + ")";
22
+ }
23
+ });
24
+
25
+ // Color Conversion functions from highlightFade
26
+ // By Blair Mitchelmore
27
+ // http://jquery.offput.ca/highlightFade/
28
+
29
+ // Parse strings looking for color tuples [255,255,255]
30
+ function getRGB(color) {
31
+ var result;
32
+
33
+ // Check if we're already dealing with an array of colors
34
+ if ( color && color.constructor == Array && color.length == 3 )
35
+ return color;
36
+
37
+ // Look for rgb(num,num,num)
38
+ if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
39
+ return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
40
+
41
+ // Look for rgb(num%,num%,num%)
42
+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
43
+ return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
44
+
45
+ // Look for #a0b1c2
46
+ if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
47
+ return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
48
+
49
+ // Look for #fff
50
+ if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
51
+ return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
52
+
53
+ // Otherwise, we're most likely dealing with a named color
54
+ return colors[jQuery.trim(color).toLowerCase()];
55
+ }
56
+
57
+ function getColor(elem, attr) {
58
+ var color;
59
+
60
+ do {
61
+ color = jQuery.curCSS(elem, attr);
62
+
63
+ // Keep going until we find an element that has color, or we hit the body
64
+ if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
65
+ break;
66
+
67
+ attr = "backgroundColor";
68
+ } while ( elem = elem.parentNode );
69
+
70
+ return getRGB(color);
71
+ };
72
+
73
+ // Some named colors to work with
74
+ // From Interface by Stefan Petre
75
+ // http://interface.eyecon.ro/
76
+
77
+ var colors = {
78
+ aqua:[0,255,255],
79
+ azure:[240,255,255],
80
+ beige:[245,245,220],
81
+ black:[0,0,0],
82
+ blue:[0,0,255],
83
+ brown:[165,42,42],
84
+ cyan:[0,255,255],
85
+ darkblue:[0,0,139],
86
+ darkcyan:[0,139,139],
87
+ darkgrey:[169,169,169],
88
+ darkgreen:[0,100,0],
89
+ darkkhaki:[189,183,107],
90
+ darkmagenta:[139,0,139],
91
+ darkolivegreen:[85,107,47],
92
+ darkorange:[255,140,0],
93
+ darkorchid:[153,50,204],
94
+ darkred:[139,0,0],
95
+ darksalmon:[233,150,122],
96
+ darkviolet:[148,0,211],
97
+ fuchsia:[255,0,255],
98
+ gold:[255,215,0],
99
+ green:[0,128,0],
100
+ indigo:[75,0,130],
101
+ khaki:[240,230,140],
102
+ lightblue:[173,216,230],
103
+ lightcyan:[224,255,255],
104
+ lightgreen:[144,238,144],
105
+ lightgrey:[211,211,211],
106
+ lightpink:[255,182,193],
107
+ lightyellow:[255,255,224],
108
+ lime:[0,255,0],
109
+ magenta:[255,0,255],
110
+ maroon:[128,0,0],
111
+ navy:[0,0,128],
112
+ olive:[128,128,0],
113
+ orange:[255,165,0],
114
+ pink:[255,192,203],
115
+ purple:[128,0,128],
116
+ violet:[128,0,128],
117
+ red:[255,0,0],
118
+ silver:[192,192,192],
119
+ white:[255,255,255],
120
+ yellow:[255,255,0]
121
+ };
122
+
123
+ })(jQuery);
Binary file
@@ -1,5 +1,6 @@
1
1
  //= require 'font-awesome.css'
2
2
  //*= require normalize
3
+ //*= require jquery.Jcrop.css
3
4
  //*= require chosen
4
5
  //*= require_self
5
6
  * {
@@ -479,4 +480,9 @@ html.login {
479
480
  .bar {
480
481
  @include gradient(#53B75F, #1B7726);
481
482
  height: 10px;
483
+ }
484
+ .preview_crop {display:none;overflow:hidden;img{max-width:none;}}
485
+ .crop_panel {
486
+ margin:1em 0;
487
+ #unhook {display:none;}
482
488
  }
@@ -0,0 +1,86 @@
1
+ /* jquery.Jcrop.css v0.9.10 - MIT License */
2
+
3
+ /*
4
+ The outer-most container in a typical Jcrop instance
5
+ If you are having difficulty with formatting related to styles
6
+ on a parent element, place any fixes here or in a like selector
7
+
8
+ You can also style this element if you want to add a border, etc
9
+ A better method for styling can be seen below with .jcrop-light
10
+ (Add a class to the holder and style elements for that extended class)
11
+ */
12
+ .jcrop-holder {
13
+ direction: ltr;
14
+ text-align: left;
15
+ }
16
+
17
+ /* These styles define the border lines */
18
+ .jcrop-vline,.jcrop-hline{background:#FFF url(Jcrop.gif) top left repeat;font-size:0;position:absolute;}
19
+ .jcrop-vline{height:100%;width:1px!important;}
20
+ .jcrop-hline{height:1px!important;width:100%;}
21
+ .jcrop-vline.right{right:0;}
22
+ .jcrop-hline.bottom{bottom:0;}
23
+
24
+ /* Handle style - size is set by Jcrop handleSize option (currently) */
25
+ .jcrop-handle{background-color:#333;border:1px #eee solid;font-size:1px;}
26
+
27
+ /* This style is used for invisible click targets */
28
+ .jcrop-tracker
29
+ {
30
+ height: 100%;
31
+ width: 100%;
32
+ -webkit-tap-highlight-color: transparent; /* "turn off" link highlight */
33
+ -webkit-touch-callout: none; /* disable callout, image save panel */
34
+ -webkit-user-select: none; /* disable cut copy paste */
35
+ }
36
+
37
+ /* Positioning of handles and drag bars */
38
+ .jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0;}
39
+ .jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px;}
40
+ .jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%;}
41
+ .jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%;}
42
+ .jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0;}
43
+ .jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0;}
44
+ .jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0;}
45
+ .jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px;}
46
+ .jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%;}
47
+ .jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px;}
48
+ .jcrop-dragbar.ord-n{margin-top:-4px;}
49
+ .jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px;}
50
+ .jcrop-dragbar.ord-e{margin-right:-4px;right:0;}
51
+ .jcrop-dragbar.ord-w{margin-left:-4px;}
52
+
53
+ /* The "jcrop-light" class/extension */
54
+ .jcrop-light .jcrop-vline,.jcrop-light .jcrop-hline
55
+ {
56
+ background:#FFF;
57
+ filter:Alpha(opacity=70)!important;
58
+ opacity:.70!important;
59
+ }
60
+ .jcrop-light .jcrop-handle
61
+ {
62
+ -moz-border-radius:3px;
63
+ -webkit-border-radius:3px;
64
+ background-color:#000;
65
+ border-color:#FFF;
66
+ border-radius:3px;
67
+ }
68
+
69
+ /* The "jcrop-dark" class/extension */
70
+ .jcrop-dark .jcrop-vline,.jcrop-dark .jcrop-hline
71
+ {
72
+ background:#000;
73
+ filter:Alpha(opacity=70)!important;
74
+ opacity:.7!important;
75
+ }
76
+ .jcrop-dark .jcrop-handle
77
+ {
78
+ -moz-border-radius:3px;
79
+ -webkit-border-radius:3px;
80
+ background-color:#FFF;
81
+ border-color:#000;
82
+ border-radius:3px;
83
+ }
84
+
85
+ /* Fix for twitter bootstrap et al. */
86
+ .jcrop-holder img,img.jcrop-preview{ max-width: none; }
@@ -24,6 +24,7 @@ module AdminHelper
24
24
  </script>
25
25
  }.gsub(/[\n ]+/, ' ').strip.html_safe
26
26
  end
27
+
27
28
 
28
29
 
29
30
  def sortable_columns(column, title = nil)
@@ -37,7 +38,8 @@ module AdminHelper
37
38
  url_for :only_path => false, :params => params.merge(overwrite)
38
39
  end
39
40
 
40
- def image_sortable
41
+ def image_sortable(images)
42
+ sort_url = "sort_admin_#{images.to_s}_path(:auth_token => current_user.authentication_token)"
41
43
  %Q{
42
44
  <script type="text/javascript">
43
45
  $(document).ready(function() {
@@ -54,7 +56,7 @@ module AdminHelper
54
56
  type: 'post',
55
57
  data: $('.image-list').sortable('serialize') + '&authenticity_token=#{u(form_authenticity_token)}',
56
58
  dataType: 'script',
57
- url: '#{sort_admin_post_images_path(:auth_token => current_user.authentication_token)}'})
59
+ url: '#{eval(sort_url)}'})
58
60
  }
59
61
  });
60
62
  });
data/ideyabox.gemspec CHANGED
@@ -15,15 +15,15 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib", "app"]
16
16
  gem.version = Ideyabox::VERSION
17
17
 
18
- gem.add_dependency "russian"
19
- gem.add_dependency "redactor-rails"
20
- gem.add_dependency "kaminari"
21
- gem.add_dependency "haml", ">= 3.1.6"
22
- gem.add_dependency "devise"
23
- gem.add_dependency "jquery-fileupload-rails"
24
- gem.add_dependency "mini_magick"
25
- gem.add_dependency "sexy_validators", ">=0.0.5"
26
- gem.add_development_dependency "haml-rails", ">= 0.3.4"
27
- gem.add_development_dependency "capistrano"
18
+ # gem.add_dependency "russian"
19
+ # gem.add_dependency "redactor-rails"
20
+ # gem.add_dependency "kaminari"
21
+ # gem.add_dependency "haml", ">= 3.1.6"
22
+ # gem.add_dependency "devise"
23
+ # gem.add_dependency "jquery-fileupload-rails"
24
+ # gem.add_dependency "mini_magick"
25
+ # gem.add_dependency "sexy_validators", ">=0.0.5"
26
+ # gem.add_development_dependency "haml-rails", ">= 0.3.4"
27
+ # gem.add_development_dependency "capistrano"
28
28
 
29
29
  end
@@ -1,4 +1,7 @@
1
1
  //= require default.js
2
+ //= require redactor-rails
3
+ //= require jquery-fileupload/basic
4
+ //= require jquery-fileupload/vendor/tmpl
2
5
  //= require_self
3
6
 
4
7
  $(document).ready(function(){
@@ -0,0 +1,195 @@
1
+ #encoding:utf-8
2
+ require 'rails/generators'
3
+ require 'rails/generators/generated_attribute'
4
+
5
+ module Ideyabox
6
+ module Generators
7
+ class CropGenerator < ::Rails::Generators::Base
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ argument :controller_path, :type => :string
10
+ argument :model_name, :type => :string, :required => false
11
+ argument :layout, :type => :string, :default => "application",
12
+ :banner => "Specify application layout"
13
+
14
+ def initialize(args, *options)
15
+ super(args, *options)
16
+ initialize_views_variables
17
+ end
18
+
19
+ def copy_views
20
+ generate_views
21
+ end
22
+
23
+ def updating_models
24
+ inject_into_file "app/models/#{resource_name}.rb", " :crop_x, :crop_y, :crop_w, :crop_h,", :after => " attr_accessible"
25
+ inject_into_file "app/models/#{resource_name}.rb", "\n attr_accessor :crop_x, :crop_y, :crop_w, :crop_h\n after_update :crop_image\n def crop_image\n image.recreate_versions! if crop_x.present?\n end\n", :after => "class #{@model_name.demodulize} < ActiveRecord::Base"
26
+
27
+ end
28
+
29
+ def updating_uploader
30
+ inject_into_file "app/uploaders/#{resource_name}_uploader.rb", "\n
31
+ version :large do
32
+ process :resize_to_limit => [500, 500]
33
+ end
34
+
35
+ version :crop do
36
+ process :crop
37
+ resize_to_fill(300, 200)
38
+ end
39
+
40
+ def crop
41
+ if model.crop_x.present?
42
+ resize_to_limit(500, 500)
43
+ manipulate! do |img|
44
+ x = model.crop_x.to_i
45
+ y = model.crop_y.to_i
46
+ w = model.crop_w.to_i
47
+ h = model.crop_h.to_i
48
+ img.crop(\"\#{w}x\#{h}+\#{x}+\#{y}\")
49
+ img
50
+ end
51
+ end
52
+ end
53
+ \n", :after => "process :resize_to_fill => [160, 100]\n end"
54
+
55
+ end
56
+
57
+ def updating_edit_view
58
+ inject_into_file "app/views/admin/#{plural_resource_name}/edit.html.haml", "(:large), :id=>'cropbox'\n = render 'crop', :#{resource_name} => @#{resource_name}\n", :after => " = image_tag @#{resource_name}.image_url"
59
+
60
+ end
61
+
62
+ protected
63
+
64
+ def initialize_views_variables
65
+ @base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(controller_path)
66
+ @controller_routing_path = @controller_file_path.gsub(/\//, '_')
67
+ @model_name = @controller_class_nesting + "::#{@base_name.singularize.camelize}" unless @model_name
68
+ @model_name = @model_name.camelize
69
+ end
70
+
71
+ def controller_routing_path
72
+ @controller_routing_path
73
+ end
74
+
75
+ def singular_controller_routing_path
76
+ @controller_routing_path.singularize
77
+ end
78
+
79
+ def model_name
80
+ @model_name
81
+ end
82
+
83
+ def plural_model_name
84
+ @model_name.pluralize
85
+ end
86
+
87
+ def resource_name
88
+ @model_name.demodulize.underscore
89
+ end
90
+
91
+ def parent_name
92
+ resource_name.split("_").first
93
+ end
94
+
95
+ def plural_parent_name
96
+ parent_name.pluralize
97
+ end
98
+
99
+ def plural_resource_name
100
+ resource_name.pluralize
101
+ end
102
+
103
+ def sort_priority(column_name)
104
+ case column_name
105
+ when "position" then 1
106
+ when "visible" then 2
107
+ when "name" then 3
108
+ when "title" then 3
109
+ else 5
110
+ end
111
+ end
112
+
113
+ def columns
114
+ begin
115
+ excluded_column_names = %w[id created_at updated_at]
116
+ @model_name.constantize.columns.reject{|c| excluded_column_names.include?(c.name) || c.name.index("_id") }.sort{|a, b| sort_priority(a.name) <=> sort_priority(b.name)}.collect{|c| ::Rails::Generators::GeneratedAttribute.new(c.name, c.type)}
117
+ rescue NoMethodError
118
+ @model_name.constantize.fields.collect{|c| c[1]}.reject{|c| excluded_column_names.include?(c.name) || c.name.index("_id") }.collect{|c| ::Rails::Generators::GeneratedAttribute.new(c.name, c.type.to_s)}
119
+ end
120
+ end
121
+
122
+ def column_names
123
+ @model_name.constantize.column_names
124
+ end
125
+
126
+ def extract_modules(name)
127
+ modules = name.include?('/') ? name.split('/') : name.split('::')
128
+ name = modules.pop
129
+ path = modules.map { |m| m.underscore }
130
+ file_path = (path + [name.underscore]).join('/')
131
+ nesting = modules.map { |m| m.camelize }.join('::')
132
+ [name, path, file_path, nesting, modules.size]
133
+ end
134
+
135
+ def generate_views
136
+ views = {
137
+ "_crop.html.haml" => "app/views/admin/#{@controller_file_path}/_crop.html.#{ext}",
138
+ }
139
+
140
+ selected_views = views
141
+ options.engine == generate_erb(selected_views)
142
+ end
143
+
144
+ def generate_erb(views)
145
+ views.each do |template_name, output_path|
146
+ template template_name, output_path
147
+ end
148
+ end
149
+
150
+ def ext
151
+ :haml
152
+ end
153
+
154
+
155
+ def add_resource_route
156
+ resources_string = "\n resources :#{plural_resource_name} do\n"
157
+ sort_string = " post \"sort\", :on => :collection\n"
158
+ toggleshow_string = " get \"toggleshow\", :on => :member\n"
159
+
160
+ if column_names.include?("visible") && column_names.include?("position")
161
+ final_string = "#{resources_string}#{sort_string}#{toggleshow_string} end\n"
162
+ elsif column_names.include?("visible")
163
+ final_string = "#{resources_string}#{toggleshow_string} end\n"
164
+ elsif column_names.include?("position")
165
+ final_string = "#{resources_string}#{sort_string} end\n"
166
+ else
167
+ final_string = "\n resources :#{plural_resource_name}\n"
168
+ end
169
+
170
+ inject_into_file "config/routes.rb", final_string, :after => "\n namespace :admin do\n"
171
+
172
+ inject_into_file "config/routes.rb", "\n resources :#{plural_resource_name}\n", :after => "\n resources :#{plural_parent_name} do"
173
+
174
+ inject_into_file "config/routes.rb", " do\n resources :#{plural_resource_name}\n end", :after => "\n resources :#{plural_parent_name}\n"
175
+ end
176
+
177
+ def add_to_locales
178
+ locales = [:ru, :en]
179
+
180
+ attributes = column_names.collect {|column| " #{column}: \"#{column}\"\n"}
181
+
182
+ attributes_string = " #{resource_name}:\n#{attributes.join}"
183
+
184
+ locales.each do |locale|
185
+ inject_into_file "config/locales/#{locale}.yml", " #{resource_name}: \"#{resource_name}\"\n", :after => "models:\n"
186
+ inject_into_file "config/locales/#{locale}.yml", attributes_string, :after => "attributes:\n"
187
+ end
188
+ end
189
+
190
+
191
+
192
+
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,17 @@
1
+ .crop_panel
2
+ = link_to "Выделить фрагмент вручную", "#", :id=>'rehook', :class=>'bright_link'
3
+ = link_to "Не выделять фрагмент", "#", :id=>'unhook', :class=>'bright_link'
4
+ %h3 Preview:
5
+ .preview_crop
6
+
7
+ = image_tag @<%=resource_name%>.image_url(:large), :id=>'preview'
8
+
9
+ - if @<%=resource_name%>.image && @<%=resource_name%>.image_url(:crop)
10
+ %h3 Current version:
11
+ = image_tag @<%= resource_name %>.image_url(:crop)
12
+
13
+ %br
14
+ = form_for [:admin, <%=resource_name%>] do |f|
15
+ - ['x','y','w','h'].each do |attribute|
16
+ = f.hidden_field "crop_#{attribute}"
17
+ = cropable('<%=resource_name%>', 0, 0, 300, 200)
@@ -36,7 +36,8 @@ module Ideyabox
36
36
 
37
37
  def updating_models
38
38
  inject_into_file "app/models/#{parent_name}.rb", "\n has_many :#{plural_resource_name}", :after => "class #{parent_name.capitalize} < ActiveRecord::Base"
39
- inject_into_file "app/models/#{resource_name}.rb", "\n belongs_to :#{parent_name}\n mount_uploader :image, #{@model_name.demodulize}Uploader", :after => "class #{@model_name.demodulize} < ActiveRecord::Base"
39
+ inject_into_file "app/models/#{resource_name}.rb", "\n belongs_to :#{parent_name}\n mount_uploader :image, #{@model_name.demodulize}Uploader", :after => "class #{@model_name.demodulize} < ActiveRecord::Base"
40
+ inject_into_file "app/models/#{resource_name}.rb", "\n before_create :add_position\n def add_position\n last_#{resource_name} = self.#{parent_name}.#{plural_resource_name}.order(\"position\").last\n if last_#{resource_name}\n self.position = last_#{resource_name}.position + 1\n else\n self.position = 1\n end\n end\n", :after => "\n mount_uploader :image, #{@model_name.demodulize}Uploader\n"
40
41
  end
41
42
 
42
43
  protected
@@ -158,7 +159,10 @@ module Ideyabox
158
159
  end
159
160
 
160
161
  inject_into_file "config/routes.rb", final_string, :after => "\n namespace :admin do\n"
162
+
161
163
  inject_into_file "config/routes.rb", "\n resources :#{plural_resource_name}\n", :after => "\n resources :#{plural_parent_name} do"
164
+
165
+ inject_into_file "config/routes.rb", " do\n resources :#{plural_resource_name}\n end", :after => "\n resources :#{plural_parent_name}\n"
162
166
  end
163
167
 
164
168
  def add_to_locales
@@ -31,7 +31,7 @@ class Admin::<%= @model_name.demodulize.pluralize -%>Controller < Admin::Applica
31
31
  def update
32
32
  @<%= resource_name %> = <%= @model_name.demodulize -%>.find(params[:id])
33
33
  if @<%= resource_name %>.update_attributes(params[:<%= resource_name %>])
34
- redirect_to admin_<%= plural_resource_name %>_path, :notice => "#{<%= @model_name.demodulize %>.model_name.human} #{t 'flash.notice.was_updated'}"
34
+ redirect_to [:edit, :admin, @<%= resource_name %>.<%= parent_name %>], :notice => "#{<%= @model_name.demodulize %>.model_name.human} #{t 'flash.notice.was_updated'}"
35
35
  else
36
36
  render 'edit'
37
37
  end
@@ -1,7 +1,7 @@
1
1
  %h2 Галерея изображений
2
2
  .image-list#<%=plural_resource_name%>
3
- = render @<%=parent_name%>.<%=plural_resource_name%>
4
- = image_sortable
3
+ = render @<%=parent_name%>.<%=plural_resource_name%>.order('position')
4
+ = image_sortable("<%=plural_resource_name%>")
5
5
 
6
6
  .image_upload_form.bordered_box
7
7
  %h3 Загрузить изображения
@@ -23,7 +23,10 @@
23
23
  %br
24
24
  %tr
25
25
  %th= f.label :image
26
- %td= f.file_field :image
26
+ %td= f.file_field :image
27
+ %tr
28
+ %th= f.label :visible
29
+ %td= f.check_box :visible
27
30
 
28
31
  .actions
29
32
  = f.submit t('save')
@@ -1,3 +1,3 @@
1
1
  module Ideyabox
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ideyabox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,168 +10,8 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-19 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: russian
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: '0'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ! '>='
29
- - !ruby/object:Gem::Version
30
- version: '0'
31
- - !ruby/object:Gem::Dependency
32
- name: redactor-rails
33
- requirement: !ruby/object:Gem::Requirement
34
- none: false
35
- requirements:
36
- - - ! '>='
37
- - !ruby/object:Gem::Version
38
- version: '0'
39
- type: :runtime
40
- prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- - !ruby/object:Gem::Dependency
48
- name: kaminari
49
- requirement: !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :runtime
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ! '>='
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- - !ruby/object:Gem::Dependency
64
- name: haml
65
- requirement: !ruby/object:Gem::Requirement
66
- none: false
67
- requirements:
68
- - - ! '>='
69
- - !ruby/object:Gem::Version
70
- version: 3.1.6
71
- type: :runtime
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ! '>='
77
- - !ruby/object:Gem::Version
78
- version: 3.1.6
79
- - !ruby/object:Gem::Dependency
80
- name: devise
81
- requirement: !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ! '>='
85
- - !ruby/object:Gem::Version
86
- version: '0'
87
- type: :runtime
88
- prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ! '>='
93
- - !ruby/object:Gem::Version
94
- version: '0'
95
- - !ruby/object:Gem::Dependency
96
- name: jquery-fileupload-rails
97
- requirement: !ruby/object:Gem::Requirement
98
- none: false
99
- requirements:
100
- - - ! '>='
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
- type: :runtime
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
- requirements:
108
- - - ! '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: mini_magick
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ! '>='
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :runtime
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ! '>='
125
- - !ruby/object:Gem::Version
126
- version: '0'
127
- - !ruby/object:Gem::Dependency
128
- name: sexy_validators
129
- requirement: !ruby/object:Gem::Requirement
130
- none: false
131
- requirements:
132
- - - ! '>='
133
- - !ruby/object:Gem::Version
134
- version: 0.0.5
135
- type: :runtime
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
140
- - - ! '>='
141
- - !ruby/object:Gem::Version
142
- version: 0.0.5
143
- - !ruby/object:Gem::Dependency
144
- name: haml-rails
145
- requirement: !ruby/object:Gem::Requirement
146
- none: false
147
- requirements:
148
- - - ! '>='
149
- - !ruby/object:Gem::Version
150
- version: 0.3.4
151
- type: :development
152
- prerelease: false
153
- version_requirements: !ruby/object:Gem::Requirement
154
- none: false
155
- requirements:
156
- - - ! '>='
157
- - !ruby/object:Gem::Version
158
- version: 0.3.4
159
- - !ruby/object:Gem::Dependency
160
- name: capistrano
161
- requirement: !ruby/object:Gem::Requirement
162
- none: false
163
- requirements:
164
- - - ! '>='
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- type: :development
168
- prerelease: false
169
- version_requirements: !ruby/object:Gem::Requirement
170
- none: false
171
- requirements:
172
- - - ! '>='
173
- - !ruby/object:Gem::Version
174
- version: '0'
13
+ date: 2012-12-08 00:00:00.000000000 Z
14
+ dependencies: []
175
15
  description: Write a gem description
176
16
  email:
177
17
  - maks.rydkin@gmail.com
@@ -203,11 +43,14 @@ files:
203
43
  - app/assets/javascripts/.DS_Store
204
44
  - app/assets/javascripts/chosen.jquery.js
205
45
  - app/assets/javascripts/default.js
46
+ - app/assets/javascripts/jquery.Jcrop.min.js
47
+ - app/assets/javascripts/jquery.color.js
206
48
  - app/assets/javascripts/jquery.ui.nestedSortable.js
207
49
  - app/assets/javascripts/jquery.uploadify.min.js
208
50
  - app/assets/javascripts/modernizr.js
209
51
  - app/assets/javascripts/swfobject.js
210
52
  - app/assets/stylesheets/.DS_Store
53
+ - app/assets/stylesheets/Jcrop.gif
211
54
  - app/assets/stylesheets/chosen.scss.erb
212
55
  - app/assets/stylesheets/default.scss.erb
213
56
  - app/assets/stylesheets/font-awesome.css
@@ -216,6 +59,7 @@ files:
216
59
  - app/assets/stylesheets/font_awesome/font/fontawesome-webfont.svg
217
60
  - app/assets/stylesheets/font_awesome/font/fontawesome-webfont.ttf
218
61
  - app/assets/stylesheets/font_awesome/font/fontawesome-webfont.woff
62
+ - app/assets/stylesheets/jquery.Jcrop.css
219
63
  - app/assets/stylesheets/normalize.css
220
64
  - app/helpers/.DS_Store
221
65
  - app/helpers/admin_helper.rb
@@ -244,6 +88,8 @@ files:
244
88
  - lib/generators/ideyabox/admin/templates/views/layouts/admin.html.haml
245
89
  - lib/generators/ideyabox/admin/templates/views/layouts/login.html.haml
246
90
  - lib/generators/ideyabox/assets/assets_generator.rb
91
+ - lib/generators/ideyabox/crop/crop_generator.rb
92
+ - lib/generators/ideyabox/crop/templates/_crop.html.haml
247
93
  - lib/generators/ideyabox/images_scaffold/.DS_Store
248
94
  - lib/generators/ideyabox/images_scaffold/images_scaffold_generator.rb
249
95
  - lib/generators/ideyabox/images_scaffold/templates/.DS_Store