aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cabo <david@calibea.com>2011-09-07 22:01:13 +0200
committerDavid Cabo <david@calibea.com>2011-09-07 22:01:13 +0200
commitc53bf71fcb9a646c206ab2a93473852cbeb56ffe (patch)
tree97577f880dc24ab541e4f29ba97d375e0e0049a9
parent07659d28d268482afcaf7a5a4105bb4e2854319e (diff)
Add link to search in public body web while creating new request, fixes #174
-rw-r--r--app/views/request/_search_ahead.rhtml11
-rw-r--r--app/views/request/new.rhtml6
2 files changed, 11 insertions, 6 deletions
diff --git a/app/views/request/_search_ahead.rhtml b/app/views/request/_search_ahead.rhtml
index b8ef7437e..9c49680c3 100644
--- a/app/views/request/_search_ahead.rhtml
+++ b/app/views/request/_search_ahead.rhtml
@@ -1,13 +1,12 @@
-<p>
- <div id="request_search_ahead_results">
+<div id="request_search_ahead_results">
<% if @xapian_requests.results.size > 0 %>
<h3><%= _("Possibly related requests:") %></h3>
<% end %>
<% for result in @xapian_requests.results %>
<%= render :partial => 'request/request_listing_short_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
<% end %>
- </div>
-</p>
-
-
+ <p>
+ <a id="body-site-search-link" target="_blank"><%= _("Or search in their website for this information.") %></a>
+ </p>
+</div>
diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml
index 4301d639a..79002e843 100644
--- a/app/views/request/new.rhtml
+++ b/app/views/request/new.rhtml
@@ -7,8 +7,13 @@
$("#typeahead_response").load("<%=search_ahead_url%>?q="+encodeURI(this.value), function() {
// When following links in typeahead results, open new tab/window
$("#typeahead_response a").attr("target","_blank");
+
+ // Update the public body site search link
+ $("#body-site-search-link").attr("href", "http://www.google.com/#q="+encodeURI($("#typeahead_search").val())+
+ "+site:<%= @info_request.public_body.calculated_home_page %>");
});
}));
+
});
</script>
@@ -87,6 +92,7 @@
<% end %>
)
</div>
+
<div id="typeahead_response">
</div>
</div>