use directories for structure

This commit is contained in:
s2
2020-05-26 10:37:57 +02:00
parent 66580d4847
commit ae4aaf2668
1287 changed files with 92093 additions and 13113 deletions

View File

@@ -0,0 +1,5 @@
<ul>
<% for (var i=0; i<texts.length; i++) { %>
<li data-id="<%= texts[i].id %>" class="js-link"><%= texts[i].description %></li>
<% } %>
</ul>

32
app/text/text.js Normal file
View File

@@ -0,0 +1,32 @@
(function() {
// globals
MyApp.Text = {};
// utility functions
// app functions
MyApp.Text.renderTextPage = function() {
$('.js-page-container').html(ejs.rr('/app/text/templates/sometext.ejs', {
texts: [
{
id: 100,
description: 'Some text with id 100'
},
{
id: 200,
description: 'Some other text with id 200. Click it!'
}
]
}));
};
// events
$(document).on('click', '.js-link', function(ev) {
var el = $(ev.currentTarget);
var linkId = el.attr('data-id');
PNotify.success('The text you clicked had id ' + linkId + '. Maybe next time I will do something with this id.');
});
// app startup
page('/text', MyApp.Text.renderTextPage);
})();