Last active
December 15, 2016 13:48
-
-
Save hampusn/7b5a5bf53e159fd2eef80abdf0d913af to your computer and use it in GitHub Desktop.
script-module
This file contains hidden or 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
/** | |
* [MODULE NAME] | |
* | |
* Limepark AB, 2016 | |
*/ | |
(function (window, document, $) { | |
// ... | |
// Document Ready | |
$(function () { | |
}); | |
// Window Load | |
$(window).on('load', function () { | |
}); | |
})(this, this.document, jQuery); |
This file contains hidden or 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
/** | |
* [MODULE DESCRIPTION] | |
* | |
* Limepark AB, 2016 | |
*/ | |
// sitevision < 4.2 | |
if (typeof scriptVariables === 'undefined') var scriptVariables = {}; | |
/** | |
* Contains configuration settings. | |
* @type {Object} | |
*/ | |
var settings = { | |
"foo": (scriptVariables.foo !== null) ? scriptVariables.foo : 'tar', | |
"bar": (scriptVariables.bar !== null) ? scriptVariables.bar : true | |
}; | |
/** | |
* Contains the main logic for this script module. Places needed | |
* variables in a context object accessible in the velocity template. | |
* @return {Object} | |
*/ | |
var context = (function (request) { | |
var portletContextUtil = require('PortletContextUtil'); | |
var endecUtil = require('EndecUtil'); | |
var propertyUtil = require('PropertyUtil'); | |
var resourceLocatorUtil = require('ResourceLocatorUtil'); | |
var currentPage = portletContextUtil.getCurrentPage(); | |
var currentPortlet = portletContextUtil.getCurrentPortlet(); | |
// ... | |
return { | |
"foo": "bar" | |
}; | |
})(request); |
This file contains hidden or 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
/* | |
========================================================= | |
[MODULE NAME] | |
========================================================= | |
* [MODULE DESCRIPTION] | |
* | |
* Limepark AB, 2016 | |
=========================================================*/ | |
/* ... */ |
This file contains hidden or 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
## INIT ## | |
#set( $svUtils = $request.getAttribute('sitevision.utils') ) | |
#set( $scriptUtil = $svUtils.scriptUtil ) | |
#set( $endecUtil = $svUtils.endecUtil ) | |
#set( $propertyUtil = $svUtils.propertyUtil ) | |
## MAIN ## | |
<p>$context.foo</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment