From f80727a344d08ba0e801fd11d833ee6cf001d8f3 Mon Sep 17 00:00:00 2001 From: kbparagua Date: Tue, 5 Mar 2013 07:04:07 +0800 Subject: [PATCH] New templates --- app/templates/_filters.js | 14 ++++++++++++++ app/templates/application/_locals.js | 13 +++++++++++++ app/templates/controller/_locals.js | 19 +++++++++++++++++++ app/templates/controller/_manifest.js | 3 +++ app/templates/controller/action.js | 23 +++++++++++++++++++++++ app/templates/namespace/_locals.js | 16 ++++++++++++++++ app/templates/namespace/_manifest.js | 2 ++ 7 files changed, 90 insertions(+) create mode 100644 app/templates/_filters.js create mode 100644 app/templates/application/_locals.js create mode 100644 app/templates/controller/_locals.js create mode 100644 app/templates/controller/_manifest.js create mode 100644 app/templates/controller/action.js create mode 100644 app/templates/namespace/_locals.js create mode 100644 app/templates/namespace/_manifest.js diff --git a/app/templates/_filters.js b/app/templates/_filters.js new file mode 100644 index 0000000..949ab47 --- /dev/null +++ b/app/templates/_filters.js @@ -0,0 +1,14 @@ +(function(){ + // Initializes the main container for all filters and skippers for this + // specific scope. + var filter = new Paloma.FilterScope(':scope'); + + // The _x object is also available on callbacks. + // You can make a variable visible on callbacks by using _x here. + // + // Example: + // _x.visibleOnCallback = "I'm a shared variable" + var _x = Paloma.variableContainer; + + // ~> Start definitions here and remove this line. +})(); \ No newline at end of file diff --git a/app/templates/application/_locals.js b/app/templates/application/_locals.js new file mode 100644 index 0000000..291b257 --- /dev/null +++ b/app/templates/application/_locals.js @@ -0,0 +1,13 @@ +(function(){ + // Initializes locals container for the global scope. + // All _locals.js file will inherit all locals here by default. + // + // Define a local by adding property to 'locals'. + // + // Example: + // locals.localMethod = function(){}; + var locals = Paloma.locals['/'] = {}; + + + // ~> Start local definitions here and remove this line. +})(); \ No newline at end of file diff --git a/app/templates/controller/_locals.js b/app/templates/controller/_locals.js new file mode 100644 index 0000000..1405082 --- /dev/null +++ b/app/templates/controller/_locals.js @@ -0,0 +1,19 @@ +(function(){ + // Initializes callbacks container for the this specific scope. + Paloma.callbacks[':controller_path'] = {}; + + // Initializes locals container for this specific scope. + // Define a local by adding property to 'locals'. + // + // Example: + // locals.localMethod = function(){}; + var locals = Paloma.locals[':controller_path'] = {}; + + + // ~> Start local definitions here and remove this line. + + + // Remove this line if you don't want to inherit locals defined + // on parent's _locals.js + Paloma.inheritLocals({from : ':namespace', to : ':controller'}); +})(); \ No newline at end of file diff --git a/app/templates/controller/_manifest.js b/app/templates/controller/_manifest.js new file mode 100644 index 0000000..cfaa921 --- /dev/null +++ b/app/templates/controller/_manifest.js @@ -0,0 +1,3 @@ +//= require ./_locals.js +//= require ./_filters.js +//= require_tree . diff --git a/app/templates/controller/action.js b/app/templates/controller/action.js new file mode 100644 index 0000000..0b4f7f9 --- /dev/null +++ b/app/templates/controller/action.js @@ -0,0 +1,23 @@ +(function(){ + // You access variables from before/around filters from _x object. + // You can also share variables to after/around filters through _x object. + var _x = Paloma.variableContainer; + + // We are using _L as an alias for the locals container. + // Use either of the two to access locals from other scopes. + // + // Example: + // _L.otherController.localVariable = 100; + var _L = Paloma.locals; + + // Access locals for the current scope through the _l object. + // + // Example: + // _l.localMethod(); + var _l = _L[':controller_path']; + + + Paloma.callbacks[':controller_path'][':action'] = function(params){ + // Do something here. + }; +})(); \ No newline at end of file diff --git a/app/templates/namespace/_locals.js b/app/templates/namespace/_locals.js new file mode 100644 index 0000000..3029a84 --- /dev/null +++ b/app/templates/namespace/_locals.js @@ -0,0 +1,16 @@ +(function(){ + // Initializes locals container for this specific scope. + // Define a local by adding property to 'locals'. + // + // Example: + // locals.localMethod = function(){}; + var locals = Paloma.locals[':namespace'] = {}; + + + // ~> Start local definitions here and remove this line. + + + // Remove this line if you don't want to inherit locals defined + // on parent's _locals.js + Paloma.inheritLocals({from : '/', to : ':namespace'}); +})(); \ No newline at end of file diff --git a/app/templates/namespace/_manifest.js b/app/templates/namespace/_manifest.js new file mode 100644 index 0000000..ee30f5f --- /dev/null +++ b/app/templates/namespace/_manifest.js @@ -0,0 +1,2 @@ +//= require ./_locals.js +//= require ./_filters.js \ No newline at end of file