Skip to content

Commit

Permalink
refactor Controller with Mixins.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgee committed Oct 29, 2015
1 parent 711693a commit b6932a1
Show file tree
Hide file tree
Showing 7 changed files with 866 additions and 608 deletions.
74 changes: 49 additions & 25 deletions viewer/js/config/app.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,57 @@
(function () {
'use strict';

// globel dojoConfig is required for async loading of gmaps api
var path = location.pathname.replace(/[^\/]+$/, '');
window.dojoConfig = {
async: true,
packages: [{
name: 'viewer',
location: location.pathname.replace(/[^\/]+$/, '') + 'js/viewer'
}, {
name: 'config',
location: location.pathname.replace(/[^\/]+$/, '') + 'js/config'
}, {
name: 'gis',
location: location.pathname.replace(/[^\/]+$/, '') + 'js/gis'
}]
packages: [
{
name: 'viewer',
location: path + 'js/viewer'
}, {
name: 'gis',
location: path + 'js/gis'
}, {
name: 'config',
location: path + 'js/config'
}
]
};

// get the config file from the url if present
var file = 'config/viewer',
s = window.location.search,
q = s.match(/config=([^&]*)/i);
if (q && q.length > 0) {
file = q[1];
if (file.indexOf('/') < 0) {
file = 'config/' + file;
}
}

require(window.dojoConfig, ['viewer/Controller', file, 'dojo/domReady!'], function (Controller, config) {
Controller.startup(config);
require(window.dojoConfig, [
'dojo/_base/declare',

// minimal Base Controller
'viewer/_ControllerBase',

// *** Controller Mixins
// Use the core mixins, add custom mixins
// or replace core mixins with your own
'viewer/_ConfigMixin', // manage the Configuration
'viewer/_LayoutMixin', // build and manage the Page Layout and User Interface
'viewer/_MapMixin', // build and manage the Map
'viewer/_WidgetsMixin' // build and manage the Widgets

//'config/_customMixin'

], function (
declare,

_ControllerBase,
_ConfigMixin,
_LayoutMixin,
_MapMixin,
_WidgetsMixin

//_MyCustomMixin

) {
var controller = new (declare([
_ControllerBase,
_ConfigMixin,
_LayoutMixin,
_MapMixin,
_WidgetsMixin
]))();
controller.startup();
});
})();
Loading

0 comments on commit b6932a1

Please sign in to comment.