diff options
author | Joas Schilling <coding@schilljs.com> | 2016-10-10 12:54:03 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-10-10 15:17:26 +0300 |
commit | c91ed8bb2c8fe4bb265954da26e2a31a8a39cd95 (patch) | |
tree | cd32982589e1be75d5a7b0539152274bf87ea34d /js | |
parent | 37d3d213e5d0d90599b48f74ff118e771dcf3b67 (diff) |
Use handlebar for the container template
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'js')
-rw-r--r-- | js/app.js | 35 |
1 files changed, 18 insertions, 17 deletions
@@ -32,25 +32,26 @@ interval: null, - initialise: function() { - // Go! + containerTemplate: '' + + '<div class="notifications hidden">' + + ' <div class="notifications-button menutoggle">' + + ' <img class="svg" alt="' + t('notifications', 'Notifications') + '"' + + ' src="' + OC.imagePath('notifications', 'notifications') + '">' + + ' </div>' + + ' <div class="notification-container">' + + ' <div class="notification-wrapper"></div>' + + ' <div class="emptycontent">' + + ' <h2>' + t('notifications', 'No notifications') + '</h2>' + + ' </div>' + + ' </div>' + + '</div>', + initialise: function() { // Setup elements - this.$notifications = $('<div class="notifications hidden"></div>'); - this.$button = $('<div class="notifications-button menutoggle"><img class="svg" alt="' + t('notifications', 'Notifications') + '" src="' + OC.imagePath('notifications', 'notifications') + '"></div>'); - this.$container = $('<div class="notification-container"></div>'); - var $wrapper = $('<div class="notification-wrapper"></div>'); - - // Empty content dropdown - var $headLine = $('<h2></h2>'); - $headLine.text(t('notifications', 'No notifications')); - var $emptyContent = $('<div class="emptycontent"></div>'); - $emptyContent.append($headLine); - this.$container.append($emptyContent); - - this.$notifications.append(this.$button); - this.$notifications.append(this.$container); - this.$container.append($wrapper); + var compiledTemplate = Handlebars.compile(this.containerTemplate); + this.$notifications = $(compiledTemplate()); + this.$button = this.$notifications.find('.notifications-button'); + this.$container = this.$notifications.find('.notification-container'); // Add to the UI $('form.searchbox').before(this.$notifications); |