blob: 0a65a3f4c5f8881743c0275230272d0309efdf86 [file] [log] [blame]
Akron52ed22d2018-07-11 17:05:19 +02001<!DOCTYPE html>
2<html>
3 <head>
Akron537bc522018-07-13 19:06:27 +02004 <title>Panel and ButtonGroup demo</title>
Akron52ed22d2018-07-11 17:05:19 +02005 <meta charset="utf-8" />
6 <script src="../js/lib/require.js" async="async"></script>
7 <link type="text/css" rel="stylesheet" href="../css/kalamar.css" />
8 </head>
9 <body>
Akron537bc522018-07-13 19:06:27 +020010 <nav id="mainButton" style="position: absolute; width: 100%; top: 150px"></nav>
Akron52ed22d2018-07-11 17:05:19 +020011 </body>
12 <script>
13requirejs.config({
14 baseUrl: '../js/src',
15 paths : {
16 'lib': '../lib'
17 }
18});
19
20
Akron537bc522018-07-13 19:06:27 +020021require(['buttongroup', 'panel','view'], function (btnClass, panelClass, viewClass) {
Akron3967d342018-07-14 08:35:12 +020022 var panel = panelClass.create('up');
Akron537bc522018-07-13 19:06:27 +020023 var actions = panel.actions;
24 actions.add('Meta',['meta'], function () {
Akron52ed22d2018-07-11 17:05:19 +020025 console.log(this.button.classList.contains('meta'));
Akron537bc522018-07-13 19:06:27 +020026 view = viewClass.create();
27 panel.add(view);
Akron52ed22d2018-07-11 17:05:19 +020028 });
Akron537bc522018-07-13 19:06:27 +020029 var list = actions.addList('More', ['list']);
Akron52ed22d2018-07-11 17:05:19 +020030 list.readItems([
31 ['cool', 'cool', function (e, action) { console.log('really' + this.action()) }],
32 ['very cool', 'veryCool', function (e, action) { console.log('very cool') }]
33 ]);
Akron537bc522018-07-13 19:06:27 +020034
35 document.getElementById('mainButton').appendChild(panel.element());
Akron52ed22d2018-07-11 17:05:19 +020036});
37
38
39 </script>
40</html>