Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Controller with Mixins. #475

Merged
merged 1 commit into from
Nov 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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