Commit 7bf303db authored by Christoph Thelen's avatar Christoph Thelen

Minify JS files and package inside war archive

parent 1bf9e0f5
...@@ -4,8 +4,12 @@ ...@@ -4,8 +4,12 @@
<property name="sencha.dir" value="${lib.dir}/sencha1.1.1" /> <property name="sencha.dir" value="${lib.dir}/sencha1.1.1" />
<property name="build.dir" value="src/main/build" /> <property name="build.dir" value="src/main/build" />
<target name="-build:init">
<mkdir dir="${build.dir}" />
</target>
<target name="-min:js:minify"> <target name="-min:js:minify">
<apply executable="java" dest="${main.dir}/app"> <apply executable="java" dest="${main.dir}" failonerror="true">
<arg value="-jar"/> <arg value="-jar"/>
<arg value="${lib.dir}/compiler.jar"/> <arg value="${lib.dir}/compiler.jar"/>
<arg value="--js"/> <arg value="--js"/>
...@@ -13,21 +17,40 @@ ...@@ -13,21 +17,40 @@
<arg value="--js_output_file"/> <arg value="--js_output_file"/>
<targetfile/> <targetfile/>
<fileset dir="${main.dir}/app" includes="**/*.js" /> <fileset dir="${main.dir}">
<include name="**/*.js"/>
<!-- do not process Touch Charts - it throws errors! -->
<exclude name="**/*touch-charts-debug.js"/>
<exclude name="**/*touch-charts.js"/>
</fileset>
<mapper type="glob" from="*.js" to="*.js.min"/> <mapper type="glob" from="*.js" to="*.js.min"/>
</apply> </apply>
</target> </target>
<target name="-min:js:move" depends="-min:js:minify"> <target name="-min:js:move" depends="-min:js:minify">
<move todir="${build.dir}" verbose="true"> <move todir="${build.dir}" verbose="true">
<fileset dir="${main.dir}/app"> <fileset dir="${main.dir}">
<include name="**/*.js.min"/> <include name="**/*.js.min"/>
</fileset> </fileset>
<mapper type="glob" from="*.min" to="*"/> <mapper type="glob" from="*.min" to="*"/>
</move> </move>
</target> </target>
<target name="min:js" depends="-min:js:move" /> <target name="-assets:copy" depends="-build:init">
<copy todir="${build.dir}/resources">
<fileset dir="${main.dir}/resources" />
</copy>
<copy todir="${build.dir}">
<fileset dir="${main.dir}">
<include name="st2-index.html" />
<include name="st2-arsnova.manifest" />
<include name="favicon.png" />
<include name="WEB-INF/**" />
</fileset>
</copy>
</target>
<target name="min:js" depends="-build:init,-assets:copy,-min:js:move" />
<target name="min:css"> <target name="min:css">
<java jar="${sencha.dir}/jsbuilder/ycompressor/ycompressor.jar" fork="true" failonerror="true" output="${main.dir}/resources/css/arsnova_min.css"> <java jar="${sencha.dir}/jsbuilder/ycompressor/ycompressor.jar" fork="true" failonerror="true" output="${main.dir}/resources/css/arsnova_min.css">
......
...@@ -54,6 +54,25 @@ ...@@ -54,6 +54,25 @@
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<target>
<!-- ant target="min:css" /-->
<ant target="min:js" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
...@@ -68,16 +87,11 @@ ...@@ -68,16 +87,11 @@
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>2.3</version> <version>2.3</version>
<configuration> <configuration>
<warSourceIncludes> <warSourceDirectory>
st2-index.html, src/main/build
st2-developer.html, </warSourceDirectory>
resources/**,
screenshots/**,
app/**,
lib/**
</warSourceIncludes>
<webXml> <webXml>
src/main/webapp/WEB-INF/web.xml src/main/build/WEB-INF/web.xml
</webXml> </webXml>
</configuration> </configuration>
</plugin> </plugin>
......
...@@ -25,7 +25,7 @@ Ext.define('ARSnova.view.Caption', { ...@@ -25,7 +25,7 @@ Ext.define('ARSnova.view.Caption', {
this.listButton = Ext.create('ARSnova.view.MultiBadgeButton', { this.listButton = Ext.create('ARSnova.view.MultiBadgeButton', {
ui : 'small', ui : 'small',
text : "", text : "",
cls : 'forwardListButton caption', cls : 'forwardListButton caption'
}); });
this.add([].concat(window.innerWidth > 320 ? [{ this.add([].concat(window.innerWidth > 320 ? [{
......
...@@ -39,11 +39,11 @@ Ext.define('ARSnova.view.FreetextAnswerPanel', { ...@@ -39,11 +39,11 @@ Ext.define('ARSnova.view.FreetextAnswerPanel', {
freetextAnswerStore: null freetextAnswerStore: null
}, },
constructor: function(arguments) { constructor: function(args) {
this.callParent(arguments); this.callParent(args);
this.questionObj = arguments.question; this.questionObj = args.question;
this.lastPanel = arguments.lastPanel; this.lastPanel = args.lastPanel;
var self = this; var self = this;
this.checkFreetextAnswersTask = { this.checkFreetextAnswersTask = {
......
...@@ -30,11 +30,11 @@ Ext.define('ARSnova.view.FreetextDetailAnswer', { ...@@ -30,11 +30,11 @@ Ext.define('ARSnova.view.FreetextDetailAnswer', {
} }
}, },
constructor: function(arguments) { constructor: function(args) {
this.callParent(arguments); this.callParent(args);
this.answer = arguments.answer; this.answer = args.answer;
this.sTP = arguments.sTP; this.sTP = args.sTP;
var self = this; var self = this;
......
...@@ -29,12 +29,12 @@ Ext.define('ARSnova.view.FreetextQuestion', { ...@@ -29,12 +29,12 @@ Ext.define('ARSnova.view.FreetextQuestion', {
} }
}, },
constructor: function(arguments) { constructor: function(args) {
this.callParent(arguments); this.callParent(args);
var self = this; var self = this;
this.questionObj = arguments.questionObj; this.questionObj = args.questionObj;
this.viewOnly = typeof arguments.viewOnly === "undefined" ? false : arguments.viewOnly; this.viewOnly = typeof args.viewOnly === "undefined" ? false : args.viewOnly;
this.on('preparestatisticsbutton', function(button) { this.on('preparestatisticsbutton', function(button) {
button.scope = this; button.scope = this;
......
...@@ -33,10 +33,10 @@ Ext.define('ARSnova.view.QuestionStatusButton', { ...@@ -33,10 +33,10 @@ Ext.define('ARSnova.view.QuestionStatusButton', {
questionIsOpenButton: null, questionIsOpenButton: null,
questionIsClosedButton: null, questionIsClosedButton: null,
constructor: function(arguments) { constructor: function(args) {
this.callParent(arguments); this.callParent(args);
this.questionObj = arguments.questionObj; this.questionObj = args.questionObj;
this.questionIsClosedButton = Ext.create('Ext.Button', { this.questionIsClosedButton = Ext.create('Ext.Button', {
cls : 'closedSession', cls : 'closedSession',
......
...@@ -85,5 +85,5 @@ Ext.define('ARSnova.view.TextCheckfield', { ...@@ -85,5 +85,5 @@ Ext.define('ARSnova.view.TextCheckfield', {
} }
this.config.checked = !this.config.checked; this.config.checked = !this.config.checked;
}, }
}); });
...@@ -226,7 +226,7 @@ Ext.define('ARSnova.view.feedback.StatisticPanel', { ...@@ -226,7 +226,7 @@ Ext.define('ARSnova.view.feedback.StatisticPanel', {
color:0x6238A7, color:0x6238A7,
size:8, size:8,
fill: 'blue' fill: 'blue'
}, }
}] }]
}); });
......
...@@ -38,10 +38,10 @@ Ext.define('ARSnova.view.feedbackQuestions.DetailsPanel', { ...@@ -38,10 +38,10 @@ Ext.define('ARSnova.view.feedbackQuestions.DetailsPanel', {
backButton : null, backButton : null,
questionObj : null, questionObj : null,
constructor: function(arguments){ constructor: function(args){
this.callParent(arguments); this.callParent(args);
this.questionObj = arguments.question; this.questionObj = args.question;
this.backButton = Ext.create('Ext.Button', { this.backButton = Ext.create('Ext.Button', {
text : Messages.QUESTIONS, text : Messages.QUESTIONS,
......
...@@ -39,15 +39,13 @@ Ext.define('ARSnova.view.home.NewSessionPanel', { ...@@ -39,15 +39,13 @@ Ext.define('ARSnova.view.home.NewSessionPanel', {
toolbar : null, toolbar : null,
backButton : null, backButton : null,
constructor: function(arguments) { constructor: function(args) {
this.callParent(arguments); this.callParent(args);
this.mycoursesStore = new Ext.data.JsonStore({ this.mycoursesStore = new Ext.data.JsonStore({
model: 'ARSnova.model.Course' model: 'ARSnova.model.Course'
}); });
var mycoursesStore = this.mycoursesStore;
this.mycourses = Ext.create('Ext.List', { this.mycourses = Ext.create('Ext.List', {
store: this.mycoursesStore, store: this.mycoursesStore,
hidden: true, hidden: true,
...@@ -104,7 +102,7 @@ Ext.define('ARSnova.view.home.NewSessionPanel', { ...@@ -104,7 +102,7 @@ Ext.define('ARSnova.view.home.NewSessionPanel', {
this.add([this.toolbar, { this.add([this.toolbar, {
title: 'createSession', title: 'createSession',
style: { style: {
marginTop: '15px', marginTop: '15px'
}, },
xtype: 'formpanel', xtype: 'formpanel',
scrollable: null, scrollable: null,
......
...@@ -165,7 +165,7 @@ Ext.define('ARSnova.view.speaker.InClass', { ...@@ -165,7 +165,7 @@ Ext.define('ARSnova.view.speaker.InClass', {
style : { marginTop: '50px' }, style : { marginTop: '50px' },
layout : { layout : {
type: 'hbox', type: 'hbox',
pack: 'center', pack: 'center'
}, },
items: [ items: [
......
...@@ -75,11 +75,11 @@ Ext.define('ARSnova.view.speaker.QuestionDetailsPanel', { ...@@ -75,11 +75,11 @@ Ext.define('ARSnova.view.speaker.QuestionDetailsPanel', {
interval: 20000 //20 seconds interval: 20000 //20 seconds
}, },
constructor: function(arguments){ constructor: function(args){
this.callParent(arguments); this.callParent(args);
var me = this; var me = this;
this.questionObj = arguments.question; this.questionObj = args.question;
if( this.questionObj.questionType == "yesno" || if( this.questionObj.questionType == "yesno" ||
this.questionObj.questionType == "mc" || this.questionObj.questionType == "mc" ||
......
...@@ -58,11 +58,11 @@ Ext.define('ARSnova.view.speaker.QuestionStatisticChart', { ...@@ -58,11 +58,11 @@ Ext.define('ARSnova.view.speaker.QuestionStatisticChart', {
interval: 15000 interval: 15000
}, },
constructor: function(arguments){ constructor: function(args){
this.callParent(arguments); this.callParent(args);
this.questionObj = arguments.question; this.questionObj = args.question;
this.lastPanel = arguments.lastPanel; this.lastPanel = args.lastPanel;
this.questionStore = Ext.create('Ext.data.Store', { this.questionStore = Ext.create('Ext.data.Store', {
fields: ['text', 'value', 'percent'] fields: ['text', 'value', 'percent']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment