Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fa46613
Showing
42 changed files
with
9,006 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2010-2015 Gelin Luo | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
h1. GreenScript module | ||
|
||
The GreenScript module help you to manage javascript and CSS dependencies and do minimizing work in the same time. | ||
|
||
h2. <a>Enable the GreenScript module for the application</a> | ||
|
||
In the **/conf/application.conf** file, enable the GreenScript module by adding this line: | ||
|
||
bc. # The greenscript module | ||
module.greenscript=${play.path}/modules/greenscript | ||
|
||
h2. <a>Using the GreenScript module</a> | ||
|
||
h3. <a>Setup tags</a> | ||
|
||
In order to use GreenScript you need to copy tags folder from src/views folder to your views folder. This is a temporary solution. In the final version this step should be unnecessary | ||
|
||
h3. <a>Configure GreenScript<a> | ||
|
||
Copy greenscript.conf from the samples/greenscript/conf to your conf folder. Edit the file to | ||
# setup javascript dependencies and css file dependencies. Basically you set dependecies in this way <code>js.file1=file2,file3</code>, meaning javascript file1.js require file2.js and file3.js be loaded first. For css dependencies, you use <code>css.file1=file2 to require file2.css be loaded prior to file1.css. Check sample application greenscript.conf for detail | ||
# other configurations | ||
## <code>gs.dir.js=javascripts</code>, configure your javascript dir in the public folder | ||
## <code>gs.dir.css=stylesheets</code>, configure your css dir in the public folder | ||
## <code>gs.minimize.enabled</code>, enable/disable minizing process. Note even minizing is disabled, the dependency management is still there. | ||
## <code>gs.nocache=false<code>, enable/disable cache on minizing. Disable cache enable you to refresh css or javascript updates without restart the server | ||
## <code>gs.compress=true<code>, enable/disable compressing on minizing. Disable compress help you debug your javascript using e.g. firebugs | ||
|
||
h3. <a>Using greenscript tags in your template</a>: | ||
|
||
h4. <a>Using css tag</a> | ||
|
||
Use the following syntax to load your css file: | ||
|
||
bc. #{greenscript.css sm:gsSM, load:['layout', 'color'], output:true/} | ||
|
||
note sm:gsSM must to included. load parameter is an array of css file names. You don't need to load dependent files. In the above example, if layout.css depend on reset.css, the latter will load automatically. | ||
|
||
output: true is optional. if that is omitted, the css file presented in the load list will be load into the memory but not flush to the output stream where the #{greenscript.css ...} statement is presented. Otherwise a link ref html statement will be output for the relevant css files. | ||
|
||
tips: | ||
|
||
# Usually you should use output:true when you declare css files in the main.html file. | ||
|
||
h4. <a>Using javascript tag</a> | ||
|
||
The following syntax can help you load javascript file: | ||
|
||
bc. #{greenscript.javascript sm:gsSM, load:['pMask'] /} | ||
|
||
The above statement in your template load pMask.js file and all it's dependents, say, prototype-event-extensions.js and prototype.js which is a dependent of prototype-event-extensions.js. However, only pMask.js will be output in here, the latter two will be output with the following statement: | ||
|
||
bc. #{greenscript.javascript sm:gsSM, loadMissing:true /} | ||
|
||
The above statement in your templates load all javascript files that are not outputs, usually those dependent javascripts that are declared but not outputed. | ||
|
||
tips: | ||
|
||
# Usually you should use loadMissing:true in the main.html file. See samples/greenscript application for detail. | ||
|
||
h2. License | ||
|
||
GreenScript is licensed under the terms of the MIT License, | ||
see the included MIT-LICENSE file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# change the play.path to where your play framework is installed | ||
play.path=../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project name="greenscript module" default="build" basedir="."> | ||
|
||
<property file="./build.properties" /> | ||
|
||
<path id="project.classpath"> | ||
<pathelement path="${play.path}/framework/classes"/> | ||
<fileset dir="${play.path}/framework/lib"> | ||
<include name="*.jar"/> | ||
</fileset> | ||
<fileset dir="lib"> | ||
<include name="*.jar"/> | ||
</fileset> | ||
</path> | ||
|
||
<target name="build" depends="compile"> | ||
|
||
<copy todir="tmp/classes"> | ||
<fileset dir="src"> | ||
<include name="**/*.properties"/> | ||
<include name="**/*.xml"/> | ||
<include name="**/*.html"/> | ||
<include name="**/play.plugins"/> | ||
<include name="**/play.static"/> | ||
</fileset> | ||
</copy> | ||
<jar destfile="lib/play-greenscript.jar" basedir="tmp/classes"> | ||
<manifest> | ||
<section name="Play"> | ||
<attribute name="Specification-Title" value="greenscript module"/> | ||
</section> | ||
</manifest> | ||
</jar> | ||
<delete dir="tmp" /> | ||
</target> | ||
|
||
<target name="compile"> | ||
<mkdir dir="tmp/classes" /> | ||
<javac srcdir="src" destdir="tmp/classes" target="1.5" debug="true"> | ||
<classpath refid="project.classpath" /> | ||
</javac> | ||
</target> | ||
|
||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
h1. GreenScript module | ||
|
||
The GreenScript module help you to manage javascript and CSS dependencies and do minimizing work in the same time. | ||
|
||
h2. <a>Enable the GreenScript module for the application</a> | ||
|
||
In the **/conf/application.conf** file, enable the GreenScript module by adding this line: | ||
|
||
bc. # The greenscript module | ||
module.greenscript=${play.path}/modules/greenscript | ||
|
||
h2. <a>Using the GreenScript module</a> | ||
|
||
h3. <a>Setup tags</a> | ||
|
||
In order to use GreenScript you need to copy tags folder from src/views folder to your views folder. This is a temporary solution. In the final version this step should be unnecessary | ||
|
||
h3. <a>Configure GreenScript<a> | ||
|
||
Copy greenscript.conf from the samples/greenscript/conf to your conf folder. Edit the file to | ||
# setup javascript dependencies and css file dependencies. Basically you set dependecies in this way <code>js.file1=file2,file3</code>, meaning javascript file1.js require file2.js and file3.js be loaded first. For css dependencies, you use <code>css.file1=file2 to require file2.css be loaded prior to file1.css. Check sample application greenscript.conf for detail | ||
# other configurations | ||
## <code>gs.dir.js=javascripts</code>, configure your javascript dir in the public folder | ||
## <code>gs.dir.css=stylesheets</code>, configure your css dir in the public folder | ||
## <code>gs.minimize.enabled</code>, enable/disable minizing process. Note even minizing is disabled, the dependency management is still there. | ||
## <code>gs.nocache=false<code>, enable/disable cache on minizing. Disable cache enable you to refresh css or javascript updates without restart the server | ||
## <code>gs.compress=true<code>, enable/disable compressing on minizing. Disable compress help you debug your javascript using e.g. firebugs | ||
|
||
h3. <a>Using greenscript tags in your template</a>: | ||
|
||
h4. <a>Using css tag</a> | ||
|
||
Use the following syntax to load your css file: | ||
|
||
bc. #{greenscript.css sm:gsSM, load:['layout', 'color'], output:true/} | ||
|
||
note sm:gsSM must to included. load parameter is an array of css file names. You don't need to load dependent files. In the above example, if layout.css depend on reset.css, the latter will load automatically. | ||
|
||
output: true is optional. if that is omitted, the css file presented in the load list will be load into the memory but not flush to the output stream where the #{greenscript.css ...} statement is presented. Otherwise a link ref html statement will be output for the relevant css files. | ||
|
||
tips: | ||
|
||
# Usually you should use output:true when you declare css files in the main.html file. | ||
|
||
h4. <a>Using javascript tag</a> | ||
|
||
The following syntax can help you load javascript file: | ||
|
||
bc. #{greenscript.javascript sm:gsSM, load:['pMask'] /} | ||
|
||
The above statement in your template load pMask.js file and all it's dependents, say, prototype-event-extensions.js and prototype.js which is a dependent of prototype-event-extensions.js. However, only pMask.js will be output in here, the latter two will be output with the following statement: | ||
|
||
bc. #{greenscript.javascript sm:gsSM, loadMissing:true /} | ||
|
||
The above statement in your templates load all javascript files that are not outputs, usually those dependent javascripts that are declared but not outputed. | ||
|
||
tips: | ||
|
||
# Usually you should use loadMissing:true in the main.html file. See samples/greenscript application for detail. |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package controllers; | ||
|
||
import play.mvc.*; | ||
|
||
public class Application extends Controller { | ||
|
||
public static void index() { | ||
render(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#{extends 'templates/form_layout.html' /} | ||
|
||
#{set 'formTitle'} | ||
Add Customer | ||
#{/set} | ||
|
||
<form> | ||
<div class="fields"> | ||
<div> | ||
<label>First Name</label> | ||
<input type="text" id="first_name" name="firstName"/> | ||
<span class="help">required</span> | ||
</div> | ||
<div> | ||
<label>Last Name</label> | ||
<input type="text" id="last_name" name="lastName"/> | ||
<span class="help">required</span> | ||
</div> | ||
<div> | ||
<label>Birthday</label> | ||
<input class="date" type="text" name="birthday"/> | ||
</div> | ||
<div> | ||
<label>Street</label> | ||
<input type="text" name="street"/> | ||
</div> | ||
<div> | ||
<label>State</label> | ||
<input type="text" name="state"/> | ||
</div> | ||
<div> | ||
<label>Country</label> | ||
<input type="text" name="country"/> | ||
</div> | ||
<div> | ||
<label>Email</label> | ||
<input id="email" type="text" name="email"/> | ||
</div> | ||
<div> | ||
<label>Phone</label> | ||
<input type="text" name="phone" class="p-mask" data-pMask="{type:'fixed', mask:'[99.999.999-x]',stripMask:false, stripMaskOnSubmit:false}"/> | ||
</div> | ||
</div> | ||
<ul class="actions"> | ||
<li><input type="submit" value="Save"/></li> | ||
<li><input type="button" value="Reset"/></li> | ||
</ul> | ||
</form> | ||
|
||
#{greenscript.css sm:gsSM, load: ['datepicker'] /} | ||
#{greenscript.javascript sm:gsSM, load:['datepicker'] /} | ||
<script type="text/javascript"> | ||
var rule = ruleById('first_name'); | ||
rule.add(Validate.Presence) | ||
rule = ruleById('last_name'); | ||
rule.add(Validate.Presence) | ||
rule = ruleById('email'); | ||
rule.add(Validate.Email) | ||
rule.add(Validate.Presence) | ||
$$('input.date').each(function(el){ | ||
new Control.DatePicker(el, {icon: '/public/images/calendar.png', locale: 'en_iso8601'}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<title>Not found</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
</head> | ||
<body> | ||
#{if play.mode.name() == 'DEV'} | ||
#{404 result /} | ||
#{/if} | ||
#{else} | ||
<h1>Not found</h1> | ||
<p> | ||
${result.message} | ||
</p> | ||
#{/else} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<title>Application error</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
</head> | ||
<body> | ||
#{if play.mode.name() == 'DEV'} | ||
#{500 exception /} | ||
#{/if} | ||
#{else} | ||
<h1>Oops, an error occured</h1> | ||
<p> | ||
This exception has been logged with id <strong>${exception.id}</strong>. | ||
</p> | ||
#{/else} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
%{ | ||
docTitle = get('title') ?: 'GreenScript Demo Application' | ||
}% | ||
<html> | ||
<head> | ||
<title>${docTitle}</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
#{greenscript.css sm:gsSM, load:['layout', 'color'], output:true/} | ||
<link rel="shortcut icon" type="image/png" href="/public/images/favicon.png"> | ||
#{greenscript.javascript sm:gsSM, loadMissing:true /} | ||
</head> | ||
<body> | ||
<div id="header"> | ||
<h1>${docTitle}</h1> | ||
</div> | ||
|
||
#{if flash.success} | ||
<div class="success"> | ||
${flash.success} | ||
</div> | ||
#{/if} | ||
#{if flash.error || error} | ||
<div class="error"> | ||
${error ?: flash.error} | ||
</div> | ||
#{/if} | ||
|
||
<div id="content"> | ||
#{doLayout /} | ||
</div> | ||
|
||
<div id="footer"> | ||
greenlaw110@gmail.com | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#{list items:_load, as:'name'} | ||
%{_sm.addCss(name, _media)}% | ||
#{/list} | ||
|
||
#{if (_output)} | ||
#{if (_sm.minimize())} | ||
%{def fn = play.modules.greenscript.utils.Minimizor.minimizeCss(_sm.getCssList(_media));}% | ||
<link rel="stylesheet" type="text/css" media="${_media?:'screen'}" href="/public/gs/${fn}"> | ||
#{/if} | ||
#{else} | ||
#{list items:_sm.getCssList(_media), as:'name'} | ||
<link rel="stylesheet" type="text/css" media="${_media?:'screen'}" href="/public/${_sm.cssDir()}/${name}.css"> | ||
#{/list} | ||
#{/else} | ||
|
||
#{/if} |
Oops, something went wrong.