Explorar o código

HUE-1989 [core] Move the js logic to the home page

The welcome popup will be shown only on home page.
If the landing page uis different than the home page, the popup
won't show up but will show up if the user goes to the home page.
Romain Rigaux %!s(int64=11) %!d(string=hai) anos
pai
achega
592649f

+ 13 - 0
desktop/core/src/desktop/templates/home.mako

@@ -870,6 +870,19 @@ $(document).ready(function(){
     $(".tourStepDetails").hide();
     $("#" + step).show();
   }
+
+  if ($.totalStorage("jHueTourHideModal") == null || $.totalStorage("jHueTourHideModal") == false) {
+    $("#jHueTourModal").modal();
+    $.totalStorage("jHueTourHideModal", true);
+    $("#jHueTourModalChk").attr("checked", "checked");
+    $("#jHueTourModalChk").on("change", function () {
+      $.totalStorage("jHueTourHideModal", $(this).is(":checked"));
+    });
+    $("#jHueTourModalClose").on("click", function () {
+      $("#jHueTourFlag").click();
+      $("#jHueTourModal").modal("hide");
+    });
+  } 
 });
 </script>
 

+ 2 - 14
desktop/core/static/js/jquery.tour.js

@@ -170,6 +170,7 @@
           _added++;
         }
       });
+
       if (_added == 0) {
         if (_this.options.hideIfNoneAvailable){
           _questionMark.css("display", "none");
@@ -178,20 +179,7 @@
           _toursHtml += '<li>' + _this.options.labels.NO_AVAILABLE_TOURS + '</li>';
         }
       }
-      if (_added > 0 && typeof $.totalStorage !== "undefined" && ($.totalStorage("jHueTourHideModal") == null || $.totalStorage("jHueTourHideModal") == false) && RegExp("/home").test(location.pathname)) {
-        $(document).ready(function () {
-          $("#jHueTourModal").modal();
-          $.totalStorage("jHueTourHideModal", true);
-          $("#jHueTourModalChk").attr("checked", "checked");
-          $("#jHueTourModalChk").on("change", function () {
-            $.totalStorage("jHueTourHideModal", $(this).is(":checked"));
-          });
-          $("#jHueTourModalClose").on("click", function () {
-            _questionMark.click();
-            $("#jHueTourModal").modal("hide");
-          });
-        });
-      }
+
       if (_this.options.showRemote){
         _toursHtml += '<li>' +
           ' <div class="input-append" style="margin-top: 10px">' +