##// END OF EJS Templates
packaging: Use a recent bower2nix to have fetch-bower...
packaging: Use a recent bower2nix to have fetch-bower Recent versions of bower2nix provide "fetch-bower" as a separate command. This command is needed for the backported bower related utilities.

File last commit:

r714:822499e8 default
r726:5b2d844f default
Show More
my_account_notifications.html
93 lines | 3.6 KiB | text/html | HtmlLexer
/ rhodecode / templates / admin / my_account / my_account_notifications.html
notifications: replace toggle button with actual toggle element - fixes #4171
r692 <template is="dom-bind" id="notificationsPage">
<iron-ajax id="toggleNotifications"
method="post"
url="${url('my_account_notifications_toggle_visibility')}"
content-type="application/json"
loading="{{changeNotificationsLoading}}"
on-response="handleNotifications"
handle-as="json"></iron-ajax>
notifications: support real-time notifications with websockets via channelstream
r526 <div class="panel panel-default">
<div class="panel-heading">
styling: capitalisation and spinner colours
r706 <h3 class="panel-title">${_('Your Live Notification Settings')}</h3>
notifications: support real-time notifications with websockets via channelstream
r526 </div>
<div class="panel-body">
<p><strong>IMPORTANT:</strong> This feature requires enabled channelstream websocket server to function correctly.</p>
<p class="hidden">Status of browser notifications permission: <strong id="browser-notification-status"></strong></p>
notifications: replace toggle button with actual toggle element - fixes #4171
r692 <div class="form">
<!-- fields -->
<div class="fields">
<div class="field">
<div class="label">
styling: capitalisation and spinner colours
r706 <label for="new_email">${_('Notifications Status')}:</label>
notifications: replace toggle button with actual toggle element - fixes #4171
r692 </div>
<div class="checkboxes">
styling: capitalisation and spinner colours
r706 <paper-toggle-button class="paper-toggle-button" on-change="toggleNotifications" ${'checked' if c.rhodecode_user.get_instance().user_data.get('notification_status') else ''}></paper-toggle-button>
notifications: replace toggle button with actual toggle element - fixes #4171
r692 <paper-tooltip>Toggle your notifications on/off globally.</paper-tooltip>
<template is="dom-if" if="{{changeNotificationsLoading}}">
styling: capitalisation and spinner colours
r706 <paper-spinner active class="toggle-ajax-spinner"></paper-spinner>
notifications: replace toggle button with actual toggle element - fixes #4171
r692 </template>
</div>
</div>
<div class="buttons">
notifications: make styling match the design
r704 <a class="btn btn-default" id="test-notification">Test notification</a>
notifications: replace toggle button with actual toggle element - fixes #4171
r692 </div>
</div>
</div>
notifications: support real-time notifications with websockets via channelstream
r526
</div>
</div>
<script type="application/javascript">
notifications: replace toggle button with actual toggle element - fixes #4171
r692 /** because im not creating a custom element for this page
* we need to push the function onto the dom-template
* ideally we turn this into notification-settings elements
* then it will be cleaner
*/
var ctrlr = $('#notificationsPage')[0];
ctrlr.toggleNotifications = function(event){
var ajax = $('#toggleNotifications')[0];
ajax.headers = {"X-CSRF-Token": CSRF_TOKEN}
ajax.body = {notification_status:event.target.active};
ajax.generateRequest();
};
ctrlr.handleNotifications = function(event){
$('paper-toggle-button')[0].active = event.detail.response;
};
notifications: support real-time notifications with websockets via channelstream
r526
function checkBrowserStatus(){
var browserStatus = 'Unknown';
if (!("Notification" in window)) {
browserStatus = 'Not supported'
}
else if(Notification.permission === 'denied'){
browserStatus = 'Denied';
$('.flash_msg').append('<div class="alert alert-error">Notifications are blocked on browser level - you need to enable them in your browser settings.</div>')
}
else if(Notification.permission === 'granted'){
browserStatus = 'Allowed';
}
$('#browser-notification-status').text(browserStatus);
};
checkBrowserStatus();
$('#test-notification').on('click', function(e){
var levels = ['info', 'error', 'warning', 'success'];
var level = levels[Math.floor(Math.random()*levels.length)];
var payload = {
message: {
message: 'This is a test notification.',
level: level,
testMessage: true
}
};
$.Topic('/notifications').publish(payload);
})
</script>
notifications: replace toggle button with actual toggle element - fixes #4171
r692 </template>