From cd394639f8937c2af83ce3c566744dc6f15544a8 Mon Sep 17 00:00:00 2001 From: Mike Tigas Date: Mon, 12 May 2014 23:55:29 -0400 Subject: [PATCH] refactor modal so that if user has no pref, page is rendered with modal already on it (no fade in or flicker). see #175 --- webapp/static/css/tabula_web.css | 4 ++-- webapp/static/js/update-notifications.js | 6 ++++++ webapp/views/index.html.erb | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/webapp/static/css/tabula_web.css b/webapp/static/css/tabula_web.css index d7421fcf..5978f4b4 100644 --- a/webapp/static/css/tabula_web.css +++ b/webapp/static/css/tabula_web.css @@ -75,7 +75,7 @@ img.page-image { #myModal { width: 80%; - margin: -170px 0 0 -40%; + margin: 150px 0 0 -40%; max-height: 500px; } @@ -266,4 +266,4 @@ div.explanation-label { left: 0; background-color: #000; opacity: 0.8; -} \ No newline at end of file +} diff --git a/webapp/static/js/update-notifications.js b/webapp/static/js/update-notifications.js index 8abb43d5..ec06428d 100644 --- a/webapp/static/js/update-notifications.js +++ b/webapp/static/js/update-notifications.js @@ -1,8 +1,12 @@ $(function() { function showNotificationModal(){ + $('#myModal').show(); $('#myModal').modal("show"); } + function hideNotificationModal(){ + $('#myModal').hide(); + } $('#myModal').on('hidden.bs.modal', function (e) { if( $('input#update-notifications').is(':checked')){ @@ -15,10 +19,12 @@ $(function() { var notificationSetting = localStorage.getItem("tabula-notifications"); if ( notificationSetting == "false" ){ + hideNotificationModal(); return; }else if (notificationSetting == null){ showNotificationModal(); }else{ + hideNotificationModal(); getNotifications(); } // if it's neither "false" nor null, it's true (or something weird) // so we can continue. diff --git a/webapp/views/index.html.erb b/webapp/views/index.html.erb index 79332231..b707b109 100644 --- a/webapp/views/index.html.erb +++ b/webapp/views/index.html.erb @@ -70,7 +70,7 @@ -