Skip to content

Commit

Permalink
set up watcher and example
Browse files Browse the repository at this point in the history
  • Loading branch information
albanx committed Mar 18, 2017
1 parent eac2f39 commit b2e20d0
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 63 deletions.
32 changes: 19 additions & 13 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,11 @@ module.exports = function (grunt) {
},

template: {
commercial: {
semver: {
options: {
data: {
builddate: new Date(),
version: grunt.config.get('version'),
MD5_ON: 'true',
IMAGE_SCALE_ON: 'true',
EXIF_ON: 'true',
ENV: 'PROD'
}
},
Expand Down Expand Up @@ -170,13 +167,6 @@ module.exports = function (grunt) {

//copy all CSS files, all themes
{expand: true, src: ['css/*.css'], dest: 'build/prod/css/', filter: 'isFile', flatten: true},
//Copy to web site repo
{
expand: false,
src: ['build/temp/realuploader-min.js'],
dest: 'web/js/jquery-ui.js',
filter: 'isFile'
},

//copy minifield and not compressed files
{expand: true, src: ['build/temp/*.js'], dest: 'build/prod/js/', filter: 'isFile', flatten: true},
Expand Down Expand Up @@ -230,7 +220,23 @@ module.exports = function (grunt) {
dest: 'web/download/'
}
},
shell: {}
shell: {},
watch: {
scripts: {
files: ['js/**/*.js'],
tasks: ['compass:dev'],
options: {
spawn: false
}
},
styles: {
files: ['sass/**/*.scss'],
tasks: ['compass:dev'],
options: {
spawn: false
}
}
}
});

grunt.registerTask('default', ['prompt:buildprompt']);
Expand All @@ -241,7 +247,7 @@ module.exports = function (grunt) {

grunt.registerTask('doBuild', 'Main task runner', function () {
var tasks = [];
tasks.push('template:commercial');//set constants vars
tasks.push('template:semver');//set version
tasks.push('requirejs:dev');//compile js
tasks.push('requirejs:min');//compile js min
tasks.push('compass:dev');//compile sass to css (not needed in this case)
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<!--<link rel="stylesheet" type="text/css" href="css/minimal.css" />-->

<script data-main="js/main" src="libs/require.js"></script>
<!--<script src="build/prod/js/realuploader.js"></script>-->

<style>
#uploader_div {
Expand Down
2 changes: 0 additions & 2 deletions js/Constants.tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ define(/** @lends Constants */ function(){
preview: 'preview_done'
},
ENV: '<%=ENV%>', //dev/production: useful if need to enable log on windows console
MD5_ON: <%=MD5_ON%>,
EXIF_ON: <%=EXIF_ON%>,
VERSION: '<%=version%>'
}

Expand Down
4 changes: 3 additions & 1 deletion js/RealUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ define(['FileObject', 'Constants', 'Utils', 'i18n'], /** @lends RealUploader */
* @constructor
*/
var RealUploader = function (querySelector, config) {

this.fileList = {};
this.fileIndex = 0;
this.uploadQueue = [];
Expand Down Expand Up @@ -764,6 +763,7 @@ define(['FileObject', 'Constants', 'Utils', 'i18n'], /** @lends RealUploader */
}

if (!maxFileNumber) {
console.warn('Error :Maximum files number reached', maxFileNumber);
errors.push({
message: _('Maximum files number reached'),
error: 'MAX_FILES',
Expand All @@ -772,6 +772,7 @@ define(['FileObject', 'Constants', 'Utils', 'i18n'], /** @lends RealUploader */
}

if (!isAllowedExt) {
console.warn('Error :Extension not allowed', ext);
errors.push({
message: _('Extension not allowed'),
error: 'ALLOW_EXTENSION',
Expand All @@ -780,6 +781,7 @@ define(['FileObject', 'Constants', 'Utils', 'i18n'], /** @lends RealUploader */
}

if (!isSizeAllowed) {
console.warn('Error :File size now allowed', size);
errors.push({message: _('File size now allowed'), error: 'FILE_SIZE', param: size});
}
if (hasUserError) {
Expand Down
47 changes: 5 additions & 42 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,21 @@ define(['RealUploader'], function(RealUploader) {
allowDelete:true,
//remotePath: '/Users/axhaferllari/uploads/',
//remotePath: '/home/work2fly/lamp/wingbeat/public_html/upload-test/test-path/',
accept: "image/*",
// accept: "image/*",
editFilename: true,
data: {
var1 : 1,
var2 : 'string'
},
listeners: {
beforeUploadFile: function(file, name) {
file.old_name = file.name;

},
finishFile: function(file){
//access the dom object of the file html
//file.dom.previewImage
//file.dom.previewContainer
//file.dom.progressBar
//file.dom.progressInfo
//file.dom.progressStat
file.dom.progressInfo.innerHTML = '100%';
this.dom.nameContainer.innerHTML = file.old_name;

},
finish: function () {
alert('all files uploaded');
},
beforeRenderFile: function(file, template) {
var title = "Title: <input type=text name=file_title ><br>";
Expand All @@ -63,37 +58,5 @@ define(['RealUploader'], function(RealUploader) {
allowOverResize: false
}
});
//var uploader = new RealUploader('#uploader_div', {
// url:'upload.jsp',
// remotePath:'example6/',
// allowDelete: true,
// language: 'en_EN',
// md5Calculate: true,
// exifRead:true,
// maxFileSize: '4G',
// allowedExtensions: ['jpg', 'avi', 'zip', 'png'],
// listeners: {
// init: function() {
//
// },
// dragEnter: function(e, element) {
//
// },
// dragLeave: function(e, element) {
//
// }
// }
mainTemplate: ['<div class="ax-main-container" style="border: 2px solid orangered; width: 25em; height: 15em; border-radius: 34px;">',
'<h5 class="ax-main-title">Drag &amp; Drop file here</h5>',
'<div class="ax-file-list"></div>',
'</div>'].join("");
// //resizeImage: {
// // maxWidth: 200,
// // maxHeight: 600,
// // keepExif: false,
// // keepAspectRatio: false
// //}
//});

return RealUploader;
});
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "RealAjaxUploader",
"name": "RealUploader",
"version": "2.0.0",
"private": true,
"main": "app.js",
"devDependencies": {
"grunt": "~1.0.1",
"grunt": "^1.0.1",
"grunt-contrib-compass": "1.1.1",
"grunt-contrib-compress": "1.3.0",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-jasmine": "~1.0.3",
"grunt-contrib-jshint": "~1.1.0",
"grunt-contrib-rename": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-watch": "^1.0.0",
"grunt-ftp-deploy": "0.1.10",
"grunt-git": "*",
"grunt-jsdoc": "2.1.0",
Expand Down
4 changes: 2 additions & 2 deletions start.frag
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Real Uploader
* http://www.realuploader.com/ajaxuploader
* Build date Thu May 26 2016 20:14:18 GMT+0100 (IST)
* Copyright 2010-2015, Xscripts, http://www.albanx.com
* Build date Sat Mar 18 2017 19:20:18 GMT+0100 (W. Europe Standard Time)
* Copyright Xscripts, http://www.albanx.com
*/
(function (root, factory) {
var myLibrary = factory();
Expand Down
2 changes: 1 addition & 1 deletion start.tpl.frag
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Real Uploader <%=version%>
* http://www.realuploader.com/ajaxuploader
* Build date <%=builddate%>
* Copyright 2010-2015, Xscripts, http://www.albanx.com
* Copyright Xscripts, http://www.albanx.com
*/
(function (root, factory) {
var myLibrary = factory();
Expand Down

0 comments on commit b2e20d0

Please sign in to comment.