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">
<?php
$hint = Application_Common_UsabilityHints::getUsabilityHint();
Logging::info($hint);
if ($hint != "") { ?>
<div class="usability_hint"><?php echo $hint; ?></div>
<?php

View File

@ -165,20 +165,24 @@ function removeSuccessMsg() {
function getUsabilityHint() {
var pathname = window.location.pathname;
$.getJSON("/api/get-usability-hint", {"format": "json", "userPath": pathname}, function(json) {
console.log(json);
var $hint_div = $('.usability_hint');
var current_hint = $hint_div.html();
if (json === "") {
// there are no more hints to display to the user
$hint_div.hide();
} else if (current_hint !== json) {
console.log($hint_div);
// we only change the message if it is new
if ($hint_div.is(":hidden")) {
console.log("hidden");
$hint_div.show();
}
$hint_div.slideUp("slow");
$hint_div.html(json);
$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();
$.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){
callback(json.events);
getUsabilityHint();
});
}
}