##// END OF EJS Templates
git: use force fetch and update for target ref. This solves a case...
git: use force fetch and update for target ref. This solves a case when in PRs a target is force updated and is out of sync. Before we used a pull which --ff-only fails obviosly because two are out of sync. This change uses new logic that resets the target branch according to the source target branch allowing smooth merge simulation.

File last commit:

r1819:956c5cda default
r2784:e8c62649 default
Show More
my_account_notifications.mako
130 lines | 4.8 KiB | application/x-mako | MakoHtmlLexer
/ rhodecode / templates / admin / my_account / my_account_notifications.mako
templating: use .mako as extensions for template files.
r1282 <template is="dom-bind" id="notificationsPage">
<iron-ajax id="toggleNotifications"
method="post"
my-account: moved few my account views into pyramid.
r1819 url="${h.route_path('my_account_notifications_toggle_visibility')}"
templating: use .mako as extensions for template files.
r1282 content-type="application/json"
loading="{{changeNotificationsLoading}}"
on-response="handleNotifications"
handle-as="json">
</iron-ajax>
<iron-ajax id="sendTestNotification"
method="post"
core: moved channelstream test into pyramid.
r1756 url="${h.route_path('my_account_notifications_test_channelstream')}"
templating: use .mako as extensions for template files.
r1282 content-type="application/json"
on-response="handleTestNotification"
handle-as="json">
</iron-ajax>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">${_('Your Live Notification Settings')}</h3>
</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>
<div class="form">
<div class="fields">
<div class="field">
<div class="label">
<label for="new_email">${_('Notifications Status')}:</label>
</div>
<div class="checkboxes">
<rhodecode-toggle id="live-notifications" active="[[changeNotificationsLoading]]" on-change="toggleNotifications" ${'checked' if c.rhodecode_user.get_instance().user_data.get('notification_status') else ''}></rhodecode-toggle>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">${_('Test Notifications')}</h3>
</div>
<div class="panel-body">
<div style="padding: 0px 0px 20px 0px">
<button class="btn" id="test-notification" on-tap="testNotifications">Test flash message</button>
<button class="btn" id="test-notification-live" on-tap="testNotificationsLive">Test live notification</button>
</div>
<h4 id="test-response"></h4>
</div>
</div>
<script type="text/javascript">
/** 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){
$('#live-notifications')[0].checked = event.detail.response;
};
ctrlr.testNotifications = function(event){
var levels = ['info', 'error', 'warning', 'success'];
var level = levels[Math.floor(Math.random()*levels.length)];
rhodecode-toasts: allow removing single elements from toast queue.
r1513 function getRandomArbitrary(min, max) {
return parseInt(Math.random() * (max - min) + min);
}
function shuffle(a) {
var j, x, i;
for (i = a.length; i; i--) {
j = Math.floor(Math.random() * i);
x = a[i - 1];
a[i - 1] = a[j];
a[j] = x;
}
}
var wordDb = [
"Leela,", "Bender,", "we are", "going", "grave", "robbing.",
"Oh,", "I", "think", "we", "should", "just", "stay", "friends.",
"got", "to", "find", "a", "way", "to", "escape", "the", "horrible",
"ravages", "of", "youth.", "Suddenly,", "going", "to",
"the", "bathroom", "like", "clockwork,", "every", "three",
"hours.", "And", "those", "jerks", "at", "Social", "Security",
"stopped", "sending", "me", "checks.", "Now", "have", "to", "pay"
];
shuffle(wordDb);
wordDb = wordDb.slice(0, getRandomArbitrary(3, wordDb.length));
var randomMessage = wordDb.join(" ");
templating: use .mako as extensions for template files.
r1282 var payload = {
message: {
rhodecode-toasts: allow removing single elements from toast queue.
r1513 message: randomMessage + " " + new Date(),
templating: use .mako as extensions for template files.
r1282 level: level,
force: true
}
};
$.Topic('/notifications').publish(payload);
};
ctrlr.testNotificationsLive = function(event){
var ajax = $('#sendTestNotification')[0];
ajax.headers = {"X-CSRF-Token": CSRF_TOKEN};
ajax.body = {test_msg: 'Hello !'};
ajax.generateRequest();
};
ctrlr.handleTestNotification = function(event){
var reply = event.detail.response.response;
reply = reply || 'no reply form server';
$('#test-response').html(reply);
};
</script>
</template>