Express.js setup initial project

A good place to start:

Node.js tutorial for beginners – an introduction to Node.js with Express.js

>express myApp –hogan -c less

>cd myApp

Check less-middleware version
>npm show less-middleware version

Before run npm install, open package.json and replace
“less-middleware”: “*” to
“less-middleware”: “~0.1.15″

>npm install

Install nodemon
>npm install -g nodemon

Start myApp
>nodemon myApp

Liferay – Javascript API – Session object

AUI().use('liferay-session', function(A) {
  var session = new Liferay.SessionBase();
})

Liferay – Use AngularJS in portlet

The simplest way to try AngularJS in Liferay is to include it in portlet.
Add a Web Content Display portlet to a page and copy and paste the following example code to content:

<script>
AUI().use('get', function(A){
    A.Get.script('http://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js', {	});
});
</script>
<div ng-app=""><label>Name:</label> <input ng-model="yourName" placeholder="Enter a name here" type="text" />
<hr />
<h1>Hello {{yourName}}!</h1>
</div>

Liferay – use Handlebars

Delete or replace Handlebars.js on line 6.

Handlebars.js in-line template

Use handlebars.js in-line tempalte for HTML output.

Precompiling Handlebars.js templates in Windows

1. Download and install Node.js Windows installer from http://nodejs.org/download/. On my system Node.js is installed to C:\Program Files\nodejs directory.

2. Open a command window and change directory to where Nodejs is installed. Run this command:
npm install handlebars -g

3. Now you can run the handlesbars command to pre-compile template:

handlebars infileName -f outfileName

,where infielName is an original template file name with full path, and outfileName is a pre-compliled template file name.

Add -m option to minimize the output file:
handlebars infileName -f outfileName -m

Example:

handlebars C:\template\images.tmpl -f C:\template\images.tmpl.js

A sample HTML file using the images.tmpl.js template.

Liferay – Admin Console Groovy script to update document permissions

I need a quick way to update 20+ permissions among 100+ permissions for each document uploaded. So replace the companyId and fileEntryId allows me to update all permissions specified.

Follow

Get every new post delivered to your Inbox.