From 06a88ff5569a2685e2e2951823d84f84e4532476 Mon Sep 17 00:00:00 2001 From: Philipp Bayer Date: Sun, 19 Aug 2012 14:28:21 +1000 Subject: [PATCH] Complete modal now hides nicely when all help-boxes are hidden --- app/views/layouts/application.html.erb | 71 +++++++++++++------------- public/javascripts/application.js | 26 +++++++--- 2 files changed, 55 insertions(+), 42 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 788d350..1ed1102 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -15,42 +15,41 @@
<%if current_user %> diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 7682be4..0074b56 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1,9 +1,7 @@ // Place your application-specific JavaScript functions and classes here // This file is automatically included by javascript_include_tag :defaults - -$(document).ready(function() - { +$(document).ready(function() { $('#update_user').click(function() { $('#update_user').val("Updating...").addClass("disabled"); setTimeout(function(){ $('#update_user').val("Update Information").removeClass("disabled");},1000); @@ -11,14 +9,30 @@ $(document).ready(function() $("#PaperMendeley").tablesorter({sortList: [[2,1]]}); $("#PaperPlos").tablesorter({sortList: [[2,1]]}); + $('#remove_help_one').click(function() { - $('#help_one').hide('slow'); + if( $('#help_three').is(":hidden") && $('#help_two').is(":hidden") ){ + $("#help_block").hide("slow"); + } + else { + $('#help_one').hide('slow'); + } });$ $('#remove_help_two').click(function() { - $('#help_two').hide('slow'); + if( $('#help_one').is(":hidden") && $('#help_three').is(":hidden") ){ + $("#help_block").hide("slow"); + } + else { + $('#help_two').hide('slow'); + } }); $('#remove_help_three').click(function() { - $('#help_three').hide('slow'); + if( $('#help_one').is(":hidden") && $('#help_two').is(":hidden") ){ + $("#help_block").hide("slow"); + } + else { + $('#help_three').hide('slow'); + }; }); $('#tab-container').easytabs();