User link/recipe logic
authorJakub Skoczen <jakub@indexdata.dk>
Thu, 3 Mar 2011 13:10:09 +0000 (14:10 +0100)
committerJakub Skoczen <jakub@indexdata.dk>
Thu, 3 Mar 2011 13:10:09 +0000 (14:10 +0100)
mkdruding2.js

index d74b6bb..8321feb 100644 (file)
@@ -1,10 +1,13 @@
 Drupal.theme.mkdruResult = function(hit, num, detailLink) {
+  var link = choose_url(hit);
+  if (!link) link = choose_url(hit['location'][0]);
   var html = "";
   html += '<li class="search-result" id="rec_' + hit.recid + '" >'
-    + '<h3 class="title">'
-    + '<a href="' + hit['location'][0]['md-electronic-url'] 
-    + '" target="_blank" >'
-    + hit["md-title"] + '</a></h3>';
+    + '<h3 class="title">';
+  if (link) html += '<a href="'+link+'" target="_blank" >';
+  html += hit["md-title"];
+  if (link) html += '</a>';
+  html += '</h3>';
   html += '<div class="search-snippet-info">'
      + '<p class="search-snippet"></p>'
      + '<div class="ting-object clearfix">'