Show More
@@ -678,6 +678,20 b' class Flash(_Flash):' | |||||
678 | session.save() |
|
678 | session.save() | |
679 | return messages |
|
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 | flash = Flash() |
|
695 | flash = Flash() | |
682 |
|
696 | |||
683 | #============================================================================== |
|
697 | #============================================================================== |
@@ -3,10 +3,14 b' ccLog.setLevel(Logger.OFF);' | |||||
3 |
|
3 | |||
4 | var rhodeCodeApp = Polymer({ |
|
4 | var rhodeCodeApp = Polymer({ | |
5 | is: 'rhodecode-app', |
|
5 | is: 'rhodecode-app', | |
6 |
|
|
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 |
|
9 | |||
|
10 | for (var i = 0; i < alertMessagePayloads.length; i++) { | |||
|
11 | $.Topic('/notifications').publish(alertMessagePayloads[i]); | |||
|
12 | } | |||
|
13 | ||||
10 | $.Topic('/plugins/__REGISTER__').subscribe( |
|
14 | $.Topic('/plugins/__REGISTER__').subscribe( | |
11 | this.kickoffChannelstreamPlugin.bind(this) |
|
15 | this.kickoffChannelstreamPlugin.bind(this) | |
12 | ); |
|
16 | ); |
@@ -21,7 +21,7 b'' | |||||
21 | </template> |
|
21 | </template> | |
22 | </div> |
|
22 | </div> | |
23 | <div class="toast-close"> |
|
23 | <div class="toast-close"> | |
24 |
<button on-tap="dismissNotifications" class="btn btn-default">{{_gettext('Close |
|
24 | <button on-tap="dismissNotifications" class="btn btn-default">{{_gettext('Close')}}</button> | |
25 | </div> |
|
25 | </div> | |
26 | </paper-toast> |
|
26 | </paper-toast> | |
27 | </template> |
|
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">×</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 | <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script> |
|
116 | <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script> | |
117 | <![endif]--> |
|
117 | <![endif]--> | |
118 | <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script> |
|
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 | <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script> |
|
120 | <script language="javascript" type="text/javascript" src="${h.asset('js/scripts.js', ver=c.rhodecode_version_hash)}"></script> | |
120 | <script> |
|
121 | <script> | |
121 | var e = document.createElement('script'); |
|
122 | var e = document.createElement('script'); |
General Comments 0
You need to be logged in to leave comments.
Login now