diff options
author | Vincent Petry <PVince81@yahoo.fr> | 2015-09-15 17:45:51 +0300 |
---|---|---|
committer | Vincent Petry <PVince81@yahoo.fr> | 2015-09-15 17:45:51 +0300 |
commit | 18d637922a26c7f0da9a3fc99b0a936fe37d4e03 (patch) | |
tree | a14dab8512ff37ff72cbfd7633691b6680be60e5 /js/notification.js | |
parent | 55c9045a7f48a4799977a9250f962495df51e6ba (diff) |
Make action buttons work
Diffstat (limited to 'js/notification.js')
-rw-r--r-- | js/notification.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/js/notification.js b/js/notification.js index 4156f96..515928d 100644 --- a/js/notification.js +++ b/js/notification.js @@ -88,6 +88,7 @@ * Generates the HTML for the notification */ renderElement: function() { + // FIXME: use handlebars template var el = $('<div class="notification"></div>'); el.attr('data-id', escapeHTML(this.getId())); el.attr('data-timestamp', escapeHTML(this.getTimestamp())); @@ -96,8 +97,14 @@ // Add actions var actions = $('<div class="actions"></div>'); var actionsData = this.getActions(); - $.each(actionsData, function(index) { - actions.append('<div class="button"><a href="'+escapeHTML(actionsData[index].link)+'">'+escapeHTML(actionsData[index].label)+'</a></div>'); + _.each(actionsData, function(actionData) { + // FIXME: use handlebars template + actions.append( + '<div class="button">' + + '<a class="action-button" href="#" data-type="' + escapeHTML(actionData.type) + '" ' + + 'data-href="'+escapeHTML(actionData.link)+'">'+escapeHTML(actionData.label)+'</a>' + + '</div>' + ); // TODO create event handler on click for given action type }); el.append(actions); |