From fe365b46bf00e5364c7bcc028628ab714e38c943 Mon Sep 17 00:00:00 2001 From: Yordan Ivanov Date: Sat, 30 Sep 2017 21:35:42 +0300 Subject: [PATCH 1/2] Ignroe JetBrains IDEs --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index fcaff28..2a03ac7 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,7 @@ /tmp db/schema.rb config/secrets.yml + +# Ignore JetBrains IDE +/.idea +/gauge.iml -- 2.40.1 From 091b442364055f21b5a2cd6dee7db38101dd2d9f Mon Sep 17 00:00:00 2001 From: Yordan Ivanov Date: Wed, 4 Oct 2017 22:36:55 +0300 Subject: [PATCH 2/2] Better save notifications --- app/assets/javascripts/halfnarp.js | 26 +++++++++++++++++--------- app/assets/stylesheets/halfnarp.css | 23 +++++++++++++++++++++++ app/views/home/index.html.erb | 5 +++++ config/locales/bg.yml | 2 ++ 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/halfnarp.js b/app/assets/javascripts/halfnarp.js index 34a4317..bb212ac 100644 --- a/app/assets/javascripts/halfnarp.js +++ b/app/assets/javascripts/halfnarp.js @@ -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); }); } diff --git a/app/assets/stylesheets/halfnarp.css b/app/assets/stylesheets/halfnarp.css index a566599..90ccc3e 100644 --- a/app/assets/stylesheets/halfnarp.css +++ b/app/assets/stylesheets/halfnarp.css @@ -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; } diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 4b0ecd6..0e1d99a 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,3 +1,8 @@ +
+ <%= t 'generic.status_success' %> + <%= t 'generic.status_failed' %> +
+
diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 83f10b0..d5528ca 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -7,3 +7,5 @@ bg: click_on_the_talks_you_would_like_to_watch: Кликнете (или натиснете два пъти, ако сте на мобилно устройство) върху лекциите, които искате да посетите. press_submit: Натиснете „Изпрати“. filter_events: Търсене + status_success: Предпочитанията Ви са запазени + status_failed: Не успахме да запазим предпочитанията Ви -- 2.40.1