Files
vanillajs-seed/app/text/text.js
2020-05-26 10:37:57 +02:00

33 lines
704 B
JavaScript

(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);
})();