##// END OF EJS Templates
notifications: move all notifications into polymer for consistency fix #4201
lisaq -
r822:133118c1 default
parent child Browse files
Show More
@@ -678,6 +678,20 b' class Flash(_Flash):'
678 678 session.save()
679 679 return messages
680 680
681 def json_alerts(self):
682 payloads = []
683 messages = flash.pop_messages()
684 if messages:
685 for message in messages:
686 payloads.append({
687 'message': {
688 'message': u'{}'.format(message.message),
689 'level': message.category,
690 'force': 'true'
691 }
692 })
693 return json.dumps(payloads)
694
681 695 flash = Flash()
682 696
683 697 #==============================================================================
@@ -3,10 +3,14 b' ccLog.setLevel(Logger.OFF);'
3 3
4 4 var rhodeCodeApp = Polymer({
5 5 is: 'rhodecode-app',
6 created: function () {
6 attached: function () {
7 7 ccLog.debug('rhodeCodeApp created');
8 8 $.Topic('/notifications').subscribe(this.handleNotifications.bind(this));
9 9
10 for (var i = 0; i < alertMessagePayloads.length; i++) {
11 $.Topic('/notifications').publish(alertMessagePayloads[i]);
12 }
13
10 14 $.Topic('/plugins/__REGISTER__').subscribe(
11 15 this.kickoffChannelstreamPlugin.bind(this)
12 16 );
@@ -21,7 +21,7 b''
21 21 </template>
22 22 </div>
23 23 <div class="toast-close">
24 <button on-tap="dismissNotifications" class="btn btn-default">{{_gettext('Close now')}}</button>
24 <button on-tap="dismissNotifications" class="btn btn-default">{{_gettext('Close')}}</button>
25 25 </div>
26 26 </paper-toast>
27 27 </template>
@@ -1,16 +0,0 b''
1 <div class="flash_msg">
2 <% messages = h.flash.pop_messages() %>
3 % if messages:
4 % for message in messages:
5 <div class="alert alert-dismissable alert-${message.category}">
6 <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
7 ${message}
8 </div>
9 % endfor
10 % endif
11 <script>
12 if (typeof jQuery != 'undefined') {
13 $(".alert").alert();
14 }
15 </script>
16 </div>
@@ -116,6 +116,7 b" c.template_context['visual']['default_re"
116 116 <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
117 117 <![endif]-->
118 118 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
119 <script> var alertMessagePayloads = ${h.flash.json_alerts()|n}; </script>
119 120 <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
120 121 <script>
121 122 var e = document.createElement('script');
General Comments 0
You need to be logged in to leave comments. Login now