or
<
authentication
mode
=
"None"
>
<
forms
loginUrl
=
"~/#/Public/Accueil"
timeout
=
"90"
slidingExpiration
=
"true"
requireSSL
=
"true"
/>
</
authentication
>
define(['jquery', 'lib/pubsub'],
function ($, pubsub) {
// Index
var publicAccueil =
{
url: "/Public/Accueil",
activate: function () {
var that = this;
require(['app/Public/Accueil'], function () { renderView(that); });
},
html: null
};
// MDPOublie
var publicMDPOublie =
{
url: "/Public/MDPOublie",
activate: function () {
var that = this;
require(['app/Public/MDPOublie'], function () { renderView(that); });
},
html: null
};
// Profil
var privateProfile =
{
url: "/Private/Profile",
activate: function () {
var that = this;
require(['app/Private/Profile'], function () { renderView(that); });
},
html: null
};
var renderView = function(view, id, params) {
$.publish("viewActivated", [ view, id, params ]);
};
return {
publicAccueil: publicAccueil,
publicMDPOublie: publicMDPOublie,
privateProfile: privateProfile,
};
});
define([
'jquery',
'kendo',
'app/route-config',
'app/Code52'
], function ($, kendo, routeConfig, Code52) {
var router = new kendo.Router({
routeMissing: function (e) { alert("Route not defined : " + e.url); },
change: function (e) {
kendo.destroy("#content");
}
});
//Default route
router.route("/", function() {
var cheminUrl = window.location.pathname;
if (cheminUrl === "/") {
router.navigate(routeConfig.publicAccueil.url);
}
});
router.route(routeConfig.publicAccueil.url, function () { routeConfig.publicAccueil.activate(); });
router.route(routeConfig.publicMDPOublie.url, function () { routeConfig.publicMDPOublie.activate(); });
router.route(routeConfig.privateProfile.url, function () { routeConfig.privateProfile.activate(); });
(function () {
require.config({
deps: ["js/jquery"]
});
require(['app'], function(App){
App.start();
});
})();
define([
'kendo/js/kendo.all.min',
'controllers/ListController'
], function (kendo, list) {
var router = new kendo.Router({
routeMissing: function (e) {
console.log('No Route Found', e.url);
}
});
router.route("list/(:id)", function(id) {
var myIdParameter = id;
// TODO Find a way to pass the myIdParameter to the view I'm about to render.
// Render the view in the "app" div
list.render("#app");
});
return router;
});
define(['kendo/js/kendo.all.min'], function (kendo) {
// TODO I would like to have the "1234" value passed from the route parameter
var viewModel = kendo.observable({
id: "1234"
});
var options = {
model: viewModel
};
return new kendo.View(
"index",
options
);
});
<!DOCTYPE html>
<
html
>
<
head
>
<
title
>TestApp</
title
>
<
meta
charset
=
"utf-8"
/>
<
link
href
=
"js/libs/kendo/styles/kendo.common.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"css/main.css"
rel
=
"stylesheet"
/>
<
script
data-main
=
"js/main"
src
=
"js/libs/require.js"
></
script
>
</
head
>
<
body
>
<
noscript
>
<
h3
>Javascript muss aktiviert werden!</
h3
>
<
h3
>Javascript must be active!</
h3
>
</
noscript
>
<
h3
>TestApp</
h3
>
<
div
id
=
"app"
></
div
>
</
body
>
</
html
>
require.config({
paths: {
jquery :
"libs/kendo/js/jquery.min"
,
kendo :
"libs/kendo/js/kendo.all.min"
,
text :
"libs/text"
,
indexViewModel :
"models/m_index"
,
indexViewTemplate :
"views/v_index.html"
},
// inform requirejs that kendo ui depends on jquery
shim: {
"kendo"
: {
deps: [
"jquery"
]
}
}
});
require([
'jquery'
,
'kendo'
,
'myapp'
],
function
() {
var
$ = require(
'jquery'
);
var
kendo = require(
'kendo'
);
var
myapp = require(
'myapp'
);
var
App =
new
myapp();
App.init();
});
define(
function
()
{
var
myApp =
function
() {
var
constructor,
app = {},
// public class object of app
constructor =
function
() {
console.info(
'App constructor executed'
);
return
app;
};
app.init =
function
() {
console.info(
'App started'
);
// Here I want to enter the code which should create the view and load the template as text
// The view model should be a requureJS file and the template for the view should be loaded by
// require text plugin
};
return
constructor.apply(
null
, arguments);
};
return
myApp;
});