diff --git a/src/core/_boiler_.js b/src/core/_boiler_.js
index bc7d0d7..b5a0f3f 100644
--- a/src/core/_boiler_.js
+++ b/src/core/_boiler_.js
@@ -1,21 +1,26 @@
-/*
- * Here we define the frequently accessed core classes of boilerplatejs. We are creating a object
- * that carry these classes as properties of it. This object is then used as a namespace when
- * accessing the core classes. This is a trick we use to aggregate classes under namespaces
- * since javascript has no formal way of grouping functions in to namespace.
- */
-define(function (require) {
-
- /*
- * Here you will notice we are not returning a function from this AMD module. We are returning a
- * plain javascript object with its properties holding references to core classes (functions).
- * We use 'require' function from requirejs inside the object to load appropriate core classes
- * from the respective AMD modules.
- */
- return {
- Context : require("./core/context"),
- DomController : require("./core/dom-controller"),
- UrlController : require("./core/url-controller"),
- UiPanel: require("./core/ui-panel")
- };
+/*
+ * Here we define the frequently accessed core classes of boilerplatejs. We are creating a object
+ * that carry these classes as properties of it. This object is then used as a namespace when
+ * accessing the core classes. This is a trick we use to aggregate classes under namespaces
+ * since javascript has no formal way of grouping functions in to namespace.
+ */
+define(function (require) {
+
+ /*
+ * Here you will notice we are not returning a function from this AMD module. We are returning a
+ * plain javascript object with its properties holding references to core classes (functions).
+ * We use 'require' function from requirejs inside the object to load appropriate core classes
+ * from the respective AMD modules.
+ */
+
+ /**
+ @type Script
+ @namespace Boiler
+ **/
+ return {
+ Context : require("./core/context"),
+ DomController : require("./core/dom-controller"),
+ UrlController : require("./core/url-controller"),
+ UiPanel: require("./core/ui-panel")
+ };
});
diff --git a/src/core/context.js b/src/core/context.js
index 8391a70..a26dcb7 100644
--- a/src/core/context.js
+++ b/src/core/context.js
@@ -1,150 +1,196 @@
-/*
-* Context is one of the most important classes in boilerplate. This represents a sandboxed environment
-* for writing group of functionalities. Contexts can be nested to create hierachies for complex
-* implementations.
-* For example,
-* a product suit may have multiple products,
-* and a product may have multiple modules,
-* and a module may have multiple submodules.
-*
-* It is possible to create such hierachies by nesting contexts. Context can provide several
-* necessary services such as 'settings store', 'pub-sub event infrastructure', 'logging', etc.
-*/
-define(['./helpers/mediator', './helpers/settings', './helpers/storage', './helpers/localizer'], function (Mediator, Settings, Storage, Localizer) {
-
- /*
- * This is the constructor function for the context and it takes a reference to a parent
- * context. If supplied, it will be initialized to support chaining of it's functionalities.
- * For example, all child contexts will inherit the settings of its parent contexts. Event notifications
- * will bubble through the context hierachy so that inter context communication is possibe
- * within a hierachy tree.
- *
- * Lets assign the function to a variable which we will be returning at the end of the script. Below
- * the constructor function, you can find instance methods for Context class. This might appear strange
- * since they are defined outside the class body and attached to 'prototype' of the class. Although it is
- * possible to define methods within the class body, we use this approach for better performance. For
- * more information read about prototypes in javascripts.
- */
- var Context = function (uniqueId, parentContext) {
- if (uniqueId) {
- this.id = uniqueId;
- } else {
- throw "an id must be defined for a context";
- }
- this.parentContext = parentContext;
- this.mediator = this.parentContext ? this.parentContext.mediator : new Mediator();
- this.settings = this.parentContext ? new Settings(this.parentContext.settings) : new Settings();
- };
-
- Context.prototype.getUid = function () {
- return this.id;
- };
-
- /*
- * This is the method to get settings from the context. This will return a object that has
- * settings as object properties. Consimers can simply use the settings property keys
- * to retrieve values. For example, context.getSettings().base-server-url will look for a
- * setting object defined under 'base-server-url' preperty.
- *
- * If context is a part of a context hierachy, the settings object returned will contain
- * settings of all parent contexts. Settings from child contexts will override settings from
- * parent contexts, if same key exists.
- *
- * To improve performance, it is a good practice to store the returned object and reduce the
- * number of calls to this method.
- */
- Context.prototype.getSettings = function () {
- return this.settings.items();
- };
-
- /*
- * One can pass an object containing settings as properties in it. If the existing
- * settings contain properties with same key, those will be replaced.
- */
- Context.prototype.addSettings = function (newSettings) {
- this.settings.load(newSettings);
- };
-
- /*
- * This is the method to raise an event in the context. All subscribers in the same context hierachy
- * will be notified. first parameter is the event name as a string, and the next parameter is the
- * event data as a object.
- */
- Context.prototype.notify = function (event, params) {
- this.mediator.notify(event, params);
- };
-
- /*
- * The method for subscribing to recieve events. first parameter is the name of the event you wish
- * to recieve. Next is the callback function incase event has occurred. Callback function may have a
- * parameter in case it is interesting to recieve the event data as well.
- */
- Context.prototype.listen = function (event, fn) {
- this.mediator.listen(event, fn);
- };
-
- /*
- * It is possible to use the context as a medium to share objects. Since context is usually
- * passed arround, it serves the purpose of sharing well.
- * @param {key} name of the object to store
- * @param {objectToStore} object to store in
- */
- Context.prototype.persistObject = function (key, objectToStore) {
- Storage.persist(key, objectToStore);
- };
-
- /*
- * Allows developers to retrieve objects that are stored (using 'store' method) in
- * this context.
- * @param {key} name of the object
- * @return The stored object if found, else 'undefined'
- */
- Context.prototype.retreiveObject = function (key) {
- return Storage.retreive(key);
- };
-
- /*
- * Removed the object stored in persistance store
- * @param {key} name of the object to be removed
- */
- Context.prototype.removeObject = function (key) {
- return Storage.remove(key);
- };
-
- /*
- * Set the language for the whole system. Will cause the page to refresh
- */
- Context.prototype.setLanguage = function (lang) {
- return Localizer.setLanguage(lang);
- };
-
- /*
- * Clear any language settings stored. Falls back to browser language detection
- */
- Context.prototype.clearLanguage = function () {
- return Localizer.clearLanguage();
- };
-
-
- /*
- * If someone is interested in obtaining the parent context, this method could be used. But it is not a
- * good practice to work directly on contexts other than your immediate. Instead use events to communicate.
- */
- Context.prototype.getParentContext = function () {
- return this.parentContext;
- };
-
- /*
- * Helper method to construct child contexts under this parent context.
- * Children will recieve a reference to this object through a constructor argument.
- */
- Context.prototype.loadChildContexts = function (children) {
- for (var i = 0; i < children.length; i++) {
- var ChildContextClass = children[i];
- new ChildContextClass(this); //initializes the module
- }
- };
-
- //now we have built our Context class with methods. Lets return it so that callers may instantiate.
- return Context;
+define(['./helpers/mediator', './helpers/settings', './helpers/storage', './helpers/localizer'], function (Mediator, Settings, Storage, Localizer) {
+
+ /*
+ * This is the constructor function for the context and it takes a reference to a parent
+ * context. If supplied, it will be initialized to support chaining of it's functionalities.
+ * For example, all child contexts will inherit the settings of its parent contexts. Event notifications
+ * will bubble through the context hierachy so that inter context communication is possibe
+ * within a hierachy tree.
+ *
+ * Lets assign the function to a variable which we will be returning at the end of the script. Below
+ * the constructor function, you can find instance methods for Context class. This might appear strange
+ * since they are defined outside the class body and attached to 'prototype' of the class. Although it is
+ * possible to define methods within the class body, we use this approach for better performance. For
+ * more information read about prototypes in javascripts.
+ */
+
+ /**
+ Context is one of the most important classes in boilerplate. This represents a sandboxed environment
+ for writing group of functionalities. Contexts can be nested to create hierachies for complex
+ implementations.
+ For example,
+ a product suit may have multiple products,
+ and a product may have multiple modules,
+ and a module may have multiple submodules.
+
+ It is possible to create such hierachies by nesting contexts. Context can provide several
+ necessary services such as 'settings store', 'pub-sub event infrastructure', 'logging', etc.
+
+ @namespace Boiler
+ @module BoilerCoreClasses
+ @class Context
+ @constructor
+ @param {Object} uniqueId
+ @param {Object} parentContext reference to a parent context
+ **/
+ var Context = function (uniqueId, parentContext) {
+ if (uniqueId) {
+ this.id = uniqueId;
+ } else {
+ throw "an id must be defined for a context";
+ }
+ this.parentContext = parentContext;
+ this.mediator = this.parentContext ? this.parentContext.mediator : new Mediator();
+ this.settings = this.parentContext ? new Settings(this.parentContext.settings) : new Settings();
+ };
+ /**
+ Returns the context id
+
+ @method getUid
+ @return {Object} context id
+ **/
+ Context.prototype.getUid = function () {
+ return this.id;
+ };
+
+ /**
+ * This is the method to get settings from the context. This will return a object that has
+ * settings as object properties. Consimers can simply use the settings property keys
+ * to retrieve values. For example, context.getSettings().base-server-url will look for a
+ * setting object defined under 'base-server-url' preperty.
+ *
+ * If context is a part of a context hierachy, the settings object returned will contain
+ * settings of all parent contexts. Settings from child contexts will override settings from
+ * parent contexts, if same key exists.
+ *
+ * To improve performance, it is a good practice to store the returned object and reduce the
+ * number of calls to this method.
+
+ @method getSettings
+ @return {Object} settings
+ **/
+ Context.prototype.getSettings = function () {
+ return this.settings.items();
+ };
+
+ /**
+ * One can pass an object containing settings as properties in it. If the existing
+ * settings contain properties with same key, those will be replaced.
+
+ @method addSettings
+ @param {Object} newSettings object containing settings as properties in it
+ **/
+ Context.prototype.addSettings = function (newSettings) {
+ this.settings.load(newSettings);
+ };
+
+ /**
+ * This is the method to raise an event in the context. All subscribers in the same context hierachy
+ * will be notified. first parameter is the event name as a string, and the next parameter is the
+ * event data as a object.
+
+ @method notify
+ @param {String} event Event name
+ @param {Object} params Event data
+ **/
+ Context.prototype.notify = function (event, params) {
+ this.mediator.notify(event, params);
+ };
+
+ /**
+ * The method for subscribing to recieve events. first parameter is the name of the event you wish
+ * to recieve. Next is the callback function incase event has occurred. Callback function may have a
+ * parameter in case it is interesting to recieve the event data as well.
+
+ @method listen
+ @param {String} event Event name
+ @param {Object} fn Callback function
+ **/
+ Context.prototype.listen = function (event, fn) {
+ this.mediator.listen(event, fn);
+ };
+
+ /**
+ * It is possible to use the context as a medium to share objects. Since context is usually
+ * passed arround, it serves the purpose of sharing well.
+
+ @method persistObject
+ @param {String} key name of the object to store
+ @param {Object} objectToStore object to store in
+ **/
+ Context.prototype.persistObject = function (key, objectToStore) {
+ Storage.persist(key, objectToStore);
+ };
+
+ /**
+ * Allows developers to retrieve objects that are stored (using 'store' method) in
+ * this context.
+
+ @method retreiveObject
+ @param {String} key name of the object
+ @return {Object} object The stored object if found, else 'undefined'
+ **/
+ Context.prototype.retreiveObject = function (key) {
+ return Storage.retreive(key);
+ };
+
+ /**
+ * Remove the object stored in persistance store.
+
+ @method removeObject
+ @param {String} key Name of the object to be removed
+ @return {Object} object
+ **/
+ Context.prototype.removeObject = function (key) {
+ return Storage.remove(key);
+ };
+
+ /**
+ * Set the language for the whole system. Will cause the page to refresh
+
+ @method setLanguage
+ @param {String} lang
+ @return {Object} object
+ **/
+ Context.prototype.setLanguage = function (lang) {
+ return Localizer.setLanguage(lang);
+ };
+
+ /**
+ * Clear any language settings stored. Falls back to browser language detection
+
+ @method clearLanguage
+ @return {Object} object
+ **/
+ Context.prototype.clearLanguage = function () {
+ return Localizer.clearLanguage();
+ };
+
+ /**
+ * If someone is interested in obtaining the parent context, this method could be used. But it is not a
+ * good practice to work directly on contexts other than your immediate. Instead use events to communicate.
+
+ @method getParentContext
+ @return {Object} parentContext Parent context object
+ **/
+ Context.prototype.getParentContext = function () {
+ return this.parentContext;
+ };
+
+ /**
+ * Helper method to construct child contexts under this parent context.
+ * Children will recieve a reference to this object through a constructor argument.
+
+ @method loadChildContexts
+ @param {ObjectArray} children
+ **/
+ Context.prototype.loadChildContexts = function (children) {
+ for (var i = 0; i < children.length; i++) {
+ var ChildContextClass = children[i];
+ new ChildContextClass(this); //initializes the module
+ }
+ };
+
+ //now we have built our Context class with methods. Lets return it so that callers may instantiate.
+ return Context;
});
diff --git a/src/core/dom-controller.js b/src/core/dom-controller.js
index 45e5b48..14ce343 100644
--- a/src/core/dom-controller.js
+++ b/src/core/dom-controller.js
@@ -1,30 +1,35 @@
-define([], function () {
-
-
- var DomController = function (context) {
-
- var self = this;
- self.handles = {};
-
- return {
- addRoutes: function (newHandles) {
- _.extend(self.handles, newHandles);
- },
-
- start: function () {
- for (path in self.handles) {
- var HandlerClass = self.handles[path];
- $("." + path).each(function (index) {
- var paramString = $(this).attr("params");
- var params = paramString ? eval("({" + paramString + "})") : {};
- var handlerObj = new HandlerClass(context);
- handlerObj.activate($(this), params);
- });
- }
- }
- };
-
- };
-
- return DomController;
+define([], function () {
+
+ /**
+ * dom-controller class
+ * @class DomController
+ * @constructor
+ * @param {Object} context
+ */
+ var DomController = function (context) {
+
+ var self = this;
+ self.handles = {};
+
+ return {
+ addRoutes: function (newHandles) {
+ _.extend(self.handles, newHandles);
+ },
+
+ start: function () {
+ for (path in self.handles) {
+ var HandlerClass = self.handles[path];
+ $("." + path).each(function (index) {
+ var paramString = $(this).attr("params");
+ var params = paramString ? eval("({" + paramString + "})") : {};
+ var handlerObj = new HandlerClass(context);
+ handlerObj.activate($(this), params);
+ });
+ }
+ }
+ };
+
+ };
+
+ return DomController;
});
diff --git a/src/core/helpers/_helpers_.js b/src/core/helpers/_helpers_.js
new file mode 100644
index 0000000..19fd612
--- /dev/null
+++ b/src/core/helpers/_helpers_.js
@@ -0,0 +1,16 @@
+define(function (require) {
+
+ /**
+ @type Script
+ @namespace Boiler.Helpers
+ **/
+ return {
+ Localizer : require("./core/helpers/localizer"),
+ Logger : require("./core/helpers/logger"),
+ Mediator : require("./core/helpers/mediator"),
+ Router : require("./core/helpers/router"),
+ Settings : require("./core/helpers/settings"),
+ Storage : require("./core/helpers/storage"),
+ Styler : require("./core/helpers/styler")
+ };
+});
diff --git a/src/core/helpers/localizer.js b/src/core/helpers/localizer.js
index 4e005e8..78ab494 100644
--- a/src/core/helpers/localizer.js
+++ b/src/core/helpers/localizer.js
@@ -14,10 +14,24 @@
});
}
-
+ /**
+ Localizer class
+
+ @class Localizer
+ @constructor
+ **/
var Localizer = function() {
};
+ /**
+ Returns an object containing parameters for localization
+
+ @method localize
+ @static
+ @param {Object} text
+ @param {Object} nlsObject
+ @return {Object}
+ **/
Localizer.localize = function(text, nlsObject) {
var compiled = _.template(text);
return compiled({
@@ -25,12 +39,25 @@
});
};
+ /**
+ Sets the language
+
+ @method setLanguage
+ @static
+ @param {Object} locale
+ **/
Localizer.setLanguage = function(locale) {
console.log(locale);
Storage.persist("user-language", locale);
location.reload();
};
+ /**
+ Reset the language to the default language
+
+ @method clearLanguage
+ @static
+ **/
Localizer.clearLanguage = function() {
Storage.remove("user-language");
location.reload();
diff --git a/src/core/ui-panel.js b/src/core/ui-panel.js
index 8f999da..a60b6ea 100644
--- a/src/core/ui-panel.js
+++ b/src/core/ui-panel.js
@@ -1,51 +1,99 @@
-define(['./helpers/localizer', './helpers/styler'], function (Localizer, Styler) {
-
- var Panel = function (viewTemplate, parentEl, nls) {
- this.viewId = this.createView(viewTemplate, parentEl, nls);
- };
-
- Panel.prototype.setStyleText = function(uniqueId, style) {
- Styler.attachCssText(uniqueId, style);
- };
-
- Panel.prototype.dispose = function () {
- $('#' + this.viewId).remove();
- };
-
- Panel.prototype.getElementId = function () {
- return this.viewId;
- };
-
- Panel.prototype.getJqueryElement = function () {
- return $('#' + this.viewId);
- };
-
- Panel.prototype.getDomElement = function () {
- return document.getElementById(this.viewId);
- };
-
- Panel.prototype.createView = function (viewText, parentElement, nls) {
- // set defaults
- containerType = '';
- parentElement = typeof parentElement !== 'undefined' ? parentElement : $('body');
-
- //apply localization on the template
- if(nls) {
- viewText = Localizer.localize(viewText, nls);
- }
-
- // create a random id for the child
- var childId = _.uniqueId(['container_']);
- // create the child container
-
- parentElement.append($(containerType, {
- id : childId,
- }));
- // add template text to the child container as html
- $('#' + childId).html(viewText);
-
- return childId;
- };
-
- return Panel;
+define(['./helpers/localizer', './helpers/styler'], function (Localizer, Styler) {
+
+ /**
+ ui-panel class
+
+ @class Panel
+ @constructor
+ @param {Object} viewTemplate
+ @param {Object} parentEl
+ @param {Object} nls
+ **/
+ var Panel = function (viewTemplate, parentEl, nls) {
+ this.viewId = this.createView(viewTemplate, parentEl, nls);
+ };
+
+ /**
+ Sets the style
+
+ @method setStyleText
+ @param {Object} uniqueId
+ @param {Object} style
+ **/
+ Panel.prototype.setStyleText = function(uniqueId, style) {
+ Styler.attachCssText(uniqueId, style);
+ };
+
+ /**
+ Dispose the view component
+
+ @method dispose
+ **/
+ Panel.prototype.dispose = function () {
+ $('#' + this.viewId).remove();
+ };
+
+ /**
+ Returns the view id
+
+ @method getElementId
+ @return viewId
+ **/
+ Panel.prototype.getElementId = function () {
+ return this.viewId;
+ };
+
+ /**
+ Returns the jQuery element id
+
+ @method getElementId
+ @return viewId
+ **/
+ Panel.prototype.getJqueryElement = function () {
+ return $('#' + this.viewId);
+ };
+
+ /**
+ Returns the DOM element
+
+ @method getDomElement
+ @return viewId
+ **/
+ Panel.prototype.getDomElement = function () {
+ return document.getElementById(this.viewId);
+ };
+
+ /**
+ Creates a view
+
+ @method createView
+ @param viewText
+ @param parentElement
+ @param nls
+ @return childId
+ **/
+ Panel.prototype.createView = function (viewText, parentElement, nls) {
+ // set defaults
+ containerType = '';
+ parentElement = typeof parentElement !== 'undefined' ? parentElement : $('body');
+
+ //apply localization on the template
+ if(nls) {
+ viewText = Localizer.localize(viewText, nls);
+ }
+
+ // create a random id for the child
+ var childId = _.uniqueId(['container_']);
+ // create the child container
+
+ parentElement.append($(containerType, {
+ id : childId,
+ }));
+ // add template text to the child container as html
+ $('#' + childId).html(viewText);
+
+ return childId;
+ };
+
+ return Panel;
});
diff --git a/src/core/url-controller.js b/src/core/url-controller.js
index 1dbb7d1..559c2d0 100644
--- a/src/core/url-controller.js
+++ b/src/core/url-controller.js
@@ -1,50 +1,58 @@
-define(['./helpers/router'], function (Router) {
-
- var UrlController = function (context, parentEl) {
-
- var allHandles = {};
- var router = new Router();
-
+define(['./helpers/router'], function (Router) {
+ /**
+ url-controller class
+
+ @class UrlController
+ @uses This class uses 'router' as a dependency
+ @constructor
+ @param {Object} context
+ @param {Object} parentEl
+ **/
+ var UrlController = function (context, parentEl) {
+
+ var allHandles = {};
+ var router = new Router();
+
/*
* Wrapper for handles. This allows us to intercept activation calls so
* that we are able to execute custom logic such as deactivation of
* other handles.
- */
- function Wrapper(handle) {
- var selfWrapper = this;
- selfWrapper.handle = handle;
-
- this.activate = function (vals) {
- // deactivate all active handles in current controller
- parentEl.empty();
- // activate the requested handler
- selfWrapper.handle.activate(parentEl, vals);
- };
-
- }
-
- return {
- addRoutes: function (handles) {
- for (path in handles) {
- var HandlerClass = handles[path];
- var handlerObj = new Wrapper(new HandlerClass(context));
- router.addRoute(path, handlerObj.activate);
- allHandles[path] = handlerObj;
- }
-
- },
-
- start: function () {
- router.init();
- }
-
- };
-
- };
-
- UrlController.goTo = function (newPath) {
- Router.routeTo(newPath);
- };
-
- return UrlController;
+ */
+ function Wrapper(handle) {
+ var selfWrapper = this;
+ selfWrapper.handle = handle;
+
+ this.activate = function (vals) {
+ // deactivate all active handles in current controller
+ parentEl.empty();
+ // activate the requested handler
+ selfWrapper.handle.activate(parentEl, vals);
+ };
+
+ }
+
+ return {
+ addRoutes: function (handles) {
+ for (path in handles) {
+ var HandlerClass = handles[path];
+ var handlerObj = new Wrapper(new HandlerClass(context));
+ router.addRoute(path, handlerObj.activate);
+ allHandles[path] = handlerObj;
+ }
+
+ },
+
+ start: function () {
+ router.init();
+ }
+
+ };
+
+ };
+
+ UrlController.goTo = function (newPath) {
+ Router.routeTo(newPath);
+ };
+
+ return UrlController;
});
diff --git a/src/global-context.js b/src/global-context.js
index 6446aaf..2742f8c 100644
--- a/src/global-context.js
+++ b/src/global-context.js
@@ -1,30 +1,30 @@
-/*
- * This file holds the function (or you may call it a 'class' if you are from .NET or Java world)
- * to create a root context. 'Boiler.Context' can be nested to create a hierachy of contexts
- * for complex implementations. Below we use requirejs to import following files
- * '_boiler_' : Namespace for accessing the core boilerplate functions
- * './settings' : The global setting ( to make available for all children contexts)
- * './modules' : The object containing all sub module calsses
- *
- * Note: when we define the variables in AMD callback function, we use PascalCase for namespaces
- * and classes ('Boiler' in the case), whereas object instances ('settings' and 'modules')
- * are represented with camelCase variable names.
- */
-define(["_boiler_", "./settings", "./modules/modules"], function (Boiler, settings, moduleContexts) {
-
- /*
- * Following is our function representing GlobalContext 'class'. Others can import this
- * script as a AMD module and they will obtain the function to be used as a 'class' in
- * creating instances.
- */
- var GlobalContext = function () {
- //Lets use core Boiler classes to create our global context instance
- var globalContext = new Boiler.Context("GlobalModule");
- //now lets add settings, which are to be available as global settings
- globalContext.addSettings(settings);
- //here we load the sub modules of the global context
- globalContext.loadChildContexts(moduleContexts);
- };
-
- return GlobalContext;
+/*
+ * This file holds the function (or you may call it a 'class' if you are from .NET or Java world)
+ * to create a root context. 'Boiler.Context' can be nested to create a hierachy of contexts
+ * for complex implementations. Below we use requirejs to import following files
+ * 'Boiler' : Namespace for accessing the core boilerplate functions
+ * './settings' : The global setting ( to make available for all children contexts)
+ * './modules' : The object containing all sub module calsses
+ *
+ * Note: when we define the variables in AMD callback function, we use PascalCase for namespaces
+ * and classes ('Boiler' in the case), whereas object instances ('settings' and 'modules')
+ * are represented with camelCase variable names.
+ */
+define(["Boiler", "./settings", "./modules/modules"], function (Boiler, settings, moduleContexts) {
+
+ /*
+ * Following is our function representing GlobalContext 'class'. Others can import this
+ * script as a AMD module and they will obtain the function to be used as a 'class' in
+ * creating instances.
+ */
+ var GlobalContext = function () {
+ //Lets use core Boiler classes to create our global context instance
+ var globalContext = new Boiler.Context("GlobalModule");
+ //now lets add settings, which are to be available as global settings
+ globalContext.addSettings(settings);
+ //here we load the sub modules of the global context
+ globalContext.loadChildContexts(moduleContexts);
+ };
+
+ return GlobalContext;
});
diff --git a/src/main.js b/src/main.js
index 879b56f..e949840 100644
--- a/src/main.js
+++ b/src/main.js
@@ -14,7 +14,7 @@ require.config({
i18n : '../libs/require/i18n',
domReady : '../libs/require/domReady',
// namespace that aggregate core classes that are in frequent use
- _boiler_ : './core/_boiler_'
+ Boiler : './core/_boiler_'
}
});
diff --git a/src/modules/baseModule/language/route-handler.js b/src/modules/baseModule/language/route-handler.js
index 9d985ae..e64eafc 100644
--- a/src/modules/baseModule/language/route-handler.js
+++ b/src/modules/baseModule/language/route-handler.js
@@ -1,27 +1,27 @@
-define(['_boiler_', 'text!./view.html', 'text!./style.css' ], function(Boiler, template, style) {
-
- var RouteHandler = function(moduleContext) {
- return {
- activate : function(parent) {
- var panel = new Boiler.UiPanel(template, parent, null, style);
-
- panel.setStyleText("langPanelStylesheet", style);
-
- $('#langEn').click(function (event) {
- moduleContext.setLanguage("en");
- });
-
- $('#langSv').click(function (event) {
- moduleContext.setLanguage("sv");
- });
-
- $('#clearLang').click(function (event) {
- moduleContext.clearLanguage();
- });
- }
- };
- };
-
- return RouteHandler;
-
+define(['Boiler', 'text!./view.html', 'text!./style.css' ], function(Boiler, template, style) {
+
+ var RouteHandler = function(moduleContext) {
+ return {
+ activate : function(parent) {
+ var panel = new Boiler.UiPanel(template, parent, null, style);
+
+ panel.setStyleText("langPanelStylesheet", style);
+
+ $('#langEn').click(function (event) {
+ moduleContext.setLanguage("en");
+ });
+
+ $('#langSv').click(function (event) {
+ moduleContext.setLanguage("sv");
+ });
+
+ $('#clearLang').click(function (event) {
+ moduleContext.clearLanguage();
+ });
+ }
+ };
+ };
+
+ return RouteHandler;
+
});
\ No newline at end of file
diff --git a/src/modules/baseModule/mainMenu/route-handler.js b/src/modules/baseModule/mainMenu/route-handler.js
index 1f04a6a..020b760 100644
--- a/src/modules/baseModule/mainMenu/route-handler.js
+++ b/src/modules/baseModule/mainMenu/route-handler.js
@@ -1,13 +1,13 @@
-define(['_boiler_', 'text!./view.html', 'i18n!./nls/resources' ], function(Boiler, template, nls) {
-
- var RouteHandler = function(moduleContext) {
- return {
- activate : function(parent) {
- new Boiler.UiPanel(template, parent, nls);
- }
- };
- };
-
- return RouteHandler;
-
+define(['Boiler', 'text!./view.html', 'i18n!./nls/resources' ], function(Boiler, template, nls) {
+
+ var RouteHandler = function(moduleContext) {
+ return {
+ activate : function(parent) {
+ new Boiler.UiPanel(template, parent, nls);
+ }
+ };
+ };
+
+ return RouteHandler;
+
});
\ No newline at end of file
diff --git a/src/modules/baseModule/module-context.js b/src/modules/baseModule/module-context.js
index 6378d50..e56bf05 100644
--- a/src/modules/baseModule/module-context.js
+++ b/src/modules/baseModule/module-context.js
@@ -1,5 +1,12 @@
-define(['_boiler_', './mainMenu/route-handler', './language/route-handler', './theme/route-handler'], function (Boiler, MainMenuRouteHandler, LanguageRouteHandler, ThemeRouteHandler) {
-
+define(['Boiler', './mainMenu/route-handler', './language/route-handler', './theme/route-handler'], function (Boiler, MainMenuRouteHandler, LanguageRouteHandler, ThemeRouteHandler) {
+ /**
+ This is the main entry point to the BaseModule
+
+ @module BaseModule
+ @class BaseModuleContext
+ @constructor
+ @param {Object} globalContext
+ **/
var BaseModuleContext = function(globalContext) {
var moduleContext = new Boiler.Context("baseModule", globalContext);
var controller = new Boiler.DomController(moduleContext);
diff --git a/src/modules/baseModule/theme/route-handler.js b/src/modules/baseModule/theme/route-handler.js
index e127c21..dee3c01 100644
--- a/src/modules/baseModule/theme/route-handler.js
+++ b/src/modules/baseModule/theme/route-handler.js
@@ -1,52 +1,52 @@
-define(['_boiler_', 'text!./view.html', 'text!./style.css'], function(Boiler, template, componentStyle) {
-
- /**
- * Lets define the themes we have in the system. We use CSS text to import appropriate
- * CSS file when the theme is requested.
- */
- var themes = {
- red : "@import url('./assets/modules/baseModule/theme/red/common.css');",
- gray : "@import url('./assets/modules/baseModule/theme/gray/common.css');"
- };
-
- var RouteHandler = function(moduleContext) {
- //unique key of this sub-module to be used when necessary
- var THEME_UNIQUE_KEY = "themeStylesheet";
-
-
- return {
- //this is the method that will be called by the handler
- activate : function(parent) {
- var panel = new Boiler.UiPanel(template, parent);
- panel.setStyleText("themeComponentStyle", componentStyle);
-
-
- //if we have a stored theme setting lest use it OR use default
- var storedThemeKey = moduleContext.retreiveObject(THEME_UNIQUE_KEY);
- if (!storedThemeKey) {
- storedThemeKey = "gray"; //default
- }
-
- //lets use the panel to set style in header
- panel.setStyleText(THEME_UNIQUE_KEY, themes[storedThemeKey]);
- //set the current theme selected on the select box
- $(".theme select").val(storedThemeKey);
-
- //lets handle the theme change event from the select
- $(".theme select").change(function() {
- var selection = $(".theme option:selected").val();
- //read the selected value
- css = themes[selection];
- //set style in header
- panel.setStyleText(THEME_UNIQUE_KEY, css);
- //sale in the local store
- moduleContext.persistObject(THEME_UNIQUE_KEY, selection);
- });
-
- }
- };
- };
-
- return RouteHandler;
-
-});
+define(['Boiler', 'text!./view.html', 'text!./style.css'], function(Boiler, template, componentStyle) {
+
+ /**
+ * Lets define the themes we have in the system. We use CSS text to import appropriate
+ * CSS file when the theme is requested.
+ */
+ var themes = {
+ red : "@import url('./assets/modules/baseModule/theme/red/common.css');",
+ gray : "@import url('./assets/modules/baseModule/theme/gray/common.css');"
+ };
+
+ var RouteHandler = function(moduleContext) {
+ //unique key of this sub-module to be used when necessary
+ var THEME_UNIQUE_KEY = "themeStylesheet";
+
+
+ return {
+ //this is the method that will be called by the handler
+ activate : function(parent) {
+ var panel = new Boiler.UiPanel(template, parent);
+ panel.setStyleText("themeComponentStyle", componentStyle);
+
+
+ //if we have a stored theme setting lest use it OR use default
+ var storedThemeKey = moduleContext.retreiveObject(THEME_UNIQUE_KEY);
+ if (!storedThemeKey) {
+ storedThemeKey = "gray"; //default
+ }
+
+ //lets use the panel to set style in header
+ panel.setStyleText(THEME_UNIQUE_KEY, themes[storedThemeKey]);
+ //set the current theme selected on the select box
+ $(".theme select").val(storedThemeKey);
+
+ //lets handle the theme change event from the select
+ $(".theme select").change(function() {
+ var selection = $(".theme option:selected").val();
+ //read the selected value
+ css = themes[selection];
+ //set style in header
+ panel.setStyleText(THEME_UNIQUE_KEY, css);
+ //sale in the local store
+ moduleContext.persistObject(THEME_UNIQUE_KEY, selection);
+ });
+
+ }
+ };
+ };
+
+ return RouteHandler;
+
+});
diff --git a/src/modules/sampleModule1/departments/component.js b/src/modules/sampleModule1/departments/component.js
index b3bce92..bf343e5 100644
--- a/src/modules/sampleModule1/departments/component.js
+++ b/src/modules/sampleModule1/departments/component.js
@@ -1,12 +1,12 @@
-define(['_boiler_', 'text!./view.html', './viewmodel'],
- function (Boiler, template, ViewModel) {
-
- var Component = function (moduleContext, parent, params) {
- var panel = new Boiler.UiPanel(template, parent);
- var vm = new ViewModel(moduleContext, params.initvalue);
- ko.applyBindings(vm, panel.getDomElement());
- };
-
- return Component;
-
+define(['Boiler', 'text!./view.html', './viewmodel'],
+ function (Boiler, template, ViewModel) {
+
+ var Component = function (moduleContext, parent, params) {
+ var panel = new Boiler.UiPanel(template, parent);
+ var vm = new ViewModel(moduleContext, params.initvalue);
+ ko.applyBindings(vm, panel.getDomElement());
+ };
+
+ return Component;
+
});
\ No newline at end of file
diff --git a/src/modules/sampleModule1/helloEarth/component.js b/src/modules/sampleModule1/helloEarth/component.js
index 57b36a7..124a591 100644
--- a/src/modules/sampleModule1/helloEarth/component.js
+++ b/src/modules/sampleModule1/helloEarth/component.js
@@ -1,12 +1,12 @@
-define(['_boiler_', 'text!./view.html'],
- function (Boiler, template) {
-
- var Component = function (moduleContext, parent, vm) {
-
- var panel = new Boiler.UiPanel(template, parent);
- ko.applyBindings(vm, panel.getDomElement());
- };
-
- return Component;
-
+define(['Boiler', 'text!./view.html'],
+ function (Boiler, template) {
+
+ var Component = function (moduleContext, parent, vm) {
+
+ var panel = new Boiler.UiPanel(template, parent);
+ ko.applyBindings(vm, panel.getDomElement());
+ };
+
+ return Component;
+
});
\ No newline at end of file
diff --git a/src/modules/sampleModule1/module-context.js b/src/modules/sampleModule1/module-context.js
index 08031af..68b1339 100644
--- a/src/modules/sampleModule1/module-context.js
+++ b/src/modules/sampleModule1/module-context.js
@@ -1,19 +1,19 @@
-define(['_boiler_', './routes', './settings'], function (Boiler, routes, settings) {
-
- var ModuleContext = function (globalContext) {
-
- var moduleContext = new Boiler.Context("sampleModule1", globalContext);
- moduleContext.addSettings(settings);
-
- var controller = new Boiler.UrlController(moduleContext, $(".appcontent"));
- controller.addRoutes(routes);
- controller.start();
-
- var controller = new Boiler.DomController(moduleContext);
- controller.addRoutes(routes);
- controller.start();
- };
-
- return ModuleContext;
-
+define(['Boiler', './routes', './settings'], function (Boiler, routes, settings) {
+
+ var ModuleContext = function (globalContext) {
+
+ var moduleContext = new Boiler.Context("sampleModule1", globalContext);
+ moduleContext.addSettings(settings);
+
+ var controller = new Boiler.UrlController(moduleContext, $(".appcontent"));
+ controller.addRoutes(routes);
+ controller.start();
+
+ var controller = new Boiler.DomController(moduleContext);
+ controller.addRoutes(routes);
+ controller.start();
+ };
+
+ return ModuleContext;
+
});
\ No newline at end of file
diff --git a/src/modules/sampleModule2/employeeDetails/component.js b/src/modules/sampleModule2/employeeDetails/component.js
index a566e0a..98fea42 100644
--- a/src/modules/sampleModule2/employeeDetails/component.js
+++ b/src/modules/sampleModule2/employeeDetails/component.js
@@ -1,16 +1,16 @@
-define(['_boiler_', 'text!./view.html', './viewmodel'], function (Boiler, template, ViewModel) {
-
-
- var Component = function (moduleContext, parent, id) {
- var vm = new ViewModel(moduleContext, id);
- var panel = new Boiler.UiPanel(template, parent);
- ko.applyBindings(vm, panel.getDomElement());
-
- this.dispose = function () {
- panel.dispose();
- };
- };
-
- return Component;
-
+define(['Boiler', 'text!./view.html', './viewmodel'], function (Boiler, template, ViewModel) {
+
+
+ var Component = function (moduleContext, parent, id) {
+ var vm = new ViewModel(moduleContext, id);
+ var panel = new Boiler.UiPanel(template, parent);
+ ko.applyBindings(vm, panel.getDomElement());
+
+ this.dispose = function () {
+ panel.dispose();
+ };
+ };
+
+ return Component;
+
});
\ No newline at end of file
diff --git a/src/modules/sampleModule2/employeeList/component.js b/src/modules/sampleModule2/employeeList/component.js
index 88b4009..affab45 100644
--- a/src/modules/sampleModule2/employeeList/component.js
+++ b/src/modules/sampleModule2/employeeList/component.js
@@ -1,12 +1,12 @@
-define(['_boiler_', 'text!./view.html', './viewmodel' ], function(Boiler, template, ViewModel) {
-
-
- var Component = function (moduleContext, parent, params) {
- var vm = new ViewModel(moduleContext);
- var panel = new Boiler.UiPanel(template, parent);
- ko.applyBindings(vm, panel.getDomElement());
- };
-
+define(['Boiler', 'text!./view.html', './viewmodel' ], function(Boiler, template, ViewModel) {
+
+
+ var Component = function (moduleContext, parent, params) {
+ var vm = new ViewModel(moduleContext);
+ var panel = new Boiler.UiPanel(template, parent);
+ ko.applyBindings(vm, panel.getDomElement());
+ };
+
return Component;
});
\ No newline at end of file
diff --git a/src/modules/sampleModule2/employeeList/viewmodel.js b/src/modules/sampleModule2/employeeList/viewmodel.js
index 742a768..ca4ecbc 100644
--- a/src/modules/sampleModule2/employeeList/viewmodel.js
+++ b/src/modules/sampleModule2/employeeList/viewmodel.js
@@ -1,19 +1,19 @@
-define(['_boiler_'], function (Boiler) {
-
- var ViewModel = function (moduleContext) {
- var self = this;
- this.salesPersons = ko.observableArray();
-
- this.personClicked = function (person) {
- Boiler.UrlController.goTo("employee/"+ person.id);
- };
-
- //load the data from the server
- $.getJSON(moduleContext.getSettings().urls.employees, function (result) {
- self.salesPersons(result);
- });
-
- };
-
- return ViewModel;
-});
+define(['Boiler'], function (Boiler) {
+
+ var ViewModel = function (moduleContext) {
+ var self = this;
+ this.salesPersons = ko.observableArray();
+
+ this.personClicked = function (person) {
+ Boiler.UrlController.goTo("employee/"+ person.id);
+ };
+
+ //load the data from the server
+ $.getJSON(moduleContext.getSettings().urls.employees, function (result) {
+ self.salesPersons(result);
+ });
+
+ };
+
+ return ViewModel;
+});
diff --git a/src/modules/sampleModule2/module-context.js b/src/modules/sampleModule2/module-context.js
index 6d46978..553d726 100644
--- a/src/modules/sampleModule2/module-context.js
+++ b/src/modules/sampleModule2/module-context.js
@@ -1,14 +1,14 @@
-define(['_boiler_', './routes', './settings'], function (Boiler, routes, settings) {
-
- var ModuleContext = function (globalContext) {
- var moduleContext = new Boiler.Context("sampleModule2", globalContext);
- moduleContext.addSettings(settings);
-
- var controller = new Boiler.UrlController(moduleContext, $(".appcontent"));
- controller.addRoutes(routes);
- controller.start();
- };
-
- return ModuleContext;
-
+define(['Boiler', './routes', './settings'], function (Boiler, routes, settings) {
+
+ var ModuleContext = function (globalContext) {
+ var moduleContext = new Boiler.Context("sampleModule2", globalContext);
+ moduleContext.addSettings(settings);
+
+ var controller = new Boiler.UrlController(moduleContext, $(".appcontent"));
+ controller.addRoutes(routes);
+ controller.start();
+ };
+
+ return ModuleContext;
+
});
\ No newline at end of file
diff --git a/src/modules/sampleModule2/salesDashboard/chartViewPanel/component.js b/src/modules/sampleModule2/salesDashboard/chartViewPanel/component.js
index 88d3234..2789d18 100644
--- a/src/modules/sampleModule2/salesDashboard/chartViewPanel/component.js
+++ b/src/modules/sampleModule2/salesDashboard/chartViewPanel/component.js
@@ -1,7 +1,7 @@
-define([ '_boiler_', 'text!./view.html'],function( Boiler, viewText) {
+define([ 'Boiler', 'text!./view.html'],function( Boiler, viewText) {
var Component = function(vm, parentEl) {
- var panel = new Boiler.UiPanel(viewText, parentEl);
+ var panel = new Boiler.UiPanel(viewText, parentEl);
ko.applyBindings(vm, panel.getDomElement());
return{
diff --git a/src/modules/sampleModule2/salesDashboard/component.js b/src/modules/sampleModule2/salesDashboard/component.js
index dcbe9a4..85d8eb0 100644
--- a/src/modules/sampleModule2/salesDashboard/component.js
+++ b/src/modules/sampleModule2/salesDashboard/component.js
@@ -1,4 +1,4 @@
-define([ '_boiler_', 'text!./view.html', './chartViewPanel/component', './treeViewPanel/component' ],
+define([ 'Boiler', 'text!./view.html', './chartViewPanel/component', './treeViewPanel/component' ],
function(Boiler, parentViewText, ChartViewComponent, TreeViewComponent) {
var Component = function(parentEl, vm) {
diff --git a/src/modules/sampleModule2/salesDashboard/treeViewPanel/component.js b/src/modules/sampleModule2/salesDashboard/treeViewPanel/component.js
index 355c3f3..f43cba2 100644
--- a/src/modules/sampleModule2/salesDashboard/treeViewPanel/component.js
+++ b/src/modules/sampleModule2/salesDashboard/treeViewPanel/component.js
@@ -1,8 +1,8 @@
-define([ '_boiler_', 'text!./view.html'],function( Boiler, viewText) {
+define([ 'Boiler', 'text!./view.html'],function( Boiler, viewText) {
var Component = function(vm, parentEl) {
- var panel = new Boiler.UiPanel(viewText, parentEl);
+ var panel = new Boiler.UiPanel(viewText, parentEl);
ko.applyBindings(vm, panel.getDomElement());
return{
diff --git a/tests/tests.js b/tests/tests.js
index 808c790..05ee124 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -1,21 +1,21 @@
-require.config({
- baseUrl : "../src/", //we will set the application's src folder as the base url
-});
-
-require.config({
- paths : {
- text : './libs/require/text',
- order : './libs/require/order',
- i18n : './libs/require/i18n',
-
- _boiler_ : './core/_boiler_'
- }
-});
-
-
-require([
- '../tests/core/helpers/settings',
- '../tests/core/helpers/router' ,
- '../tests/core/helpers/mediator'
-
-], function() {});
+require.config({
+ baseUrl : "../src/", //we will set the application's src folder as the base url
+});
+
+require.config({
+ paths : {
+ text : './libs/require/text',
+ order : './libs/require/order',
+ i18n : './libs/require/i18n',
+
+ Boiler : './core/Boiler'
+ }
+});
+
+
+require([
+ '../tests/core/helpers/settings',
+ '../tests/core/helpers/router' ,
+ '../tests/core/helpers/mediator'
+
+], function() {});
diff --git a/tools/documentation/README.md b/tools/documentation/README.md
new file mode 100644
index 0000000..ffe0e69
--- /dev/null
+++ b/tools/documentation/README.md
@@ -0,0 +1,3 @@
+Download and install Node.js
+Run npm -g install yuidocjs
+Run document.bat (via Command line or by double clicking)
\ No newline at end of file
diff --git a/tools/documentation/document.bat b/tools/documentation/document.bat
new file mode 100644
index 0000000..419fa4b
--- /dev/null
+++ b/tools/documentation/document.bat
@@ -0,0 +1,6 @@
+set CURRENTDIR=%CD%
+cd ../..
+yuidoc --themedir %CURRENTDIR%\template -o %CURRENTDIR%\docs src
+cd \
+echo %CD%
+cd %CURRENTDIR%
\ No newline at end of file
diff --git a/tools/documentation/template/assets/css/external-small.png b/tools/documentation/template/assets/css/external-small.png
new file mode 100644
index 0000000..759a1cd
Binary files /dev/null and b/tools/documentation/template/assets/css/external-small.png differ
diff --git a/tools/documentation/template/assets/css/logo.png b/tools/documentation/template/assets/css/logo.png
new file mode 100644
index 0000000..b7689e3
Binary files /dev/null and b/tools/documentation/template/assets/css/logo.png differ
diff --git a/tools/documentation/template/assets/css/main.css b/tools/documentation/template/assets/css/main.css
new file mode 100644
index 0000000..5b6e4db
--- /dev/null
+++ b/tools/documentation/template/assets/css/main.css
@@ -0,0 +1,429 @@
+/*
+Font sizes for all selectors other than the body are given in percentages,
+with 100% equal to 13px. To calculate a font size percentage, multiply the
+desired size in pixels by 7.6923076923.
+
+Here's a quick lookup table:
+
+10px - 76.923%
+11px - 84.615%
+12px - 92.308%
+13px - 100%
+14px - 107.692%
+15px - 115.385%
+16px - 123.077%
+17px - 130.769%
+18px - 138.462%
+19px - 146.154%
+20px - 153.846%
+*/
+
+html {
+ background: #fff;
+ color: #333;
+ overflow-y: scroll;
+}
+
+body {
+ font: 13px/1.4 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', 'Bitstream Vera Sans', 'Helvetica', 'Arial', sans-serif;
+ margin: 0;
+ padding: 0;
+}
+
+/* -- Links ----------------------------------------------------------------- */
+a {
+ color: #356de4;
+ text-decoration: none;
+}
+
+a:hover { text-decoration: underline; }
+
+/* "Jump to Table of Contents" link is shown to assistive tools, but hidden from
+ sight until it's focused. */
+.jump {
+ position: absolute;
+ padding: 3px 6px;
+ left: -99999px;
+ top: 0;
+}
+
+.jump:focus { left: 40%; }
+
+/* -- Paragraphs ------------------------------------------------------------ */
+p { margin: 1.3em 0; }
+dd p, td p { margin-bottom: 0; }
+dd p:first-child, td p:first-child { margin-top: 0; }
+
+/* -- Headings -------------------------------------------------------------- */
+h1, h2, h3, h4, h5, h6 {
+ color: #D98527;/*was #f80*/
+ font-family: 'Trebuchet MS', sans-serif;
+ font-weight: bold;
+ line-height: 1.1;
+ margin: 1.1em 0 0.5em;
+}
+
+h1 {
+ font-size: 184.6%;
+ color: #30418C;
+ margin: 0.75em 0 0.5em;
+}
+
+h2 {
+ font-size: 153.846%;
+ color: #E48A2B;
+}
+
+h3 { font-size: 138.462%; }
+
+h4 {
+ border-bottom: 1px solid #DBDFEA;
+ color: #E48A2B;
+ font-size: 115.385%;
+ font-weight: normal;
+ padding-bottom: 2px;
+}
+
+h5, h6 { font-size: 107.692%; }
+
+/* -- Code and examples ----------------------------------------------------- */
+code, kbd, pre, samp {
+ font-family: Menlo, Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;
+ font-size: 92.308%;
+ line-height: 1.35;
+}
+
+p code, p kbd, p samp {
+ background: #FCFBFA;
+ border: 1px solid #EFEEED;
+ padding: 0 3px;
+}
+
+a code, a kbd, a samp,
+pre code, pre kbd, pre samp,
+table code, table kbd, table samp,
+.intro code, .intro kbd, .intro samp,
+.toc code, .toc kbd, .toc samp {
+ background: none;
+ border: none;
+ padding: 0;
+}
+
+pre.code, pre.terminal, pre.cmd {
+ overflow-x: auto;
+ *overflow-x: scroll;
+ padding: 0.3em 0.6em;
+}
+
+pre.code {
+ background: #FCFBFA;
+ border: 1px solid #EFEEED;
+ border-left-width: 5px;
+}
+
+pre.terminal, pre.cmd {
+ background: #F0EFFC;
+ border: 1px solid #D0CBFB;
+ border-left: 5px solid #D0CBFB;
+}
+
+/* Don't reduce the font size of Caveats: please properly escape less-thans. x<y
+ instead of x<y, and use " instead of
+ " for string delimiters.// elements inside
+
+
+ blocks. */
+pre code, pre kbd, pre samp { font-size: 100%; }
+
+/* Used to denote text that shouldn't be selectable, such as line numbers or
+ shell prompts. Guess which browser this doesn't work in. */
+.noselect {
+ -moz-user-select: -moz-none;
+ -khtml-user-select: none;
+ -webkit-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+}
+
+/* -- Lists ----------------------------------------------------------------- */
+dd { margin: 0.2em 0 0.7em 1em; }
+dl { margin: 1em 0; }
+dt { font-weight: bold; }
+
+/* -- Tables ---------------------------------------------------------------- */
+caption, th { text-align: left; }
+
+table {
+ border-collapse: collapse;
+ width: 100%;
+}
+
+td, th {
+ border: 1px solid #fff;
+ padding: 5px 12px;
+ vertical-align: top;
+}
+
+td { background: #E6E9F5; }
+td dl { margin: 0; }
+td dl dl { margin: 1em 0; }
+td pre:first-child { margin-top: 0; }
+
+th {
+ background: #D2D7E6;/*#97A0BF*/
+ border-bottom: none;
+ border-top: none;
+ color: #000;/*#FFF1D5*/
+ font-family: 'Trebuchet MS', sans-serif;
+ font-weight: bold;
+ line-height: 1.3;
+ white-space: nowrap;
+}
+
+
+/* -- Layout and Content ---------------------------------------------------- */
+#doc {
+ margin: auto;
+ min-width: 1024px;
+}
+
+#main { width: 754px; }
+#sidebar { width: 270px; margin: 0 15px; }
+
+.content { padding: 0 20px 0 25px; }
+
+/* -- Sidebar --------------------------------------------------------------- */
+.sidebox {
+ background: #F9F9FC;/*E6E9F5*/
+ border: 1px solid #D4D8EB;
+
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ -moz-box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
+ -webkit-box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
+ box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
+ font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', 'Helvetica', 'Arial', sans-serif;
+ margin: 0 0 15px 0;
+ padding-bottom: 1px;
+}
+
+.sidebox h2 {
+ background: #E5E6F1;
+ -moz-border-radius: 4px 4px 0 0;
+ -webkit-border-radius: 4px 4px 0 0;
+ border-radius: 4px 4px 0 0;
+ color: #5E6BA4;
+ font-weight: bold;
+ font-size: 107.692%;
+ margin: 0;
+ padding: 4px 7px 5px;
+}
+
+.sidebox .bd {
+ font-size: 84.615%;
+ padding: 0 5px 0 8px;
+}
+
+.sidebox li { list-style-type: disc; color:#D4D5E3; }
+
+.sidebox ol, .sidebox ul {
+ margin-left: 0;
+ padding-left: 16px;
+}
+
+.sidebox ol ol, .sidebox ol ul,
+.sidebox ul ol, .sidebox ul ul {
+ margin: 0;
+ padding-left: 16px;
+}
+
+/* -- Table of Contents ----------------------------------------------------- */
+
+/* The #toc id refers to the single global table of contents, while the .toc
+ class refers to generic TOC lists that could be used throughout the page. */
+
+.toc code, .toc kbd, .toc samp { font-size: 100%; }
+.toc li { font-weight: bold; }
+.toc li li { font-weight: normal; }
+
+/* -- Intro and Example Boxes ----------------------------------------------- */
+.intro, .example { margin-bottom: 2em; }
+
+.example {
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ -moz-box-shadow: 0 0 5px #bfbfbf;
+ -webkit-box-shadow: 0 0 5px #bfbfbf;
+ box-shadow: 0 0 5px #bfbfbf;
+ padding: 1em;
+}
+
+.intro {
+ background: none repeat scroll 0 0 #F0F1F8; border: 1px solid #D4D8EB; padding: 0 1em;
+}
+
+/* -- Other Styles ---------------------------------------------------------- */
+
+/* These are probably YUI-specific, and should be moved out of Selleck's default
+ theme. */
+
+.button {
+ border: 1px solid #dadada;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ color: #444;
+ display: inline-block;
+ font-family: Helvetica, Arial, sans-serif;
+ font-size: 92.308%;
+ font-weight: bold;
+ padding: 4px 13px 3px;
+ -moz-text-shadow: 1px 1px 0 #fff;
+ -webkit-text-shadow: 1px 1px 0 #fff;
+ text-shadow: 1px 1px 0 #fff;
+ white-space: nowrap;
+
+ background: #EFEFEF; /* old browsers */
+ background: -moz-linear-gradient(top, #f5f5f5 0%, #efefef 50%, #e5e5e5 51%, #dfdfdf 100%); /* firefox */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(50%,#efefef), color-stop(51%,#e5e5e5), color-stop(100%,#dfdfdf)); /* webkit */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#dfdfdf',GradientType=0 ); /* ie */
+}
+
+.button:hover {
+ border-color: #466899;
+ color: #fff;
+ text-decoration: none;
+ -moz-text-shadow: 1px 1px 0 #222;
+ -webkit-text-shadow: 1px 1px 0 #222;
+ text-shadow: 1px 1px 0 #222;
+
+ background: #6396D8; /* old browsers */
+ background: -moz-linear-gradient(top, #6396D8 0%, #5A83BC 50%, #547AB7 51%, #466899 100%); /* firefox */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6396D8), color-stop(50%,#5A83BC), color-stop(51%,#547AB7), color-stop(100%,#466899)); /* webkit */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6396D8', endColorstr='#466899',GradientType=0 ); /* ie */
+}
+
+.newwindow { text-align: center; }
+
+.header .version em {
+ display: block;
+ text-align: right;
+}
+
+.yui3-skin-sam #classdocs .yui3-tabview-panel {
+ background-color: transparent;
+}
+
+.yui3-skin-sam #classdocs .yui3-tabview-panel {
+ border: none;
+}
+
+.yui3-skin-sam .yui3-tabview .yui3-tab,
+.yui3-skin-sam .yui3-tabview .yui3-tab-selected,
+.yui3-skin-sam .yui3-tabview .yui3-tab-hover {
+ background: -moz-linear-gradient(center top , #F4F0EC 0%, #D6D2CE 100%) repeat scroll 0 0 transparent;
+ border-bottom: 1px solid #DEDCD9;
+ border-right: 1px solid #CDCBC8;
+ border-left: 1px solid #CDCBC8;
+ border-top: 1px solid #DADADA;
+ color: #333333;
+ text-decoration: none;
+}
+.yui3-skin-sam .yui3-tabview .yui3-tab-label,
+.yui3-skin-sam .yui3-tabview .yui3-tab-selected .yui3-tab-label {
+ border: none;
+ background: none;
+ font-size: 100%;
+ color: #000;
+}
+
+.yui3-skin-sam .yui3-tabview .yui3-tab-selected,
+.yui3-skin-sam .yui3-tabview .yui3-tab-hover {
+ background: none;
+ background-color: #fff;
+ border-bottom-color: #FFFFFF;
+ border-top: 2px solid #8193C9;
+ font-weight: bold;
+ color: #000;
+
+}
+
+.yui3-skin-sam .yui3-tabview-list {
+ border-color: #DFDFDF;
+ border-width: 0 0 1px;
+}
+
+
+a.external {
+ background-image: url(external-small.png);
+ background-repeat: no-repeat;
+ background-position: 0 0;
+ padding-left: 16px;
+}
+
+#classdocs .item {
+ border-bottom: 1px solid #466899;
+ margin: 1em 0;
+ padding: 1.5em;
+}
+
+#classdocs .item .params p,
+ #classdocs .item .returns p,{
+ display: inline;
+}
+
+#classdocs .item em code, #classdocs .item em.comment {
+ color: green;
+}
+
+#classdocs .item em.comment a {
+ color: green;
+ text-decoration: underline;
+}
+
+#classdocs .foundat {
+ font-size: 11px;
+ font-style: normal;
+}
+
+.attrs .emits {
+ margin-left: 2em;
+ padding: .5em;
+ border-left: 1px dashed #ccc;
+}
+
+abbr {
+ border-bottom: 1px dashed #ccc;
+ font-size: 80%;
+ cursor: help;
+}
+
+.prettyprint li.L0,
+.prettyprint li.L1,
+.prettyprint li.L2,
+.prettyprint li.L3,
+.prettyprint li.L5,
+.prettyprint li.L6,
+.prettyprint li.L7,
+.prettyprint li.L8 {
+ list-style: decimal;
+}
+
+ul li p {
+ margin-top: 0;
+}
+
+.method .name {
+ font-size: 110%;
+}
+
+#hd {
+ background: -moz-linear-gradient(center top , #DCDBD9 0%, #F6F5F3 100%) repeat scroll 0 0 transparent;
+ border-bottom: 1px solid #DFDFDF;
+ padding: 0 15px 1px 20px;
+ margin-bottom: 15px;
+}
+
+#hd img {
+ margin-right: 10px;
+ vertical-align: middle;
+}
+
diff --git a/tools/documentation/template/assets/js/tabs.js b/tools/documentation/template/assets/js/tabs.js
new file mode 100644
index 0000000..77ab37c
--- /dev/null
+++ b/tools/documentation/template/assets/js/tabs.js
@@ -0,0 +1,38 @@
+YUI({
+ insertBefore: 'site_styles'
+}).use('tabview', function(Y) {
+ var classdocs = Y.one('#classdocs'),
+ tabviewIndexTable = {};
+ if (classdocs) {
+ if (classdocs.all('li').size()) {
+ var tabview = new Y.TabView({ srcNode: classdocs });
+ tabview.render();
+ classdocs.all('li a').each(function (item, index) {
+ var hash = item.get(['hash']);
+ type = hash.substring(1);
+ if (!tabviewIndexTable[type]) {
+ tabviewIndexTable[type] = index;
+ }
+ })
+ Y.all('.sidebox.on-page').each(function (item, index) {
+ var children = item.all('li a');
+ children.each(function (cItem, cIndex) {
+ return function () {
+ var handleClick = function (e) {
+ var node = Y.one(this),
+ hash = node.get(['hash']),
+ hashValue = hash.substring(1).split('_'),
+ type = hashValue.shift(),
+ ogKey = hashValue.join('_'); // in case the hash had other underscores
+ if (tabviewIndexTable[type] > -1 && tabviewIndexTable[type] !== currentTab) {
+ currentTab = tabviewIndexTable[type];
+ tabview.selectChild(tabviewIndexTable[type]);
+ }
+ }
+ Y.on('click', handleClick, cItem)
+ }()
+ })
+ });
+ }
+ }
+});
diff --git a/tools/documentation/template/assets/js/yui-prettify.js b/tools/documentation/template/assets/js/yui-prettify.js
new file mode 100644
index 0000000..18de864
--- /dev/null
+++ b/tools/documentation/template/assets/js/yui-prettify.js
@@ -0,0 +1,17 @@
+YUI().use('node', function(Y) {
+ var code = Y.all('.prettyprint.linenums');
+ if (code.size()) {
+ code.each(function(c) {
+ var lis = c.all('ol li'),
+ l = 1;
+ lis.each(function(n) {
+ n.prepend('');
+ l++;
+ });
+ });
+ var h = location.hash;
+ location.hash = '';
+ h = h.replace('LINE_', 'LINENUM_');
+ location.hash = h;
+ }
+});
diff --git a/tools/documentation/template/assets/vendor/prettify/CHANGES.html b/tools/documentation/template/assets/vendor/prettify/CHANGES.html
new file mode 100644
index 0000000..b50b841
--- /dev/null
+++ b/tools/documentation/template/assets/vendor/prettify/CHANGES.html
@@ -0,0 +1,130 @@
+
+
+
+
Known Issues
+
+
+
+ <code>
elements with newlines in the text
+ which use CSS to specify white-space:pre
will have the newlines
+ improperly stripped if the element is not attached to the document at the time
+ the stripping is done. Also, on IE 6, all newlines will be stripped from
+ <code>
elements because of the way IE6 produces
+ innerHTML
. Workaround: use <pre>
for code with
+ newlines.
+ Change Log
+ 29 March 2007
+
+
+ prettyPrintOne
was not halting. This was not
+ reachable through the normal entry point.
+
+
+ is no longer applicable.
+ 4 Jul 2008
+
+
+ lang-<language-file-extension>
'''string'''
+ /
in regex [charsets] should not end regex
+ 5 Jul 2008
+
+
nocode
spans to allow embedding of line
+ numbers and code annotations which should not be styled or otherwise
+ affect the tokenization of prettified code.
+ See the issue 22
+ testcase.
+ <code>
blocks with embedded newlines.
+  
instead of
+
so that the output works when embedded in XML.
+ Bug
+ 108.+<link href="prettify.css" type="text/css" rel="stylesheet" /> +<script type="text/javascript" src="prettify.js"></script>+
onload="prettyPrint()"
to your
+ document's body tag.
+ Put code snippets in + <pre class="prettyprint">...</pre> + or <code class="prettyprint">...</code> + and it will automatically be pretty printed. + +
The original + | Prettier + |
---|---|
class Voila { +public: + // Voila + static const string VOILA = "Voila"; + + // will not interfere with embedded tags. +}+ + | class Voila { +public: + // Voila + static const string VOILA = "Voila"; + + // will not interfere with embedded tags. +}+ |
The comments in prettify.js are authoritative but the lexer + should work on a number of languages including C and friends, + Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles. + It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl + and Ruby, but, because of commenting conventions, doesn't work on + Smalltalk, or CAML-like languages.
+ +LISPy languages are supported via an extension:
+ lang-lisp.js
.
And similarly for
+ CSS
,
+ Haskell
,
+ Lua
,
+ OCAML, SML, F#
,
+ Visual Basic
,
+ SQL
,
+ Protocol Buffers
, and
+ WikiText
..
+
+
If you'd like to add an extension for your favorite language, please + look at src/lang-lisp.js and file an + issue including your language extension, and a testcase.
+ +You don't need to specify the language since prettyprint()
+ will guess. You can specify a language by specifying the language extension
+ along with the prettyprint
class like so:
<pre class="prettyprint lang-html"> + The lang-* class specifies the language file extensions. + File extensions supported by default include + "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html", + "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh", + "xhtml", "xml", "xsl". +</pre>+ +
Yes. Prettifying obfuscated code is like putting lipstick on a pig + — i.e. outside the scope of this tool.
+ +It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4. + Look at the test page to see if it + works in your browser.
+ +See the change log
+ +Apparently wordpress does "smart quoting" which changes close quotes. + This causes end quotes to not match up with open quotes. +
This breaks prettifying as well as copying and pasting of code samples. + See + WordPress's help center for info on how to stop smart quoting of code + snippets.
+ +You can use the linenums
class to turn on line
+ numbering. If your code doesn't start at line number 1, you can
+ add a colon and a line number to the end of that class as in
+ linenums:52
.
+
+
For example +
<pre class="prettyprint linenums:4" +>// This is line 4. +foo(); +bar(); +baz(); +boo(); +far(); +faz(); +<pre>+ produces +
// This is line 4. +foo(); +bar(); +baz(); +boo(); +far(); +faz(); ++ +
You can use the nocode
class to identify a span of markup
+ that is not code.
+
<pre class=prettyprint> +int x = foo(); /* This is a comment <span class="nocode">This is not code</span> + Continuation of comment */ +int y = bar(); +</pre>+produces +
+int x = foo(); /* This is a comment This is not code
+ Continuation of comment */
+int y = bar();
+
+
+ For a more complete example see the issue22 + testcase.
+ +If you are calling prettyPrint
via an event handler, wrap it in a function.
+ Instead of doing
+
+ addEventListener('load', prettyPrint, false);
+
+ wrap it in a closure like
+
+ addEventListener('load', function (event) { prettyPrint() }, false);
+
+ so that the browser does not pass an event object to prettyPrint
which
+ will confuse it.
+
+ =0;){var e=p.indexOf(";",k);if(e>=0){var h=p.substring(k+3,e),g=10;if(h&&h.charAt(0)==="x"){h=h.substring(1);g=16}var s=parseInt(h,g);isNaN(s)||(p=p.substring(0,k)+String.fromCharCode(s)+p.substring(e+1))}}a=p.replace(ea,"<").replace(fa,">").replace(ga,"'").replace(ha,'"').replace(ia," ").replace(ja, +"&")}f.push(a);n+=a.length}}o={source:f.join(""),h:r};var v=o.source;b.source=v;b.c=0;b.g=o.h;Q(i,v)(b);$(b)}catch(w){if("console"in window)console.log(w&&w.stack?w.stack:w)}}var A="str",R="kwd",C="com",S="typ",J="lit",E="pun",z="pln",P="src",V="nocode",Z=function(){for(var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=", +"~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],f="(?:^^|[+-]",i=0;i:&a-z])/g,"\\$1");f+=")\\s*";return f}(),L=/&/g,M=//g,X=/\"/g,ea=/</g,fa=/>/g,ga=/'/g,ha=/"/g,ja=/&/g,ia=/ /g,ka=/[\r\n]/g,K=null,aa=RegExp("[^<]+|