浏览代码

[core] jHueTour should support external links too

Added support for a plain link
Enrico Berti 12 年之前
父节点
当前提交
9b50092f3a

+ 1 - 1
desktop/core/src/desktop/templates/common_header.mako

@@ -101,7 +101,7 @@ from django.utils.translation import ugettext as _
       labels: {
         AVAILABLE_TOURS: "${_('Available tours')}",
         NO_AVAILABLE_TOURS: "${_('None for this page.')}",
-        MORE_INFO: "${_('More info...')}"
+        MORE_INFO: "${_('Read more about it...')}"
       }
     };
 

+ 3 - 0
desktop/core/static/css/hue3.css

@@ -1325,4 +1325,7 @@ a#advanced-btn:hover {
 #jHueTourVideoPlayer {
   margin-left: -320px!important;
   width: 640px;
+}
+#jHueTourVideoPlayer .modal-body {
+  max-height: 460px;
 }

+ 15 - 9
desktop/core/static/js/jquery.tour.js

@@ -43,7 +43,7 @@
               }, ...
             ],
             video: "http://player.vimeo.com/xxxxx", <-- instead of the steps you can specify a video and it will be displayed in a modal
-            blog: "http://gethue.tumblr.com/yyyyy" <-- if specified, a link to this with a "More info..." label will be placed under the video in the modal
+            blog: "http://gethue.tumblr.com/yyyyy" <-- if specified, a link to this with a "Read more about it..." label will be placed under the video in the modal. if video is empty, the link will be automagically opened
           }, ...
         ]
       });
@@ -66,7 +66,7 @@
       labels: {
         AVAILABLE_TOURS: "Available tours",
         NO_AVAILABLE_TOURS: "None for this page",
-        MORE_INFO: "More info..."
+        MORE_INFO: "Read more about it..."
       },
       tours: [],
       showRemote: false,
@@ -135,13 +135,13 @@
       _this.options.tours = _newTours.concat($.totalStorage("jHueTourExtras"));
     }
 
-    var _toursHtml = '<ul class="nav nav-pills nav-stacked">'
+    var _toursHtml = '<ul class="nav nav-pills nav-stacked" style="margin-bottom: 0">'
       var _added = 0;
       $.each(_this.options.tours, function (ctn, tour) {
         if (tour.path === undefined || RegExp(tour.path).test(location.pathname)) {
           var _tourDone = '';
           var _removeTour = '';
-          var _videoIcon = '';
+          var _extraIcon = '';
           if ($.totalStorage !== undefined) {
             var _key = location.pathname;
             if (tour.path !== undefined && tour.path != "") {
@@ -156,10 +156,16 @@
             _removeTour = '<div style="color:red;float:right;margin:4px;cursor: pointer" onclick="javascript:$.jHueTour(\'remove_' + tour.name + '\')"><i class="icon-remove-sign"></i></div>';
           }
 
+          var _link = '<a href="javascript:$.jHueTour(\'' + tour.name + '\', 1)" style="padding-left:0">';
+
           if (typeof tour.video != "undefined" && tour.video != null && tour.video != ""){
-            _videoIcon = '<i class="icon-youtube-play"></i> ';
+            _extraIcon = '<i class="icon-youtube-play"></i> ';
+          }
+          else if (typeof tour.blog != "undefined" && tour.blog != null && tour.blog != ""){
+            _extraIcon = '<i class="icon-external-link"></i> ';
+            _link = '<a href="' + tour.blog + '" target="_blank" style="padding:0">';
           }
-          _toursHtml += '<li>' + _removeTour + _tourDone + '<a href="javascript:$.jHueTour(\'' + tour.name + '\', 1)" style="padding-left:0">' + _videoIcon + tour.desc + '</a></li>';
+          _toursHtml += '<li>' + _removeTour + _tourDone + _link + _extraIcon + tour.desc + '</a></li>';
           _added++;
         }
       });
@@ -371,15 +377,15 @@
             '</div>' +
             '<div class="modal-body">' +
             '<iframe id="jHueTourVideoFrame" src="' + _this.currentTour.video + '?autoplay=1" width="700" height="350" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" style="height:360px;width:640px"></iframe><div class="moreInfo">' +
-            (typeof _this.currentTour.blog != "undefined" && _this.currentTour.blog != "" ? '<a href="' + _this.currentTour.blog + '" target="_blank"><i class="icon-link"></i> ' + _this.options.labels.MORE_INFO + '</a>' : '') +
+            (typeof _this.currentTour.blog != "undefined" && _this.currentTour.blog != "" ? '<br/><a href="' + _this.currentTour.blog + '" target="_blank"><i class="icon-external-link"></i> ' + _this.options.labels.MORE_INFO + '</a>' : '') +
             '</div></div>';
         var _player = $("<div>").attr("id", "jHueTourVideoPlayer").addClass("modal").addClass("hide").addClass("fade");
         _player.html(_playerHTML);
         _player.appendTo($("body"));
       }
       else {
-        $("#jHueTourVideoPlayer").find("h3").text(_this.currentTour.desc);
-        $("#jHueTourVideoPlayer").find(".moreInfo").html(typeof _this.currentTour.blog != "undefined" && _this.currentTour.blog != "" ? '<a href="' + _this.currentTour.blog + '" target="_blank"><i class="icon-link"></i> ' + _this.options.labels.MORE_INFO + '</a>' : '');
+        $("#jHueTourVideoPlayer").find("h3").html(_this.currentTour.desc);
+        $("#jHueTourVideoPlayer").find(".moreInfo").html(typeof _this.currentTour.blog != "undefined" && _this.currentTour.blog != "" ? '<a href="' + _this.currentTour.blog + '" target="_blank"><i class="icon-external-link"></i> ' + _this.options.labels.MORE_INFO + '</a>' : '');
         $("#jHueTourVideoFrame").attr("src", _this.currentTour.video + "?autoplay=1");
       }
       $("#jHueTourVideoPlayer").modal().modal("show");