Commit a1bdabd9 authored by Matija Obreza's avatar Matija Obreza

Bower and grunt and other stuff

parent 892eb2bd
......@@ -6,6 +6,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" path="src/main/sourceapp"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
......@@ -22,6 +23,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" path="src/main/webapp"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
......
......@@ -11,3 +11,8 @@ logs
build
Thumbs.db
/repo
/node
/node_modules
/bower_components
.tmp/
.sass-cache
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals": {
"$": false,
"jQuery": false,
"L": false
}
}
'use strict';
module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
require('jit-grunt')(grunt);
grunt.initConfig({
app : {
source : 'src/main/sourceapp',
dist : 'src/main/webapp/html'
},
clean : {
dist : [ '.tmp', '<%= app.dist %>/styles', '<%= app.dist %>/js' ]
},
// Copies remaining files to places other tasks can use
copy : {
dist : {
files : [ {
expand : true,
dot : true,
cwd : '<%= app.source %>',
dest : '<%= app.dist %>',
src : [ '*.css', 'js/{,*/}*.js', '*.{ico,png,txt}', '.htaccess', '*.html', 'images/{,*/}*.{webp}', 'styles/fonts/{,*/}*.*' ]
}, {
expand : true,
cwd : '.tmp/images',
dest : '<%= app.dist %>/images',
src : [ 'generated/*' ]
}, {
expand : true,
cwd : 'bower_components/bootstrap-sass/assets/fonts/bootstrap/',
src : '*',
dest : '<%= app.dist %>/styles/fonts'
}, {
expand : true,
cwd : 'bower_components/jquery-ui/themes/base/',
src : [ 'jquery-ui.css' ],
dest : '<%= app.dist %>/styles'
}, {
// tinyMCE
expand : true,
cwd : 'bower_components/tinymce/skins',
src : [ '**' ],
dest : '<%= app.dist %>/js/skins'
}, {
// leaflet
expand : true,
cwd : 'bower_components/leaflet/dist/',
src : [ 'leaflet.css', 'images/*.png' ],
dest : '<%= app.dist %>/styles'
}, {
// simplecolorpicker
expand : true,
cwd : 'bower_components/jquery-simplecolorpicker/',
src : [ 'jquery.simplecolorpicker.css', 'jquery.simplecolorpicker-regularfont.css' ],
dest : '<%= app.dist %>/styles'
} ]
},
styles : {
expand : true,
cwd : '<%= app.source %>/styles',
dest : '.tmp/styles/',
src : '{,*/}*.css'
}
},
// Compiles Sass to CSS and generates necessary files if requested
compass : {
options : {
sassDir : '<%= app.source %>/styles',
cssDir : '.tmp/styles',
generatedImagesDir : '.tmp/images/generated',
imagesDir : '<%= app.source %>/images',
javascriptsDir : '<%= app.source %>/scripts',
fontsDir : '<%= app.source %>/styles/fonts',
importPath : './bower_components',
httpImagesPath : '/images',
httpGeneratedImagesPath : '/images/generated',
httpFontsPath : '/styles/fonts',
relativeAssets : false,
assetCacheBuster : false,
raw : 'Sass::Script::Number.precision = 10\n'
},
dist : {
options : {
cssDir : '<%= app.dist %>/styles',
generatedImagesDir : '<%= app.dist %>/images/generated'
}
}
// ,
// server : {
// options : {
// sourcemap : true
// }
// }
},
// Make sure code styles are up to par and there are no obvious mistakes
jshint : {
options : {
jshintrc : '.jshintrc',
reporter : require('jshint-stylish')
},
all : {
src : [ 'Gruntfile.js', '<%= app.source %>/js/{,*/}*.js' ]
},
// test: {
// options: {
// jshintrc: 'test/.jshintrc'
// },
// src: ['test/spec/{,*/}*.js']
// }
},
concat : {
options : {
// separator: ';',
},
dist : {
src : [ 'bower_components/jquery/dist/jquery.js', 'bower_components/modernizr/modernizr.js', 'bower_components/jquery-flot/jquery.flot.js', 'bower_components/jquery-flot/jquery.flot.pie.js',
'bower_components/jquery-flot/jquery.flot.fillbetween.js',
// simplecolorpicker
'bower_components/jquery-simplecolorpicker/jquery.simplecolorpicker.js',
// TinyMCE
'bower_components/tinymce/tinymce.js', 'bower_components/tinymce/tinymce.jquery.js',
// TinyMCE plugins: link, autolink, code
'bower_components/tinymce/themes/modern/theme.js', 'bower_components/tinymce/plugins/link/plugin.js', 'bower_components/tinymce/plugins/autolink/plugin.js',
'bower_components/tinymce/plugins/code/plugin.js',
// Leaflet
'bower_components/leaflet/dist/leaflet.js', 'bower_components/leaflet-locationfilter/src/locationfilter.js', 'bower_components/bootstrap-sass/assets/javascripts/bootstrap.js',
'bower_components/jquery-ui/jquery-ui.js', 'bower_components/jquery-ui/ui/autocomplete.js' ],
dest : '<%= app.dist %>/js/libraries.js',
},
app : {
src : [ '<%= app.source %>/js/main.js', '<%= app.source %>/js/crophub.js', '<%= app.source %>/js/custom.js' ],
dest : '<%= app.dist %>/js/genesys.js'
}
},
autoprefixer : {
options : {
browsers : [ 'last 3 versions' ]
},
dist : {
files : [ {
expand : true,
cwd : '<%= app.dist %>/styles',
src : '**/*.css',
dest : '<%= app.dist %>/styles'
} ]
}
},
cssmin : {
options : {
keepSpecialComments : 0
},
dist : {
files : {
'<%= app.dist %>/styles/bootstrap.min.css' : [ '<%= app.dist %>/styles/bootstrap.css' ],
'<%= app.dist %>/styles/other.min.css' : [ '<%= app.dist %>/styles/jquery-ui.css', '<%= app.dist %>/styles/forza.css', '<%= app.dist %>/styles/leaflet.css',
'<%= app.dist %>/styles/jquery.simplecolorpicker.css', '<%= app.dist %>/styles/jquery.simplecolorpicker-regularfont.css' ],
'<%= app.dist %>/styles/genesys.min.css' : [ '<%= app.dist %>/styles/genesys.css' ],
'<%= app.dist %>/styles/all.min.css' : [ '<%= app.dist %>/styles/bootstrap.css', '<%= app.dist %>/styles/jquery-ui.css', '<%= app.dist %>/styles/forza.css',
'<%= app.dist %>/styles/leaflet.css', '<%= app.dist %>/styles/genesys.css' ],
}
}
},
// JS min
uglify : {
dist : {
options : {
compress : false,
preserveComments : false,
report : 'min'
},
files : {
'<%= app.dist %>/js/libraries.min.js' : [ '<%= app.dist %>/js/libraries.js' ],
'<%= app.dist %>/js/genesys.min.js' : [ '<%= app.dist %>/js/genesys.js' ],
'<%= app.dist %>/js/all.min.js' : [ '<%= app.dist %>/js/libraries.js', '<%= app.dist %>/js/genesys.js' ]
}
}
}
});
// grunt.registerTask('serve', [ 'clean', 'copy:css', 'compass:server',
// 'autoprefixer', 'uglify:server' ]);
grunt.registerTask('build', [ 'clean', 'jshint:all', 'compass:dist', 'copy:dist', 'concat', 'autoprefixer', 'uglify:dist', 'cssmin' ]);
grunt.registerTask('js', [ 'jshint:all', 'copy:dist', 'concat', 'autoprefixer', 'uglify:dist' ]);
grunt.registerTask('css', [ 'compass:dist', 'copy:dist', 'concat', 'autoprefixer', 'cssmin' ]);
grunt.registerTask('default', [ 'build' ]);
};
{
"name": "genesys2-server",
"version": "0.0.1",
"appPath": "src/main/sourceapp",
"dependencies": {
"jquery": "~2.1.3",
"modernizr": "~2.8.3",
"leaflet": "~0.7.3",
"leaflet-locationfilter": "*",
"jquery-simplecolorpicker": "~0.3.0",
"jquery-flot": "~0.8.3",
"tinymce": "~4.1.9",
"jquery.tinymce": "*",
"bootstrap-sass": "~3.3.4",
"jquery-ui": "~1.11.4"
}
}
{
"name": "genesys2-server",
"version": "0.0.1",
"description": "Web stuffies for genesys2-server",
"repository": {},
"engines": {
"node": ">=0.10.0"
},
"devDependencies": {
"bower": "~1.3.12",
"grunt": "~0.4.5",
"grunt-autoprefixer": "~2.2.0",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-compass": "^1.0.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "~0.7.0",
"grunt-contrib-cssmin": "^0.12.2",
"grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-uglify": "~0.7.0",
"jit-grunt": "~0.9.0",
"jshint-stylish": "^1.0.0",
"load-grunt-tasks": "~3.1.0",
"time-grunt": "~1.0.0"
}
}
......@@ -27,7 +27,7 @@
<version>0.9.1</version>
<url>https://www.genesys-pgr.org</url>
<description>Genesys 2 Server</description>
<licenses>
<license>
<name>The Apache License, Version 2.0</name>
......@@ -43,13 +43,13 @@
<organization>
<name>Global Crop Diversity Trust</name>
<url>https://www.croptrust.org</url>
<url>https://www.croptrust.org</url>
</organization>
<issueManagement>
<url>https://bitbucket.org/genesys2/genesys2-server/issues</url>
</issueManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.target>1.7</jdk.target>
......@@ -108,11 +108,11 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
......@@ -405,7 +405,7 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
......@@ -448,37 +448,37 @@
<artifactId>urlrewritefilter</artifactId>
<version>4.0.4</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.prettytime</groupId>
<artifactId>prettytime</artifactId>
<version>3.2.5.Final</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>org.genesys-pgr</groupId>
<artifactId>transifex-client</artifactId>
<version>0.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.genesys-pgr</groupId>
<artifactId>worldclim-reader</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.genesys-pgr</groupId>
<artifactId>pgr-ontology-model</artifactId>
<version>0.7.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.prettytime</groupId>
<artifactId>prettytime</artifactId>
<version>3.2.5.Final</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>org.genesys-pgr</groupId>
<artifactId>transifex-client</artifactId>
<version>0.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.genesys-pgr</groupId>
<artifactId>worldclim-reader</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.genesys-pgr</groupId>
<artifactId>pgr-ontology-model</artifactId>
<version>0.7.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
......@@ -539,94 +539,54 @@
<version>${jetty.version}</version>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.4.0</version>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.23</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v0.10.36</nodeVersion>
<npmVersion>2.4.1</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>grunt build</id>
<goals>
<goal>compress</goal>
<goal>grunt</goal>
</goals>
<configuration>
<arguments>build</arguments>
<srcdir>${basedir}/src/main/sourceapp</srcdir>
<outputdir>${basedir}/src/main/webapp/html</outputdir>
<triggerfiles>
<triggerfile>Gruntfile.js</triggerfile>
<triggerfile>package.json</triggerfile>
</triggerfiles>
</configuration>
</execution>
</executions>
<configuration>
<jswarn>false</jswarn>
<force>true</force>
<gzip>true</gzip>
<suffix>.min</suffix>
<excludes>
<exclude>**/*.min.js</exclude>
<exclude>**/*.min.css</exclude>
</excludes>
<aggregations>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/html/js/genesys.js</output>
<includes>
<include>${basedir}/src/main/webapp/html/js/tab.js</include>
<include>${basedir}/src/main/webapp/html/js/crophub.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/html/js/genesys.min.js</output>
<includes>
<include>tab.min.js</include>
<include>crophub.min.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/html/js/all.min.js</output>
<includes>
<include>jquery.min.js</include>
<include>jquery-ui.min.js</include>
<include>bootstrap.min.js</include>
<include>tab.min.js</include>
<include>leaflet.min.js</include>
<include>leaflet.locationfilter.min.js</include>
<include>crophub.min.js</include>
<include>syronex-colorpicker.min.js</include>
<include>jquery.flot.min.js</include>
<include>jquery.flot.pie.min.js</include>
<include>jquery.flot.fillbetween.min.js</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/html/css/genesys.css</output>
<includes>
<include>${basedir}/src/main/webapp/html/css/custom.css</include>
<include>${basedir}/src/main/webapp/html/css/responsive.css</include>
<include>${basedir}/src/main/webapp/html/css/forza.css</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/html/css/genesys.min.css</output>
<includes>
<include>custom.min.css</include>
<include>responsive.min.css</include>
<include>forza.min.css</include>
</includes>
</aggregation>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/html/css/all.min.css</output>
<includes>
<include>bootstrap.min.css</include>
<include>jquery-ui.min.css</include>
<include>leaflet.min.css</include>
<include>leaflet.locationfilter.min.css</include>
<include>syronex-colorpicker.min.css</include>
<include>custom.min.css</include>
<include>responsive.min.css</include>
<include>forza.min.css</include>
</includes>
</aggregation>
</aggregations>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
......@@ -663,7 +623,8 @@
</resources>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
......
This diff is collapsed.
'use strict';
if (typeof Object.create !== 'function') {
Object.create = function(object) {
var F = function() {
};
F.prototype = object;
return new F();
};
}
(function($, window, document, undefined) {
var TagComponent = {
init : function(options) {
this.options = $.extend({}, $.fn.activateTag.options, options);