##// END OF EJS Templates
favicon: added favicon notifications
ergo -
r882:d869b56a default
parent child Browse files
Show More
@@ -0,0 +1,7 b''
1 <link rel="import" href="../../../../../../bower_components/polymer/polymer.html">
2
3 <dom-module id="rhodecode-favicon">
4 <template>
5 </template>
6 <script src="rhodecode-favicon.js"></script>
7 </dom-module>
@@ -0,0 +1,20 b''
1 Polymer({
2 is: 'rhodecode-favicon',
3 properties: {
4 favicon: Object,
5 counter: {
6 type: Number,
7 observer: '_handleCounter'
8 }
9 },
10
11 ready: function () {
12 this.favicon = new Favico({
13 type: 'rectangle',
14 animation: 'none'
15 });
16 },
17 _handleCounter: function (newVal, oldVal) {
18 this.favicon.badge(this.counter);
19 }
20 });
@@ -37,6 +37,7 b''
37 "<%= dirs.js.src %>/mousetrap.js",
37 "<%= dirs.js.src %>/mousetrap.js",
38 "<%= dirs.js.src %>/moment.js",
38 "<%= dirs.js.src %>/moment.js",
39 "<%= dirs.js.node_modules %>/appenlight-client/appenlight-client.min.js",
39 "<%= dirs.js.node_modules %>/appenlight-client/appenlight-client.min.js",
40 "<%= dirs.js.node_modules %>/favico.js/favico-0.3.10.min.js",
40 "<%= dirs.js.src %>/i18n_utils.js",
41 "<%= dirs.js.src %>/i18n_utils.js",
41 "<%= dirs.js.src %>/deform.js",
42 "<%= dirs.js.src %>/deform.js",
42 "<%= dirs.js.src %>/plugins/jquery.pjax.js",
43 "<%= dirs.js.src %>/plugins/jquery.pjax.js",
@@ -1,8 +1,11 b''
1 <link rel="import" href="../../../../../../bower_components/polymer/polymer.html">
1 <link rel="import" href="../../../../../../bower_components/polymer/polymer.html">
2 <link rel="import" href="../channelstream-connection/channelstream-connection.html">
2 <link rel="import" href="../channelstream-connection/channelstream-connection.html">
3 <link rel="import" href="../rhodecode-toast/rhodecode-toast.html">
4 <link rel="import" href="../rhodecode-favicon/rhodecode-favicon.html">
3
5
4 <dom-module id="rhodecode-app">
6 <dom-module id="rhodecode-app">
5 <template>
7 <template>
8 <rhodecode-favicon></rhodecode-favicon>
6 <rhodecode-toast id="notifications"></rhodecode-toast>
9 <rhodecode-toast id="notifications"></rhodecode-toast>
7 <channelstream-connection
10 <channelstream-connection
8 id="channelstream-connection"
11 id="channelstream-connection"
@@ -6,6 +6,7 b' var rhodeCodeApp = Polymer({'
6 attached: function () {
6 attached: function () {
7 ccLog.debug('rhodeCodeApp created');
7 ccLog.debug('rhodeCodeApp created');
8 $.Topic('/notifications').subscribe(this.handleNotifications.bind(this));
8 $.Topic('/notifications').subscribe(this.handleNotifications.bind(this));
9 $.Topic('/favicon/update').subscribe(this.faviconUpdate.bind(this));
9 $.Topic('/connection_controller/subscribe').subscribe(
10 $.Topic('/connection_controller/subscribe').subscribe(
10 this.subscribeToChannelTopic.bind(this));
11 this.subscribeToChannelTopic.bind(this));
11 // this event can be used to coordinate plugins to do their
12 // this event can be used to coordinate plugins to do their
@@ -27,6 +28,10 b' var rhodeCodeApp = Polymer({'
27 this.$['notifications'].handleNotification(data);
28 this.$['notifications'].handleNotification(data);
28 },
29 },
29
30
31 faviconUpdate: function (data) {
32 this.$$('rhodecode-favicon').counter = data.count;
33 },
34
30 /** opens connection to ws server */
35 /** opens connection to ws server */
31 kickoffChannelstreamPlugin: function (data) {
36 kickoffChannelstreamPlugin: function (data) {
32 ccLog.debug('kickoffChannelstreamPlugin');
37 ccLog.debug('kickoffChannelstreamPlugin');
@@ -13,9 +13,11 b' Polymer({'
13 ],
13 ],
14 _changedToasts: function(newValue, oldValue){
14 _changedToasts: function(newValue, oldValue){
15 this.$['p-toast'].notifyResize();
15 this.$['p-toast'].notifyResize();
16 $.Topic('/favicon/update').publish({count: this.toasts.length});
16 },
17 },
17 dismissNotifications: function(){
18 dismissNotifications: function(){
18 this.$['p-toast'].close();
19 this.$['p-toast'].close();
20 $.Topic('/favicon/update').publish({count: 0});
19 },
21 },
20 handleClosed: function(){
22 handleClosed: function(){
21 this.splice('toasts', 0);
23 this.splice('toasts', 0);
@@ -6,3 +6,4 b''
6 /connection_controller/subscribe - subscribes user to new channels
6 /connection_controller/subscribe - subscribes user to new channels
7 /connection_controller/presence - receives presence change messages
7 /connection_controller/presence - receives presence change messages
8 /connection_controller/channel_update - receives channel states
8 /connection_controller/channel_update - receives channel states
9 /favicon/update - notify state change for favicon
General Comments 0
You need to be logged in to leave comments. Login now