Skip to content

Commit

Permalink
sample soy ui
Browse files Browse the repository at this point in the history
  • Loading branch information
neilking committed Jan 10, 2017
1 parent 8b62bd3 commit 6cb7098
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.gradle/
build/
target/
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bundle-Name: sample-soy
Bundle-SymbolicName: sample.soy
Bundle-Version: 1.0.0
Include-Resource: package.json
Require-Capability: soy;filter:="(type=metal)"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.portlet.bridge.soy", version: "3.0.0"
}

jar {
from "/package.json"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"dependencies": {
"metal-component": "^2.4.5",
"metal-soy": "^2.4.5"
},
"devDependencies": {
"liferay-module-config-generator": "^1.1.10",
"metal-cli": "^1.3.1"
},
"name": "soy-sample",
"version": "1.0.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package sample.soy.portlet;

import com.liferay.portal.portlet.bridge.soy.SoyPortlet;

import java.io.IOException;

import javax.portlet.Portlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.osgi.service.component.annotations.Component;

/**
*
* @author Neil Zhao Jin
*
*/

@Component(
immediate = true,
property = {
"com.liferay.portlet.add-default-resource=true",
"com.liferay.portlet.application-type=full-page-application",
"com.liferay.portlet.application-type=widget",
"com.liferay.portlet.css-class-wrapper=table-wrapper",
"com.liferay.portlet.display-category=category.sample",
"com.liferay.portlet.header-portlet-css=/SoySample.css",
"com.liferay.portlet.layout-cacheable=true",
"com.liferay.portlet.preferences-owned-by-group=true",
"com.liferay.portlet.private-request-attributes=false",
"com.liferay.portlet.private-session-attributes=false",
"com.liferay.portlet.render-weight=50",
"com.liferay.portlet.scopeable=true",
"com.liferay.portlet.use-default-template=true",
"javax.portlet.display-name=Soy Sample Portlet",
"javax.portlet.expiration-cache=0",
"javax.portlet.init-param.copy-request-parameters=true",
"javax.portlet.init-param.template-path=/",
"javax.portlet.init-param.view-template=SoySample",
"javax.portlet.name=soy_sample_portlet",
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=guest,power-user,user",
"javax.portlet.supports.mime-type=text/html"
},
service = Portlet.class
)
public class SampleSoyPortlet extends SoyPortlet {
@Override
public void render(
RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {

template.put("msg", "Good Job!");

super.render(renderRequest, renderResponse);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{namespace SoySample}

/**
* Show portlet message in the view.
* @param id
* @param msg
*/
{template .render}
<div id="{$id}">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon" id="inputGroupAddon01">Message:</span>
<input aria-describedby="inputGroupAddon01" class="form-control" value="{$msg}" type="text">
</div>
</div>

<div class="form-group">
<div class="input-group">
<input aria-describedby="inputGroupAddon02" class="form-control" placeholder="Recipient's username, ex. neil.jin ;)" type="text">
<span class="input-group-addon" id="inputGroupAddon02">@liferay.com</span>
</div>
</div>

<div class="form-group">
<div class="input-group">
<span class="input-group-addon">$</span>
<input aria-label="Amount" class="form-control" type="text">
<span class="input-group-addon">.00</span>
</div>
</div>

<div class="form-group">
<button class="btn btn-default" type="button">Donate</button>
</div>
</div>
{/template}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This file was automatically generated from SoySample.soy.
// Please don't edit this file by hand.

/**
* @fileoverview Templates in namespace SoySample.
* @public
*/

if (typeof SoySample == 'undefined') { var SoySample = {}; }


SoySample.render = function(opt_data, opt_ignored) {
return soydata.VERY_UNSAFE.ordainSanitizedHtml('<div id="' + soy.$$escapeHtmlAttribute(opt_data.id) + '"><div class="form-group"><div class="input-group"><span class="input-group-addon" id="inputGroupAddon01">Message:</span><input aria-describedby="inputGroupAddon01" class="form-control" value="' + soy.$$escapeHtmlAttribute(opt_data.msg) + '" type="text"></div></div><div class="form-group"><div class="input-group"><input aria-describedby="inputGroupAddon02" class="form-control" placeholder="Recipient\'s username, ex. neil.jin ;)" type="text"><span class="input-group-addon" id="inputGroupAddon02">@liferay.com</span></div></div><div class="form-group"><div class="input-group"><span class="input-group-addon">$</span><input aria-label="Amount" class="form-control" type="text"><span class="input-group-addon">.00</span></div></div><div class="form-group"><button class="btn btn-default" type="button">Donate</button></div></div>');
};
if (goog.DEBUG) {
SoySample.render.soyTemplateName = 'SoySample.render';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
javax.portlet.display-name.sample-soy=sample-soy JSP
javax.portlet.keywords.sample-soy=sample-soy,jsp
javax.portlet.short-title.sample-soy=sample-soy JSP
javax.portlet.title.sample-soy=sample-soy JSP Portlet
sample-soy.caption=Hello from sample-soy JSP!

0 comments on commit 6cb7098

Please sign in to comment.