Skip to content

Instantly share code, notes, and snippets.

@LudgerPeters
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save LudgerPeters/92e6e2d6b4f4066582be to your computer and use it in GitHub Desktop.

Select an option

Save LudgerPeters/92e6e2d6b4f4066582be to your computer and use it in GitHub Desktop.
public class index extends com.fizzed.rocker.runtime.DefaultRockerTemplate<index> {
// <!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <title>
static private final byte[] PLAIN_TEXT_0_0;
// </title>\n <link rel='stylesheet' href='
static private final byte[] PLAIN_TEXT_1_0;
// '>\n <link rel='stylesheet' href='
static private final byte[] PLAIN_TEXT_2_0;
// '>\n</head>\n<body>\nHi!\n<a href='
static private final byte[] PLAIN_TEXT_3_0;
// '/>Home</a>\n</body>\n<script type=\"text/javascript\">\n
static private final byte[] PLAIN_TEXT_4_0;
// /* production-only code (e.g. google analytics) */\n
static private final byte[] PLAIN_TEXT_5_0;
// </script>\n</html>
static private final byte[] PLAIN_TEXT_6_0;
static {
PlainTextUnloadedClassLoader loader = PlainTextUnloadedClassLoader.tryLoad(index.class.getName() + "$PlainText", "UTF-8");
PLAIN_TEXT_0_0 = loader.tryGet("PLAIN_TEXT_0_0");
PLAIN_TEXT_1_0 = loader.tryGet("PLAIN_TEXT_1_0");
PLAIN_TEXT_2_0 = loader.tryGet("PLAIN_TEXT_2_0");
PLAIN_TEXT_3_0 = loader.tryGet("PLAIN_TEXT_3_0");
PLAIN_TEXT_4_0 = loader.tryGet("PLAIN_TEXT_4_0");
PLAIN_TEXT_5_0 = loader.tryGet("PLAIN_TEXT_5_0");
PLAIN_TEXT_6_0 = loader.tryGet("PLAIN_TEXT_6_0");
}
// argument @ [3:6]
protected String title;
public index() {
super();
__internal.setCharset("UTF-8");
__internal.setContentType(ContentType.HTML);
__internal.setTemplateName("index.rocker.html");
__internal.setTemplatePackageName("views.ApplicationController");
}
public index title(String title) {
this.title = title;
return this;
}
static public index template(String title) {
return new index()
.title(title);
}
@Override
protected void __render() throws IOException, RenderingException {
// PlainText
__internal.aboutToExecutePosInTemplate(3, 21);
__internal.writeValue(PLAIN_TEXT_0_0);
// ValueExpression
__internal.aboutToExecutePosInTemplate(8, 12);
__internal.renderValue(title);
// PlainText
__internal.aboutToExecutePosInTemplate(8, 18);
__internal.writeValue(PLAIN_TEXT_1_0);
// ValueExpression
__internal.aboutToExecutePosInTemplate(9, 34);
__internal.renderValue(N.webJarsAt("bootstrap/3.3.2-1/css/bootstrap.min.css"));
// PlainText
__internal.aboutToExecutePosInTemplate(9, 89);
__internal.writeValue(PLAIN_TEXT_2_0);
// ValueExpression
__internal.aboutToExecutePosInTemplate(10, 34);
__internal.renderValue(N.assetsAt("css/app.css"));
// PlainText
__internal.aboutToExecutePosInTemplate(10, 60);
__internal.writeValue(PLAIN_TEXT_3_0);
// ValueExpression
__internal.aboutToExecutePosInTemplate(14, 10);
__internal.renderValue(N.reverseRoute(ApplicationController.class, "index"));
// PlainText
__internal.aboutToExecutePosInTemplate(14, 63);
__internal.writeValue(PLAIN_TEXT_4_0);
// IfBlockBegin
__internal.aboutToExecutePosInTemplate(17, 1);
if (N.isProd()) {
// PlainText
__internal.aboutToExecutePosInTemplate(17, 19);
__internal.writeValue(PLAIN_TEXT_5_0);
// IfBlockEnd
__internal.aboutToExecutePosInTemplate(17, 1);
} // if end @ [17:1]
// PlainText
__internal.aboutToExecutePosInTemplate(19, 2);
__internal.writeValue(PLAIN_TEXT_6_0);
}
private static class PlainText {
static private final String PLAIN_TEXT_0_0 = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <title>";
static private final String PLAIN_TEXT_1_0 = "</title>\n <link rel='stylesheet' href='";
static private final String PLAIN_TEXT_2_0 = "'>\n <link rel='stylesheet' href='";
static private final String PLAIN_TEXT_3_0 = "'>\n</head>\n<body>\nHi!\n<a href='";
static private final String PLAIN_TEXT_4_0 = "'/>Home</a>\n</body>\n<script type=\"text/javascript\">\n";
static private final String PLAIN_TEXT_5_0 = " /* production-only code (e.g. google analytics) */\n";
static private final String PLAIN_TEXT_6_0 = "</script>\n</html>";
}
}
@import controllers.ApplicationController
@args (String title)
<!DOCTYPE html>
<html lang="en">
<head>
<title>@title</title>
<link rel='stylesheet' href='@N.webJarsAt("bootstrap/3.3.2-1/css/bootstrap.min.css")'>
<link rel='stylesheet' href='@N.assetsAt("css/app.css")'>
</head>
<body>
Hi!
<a href='@N.reverseRoute(ApplicationController.class, "index")'/>Home</a>
</body>
<script type="text/javascript">
@if (N.isProd()) {
/* production-only code (e.g. google analytics) */
}
</script>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>testing-ninja</artifactId>
<packaging>war</packaging>
<groupId>com.ludgerpeters</groupId>
<version>1.0-SNAPSHOT</version>
<url>http://www.ninjaframework.org</url>
<properties>
<ninja.version>5.1.0</ninja.version>
<jetty.version>9.2.10.v20150310</jetty.version>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.fizzed</groupId>
<artifactId>rocker-maven-plugin</artifactId>
<version>0.9.0</version>
<executions>
<execution>
<id>generate-rocker-templates</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<javaVersion>${java.version}</javaVersion>
<extendsClass>com.fizzed.ninja.rocker.NinjaRockerTemplate</extendsClass>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce-banned-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>commons-logging</exclude>
</excludes>
</bannedDependencies>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<contextPath>/</contextPath>
<stopKey>stop</stopKey>
<stopPort>8889</stopPort>
<scanIntervalSeconds>1</scanIntervalSeconds>
<reload>automatic</reload>
<scanTargetPatterns>
<scanTargetPattern>
<directory>target/classes</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.ftl.html</exclude>
<exclude>assets/**</exclude>
</excludes>
</scanTargetPattern>
</scanTargetPatterns>
<systemProperties>
<systemProperty>
<name>ninja.mode</name>
<value>dev</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
<!-- Allows you to run Ninja via the SuperDevMode. -->
<!-- run "mvn ninja:run" on the command line for the best -->
<!-- development experience. -->
<plugin>
<groupId>org.ninjaframework</groupId>
<artifactId>ninja-maven-plugin</artifactId>
<version>${ninja.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>ninja.standalone.NinjaJetty</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>tinymce-jquery</artifactId>
<version>4.0.16</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.182</version>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-client</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orient-commons</artifactId>
<version>2.0-M1</version>
</dependency>
<dependency>
<groupId>com.fizzed</groupId>
<artifactId>ninja-rocker-module</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>com.fizzed</groupId>
<artifactId>rocker-runtime</artifactId>
<version>0.9.0</version>
</dependency>
<!-- If you want to deploy to a war please -->
<!-- comment ninja-standalone dependency and -->
<!-- uncomment the dependency for ninja-servlet -->
<!--
<dependency>
<groupId>org.ninjaframework</groupId>
<artifactId>ninja-servlet</artifactId>
<version>${ninja.version}</version>
</dependency>
-->
<dependency>
<groupId>org.ninjaframework</groupId>
<artifactId>ninja-standalone</artifactId>
<version>${ninja.version}</version>
</dependency>
<dependency>
<groupId>org.ninjaframework</groupId>
<artifactId>ninja-test-utilities</artifactId>
<version>${ninja.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-13T22:10:27+02:00)
Maven home: C:\development\maven\apache-maven-3.3.1
Java version: 1.8.0_40, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_40\jre
Default locale: en_ZA, platform encoding: Cp1252
OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment