From 986c3ad710b88429a732e8444c086e25051b0dc7 Mon Sep 17 00:00:00 2001
From: Czémán Arnold <czeman.arnold@cloud.bme.hu>
Date: Fri, 15 Apr 2016 17:06:32 +0200
Subject: [PATCH] dashboard: small improvements on destktop notifications

---
 circle/dashboard/static/dashboard/activity.js           | 7 ++++---
 circle/dashboard/templates/dashboard/_display-name.html | 3 ---
 circle/dashboard/templates/dashboard/base.html          | 3 +++
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/circle/dashboard/static/dashboard/activity.js b/circle/dashboard/static/dashboard/activity.js
index 463d542..0d61c7c 100644
--- a/circle/dashboard/static/dashboard/activity.js
+++ b/circle/dashboard/static/dashboard/activity.js
@@ -203,18 +203,19 @@ function generateMessageFromLastActivity(){
   var ac = $('div.activity').first();
   var error = ac.children(".timeline-icon-failed").length;
   var sign = (error === 1) ? "❌ " : "✓ ";
-  var msg = ac.children("strong").text().trim();
+  var msg = ac.children("strong").text().replace(/\s\s+/g, " ");
   return sign + msg;
 }
 
 function sendNotification(message) {
+  var options = { icon: "/static/dashboard/img/favicon.png"};
   if (Notification.permission === "granted") {
-    var notification = new Notification(message);
+    var notification = new Notification(message, options);
   }
   else if (Notification.permission !== 'denied') {
     Notification.requestPermission(function (permission) {
       if (permission === "granted") {
-        var notification = new Notification(message);
+        var notification = new Notification(message, options);
       }
     });
   }
diff --git a/circle/dashboard/templates/dashboard/_display-name.html b/circle/dashboard/templates/dashboard/_display-name.html
index 0f58c31..6b541d8 100644
--- a/circle/dashboard/templates/dashboard/_display-name.html
+++ b/circle/dashboard/templates/dashboard/_display-name.html
@@ -14,7 +14,4 @@
       ({% trans "username" %}: {{ user.username }})
     {% endif %}
   {% endif %}
-
-  <span id="user-options" data-desktop_notifications="{{ user.profile.desktop_notifications }}"><span>
-
 {% endif %}
diff --git a/circle/dashboard/templates/dashboard/base.html b/circle/dashboard/templates/dashboard/base.html
index 3762cbd..3122054 100644
--- a/circle/dashboard/templates/dashboard/base.html
+++ b/circle/dashboard/templates/dashboard/base.html
@@ -12,6 +12,9 @@
 
 {% block navbar %}
 {% if request.user.is_authenticated and request.user.pk and not request.token_user %}
+
+  <span id="user-options" data-desktop_notifications="{{ request.user.profile.desktop_notifications }}"><span>
+
   <ul class="nav navbar-nav navbar-right" id="dashboard-menu">
     {% if request.user.is_superuser %}
     {% if ADMIN_ENABLED %}
--
libgit2 0.26.0