diff options
| author | HumairAK <humair88@hotmail.com> | 2016-09-18 21:02:07 +0000 |
|---|---|---|
| committer | HumairAK <humair88@hotmail.com> | 2016-09-18 21:02:07 +0000 |
| commit | 541341598d5ed0e5c8ef9b2325dc6bbec958463a (patch) | |
| tree | 2b52efc8b69bd787e16cc523b12d2a54caabd405 /assets | |
| parent | d181c175009ef9b3523f025a28c678ae83be024e (diff) | |
| parent | 535d6cfc7a66f174e6f9c656766bee9c15964c48 (diff) | |
Merged conflict
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/css/creative.css | 9 | ||||
| -rw-r--r-- | assets/css/style.css | 10 | ||||
| -rw-r--r-- | assets/js/script.js | 27 |
3 files changed, 43 insertions, 3 deletions
diff --git a/assets/css/creative.css b/assets/css/creative.css index a4c3ab8..a714881 100644 --- a/assets/css/creative.css +++ b/assets/css/creative.css @@ -108,14 +108,19 @@ padding-top: 200px; background-color: transparent; } -.navbar-default .dropdown-menu{ +.navbar-default .dropdown-menu, +.notification-dropdown-menu{ padding: 0; } -.navbar-default .dropdown-menu li a{ +.navbar-default .dropdown-menu li a { padding: 10px; } +.notification-dropdown-menu li a { + padding: 30px; +} + .navbar-default .dropdown-submenu .dropdown-menu { margin: 0; } diff --git a/assets/css/style.css b/assets/css/style.css index fbc38fd..d9ac8f5 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -620,3 +620,13 @@ hr { border-top-left-radius: 8px !important; border-bottom-left-radius: 8px !important; } + +.notification-dropdown-menu { + width: 400px !important; + height: auto !important; +} + +.badge { + background-color: #f2dede !important; + color: #a94442 !important; +}
\ No newline at end of file diff --git a/assets/js/script.js b/assets/js/script.js index 0881ac6..237a990 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -1,4 +1,29 @@ function main(){ + + var socket = io('http://localhost:3000'); + socket.on('alert', function (data) { + console.log(data); + socket.emit('my other event', { my: 'data' }); + }); + + socket.on('new_solution', function (data) { + console.log("new solution: "); + console.log(data); + + var $notification_menu = $(".notification-dropdown-menu"); + //$notification_menu.remove($('li a.generic-notification')); + + var $li = $('<li>'); + var $a = $('<a>').text(data.author + " has added a solution to an exam."); + $li.append($a); + $notification_menu.append($li); + + socket.emit('add_notification', data); + + // emit back to the server to save it as a notification in the database + // update badge + }); + // --- nav scripts --- $("input").keyup( function(event) { if(event.keyCode == 13){ @@ -7,7 +32,7 @@ function main(){ }); $(".dropdown").hover(function(){ - $(".dropdown-toggle", this).trigger("click"); + //$(".dropdown-toggle", this).trigger("click"); }); $(".dropdown-toggle").click(function() { |
