Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 28dd09713226a93cb3a0f33acd48acd3d3cf8065 David Marquis committed Dec 14, 2010
179 LICENSE
@@ -0,0 +1,179 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+Copyright (c) 2009 Alexis Sellier
52 LesscssGrailsPlugin.groovy
@@ -0,0 +1,52 @@
+class LesscssGrailsPlugin {
+ // the plugin version
+ def version = "0.9"
+ // the version or versions of Grails the plugin is designed for
+ def grailsVersion = "1.3.2 > *"
+ // the other plugins this plugin depends on
+ def dependsOn = [:]
+ // resources that are excluded from plugin packaging
+ def pluginExcludes = [
+ "grails-app/views/error.gsp"
+ ]
+ def loadAfter = ['ui-performance']
+
+ def author = "David Marquis"
+ def authorEmail = "davidmarquis@me.com"
+ def title = "Less CSS"
+ def description = '''\\
+Integration of the Less CSS framework into Grails. Less (lesscss.org) is what CSS should have always
+been. The plug-in allows for automatic compilation of .less files into .css files, as well as
+tools for easier development (such as auto-reload of CSS after changes in development environment).
+'''
+
+ // URL to the plugin's documentation
+ def documentation = "http://grails.org/plugin/grails-lesscss"
+
+ def doWithWebDescriptor = { xml ->
+ // TODO Implement additions to web.xml (optional), this event occurs before
+ }
+
+ def doWithSpring = {
+ // TODO Implement runtime spring config (optional)
+ }
+
+ def doWithDynamicMethods = { ctx ->
+ // TODO Implement registering dynamic methods to classes (optional)
+ }
+
+ def doWithApplicationContext = { applicationContext ->
+ // TODO Implement post initialization spring config (optional)
+ }
+
+ def onChange = { event ->
+ // TODO Implement code that is executed when any artefact that this plugin is
+ // watching is modified and reloaded. The event contains: event.source,
+ // event.application, event.manager, event.ctx, and event.plugin.
+ }
+
+ def onConfigChange = { event ->
+ // TODO Implement code that is executed when the project configuration changes.
+ // The event is the same as for 'onChange'.
+ }
+}
1 README
@@ -0,0 +1 @@
+This file was created by IntelliJ IDEA 10.0 for binding GitHub repository
4 application.properties
@@ -0,0 +1,4 @@
+#Grails Metadata file
+#Sat Dec 11 13:33:46 EST 2010
+app.grails.version=1.3.5
+app.name=lesscss
29 grails-app/conf/BuildConfig.groovy
@@ -0,0 +1,29 @@
+grails.project.class.dir = "target/classes"
+grails.project.test.class.dir = "target/test-classes"
+grails.project.test.reports.dir = "target/test-reports"
+//grails.project.war.file = "target/${appName}-${appVersion}.war"
+grails.project.dependency.resolution = {
+ // inherit Grails' default dependencies
+ inherits( "global" ) {
+ // uncomment to disable ehcache
+ // excludes 'ehcache'
+ }
+ log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
+ repositories {
+ grailsPlugins()
+ grailsHome()
+
+ // uncomment the below to enable remote dependency resolution
+ // from public Maven repositories
+ //mavenLocal()
+ //mavenCentral()
+ //mavenRepo "http://snapshots.repository.codehaus.org"
+ //mavenRepo "http://repository.codehaus.org"
+ //mavenRepo "http://download.java.net/maven/2/"
+ //mavenRepo "http://repository.jboss.com/maven2/"
+ }
+ dependencies {
+ // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
+ }
+
+}
32 grails-app/conf/DataSource.groovy
@@ -0,0 +1,32 @@
+dataSource {
+ pooled = true
+ driverClassName = "org.hsqldb.jdbcDriver"
+ username = "sa"
+ password = ""
+}
+hibernate {
+ cache.use_second_level_cache=true
+ cache.use_query_cache=true
+ cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider'
+}
+// environment specific settings
+environments {
+ development {
+ dataSource {
+ dbCreate = "create-drop" // one of 'create', 'create-drop','update'
+ url = "jdbc:hsqldb:mem:devDB"
+ }
+ }
+ test {
+ dataSource {
+ dbCreate = "update"
+ url = "jdbc:hsqldb:mem:testDb"
+ }
+ }
+ production {
+ dataSource {
+ dbCreate = "update"
+ url = "jdbc:hsqldb:file:prodDb;shutdown=true"
+ }
+ }
+}
11 grails-app/conf/UrlMappings.groovy
@@ -0,0 +1,11 @@
+class UrlMappings {
+ static mappings = {
+ "/$controller/$action?/$id?"{
+ constraints {
+ // apply constraints here
+ }
+ }
+ "/"(view:"/index")
+ "500"(view:'/error')
+ }
+}
95 grails-app/taglib/grails/lesscss/LessTagLib.groovy
@@ -0,0 +1,95 @@
+package grails.lesscss
+
+import grails.util.Environment
+import groovy.xml.MarkupBuilder
+import com.github.grails.lesscss.Constants
+import org.codehaus.groovy.grails.plugins.GrailsPluginManager
+
+class LessTagLib {
+
+ static namespace = "ui"
+
+ GrailsPluginManager pluginManager
+
+ /**
+ * If in development environment, this tag will generate links to
+ */
+ def less = { attrs, body ->
+
+
+ String name = attrs.remove('name')
+ if (!name) {
+ throwTagError("Tag [less] is missing required attribute [name]")
+ }
+
+ String rel, fileType, link, html
+ String dir = attrs.remove('dir') ?: 'css';
+ if (isUsingAutoReload()) {
+ // reference .less files directly (less.js will automatically compile css)
+ rel = 'stylesheet/less'
+ fileType = '.less'
+ } else {
+ rel = 'stylesheet'
+ fileType = '.css'
+ }
+
+ link = generateRelativePath(dir, name, fileType, attrs.remove('plugin'), attrs.remove('absolute'))
+
+
+ def mkp = new MarkupBuilder(out)
+ def params = [rel: rel, type: 'text/css', href: link]
+ params.putAll attrs
+ mkp.link(params)
+ }
+
+ def lessScripts = { attrs, body ->
+
+ if (isUsingAutoReload()) {
+ String src = generateRelativePath('js', Constants.LESS_SCRIPT_NAME, '.js', "lesscss", false)
+
+ out << "<script type=\"text/javascript\" src=\"${src}\"></script>"
+ }
+
+ if (isWatching()) {
+ out << '''
+ <script type="text/javascript">
+ less.env = "development";
+ less.watch();
+ </script>
+ '''
+ }
+ }
+
+ protected boolean isUsingAutoReload() {
+ return Environment.isDevelopmentMode()
+ }
+
+ protected boolean isWatching() {
+ return Environment.isDevelopmentMode()
+ }
+
+ protected String generateExtraAttributes(attrs) {
+
+ def extra = ""
+
+ attrs.each { key, value ->
+ extra << " $key=\"$value\""
+ }
+
+ return extra
+ }
+
+ protected String generateRelativePath(dir, name, extension, plugin, absolute) {
+ if ('true' == absolute) {
+ return name
+ }
+
+ StringBuilder path = new StringBuilder()
+ path << g.resource(plugin:plugin, dir: dir, file: name)
+ if (extension) {
+ path << extension
+ }
+
+ return path.toString().replaceAll('//', '/')
+ }
+}
19 plugin.xml
@@ -0,0 +1,19 @@
+<plugin name='lesscss' version='0.9' grailsVersion='1.3.2 &gt; *'>
+ <author>David Marquis</author>
+ <authorEmail>davidmarquis@me.com</authorEmail>
+ <title>Less CSS</title>
+ <description>\
+Integration of the Less CSS framework into Grails. Less (lesscss.org) is what CSS should have always
+been. The plug-in allows for automatic compilation of .less files into .css files, as well as
+tools for easier development (such as auto-reload of CSS after changes in development environment).
+</description>
+ <documentation>http://grails.org/plugin/grails-lesscss</documentation>
+ <resources>
+ <resource>BuildConfig</resource>
+ <resource>DataSource</resource>
+ <resource>UrlMappings</resource>
+ <resource>grails.lesscss.LessTagLib</resource>
+ </resources>
+ <dependencies />
+ <behavior />
+</plugin>
13 src/groovy/com/github/grails/lesscss/Constants.groovy
@@ -0,0 +1,13 @@
+package com.github.grails.lesscss
+
+/**
+ *
+ */
+class Constants {
+
+ public static final String LESS_EXTENSION = ".less"
+
+ public static final String LESS_SCRIPT_NAME = 'less-1.0.40'
+ public static final String LESS_SCRIPT_FILE = "${LESS_SCRIPT_NAME}.js"
+ public static final String LESS_SCRIPT_LOCATION = "/js/${LESS_SCRIPT_FILE}"
+}
39 src/groovy/com/github/grails/lesscss/LessEngineHelper.groovy
@@ -0,0 +1,39 @@
+package com.github.grails.lesscss
+
+import com.asual.lesscss.LessEngine
+
+
+class LessEngineHelper {
+
+ public void compileLessCss(stagingDir, baseDir) {
+ println "Compiling LESS files from dir ${stagingDir} / ${baseDir}"
+
+ LessEngine engine = new LessEngine()
+
+ stagingDir.eachFileRecurse { file ->
+ if (file.directory) {
+ return
+ }
+
+ if (file.name.toLowerCase().endsWith(Constants.LESS_EXTENSION)) {
+
+ def input = file
+ def output = getOutputFile(file)
+
+ println "Compiling LESS file [${input}] into [${output}]"
+
+ engine.compile input, output
+
+ input.delete()
+ }
+ }
+
+ }
+
+ private File getOutputFile(File input) {
+ def inputStr = input as String
+ new File(inputStr.substring(0, inputStr.size() - Constants.LESS_EXTENSION.length()) + ".css")
+ }
+
+
+}
273 web-app/css/main.css
@@ -0,0 +1,273 @@
+html * {
+ margin: 0;
+ /*padding: 0; SELECT NOT DISPLAYED CORRECTLY IN FIREFOX */
+}
+
+/* GENERAL */
+
+.spinner {
+ padding: 5px;
+ position: absolute;
+ right: 0;
+}
+
+body {
+ background: #fff;
+ color: #333;
+ font: 11px verdana, arial, helvetica, sans-serif;
+}
+#grailsLogo {
+ padding:20px;
+}
+
+a:link, a:visited, a:hover {
+ color: #666;
+ font-weight: bold;
+ text-decoration: none;
+}
+
+h1 {
+ color: #48802c;
+ font-weight: normal;
+ font-size: 16px;
+ margin: .8em 0 .3em 0;
+}
+
+ul {
+ padding-left: 15px;
+}
+
+input, select, textarea {
+ background-color: #fcfcfc;
+ border: 1px solid #ccc;
+ font: 11px verdana, arial, helvetica, sans-serif;
+ margin: 2px 0;
+ padding: 2px 4px;
+}
+select {
+ padding: 2px 2px 2px 0;
+}
+textarea {
+ width: 250px;
+ height: 150px;
+ vertical-align: top;
+}
+
+input:focus, select:focus, textarea:focus {
+ border: 1px solid #b2d1ff;
+}
+
+.body {
+ float: left;
+ margin: 0 15px 10px 15px;
+}
+
+/* NAVIGATION MENU */
+
+.nav {
+ background: #fff url(../images/skin/shadow.jpg) bottom repeat-x;
+ border: 1px solid #ccc;
+ border-style: solid none solid none;
+ margin-top: 5px;
+ padding: 7px 12px;
+}
+
+.menuButton {
+ font-size: 10px;
+ padding: 0 5px;
+}
+.menuButton a {
+ color: #333;
+ padding: 4px 6px;
+}
+.menuButton a.home {
+ background: url(../images/skin/house.png) center left no-repeat;
+ color: #333;
+ padding-left: 25px;
+}
+.menuButton a.list {
+ background: url(../images/skin/database_table.png) center left no-repeat;
+ color: #333;
+ padding-left: 25px;
+}
+.menuButton a.create {
+ background: url(../images/skin/database_add.png) center left no-repeat;
+ color: #333;
+ padding-left: 25px;
+}
+
+/* MESSAGES AND ERRORS */
+
+.message {
+ background: #f3f8fc url(../images/skin/information.png) 8px 50% no-repeat;
+ border: 1px solid #b2d1ff;
+ color: #006dba;
+ margin: 10px 0 5px 0;
+ padding: 5px 5px 5px 30px
+}
+
+div.errors {
+ background: #fff3f3;
+ border: 1px solid red;
+ color: #cc0000;
+ margin: 10px 0 5px 0;
+ padding: 5px 0 5px 0;
+}
+div.errors ul {
+ list-style: none;
+ padding: 0;
+}
+div.errors li {
+ background: url(../images/skin/exclamation.png) 8px 0% no-repeat;
+ line-height: 16px;
+ padding-left: 30px;
+}
+
+td.errors select {
+ border: 1px solid red;
+}
+td.errors input {
+ border: 1px solid red;
+}
+td.errors textarea {
+ border: 1px solid red;
+}
+
+/* TABLES */
+
+table {
+ border: 1px solid #ccc;
+ width: 100%
+}
+tr {
+ border: 0;
+}
+td, th {
+ font: 11px verdana, arial, helvetica, sans-serif;
+ line-height: 12px;
+ padding: 5px 6px;
+ text-align: left;
+ vertical-align: top;
+}
+th {
+ background: #fff url(../images/skin/shadow.jpg);
+ color: #666;
+ font-size: 11px;
+ font-weight: bold;
+ line-height: 17px;
+ padding: 2px 6px;
+}
+th a:link, th a:visited, th a:hover {
+ color: #333;
+ display: block;
+ font-size: 10px;
+ text-decoration: none;
+ width: 100%;
+}
+th.asc a, th.desc a {
+ background-position: right;
+ background-repeat: no-repeat;
+}
+th.asc a {
+ background-image: url(../images/skin/sorted_asc.gif);
+}
+th.desc a {
+ background-image: url(../images/skin/sorted_desc.gif);
+}
+
+.odd {
+ background: #f7f7f7;
+}
+.even {
+ background: #fff;
+}
+
+/* LIST */
+
+.list table {
+ border-collapse: collapse;
+}
+.list th, .list td {
+ border-left: 1px solid #ddd;
+}
+.list th:hover, .list tr:hover {
+ background: #b2d1ff;
+}
+
+/* PAGINATION */
+
+.paginateButtons {
+ background: #fff url(../images/skin/shadow.jpg) bottom repeat-x;
+ border: 1px solid #ccc;
+ border-top: 0;
+ color: #666;
+ font-size: 10px;
+ overflow: hidden;
+ padding: 10px 3px;
+}
+.paginateButtons a {
+ background: #fff;
+ border: 1px solid #ccc;
+ border-color: #ccc #aaa #aaa #ccc;
+ color: #666;
+ margin: 0 3px;
+ padding: 2px 6px;
+}
+.paginateButtons span {
+ padding: 2px 3px;
+}
+
+/* DIALOG */
+
+.dialog table {
+ padding: 5px 0;
+}
+
+.prop {
+ padding: 5px;
+}
+.prop .name {
+ text-align: left;
+ width: 15%;
+ white-space: nowrap;
+}
+.prop .value {
+ text-align: left;
+ width: 85%;
+}
+
+/* ACTION BUTTONS */
+
+.buttons {
+ background: #fff url(../images/skin/shadow.jpg) bottom repeat-x;
+ border: 1px solid #ccc;
+ color: #666;
+ font-size: 10px;
+ margin-top: 5px;
+ overflow: hidden;
+ padding: 0;
+}
+
+.buttons input {
+ background: #fff;
+ border: 0;
+ color: #333;
+ cursor: pointer;
+ font-size: 10px;
+ font-weight: bold;
+ margin-left: 3px;
+ overflow: visible;
+ padding: 2px 6px;
+}
+.buttons input.delete {
+ background: transparent url(../images/skin/database_delete.png) 5px 50% no-repeat;
+ padding-left: 28px;
+}
+.buttons input.edit {
+ background: transparent url(../images/skin/database_edit.png) 5px 50% no-repeat;
+ padding-left: 28px;
+}
+.buttons input.save {
+ background: transparent url(../images/skin/database_save.png) 5px 50% no-repeat;
+ padding-left: 28px;
+}

0 comments on commit 28dd097

Please sign in to comment.