Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
// Example Widget
function(app, ns, data, utils){
    // Create Widget short name for local reference    exWdgt = {};

    // Use closures for private code    var testFunc();

    // Add all widget code to widget namespace.
    ns.WidgetModel = can.Model({...});
    ns.WidgetControl = can.Control({...});

    // Add an initialization function if the widget should be initialized externally
    ns.initWidget = function(/*params*/){...};

// Pass in external values that will be used by this code
}(
raft.app,              // The app namespace
raft.widgets.ExWidget, // The specific namespace to which the resulting objects and functions from this file will be added.
raft.data.ExWidget,    // The specific data namespace for this widget/page/object. Cached and local data  should go here
raft.utils             // The namespace containing app framework utilities
));

$(document).ready(function()){
    // Code to run when document is finished loading
}
Standard Page files and Naming

pages/PageName/PageNameDef.js: Creates namespace for page and data and optionally dynamically loads files required.

pages/PageName/PageName.css: Styles specific to this page

pages/PageName/PageNameModel.js: Models used by this page

pages/PageName/PageNameCtrl.js: Controllers used by this page

pages/PageName/PageNameView.ejs: Main page view template

pages/PageName/PageNameViews.ejs: Optional second/third/... view templates

Standard Widget files and Naming

widgets/WidgetName/WidgetNameDef.js: Creates namespace for widget and data and optionally dynamically loads files required.

widgets/WidgetName/WidgetName.css: Styles specific to this widget

widgets/WidgetName/WidgetNameModel.js: Models used by this widget

widgets/WidgetName/WidgetNameCtrl.js: Controllers used by this widget

widgets/WidgetName/WidgetNameView.ejs: Main widget view template

widgets/WidgetName/WidgetNameViews.ejs: Optional second/third/... view templates

Utilities

Helper Functions

...