Update notification #2

Merged
ivanovyordan merged 2 commits from update-notification into master 2017-10-05 07:37:49 +03:00
4 changed files with 47 additions and 9 deletions
Showing only changes of commit 091b442364 - Show all commits

View File

@ -1,4 +1,17 @@
(function() {
function show_status(status) {
var container = $('.status');
var span = container.find(status ? '.success' : '.failed');
container.find('span').hide();
span.show();
container.addClass('shown');
setTimeout(function() {
container.removeClass('shown');
}, 3000);
}
function toggle_grid(whichDay) {
var vclasses= ['in-list', 'in-calendar onlyday1', 'in-calendar onlyday2', 'in-calendar onlyday3',
'in-calendar onlyday4', 'in-calendar alldays'];
@ -47,8 +60,6 @@
if( !myapi || !myapi.length ) {
/* If we do not have resource URL, post data and get resource */
$.post( halfnarpAPI, request, function( data ) {
$('.info span').text('submitted');
$('.info').removeClass('hidden');
try {
localStorage['OpenFest-gauge-api'] = data['update_url'];
localStorage['OpenFest-gauge-pid'] = mypid = data['hashed_uid'];
@ -56,8 +67,7 @@
window.location.hash = mypid;
} catch(err) {}
}, 'json' ).fail(function() {
$('.info span').text('failed :(');
$('.info').removeClass('hidden');
show_stauts(false);
});
} else {
/* If we do have a resource URL, update resource */
@ -71,11 +81,9 @@
if( localStorage['OpenFest-gauge-pid'] ) {
window.location.hash = localStorage['OpenFest-gauge-pid'];
}
$('.info span').text('updated');
$('.info').removeClass('hidden');
}).fail(function(msg) {
$('.info span').text('failed');
$('.info').removeClass('hidden');
show_status(true);
}).fail(function() {
show_stauts(false);
});
}

View File

@ -2,6 +2,29 @@ body {
font-family: "HelveticaNeueLight", "HelveticaNeue-Light", "Helvetica Neue Light", "HelveticaNeue", "Helvetica Neue", 'TeXGyreHerosRegular', "Helvetica", "Tahoma", "Geneva", "Arial", sans-serif; font-weight:300; font-stretch:normal;
}
.status {
position: fixed;
z-index: 1;
transition: opacity 0.6s;
top: 0;
left: 0;
right: 0;
opacity:0;
background: #fde073;
text-align: center;
line-height: 2.5;
overflow: hidden;
box-shadow: 0 0 5px black;
}
.status.shown {
opacity: 1;
}
.status span {
display: none;
}
.header {
min-width: 640px;
}

View File

@ -1,3 +1,8 @@
<div class="status">
<span class="success"><%= t 'generic.status_success' %></span>
<span class="failed"><%= t 'generic.status_failed' %></span>
</div>
<div style="display:none">
<div id="template">
<div class="title"></div>

View File

@ -7,3 +7,5 @@ bg:
click_on_the_talks_you_would_like_to_watch: Кликнете (или натиснете два пъти, ако сте на мобилно устройство) върху лекциите, които искате да посетите.
press_submit: Натиснете „Изпрати“.
filter_events: Търсене
status_success: Предпочитанията Ви са запазени
status_failed: Не успахме да запазим предпочитанията Ви