SAAS-940: Provide usability hints to user

Fixed bug where hints were not showing up sometimes
This commit is contained in:
drigato 2015-07-14 10:08:56 -04:00
parent 25ef70767b
commit 71e8909365
3 changed files with 8 additions and 4 deletions

View File

@ -73,7 +73,6 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
<div class="wrapper" id="content"> <div class="wrapper" id="content">
<?php <?php
$hint = Application_Common_UsabilityHints::getUsabilityHint(); $hint = Application_Common_UsabilityHints::getUsabilityHint();
Logging::info($hint);
if ($hint != "") { ?> if ($hint != "") { ?>
<div class="usability_hint"><?php echo $hint; ?></div> <div class="usability_hint"><?php echo $hint; ?></div>
<?php <?php

View File

@ -165,20 +165,24 @@ function removeSuccessMsg() {
function getUsabilityHint() { function getUsabilityHint() {
var pathname = window.location.pathname; var pathname = window.location.pathname;
$.getJSON("/api/get-usability-hint", {"format": "json", "userPath": pathname}, function(json) { $.getJSON("/api/get-usability-hint", {"format": "json", "userPath": pathname}, function(json) {
console.log(json);
var $hint_div = $('.usability_hint'); var $hint_div = $('.usability_hint');
var current_hint = $hint_div.html(); var current_hint = $hint_div.html();
if (json === "") { if (json === "") {
// there are no more hints to display to the user
$hint_div.hide(); $hint_div.hide();
} else if (current_hint !== json) { } else if (current_hint !== json) {
console.log($hint_div); // we only change the message if it is new
if ($hint_div.is(":hidden")) { if ($hint_div.is(":hidden")) {
console.log("hidden");
$hint_div.show(); $hint_div.show();
} }
$hint_div.slideUp("slow"); $hint_div.slideUp("slow");
$hint_div.html(json); $hint_div.html(json);
$hint_div.slideDown("slow"); $hint_div.slideDown("slow");
} else {
// hint is the same before we hid it so we just need to show it
if ($hint_div.is(":hidden")) {
$hint_div.show();
}
} }
}); });
} }

View File

@ -354,6 +354,7 @@ function getFullCalendarEvents(start, end, callback) {
var d = new Date(); var d = new Date();
$.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){ $.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){
callback(json.events); callback(json.events);
getUsabilityHint();
}); });
} }
} }