mechanize-store 0.0.1 → 0.0.2
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.
- checksums.yaml +8 -8
- data/README.rdoc +4 -2
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/canvas-to-blob.min.js +1 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.blueimp-gallery.min.js +1 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-angular.js +429 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-audio.js +106 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-image.js +309 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-jquery-ui.js +152 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-process.js +172 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-ui.js +699 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-validate.js +119 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-video.js +106 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload.js +1426 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.iframe-transport.js +214 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/jquery.ui.widget.js +530 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/load-image.min.js +1 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/main.js +14 -0
- data/app/assets/javascripts/mechanize_store/sb-admin/jquery-file-upload/tmpl.min.js +1 -0
- data/app/assets/stylesheets/mechanize_store/application.css +0 -2
- data/app/assets/stylesheets/mechanize_store/sb-admin/sb-admin.css +2 -2
- data/app/controllers/mechanize_store/product_photos_controller.rb +49 -0
- data/app/models/mechanize_store/product.rb +4 -3
- data/app/models/mechanize_store/product_photo.rb +11 -0
- data/app/views/layouts/{store → mechanize_store}/application.html.erb +38 -2
- data/app/views/mechanize_store/flags/_form.html.erb +1 -1
- data/app/views/mechanize_store/flags/index.html.erb +2 -2
- data/app/views/mechanize_store/order_statuses/_form.html.erb +6 -6
- data/app/views/mechanize_store/order_statuses/index.html.erb +3 -3
- data/app/views/mechanize_store/orders/index.html.erb +5 -5
- data/app/views/mechanize_store/payment_statuses/_form.html.erb +1 -1
- data/app/views/mechanize_store/payment_statuses/index.html.erb +3 -3
- data/app/views/mechanize_store/payment_types/_form.html.erb +6 -6
- data/app/views/mechanize_store/payment_types/index.html.erb +2 -2
- data/app/views/mechanize_store/product_categories/index.html.erb +4 -6
- data/app/views/mechanize_store/product_photos/create.json.jbuilder +9 -0
- data/app/views/mechanize_store/product_photos/index.json.jbuilder +9 -0
- data/app/views/mechanize_store/products/_form.html.erb +1 -1
- data/app/views/mechanize_store/products/index.html.erb +1 -1
- data/app/views/mechanize_store/products/show.html.erb +186 -32
- data/config/locales/store.pt-BR.yml +54 -11
- data/config/routes.rb +3 -2
- data/db/migrate/20140402153139_create_mechanize_store_orders.rb +1 -1
- data/lib/mechanize_store/version.rb +1 -1
- metadata +108 -7
- data/app/models/mechanize_store/store.rb +0 -5
- data/db/migrate/20140402141340_create_mechanize_store_stores.rb +0 -12
@@ -0,0 +1 @@
|
|
1
|
+
!function(a){"use strict";var b=function(a,c,d){var e,f,g=document.createElement("img");if(g.onerror=c,g.onload=function(){!f||d&&d.noRevoke||b.revokeObjectURL(f),c&&c(b.scale(g,d))},b.isInstanceOf("Blob",a)||b.isInstanceOf("File",a))e=f=b.createObjectURL(a),g._type=a.type;else{if("string"!=typeof a)return!1;e=a,d&&d.crossOrigin&&(g.crossOrigin=d.crossOrigin)}return e?(g.src=e,g):b.readFile(a,function(a){var b=a.target;b&&b.result?g.src=b.result:c&&c(a)})},c=window.createObjectURL&&window||window.URL&&URL.revokeObjectURL&&URL||window.webkitURL&&webkitURL;b.isInstanceOf=function(a,b){return Object.prototype.toString.call(b)==="[object "+a+"]"},b.transformCoordinates=function(){},b.getTransformedOptions=function(a){return a},b.renderImageToCanvas=function(a,b,c,d,e,f,g,h,i,j){return a.getContext("2d").drawImage(b,c,d,e,f,g,h,i,j),a},b.hasCanvasOption=function(a){return a.canvas||a.crop},b.scale=function(a,c){c=c||{};var d,e,f,g,h,i,j,k,l,m=document.createElement("canvas"),n=a.getContext||b.hasCanvasOption(c)&&m.getContext,o=a.naturalWidth||a.width,p=a.naturalHeight||a.height,q=o,r=p,s=function(){var a=Math.max((f||q)/q,(g||r)/r);a>1&&(q=Math.ceil(q*a),r=Math.ceil(r*a))},t=function(){var a=Math.min((d||q)/q,(e||r)/r);1>a&&(q=Math.ceil(q*a),r=Math.ceil(r*a))};return n&&(c=b.getTransformedOptions(c),j=c.left||0,k=c.top||0,c.sourceWidth?(h=c.sourceWidth,void 0!==c.right&&void 0===c.left&&(j=o-h-c.right)):h=o-j-(c.right||0),c.sourceHeight?(i=c.sourceHeight,void 0!==c.bottom&&void 0===c.top&&(k=p-i-c.bottom)):i=p-k-(c.bottom||0),q=h,r=i),d=c.maxWidth,e=c.maxHeight,f=c.minWidth,g=c.minHeight,n&&d&&e&&c.crop?(q=d,r=e,l=h/i-d/e,0>l?(i=e*h/d,void 0===c.top&&void 0===c.bottom&&(k=(p-i)/2)):l>0&&(h=d*i/e,void 0===c.left&&void 0===c.right&&(j=(o-h)/2))):((c.contain||c.cover)&&(f=d=d||f,g=e=e||g),c.cover?(t(),s()):(s(),t())),n?(m.width=q,m.height=r,b.transformCoordinates(m,c),b.renderImageToCanvas(m,a,j,k,h,i,0,0,q,r)):(a.width=q,a.height=r,a)},b.createObjectURL=function(a){return c?c.createObjectURL(a):!1},b.revokeObjectURL=function(a){return c?c.revokeObjectURL(a):!1},b.readFile=function(a,b,c){if(window.FileReader){var d=new FileReader;if(d.onload=d.onerror=b,c=c||"readAsDataURL",d[c])return d[c](a),d}return!1},"function"==typeof define&&define.amd?define(function(){return b}):a.loadImage=b}(this),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image"],a):a(window.loadImage)}(function(a){"use strict";if(window.navigator&&window.navigator.platform&&/iP(hone|od|ad)/.test(window.navigator.platform)){var b=a.renderImageToCanvas;a.detectSubsampling=function(a){var b,c;return a.width*a.height>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-a.width+1,0),0===c.getImageData(0,0,1,1).data[3]):!1},a.detectVerticalSquash=function(a,b){var c,d,e,f,g,h=a.naturalHeight||a.height,i=document.createElement("canvas"),j=i.getContext("2d");for(b&&(h/=2),i.width=1,i.height=h,j.drawImage(a,0,0),c=j.getImageData(0,0,1,h).data,d=0,e=h,f=h;f>d;)g=c[4*(f-1)+3],0===g?e=f:d=f,f=e+d>>1;return f/h||1},a.renderImageToCanvas=function(c,d,e,f,g,h,i,j,k,l){if("image/jpeg"===d._type){var m,n,o,p,q=c.getContext("2d"),r=document.createElement("canvas"),s=1024,t=r.getContext("2d");if(r.width=s,r.height=s,q.save(),m=a.detectSubsampling(d),m&&(e/=2,f/=2,g/=2,h/=2),n=a.detectVerticalSquash(d,m),m||1!==n){for(f*=n,k=Math.ceil(s*k/g),l=Math.ceil(s*l/h/n),j=0,p=0;h>p;){for(i=0,o=0;g>o;)t.clearRect(0,0,s,s),t.drawImage(d,e,f,g,h,-o,-p,g,h),q.drawImage(r,0,0,s,s,i,j,k,l),o+=s,i+=k;p+=s,j+=l}return q.restore(),c}}return b(c,d,e,f,g,h,i,j,k,l)}}}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image"],a):a(window.loadImage)}(function(a){"use strict";var b=a.hasCanvasOption;a.hasCanvasOption=function(a){return b(a)||a.orientation},a.transformCoordinates=function(a,b){var c=a.getContext("2d"),d=a.width,e=a.height,f=b.orientation;if(f)switch(f>4&&(a.width=e,a.height=d),f){case 2:c.translate(d,0),c.scale(-1,1);break;case 3:c.translate(d,e),c.rotate(Math.PI);break;case 4:c.translate(0,e),c.scale(1,-1);break;case 5:c.rotate(.5*Math.PI),c.scale(1,-1);break;case 6:c.rotate(.5*Math.PI),c.translate(0,-e);break;case 7:c.rotate(.5*Math.PI),c.translate(d,-e),c.scale(-1,1);break;case 8:c.rotate(-.5*Math.PI),c.translate(-d,0)}},a.getTransformedOptions=function(a){if(!a.orientation||1===a.orientation)return a;var b,c={};for(b in a)a.hasOwnProperty(b)&&(c[b]=a[b]);switch(a.orientation){case 2:c.left=a.right,c.right=a.left;break;case 3:c.left=a.right,c.top=a.bottom,c.right=a.left,c.bottom=a.top;break;case 4:c.top=a.bottom,c.bottom=a.top;break;case 5:c.left=a.top,c.top=a.left,c.right=a.bottom,c.bottom=a.right;break;case 6:c.left=a.top,c.top=a.right,c.right=a.bottom,c.bottom=a.left;break;case 7:c.left=a.bottom,c.top=a.right,c.right=a.top,c.bottom=a.left;break;case 8:c.left=a.bottom,c.top=a.left,c.right=a.top,c.bottom=a.right}return a.orientation>4&&(c.maxWidth=a.maxHeight,c.maxHeight=a.maxWidth,c.minWidth=a.minHeight,c.minHeight=a.minWidth,c.sourceWidth=a.sourceHeight,c.sourceHeight=a.sourceWidth),c}}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image"],a):a(window.loadImage)}(function(a){"use strict";var b=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);a.blobSlice=b&&function(){var a=this.slice||this.webkitSlice||this.mozSlice;return a.apply(this,arguments)},a.metaDataParsers={jpeg:{65505:[]}},a.parseMetaData=function(b,c,d){d=d||{};var e=this,f=d.maxMetaDataSize||262144,g={},h=!(window.DataView&&b&&b.size>=12&&"image/jpeg"===b.type&&a.blobSlice);(h||!a.readFile(a.blobSlice.call(b,0,f),function(b){if(b.target.error)return console.log(b.target.error),c(g),void 0;var f,h,i,j,k=b.target.result,l=new DataView(k),m=2,n=l.byteLength-4,o=m;if(65496===l.getUint16(0)){for(;n>m&&(f=l.getUint16(m),f>=65504&&65519>=f||65534===f);){if(h=l.getUint16(m+2)+2,m+h>l.byteLength){console.log("Invalid meta data: Invalid segment size.");break}if(i=a.metaDataParsers.jpeg[f])for(j=0;j<i.length;j+=1)i[j].call(e,l,m,h,g,d);m+=h,o=m}!d.disableImageHead&&o>6&&(g.imageHead=k.slice?k.slice(0,o):new Uint8Array(k).subarray(0,o))}else console.log("Invalid JPEG file: Missing JPEG marker.");c(g)},"readAsArrayBuffer"))&&c(g)}}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image","load-image-meta"],a):a(window.loadImage)}(function(a){"use strict";a.ExifMap=function(){return this},a.ExifMap.prototype.map={Orientation:274},a.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},a.getExifThumbnail=function(a,b,c){var d,e,f;if(!c||b+c>a.byteLength)return console.log("Invalid Exif data: Invalid thumbnail data."),void 0;for(d=[],e=0;c>e;e+=1)f=a.getUint8(b+e),d.push((16>f?"0":"")+f.toString(16));return"data:image/jpeg,%"+d.join("%")},a.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},a.exifTagTypes[7]=a.exifTagTypes[1],a.getExifValue=function(b,c,d,e,f,g){var h,i,j,k,l,m,n=a.exifTagTypes[e];if(!n)return console.log("Invalid Exif data: Invalid tag type."),void 0;if(h=n.size*f,i=h>4?c+b.getUint32(d+8,g):d+8,i+h>b.byteLength)return console.log("Invalid Exif data: Invalid data offset."),void 0;if(1===f)return n.getValue(b,i,g);for(j=[],k=0;f>k;k+=1)j[k]=n.getValue(b,i+k*n.size,g);if(n.ascii){for(l="",k=0;k<j.length&&(m=j[k],"\x00"!==m);k+=1)l+=m;return l}return j},a.parseExifTag=function(b,c,d,e,f){var g=b.getUint16(d,e);f.exif[g]=a.getExifValue(b,c,d,b.getUint16(d+2,e),b.getUint32(d+4,e),e)},a.parseExifTags=function(a,b,c,d,e){var f,g,h;if(c+6>a.byteLength)return console.log("Invalid Exif data: Invalid directory offset."),void 0;if(f=a.getUint16(c,d),g=c+2+12*f,g+4>a.byteLength)return console.log("Invalid Exif data: Invalid directory size."),void 0;for(h=0;f>h;h+=1)this.parseExifTag(a,b,c+2+12*h,d,e);return a.getUint32(g,d)},a.parseExifData=function(b,c,d,e,f){if(!f.disableExif){var g,h,i,j=c+10;if(1165519206===b.getUint32(c+4)){if(j+8>b.byteLength)return console.log("Invalid Exif data: Invalid segment size."),void 0;if(0!==b.getUint16(c+8))return console.log("Invalid Exif data: Missing byte alignment offset."),void 0;switch(b.getUint16(j)){case 18761:g=!0;break;case 19789:g=!1;break;default:return console.log("Invalid Exif data: Invalid byte alignment marker."),void 0}if(42!==b.getUint16(j+2,g))return console.log("Invalid Exif data: Missing TIFF marker."),void 0;h=b.getUint32(j+4,g),e.exif=new a.ExifMap,h=a.parseExifTags(b,j,j+h,g,e),h&&!f.disableExifThumbnail&&(i={exif:{}},h=a.parseExifTags(b,j,j+h,g,i),i.exif[513]&&(e.exif.Thumbnail=a.getExifThumbnail(b,j+i.exif[513],i.exif[514]))),e.exif[34665]&&!f.disableExifSub&&a.parseExifTags(b,j,j+e.exif[34665],g,e),e.exif[34853]&&!f.disableExifGps&&a.parseExifTags(b,j,j+e.exif[34853],g,e)}}},a.metaDataParsers.jpeg[65505].push(a.parseExifData)}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image","load-image-exif"],a):a(window.loadImage)}(function(a){"use strict";a.ExifMap.prototype.tags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright",36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",42240:"Gamma",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"PhotographicSensitivity",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},a.ExifMap.prototype.stringValues={ExposureProgram:{0:"Undefined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Undefined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},ComponentsConfiguration:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"},Orientation:{1:"top-left",2:"top-right",3:"bottom-right",4:"bottom-left",5:"left-top",6:"right-top",7:"right-bottom",8:"left-bottom"}},a.ExifMap.prototype.getText=function(a){var b=this.get(a);switch(a){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":case"Orientation":return this.stringValues[a][b];case"ExifVersion":case"FlashpixVersion":return String.fromCharCode(b[0],b[1],b[2],b[3]);case"ComponentsConfiguration":return this.stringValues[a][b[0]]+this.stringValues[a][b[1]]+this.stringValues[a][b[2]]+this.stringValues[a][b[3]];case"GPSVersionID":return b[0]+"."+b[1]+"."+b[2]+"."+b[3]}return String(b)},function(a){var b,c=a.tags,d=a.map;for(b in c)c.hasOwnProperty(b)&&(d[c[b]]=b)}(a.ExifMap.prototype),a.ExifMap.prototype.getAll=function(){var a,b,c={};for(a in this)this.hasOwnProperty(a)&&(b=this.tags[a],b&&(c[b]=this.getText(b)));return c}});
|
@@ -0,0 +1,14 @@
|
|
1
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/jquery.ui.widget
|
2
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/tmpl.min
|
3
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/load-image.min
|
4
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/canvas-to-blob.min
|
5
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/jquery.blueimp-gallery.min
|
6
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/jquery.iframe-transport
|
7
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload
|
8
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-process
|
9
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-image
|
10
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-audio
|
11
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-video
|
12
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-validate
|
13
|
+
//= require mechanize_store/sb-admin/jquery-file-upload/jquery.fileupload-ui
|
14
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(a){"use strict";var b=function(a,c){var d=/[^\w\-\.:]/.test(a)?new Function(b.arg+",tmpl","var _e=tmpl.encode"+b.helper+",_s='"+a.replace(b.regexp,b.func)+"';return _s;"):b.cache[a]=b.cache[a]||b(b.load(a));return c?d(c,b):function(a){return d(a,b)}};b.cache={},b.load=function(a){return document.getElementById(a).innerHTML},b.regexp=/([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g,b.func=function(a,b,c,d,e,f){return b?{"\n":"\\n","\r":"\\r"," ":"\\t"," ":" "}[b]||"\\"+b:c?"="===c?"'+_e("+d+")+'":"'+("+d+"==null?'':"+d+")+'":e?"';":f?"_s+='":void 0},b.encReg=/[<>&"'\x00]/g,b.encMap={"<":"<",">":">","&":"&",'"':""","'":"'"},b.encode=function(a){return(null==a?"":""+a).replace(b.encReg,function(a){return b.encMap[a]||""})},b.arg="o",b.helper=",print=function(s,e){_s+=e?(s==null?'':s):_e(s);},include=function(s,d){_s+=tmpl(s,d);}","function"==typeof define&&define.amd?define(function(){return b}):a.tmpl=b}(this);
|
@@ -23,7 +23,7 @@
|
|
23
23
|
@media(min-width:768px) {
|
24
24
|
#page-wrapper {
|
25
25
|
position: inherit;
|
26
|
-
margin: 0 0 0
|
26
|
+
margin: 0 0 0 250px;
|
27
27
|
padding: 0 30px;
|
28
28
|
min-height: 1300px;
|
29
29
|
border-left: 1px solid #e7e7e7;
|
@@ -129,7 +129,7 @@
|
|
129
129
|
.navbar-static-side {
|
130
130
|
z-index: 1;
|
131
131
|
position: absolute;
|
132
|
-
width:
|
132
|
+
width: 250px;
|
133
133
|
}
|
134
134
|
|
135
135
|
.navbar-top-links .dropdown-messages,
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_dependency "mechanize_store/application_controller"
|
2
|
+
|
3
|
+
module MechanizeStore
|
4
|
+
class ProductPhotosController < ApplicationController
|
5
|
+
respond_to :html, :json
|
6
|
+
|
7
|
+
def index
|
8
|
+
@product = Product.find(params[:product_id])
|
9
|
+
|
10
|
+
@product_photos = @product.product_photos
|
11
|
+
|
12
|
+
respond_with @product_photos
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
@product_photos = []
|
17
|
+
|
18
|
+
@product = Product.find(params[:product_id])
|
19
|
+
|
20
|
+
@product_photo = @product.product_photos.new(file: params["product_photo"]["file"][0])
|
21
|
+
|
22
|
+
respond_with @product_photo do |format|
|
23
|
+
if @product_photo.save
|
24
|
+
@product_photos << @product_photo
|
25
|
+
format.html { redirect_to @product, notice: I18n.t(:created, model: I18n.t(:product_photo, scope: 'activerecord.models')) }
|
26
|
+
else
|
27
|
+
format.html { render action: 'new' }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def destroy
|
33
|
+
@product_photo = ProductPhoto.find(params[:id])
|
34
|
+
@product = @product_photo.product
|
35
|
+
@product_photo.destroy
|
36
|
+
|
37
|
+
respond_with @product_photo do |format|
|
38
|
+
format.html do
|
39
|
+
redirect_to @product
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
def product_photo_params
|
46
|
+
params.require(:product_photo).permit(:product_id, file: [])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -1,5 +1,16 @@
|
|
1
1
|
module MechanizeStore
|
2
2
|
class ProductPhoto < ActiveRecord::Base
|
3
3
|
belongs_to :product
|
4
|
+
|
5
|
+
has_attached_file :file,
|
6
|
+
:styles => { :medium => "300x300>", :thumb => "100x100>" },
|
7
|
+
:default_url => "/images/:style/missing.png",
|
8
|
+
path: "#{Rails.root}/public/photos/:id/:style.:extension",
|
9
|
+
url: "/photos/:id/:style.:extension"#,
|
10
|
+
# storage: :s3,
|
11
|
+
# s3_credentials: "#{Rails.root}/config/amazon_s3.yml"
|
12
|
+
|
13
|
+
# validates_attachment_content_type :file, :content_type => /png|jpg|jpeg/
|
14
|
+
validates :file, :attachment_presence => true
|
4
15
|
end
|
5
16
|
end
|
@@ -45,15 +45,51 @@
|
|
45
45
|
<nav class="navbar-static-side" role="navigation">
|
46
46
|
<div class="sidebar-collapse">
|
47
47
|
<ul class="nav" id="side-menu">
|
48
|
+
<li>
|
49
|
+
<%= link_to flags_path do %>
|
50
|
+
<%= t(:flag, scope: "activerecord.models.mechanize_store").pluralize %>
|
51
|
+
<% end -%>
|
52
|
+
</li>
|
53
|
+
|
48
54
|
<li>
|
49
55
|
<%= link_to orders_path do %>
|
50
|
-
|
56
|
+
<%= t(:order, scope: "activerecord.models.mechanize_store").pluralize %>
|
57
|
+
<% end -%>
|
58
|
+
</li>
|
59
|
+
|
60
|
+
<li>
|
61
|
+
<%= link_to payment_types_path do %>
|
62
|
+
<%= t(:payment_type, scope: "activerecord.models.mechanize_store").pluralize %>
|
63
|
+
<% end -%>
|
64
|
+
</li>
|
65
|
+
|
66
|
+
<li>
|
67
|
+
<%= link_to payment_statuses_path do %>
|
68
|
+
<%= t(:payment_status, scope: "activerecord.models.mechanize_store").pluralize %>
|
69
|
+
<% end -%>
|
70
|
+
</li>
|
71
|
+
<li>
|
72
|
+
<%= link_to order_statuses_path do %>
|
73
|
+
<%= t(:order_status, scope: "activerecord.models.mechanize_store").pluralize %>
|
51
74
|
<% end -%>
|
52
75
|
</li>
|
53
76
|
<li>
|
54
77
|
<%= link_to products_path do %>
|
55
|
-
|
78
|
+
<%= t(:product, scope: "activerecord.models.mechanize_store").pluralize %>
|
79
|
+
<span class="fa arrow"></span>
|
56
80
|
<% end -%>
|
81
|
+
<ul class="nav nav-second-level collapse" style="height: auto;">
|
82
|
+
<li>
|
83
|
+
<%= link_to products_path do %>
|
84
|
+
<%= t(:products_list).pluralize %>
|
85
|
+
<% end -%>
|
86
|
+
</li>
|
87
|
+
<li>
|
88
|
+
<%= link_to product_categories_path do %>
|
89
|
+
<%= t(:product_category, scope: "activerecord.models.mechanize_store").pluralize %>
|
90
|
+
<% end -%>
|
91
|
+
</li>
|
92
|
+
</ul>
|
57
93
|
</li>
|
58
94
|
</ul>
|
59
95
|
<!-- /#side-menu -->
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= title t("flag", scope: "activerecord.models").pluralize %>
|
1
|
+
<%= title t("flag", scope: "activerecord.models.mechanize_store").pluralize %>
|
2
2
|
|
3
3
|
<% content_for :right do -%>
|
4
4
|
<li class="active">
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<thead>
|
11
11
|
<tr>
|
12
12
|
<th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes") %></th>
|
13
|
-
<th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.flag") %></th>
|
13
|
+
<th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.mechanize_store/flag") %></th>
|
14
14
|
<th colspan="3"></th>
|
15
15
|
</tr>
|
16
16
|
</thead>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%= simple_form_for(@order_status) do |f| %>
|
2
|
-
|
2
|
+
<%= f.error_notification %>
|
3
3
|
|
4
|
-
|
4
|
+
<div class="form-group">
|
5
5
|
<%= f.input :name %>
|
6
|
-
|
6
|
+
</div>
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
<div class="form-actions">
|
9
|
+
<%= f.button :submit, t(:create, model: t(:order_status, scope: "activerecord.models.mechanize_store"), scope: "helpers.submit"), class: "btn btn-primary" %>
|
10
|
+
</div>
|
11
11
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= title t("order_status", scope: "activerecord.models").pluralize %>
|
1
|
+
<%= title t("order_status", scope: "activerecord.models.mechanize_store").pluralize %>
|
2
2
|
|
3
3
|
<% content_for :right do -%>
|
4
4
|
<li class="active">
|
@@ -9,8 +9,8 @@
|
|
9
9
|
<table class="table table-striped">
|
10
10
|
<thead>
|
11
11
|
<tr>
|
12
|
-
<th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes") %></th>
|
13
|
-
<th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.order_status") %></th>
|
12
|
+
<th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes.mechanize_store") %></th>
|
13
|
+
<th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.mechanize_store.order_status") %></th>
|
14
14
|
<th colspan="3"></th>
|
15
15
|
</tr>
|
16
16
|
</thead>
|
@@ -45,13 +45,13 @@
|
|
45
45
|
<thead>
|
46
46
|
<tr>
|
47
47
|
<th><%= sort_link(@search, :id, t(:id, scope: "activerecord.attributes") ) %></th>
|
48
|
-
<th><%= sort_link(@search, :order_status_id, t(:order_status_id, scope: "activerecord.attributes.mechanize_store
|
48
|
+
<th><%= sort_link(@search, :order_status_id, t(:order_status_id, scope: "activerecord.attributes.mechanize_store/order") ) %></th>
|
49
49
|
<th>
|
50
|
-
<%= sort_link(@search, :order_payment_payment_status_name, t(:payment_status_id, scope: "activerecord.attributes.mechanize_store
|
50
|
+
<%= sort_link(@search, :order_payment_payment_status_name, t(:payment_status_id, scope: "activerecord.attributes.mechanize_store/payment") ) %>
|
51
51
|
</th>
|
52
|
-
<th><%= sort_link(@search, :generated_at, t(:generated_at, scope: "activerecord.attributes.mechanize_store
|
53
|
-
<th><%= sort_link(@search, :delivery_date, t(:delivery_date, scope: "activerecord.attributes.mechanize_store
|
54
|
-
<th><%= sort_link(@search, :created_at, t(:created_at, scope: "activerecord.attributes.mechanize_store
|
52
|
+
<th><%= sort_link(@search, :generated_at, t(:generated_at, scope: "activerecord.attributes.mechanize_store/order") ) %></th>
|
53
|
+
<th><%= sort_link(@search, :delivery_date, t(:delivery_date, scope: "activerecord.attributes.mechanize_store/order") ) %></th>
|
54
|
+
<th><%= sort_link(@search, :created_at, t(:created_at, scope: "activerecord.attributes.mechanize_store/order") ) %></th>
|
55
55
|
<th><%= t(:options, scope: "activerecord.attributes.order") %></th>
|
56
56
|
</tr>
|
57
57
|
</thead>
|
@@ -6,6 +6,6 @@
|
|
6
6
|
</div>
|
7
7
|
|
8
8
|
<div class="form-actions">
|
9
|
-
<%= f.button :submit, class: "btn btn-primary" %>
|
9
|
+
<%= f.button :submit, t(:create, model: t(:payment_status, scope: "activerecord.models.mechanize_store"), scope: "helpers.submit"), class: "btn btn-primary" %>
|
10
10
|
</div>
|
11
11
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= title t("payment_status", scope: "activerecord.models").pluralize %>
|
1
|
+
<%= title t("payment_status", scope: "activerecord.models.mechanize_store").pluralize %>
|
2
2
|
|
3
3
|
<% content_for :right do -%>
|
4
4
|
<li class="active">
|
@@ -9,8 +9,8 @@
|
|
9
9
|
<table class="table table-striped">
|
10
10
|
<thead>
|
11
11
|
<tr>
|
12
|
-
<th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes") %></th>
|
13
|
-
<th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.payment_status") %></th>
|
12
|
+
<th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes.mechanize_store") %></th>
|
13
|
+
<th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.mechanize_store.payment_status") %></th>
|
14
14
|
<th colspan="3"></th>
|
15
15
|
</tr>
|
16
16
|
</thead>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%= simple_form_for(@payment_type) do |f| %>
|
2
|
-
|
2
|
+
<%= f.error_notification %>
|
3
3
|
|
4
|
-
|
4
|
+
<div class="form-group">
|
5
5
|
<%= f.input :name %>
|
6
|
-
|
6
|
+
</div>
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
<div class="form-actions">
|
9
|
+
<%= f.button :submit, t(:create, model: t(:order_status, scope: "activerecord.models.mechanize_store"), scope: "helpers.submit"), class: "btn btn-primary" %>
|
10
|
+
</div>
|
11
11
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= title t("payment_type", scope: "activerecord.models").pluralize %>
|
1
|
+
<%= title t("payment_type", scope: "activerecord.models.mechanize_store").pluralize %>
|
2
2
|
|
3
3
|
<% content_for :right do -%>
|
4
4
|
<li class="active">
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<thead>
|
11
11
|
<tr>
|
12
12
|
<th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes") %></th>
|
13
|
-
<th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.payment_type") %></th>
|
13
|
+
<th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.mechanize_store/payment_type") %></th>
|
14
14
|
<th colspan="3"></th>
|
15
15
|
</tr>
|
16
16
|
</thead>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= title t("product_category", scope: "activerecord.models").pluralize %>
|
1
|
+
<%= title t("product_category", scope: "activerecord.models.mechanize_store").pluralize %>
|
2
2
|
|
3
3
|
<% content_for :right do -%>
|
4
4
|
<li class="active">
|
@@ -10,19 +10,17 @@
|
|
10
10
|
<thead>
|
11
11
|
<tr>
|
12
12
|
<th><%= sort_link @search, :id, t(:id, scope: "activerecord.attributes") %></th>
|
13
|
-
<th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.product_category") %></th>
|
14
|
-
<th><%= sort_link @search, :product_category, t(:product_category, scope: "activerecord.attributes.product_category") %></th>
|
13
|
+
<th><%= sort_link @search, :name, t(:name, scope: "activerecord.attributes.mechanize_store/product_category") %></th>
|
14
|
+
<th><%= sort_link @search, :product_category, t(:product_category, scope: "activerecord.attributes.mechanize_store/product_category") %></th>
|
15
15
|
<th colspan="3"></th>
|
16
16
|
</tr>
|
17
17
|
</thead>
|
18
|
-
|
19
18
|
<tbody>
|
20
|
-
|
21
19
|
<% @product_categories.each do |product_category| %>
|
22
20
|
<tr>
|
23
21
|
<td><%= product_category.id %></td>
|
24
22
|
<td><%= product_category.name %></td>
|
25
|
-
<td><%= product_category.product_category %></td>
|
23
|
+
<td><%= product_category.product_category.name unless product_category.product_category.nil? %></td>
|
26
24
|
<td>
|
27
25
|
<%= link_to product_category do %>
|
28
26
|
<i class="fa fa-file"></i>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
json.files do |json|
|
2
|
+
json.array! @product_photos do |product_photo|
|
3
|
+
json.name product_photo.file_file_name
|
4
|
+
json.size product_photo.file_file_size
|
5
|
+
json.thumbnailUrl url_for(product_photo.file.url(:thumb))
|
6
|
+
json.mediumUrl url_for(product_photo.file.url(:medium))
|
7
|
+
json.url url_for(product_photo.file.url)
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
json.array! @product_photos do |product_photo|
|
2
|
+
json.name product_photo.file_file_name
|
3
|
+
json.size product_photo.file_file_size
|
4
|
+
json.thumbnailUrl url_for(product_photo.file.url(:thumb))
|
5
|
+
json.mediumUrl url_for(product_photo.file.url(:medium))
|
6
|
+
json.url url_for(product_photo.file.url)
|
7
|
+
json.deleteUrl product_photo_path(product_photo)
|
8
|
+
json.deleteType "DELETE"
|
9
|
+
end
|
@@ -13,6 +13,6 @@
|
|
13
13
|
</div>
|
14
14
|
|
15
15
|
<div class="form-actions">
|
16
|
-
<%= f.button :submit, class: "btn btn-primary" %>
|
16
|
+
<%= f.button :submit, t(:create, model: t(:product, scope: "activerecord.models.mechanize_store"), scope: "helpers.submit"), class: "btn btn-primary" %>
|
17
17
|
</div>
|
18
18
|
<% end %>
|
@@ -9,35 +9,189 @@
|
|
9
9
|
</li>
|
10
10
|
<% end -%>
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
12
|
+
<p>
|
13
|
+
<small><%= t(:name, scope: "activerecord.attributes.mechanize_store.product") %>:</small>
|
14
|
+
<h3><%= @product.name %></h3>
|
15
|
+
</p>
|
16
|
+
<p>
|
17
|
+
<small><%= t(:description, scope: "activerecord.attributes.mechanize_store.product") %>:</small>
|
18
|
+
<h3><%= @product.description %></h3>
|
19
|
+
</p>
|
20
|
+
<p>
|
21
|
+
<small><%= t(:short_description, scope: "activerecord.attributes.mechanize_store.product") %>:</small>
|
22
|
+
<h3><%= @product.short_description %></h3>
|
23
|
+
</p>
|
24
|
+
<p>
|
25
|
+
<small><%= t(:price, scope: "activerecord.attributes.mechanize_store.product") %>:</small>
|
26
|
+
<h3><%= @product.price %></h3>
|
27
|
+
</p>
|
28
|
+
<p>
|
29
|
+
<small><%= t(:weight, scope: "activerecord.attributes.mechanize_store.product") %>:</small>
|
30
|
+
<h3><%= @product.weight %></h3>
|
31
|
+
</p>
|
32
|
+
<p>
|
33
|
+
<small><%= t(:lenght, scope: "activerecord.attributes.mechanize_store.product") %>:</small>
|
34
|
+
<h3><%= @product.lenght %></h3>
|
35
|
+
</p>
|
36
|
+
<p>
|
37
|
+
<small><%= t(:height, scope: "activerecord.attributes.mechanize_store.product") %>:</small>
|
38
|
+
<h3><%= @product.height %></h3>
|
39
|
+
</p>
|
40
|
+
<p>
|
41
|
+
<small><%= t(:product_category_id, scope: "activerecord.attributes.mechanize_store.product") %>:</small>
|
42
|
+
<h3><%= @product.product_category.name %></h3>
|
43
|
+
</p>
|
44
|
+
|
45
|
+
<form id="fileupload" action="/photos" method="POST" enctype="multipart/form-data">
|
46
|
+
<!-- Redirect browsers with JavaScript disabled to the origin page -->
|
47
|
+
<noscript><input type="hidden" name="redirect" value="http://blueimp.github.io/jQuery-File-Upload/"></noscript>
|
48
|
+
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
|
49
|
+
<div class="row fileupload-buttonbar">
|
50
|
+
<div class="col-lg-7">
|
51
|
+
<!-- The fileinput-button span is used to style the file input field as button -->
|
52
|
+
<span class="btn btn-success fileinput-button">
|
53
|
+
<i class="fa fa-plus"></i>
|
54
|
+
<span>Adicionar...</span>
|
55
|
+
<input type="file" name="product_photo[file][]" multiple>
|
56
|
+
</span>
|
57
|
+
|
58
|
+
<button type="submit" class="btn btn-primary start">
|
59
|
+
<i class="fa fa-upload"></i>
|
60
|
+
<span>Iniciar Upload</span>
|
61
|
+
</button>
|
62
|
+
|
63
|
+
<button type="reset" class="btn btn-warning cancel">
|
64
|
+
<i class="fa fa-ban-circle"></i>
|
65
|
+
<span>Cancelar upload</span>
|
66
|
+
</button>
|
67
|
+
|
68
|
+
<button type="button" class="btn btn-danger delete">
|
69
|
+
<i class="fa fa-trash-o"></i>
|
70
|
+
<span>Remover</span>
|
71
|
+
</button>
|
72
|
+
|
73
|
+
<input type="checkbox" class="toggle">
|
74
|
+
<!-- The global file processing state -->
|
75
|
+
<span class="fileupload-process"></span>
|
76
|
+
</div>
|
77
|
+
<!-- The global progress state -->
|
78
|
+
<div class="col-lg-5 fileupload-progress fade">
|
79
|
+
<!-- The global progress bar -->
|
80
|
+
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
|
81
|
+
<div class="progress-bar progress-bar-success" style="width:0%;"></div>
|
82
|
+
</div>
|
83
|
+
<!-- The extended global progress state -->
|
84
|
+
<div class="progress-extended"> </div>
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
<!-- The table listing the files available for upload/download -->
|
88
|
+
<table role="presentation" class="table table-striped"><tbody class="files"></tbody></table>
|
89
|
+
</form>
|
90
|
+
|
91
|
+
<!-- The blueimp Gallery widget -->
|
92
|
+
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even">
|
93
|
+
<div class="slides"></div>
|
94
|
+
<h3 class="title"></h3>
|
95
|
+
<a class="prev">‹</a>
|
96
|
+
<a class="next">›</a>
|
97
|
+
<a class="close">×</a>
|
98
|
+
<a class="play-pause"></a>
|
99
|
+
<ol class="indicator"></ol>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<!-- The template to display files available for upload -->
|
103
|
+
<script id="template-upload" type="text/x-tmpl">
|
104
|
+
{% for (var i=0, file; file=o.files[i]; i++) { %}
|
105
|
+
<tr class="template-upload fade">
|
106
|
+
<td>
|
107
|
+
<span class="preview"></span>
|
108
|
+
</td>
|
109
|
+
<td>
|
110
|
+
<p class="name">{%=file.name%}</p>
|
111
|
+
<strong class="error text-danger"></strong>
|
112
|
+
</td>
|
113
|
+
<td>
|
114
|
+
<p class="size">Processing...</p>
|
115
|
+
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
|
116
|
+
</td>
|
117
|
+
<td>
|
118
|
+
{% if (!i && !o.options.autoUpload) { %}
|
119
|
+
<button class="btn btn-primary start" disabled>
|
120
|
+
<i class="glyphicon glyphfa fa-upload"></i>
|
121
|
+
<span>Start</span>
|
122
|
+
</button>
|
123
|
+
{% } %}
|
124
|
+
{% if (!i) { %}
|
125
|
+
<button class="btn btn-warning cancel">
|
126
|
+
<i class="glyphicon glyphfa fa-ban-circle"></i>
|
127
|
+
<span>Cancel</span>
|
128
|
+
</button>
|
129
|
+
{% } %}
|
130
|
+
</td>
|
131
|
+
</tr>
|
132
|
+
{% } %}
|
133
|
+
</script>
|
134
|
+
<!-- The template to display files available for download -->
|
135
|
+
<script id="template-download" type="text/x-tmpl">
|
136
|
+
{% for (var i=0, file; file=o.files[i]; i++) { %}
|
137
|
+
<tr class="template-download fade">
|
138
|
+
<td>
|
139
|
+
<span class="preview">
|
140
|
+
{% if (file.thumbnailUrl) { %}
|
141
|
+
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
|
142
|
+
{% } %}
|
143
|
+
</span>
|
144
|
+
</td>
|
145
|
+
<td>
|
146
|
+
<p class="name">
|
147
|
+
{% if (file.url) { %}
|
148
|
+
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
|
149
|
+
{% } else { %}
|
150
|
+
<span>{%=file.name%}</span>
|
151
|
+
{% } %}
|
152
|
+
</p>
|
153
|
+
{% if (file.error) { %}
|
154
|
+
<div><span class="label label-danger">Error</span> {%=file.error%}</div>
|
155
|
+
{% } %}
|
156
|
+
</td>
|
157
|
+
<td>
|
158
|
+
<span class="size">{%=o.formatFileSize(file.size)%}</span>
|
159
|
+
</td>
|
160
|
+
<td>
|
161
|
+
{% if (file.deleteUrl) { %}
|
162
|
+
<button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
|
163
|
+
<i class="fa fa-trash-o"></i>
|
164
|
+
<span>Delete</span>
|
165
|
+
</button>
|
166
|
+
<input type="checkbox" name="delete" value="1" class="toggle">
|
167
|
+
{% } else { %}
|
168
|
+
<button class="btn btn-warning cancel">
|
169
|
+
<i class="fa fa-ban-circle"></i>
|
170
|
+
<span>Cancel</span>
|
171
|
+
</button>
|
172
|
+
{% } %}
|
173
|
+
</td>
|
174
|
+
</tr>
|
175
|
+
{% } %}
|
176
|
+
</script>
|
177
|
+
|
178
|
+
<%= javascript_include_tag "mechanize_store/sb-admin/jquery-file-upload/main" %>
|
179
|
+
|
180
|
+
<script type="text/javascript">
|
181
|
+
jQuery(document).ready(function($) {
|
182
|
+
$('#fileupload').fileupload({
|
183
|
+
url: '<%= product_product_photos_path(@product) %>',
|
184
|
+
authenticity_token: "<%= form_authenticity_token %>",
|
185
|
+
dataType: "json"
|
186
|
+
});
|
187
|
+
|
188
|
+
$.getJSON($('#fileupload').fileupload('option', 'url'), function (files) {
|
189
|
+
var fu = $('#fileupload').data('blueimpFileupload'), template;
|
190
|
+
template = fu._renderDownload(files).appendTo($('#fileupload .files'));
|
191
|
+
fu._reflow = fu._transition && template.length && template[0].offsetWidth;
|
192
|
+
template.addClass('in');
|
193
|
+
|
194
|
+
$('#fileupload').removeClass('fileupload-processing');
|
195
|
+
});
|
196
|
+
});
|
197
|
+
</script>
|