use templates in poll.js

pull/1/head
ansuz 8 years ago
parent bb74935b08
commit bdca6b10c2

@ -259,8 +259,7 @@ define([
]), ]),
]) ])
] ]
.concat(tryIt()) .concat(tryIt());
//.concat(indexContent());
}; };
var loadingScreen = function () { var loadingScreen = function () {
@ -427,5 +426,58 @@ define([
]; ];
}; };
Pages['/poll/'] = Pages['/poll/index.html'] = function () {
return [
appToolbar(),
h('div#content', [
h('div#poll', [
h('div#howItWorks', [
h('h1', 'CryptPoll'),
h('h2', Msg.poll_subtitle),
h('p', Msg.poll_p_save),
h('p', Msg.poll_p_encryption)
]),
h('div.upper', [
h('button#publish', {
style: { display: 'none' }
}, Msg.poll_publish_button),
h('button#admin', {
style: { display: 'none' },
title: Msg.poll_admin_button
}, Msg.poll_admin_button),
h('button#help', {
title: Msg.poll_show_help_button,
style: { display: 'none' }
}, Msg.poll_show_help_button)
]),
h('div.realtime', [
h('br'),
h('center', [
h('textarea#description', {
rows: "5",
cols: "50",
disabled: true
}),
h('br')
]),
h('div#tableContainer', [
h('div#tableScroll'),
h('button#create-user', {
title: Msg.poll_create_user
}, h('span.fa.fa-plus')),
h('button#create-option', {
title: Msg.poll_create_option
}, h('span.fa.fa-plus')),
h('button#commit', {
title: Msg.poll_commit
}, h('span.fa.fa-check'))
])
])
])
]),
loadingScreen()
];
};
return Pages; return Pages;
}); });

@ -119,11 +119,21 @@ $(function () {
if (isMainApp()) { if (isMainApp()) {
if (typeof(Pages[pathname]) === 'function') { if (typeof(Pages[pathname]) === 'function') {
$('body').html(h('body', Pages[pathname]()).innerHTML); $('body').html(h('body', Pages[pathname]()).innerHTML);
setTimeout(function () {
require(['/whiteboard/main.js'], function () { if (/whiteboard/.test(pathname)) {
$('body').removeClass('noscroll'); setTimeout(function () {
require(['/whiteboard/main.js'], function () {
$('body').removeClass('noscroll');
});
});
} else if (/poll/.test(pathname)) {
setTimeout(function () {
require(['/poll/main.js'], function () {
$('body').removeClass('noscroll');
console.log("TEMPLATE!");
});
}); });
}); }
return; return;
} }
} }

@ -9,48 +9,7 @@
data-main-favicon="/customize/main-favicon.png" data-main-favicon="/customize/main-favicon.png"
data-alt-favicon="/customize/alt-favicon.png" data-alt-favicon="/customize/alt-favicon.png"
id="favicon" /> id="favicon" />
<script data-bootload="main.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script> <script data-bootload="/customize/template.js" data-main="/common/boot.js" src="/bower_components/requirejs/require.js"></script>
</head> </head>
<body> <body>
<div id="toolbar" class="toolbar-container"></div>
<div id="content">
<div id="poll">
<div id="howItWorks">
<h1 id="mainTitle">CryptPoll</h1>
<h2 data-localization="poll_subtitle"></h2>
<p data-localization="poll_p_save"></p>
<p data-localization="poll_p_encryption"></p>
</div>
<div class="upper">
<button id="publish" data-localization-title="poll_publish_button" data-localization="poll_publish_button" style="display: none;">publish poll</button>
<button id="admin" data-localization-title="poll_admin_button" data-localization="poll_admin_button" style="display: none;">admin</button>
<button id="help" data-localization-title="poll_show_help_button" data-localization="poll_show_help_button">help</button>
</div>
<div class="realtime">
<br />
<center>
<textarea rows=5 cols=50 disabled="disabled" id="description"></textarea><br />
</center>
<div id="tableContainer">
<div id="tableScroll"></div>
<button data-localization-title="poll_create_user" id="create-user"><span class="fa fa-plus"></span></button>
<button data-localization-title="poll_create_option" id="create-option"><span class="fa fa-plus"></span></button>
<button data-localization-title="poll_commit" id="commit"><span class="fa fa-check"></span></button>
</div>
</div>
</div>
</div>
<div id="loading">
<div class="loadingContainer">
<img class="cryptofist" src="/customize/cryptofist_small.png" />
<div class="spinnerContainer">
<span class="fa fa-spinner fa-pulse fa-4x fa-fw"></span>
</div>
<p data-localization="loading"></p>
</div>
</div>

Loading…
Cancel
Save