Changeset 9112

Show
Ignore:
Timestamp:
06/13/08 12:21:27 (4 months ago)
Author:
matthias
Message:

* moved modules to seperate namespace, instead of having them all in modules.aida.*
* fixed bug: added missing loadHelpers function to controller.js

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/aida/demo-app/app/controllers/twitter_controller.js

    r9111 r9112  
    11importFromModule("aida.controller", "*"); 
    22 
    3 importModule("aida.twitter", "twitter"); 
     3importModule("knallgrau.twitter", "twitter"); 
    44importModule("helma.http", "http"); 
    5 importModule("aida.html", "html"); 
     5importModule("knallgrau.html", "html"); 
    66 
    7 importModule("aida.prototype", "prototype"); 
     7importModule("javascript.prototype"); 
    88 
    99function TwitterController(req, res, session) { 
  • sandbox/aida/demo-app/app/helpers/html_helpers.js

    r9100 r9112  
    11 
    2 importModule("aida.html", "html"); 
     2importModule("knallgrau.html", "html"); 
    33 
    44function __get__(name) { 
  • sandbox/aida/demo-app/config/environments/boot.js

    r9090 r9112  
    66importModule("helma.shell", "shell"); 
    77importFromModule("helma.file", "File"); 
    8  
    9  
  • sandbox/aida/modules/aida/controller.js

    r9111 r9112  
    11importModule('helma.skin'); 
    2 importModule('este'); 
    3 importModule('ejs'); 
    4 importModule('prototype'); 
     2importModule('templating.este', 'este'); 
     3importModule('templating.ejs', 'ejs'); 
     4importModule('javascript.prototype'); 
    55importModule('routing'); 
    66 
    7 importFromModule("loader", "loadHelpers"); 
    87importFromModule("config.environments.development", "config"); 
    98 
     
    369368   loadHelpers(this, module, namespace); 
    370369} 
     370 
     371importFromModule("helma.file", "File"); 
     372/** 
     373 * Loads and mount helpers from a file. 
     374 * Loads the helper file located at <tt>app/helpers/$name_helpers.js</tt> and 
     375 * adds it to the module. All loaded helpers will be available in the view. 
     376 * 
     377 * @param {object} module        controller module, where the helpers should be mounted 
     378 * @param {string} name          name of the helpers (file) 
     379 * @param {string} [namespace]   optional namespace, for the helpers which will be used in the view 
     380 * @return {object} helper module 
     381 */ 
     382function loadHelpers(module, name, namespace) { 
     383   // FIXME: 
     384   var helpersDir = new File(APP_DIR + "/app/helpers");    
     385   var helpersPattern = /^([a-z][a-z_\-0-9]*_helpers).js$/i; 
     386   var helpers; 
     387   if (!module.helpers) module.helpers = {}; 
     388    
     389   // load helpers 
     390   var helperFile = new File(helpersDir, name + "_helpers.js"); 
     391   if (helperFile.exists()) { 
     392      importModule("app.helpers." + name + "_helpers"); 
     393      helpers = app.helpers[name + "_helpers"]; 
     394      if (namespace) helpers._namespace = namespace; 
     395      module.helpers[name] = helpers;       
     396      shell.writeln("loaded helpers for " + module.__name__ + " from " + helperFile);       
     397   } 
     398    
     399   return helpers; 
     400} 
  • sandbox/aida/modules/aida/routing.js

    r9111 r9112  
    11importModule("helma.shell", "shell"); 
    2 importModule("prototype"); 
     2importModule("javascript.prototype"); 
    33 
    44__shared__ = true;