Move the search results to use list-group-flush
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 15 Jan 2020 16:00:58 +0000 (17:00 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Thu, 16 Jan 2020 11:39:13 +0000 (12:39 +0100)
app/assets/javascripts/index/search.js
app/assets/stylesheets/common.scss
app/views/geocoder/results.html.erb
test/controllers/geocoder_controller_test.rb

index ba66f47..9ed2434 100644 (file)
@@ -45,9 +45,9 @@ OSM.Search = function (map) {
   $("#sidebar_content")
     .on("click", ".search_more a", clickSearchMore)
     .on("click", ".search_results_entry a.set_position", clickSearchResult)
-    .on("mouseover", "p.search_results_entry:has(a.set_position)", showSearchResult)
-    .on("mouseout", "p.search_results_entry:has(a.set_position)", hideSearchResult)
-    .on("mousedown", "p.search_results_entry:has(a.set_position)", function () {
+    .on("mouseover", "li.search_results_entry:has(a.set_position)", showSearchResult)
+    .on("mouseout", "li.search_results_entry:has(a.set_position)", hideSearchResult)
+    .on("mousedown", "li.search_results_entry:has(a.set_position)", function () {
       var moved = false;
       $(this).one("click", function (e) {
         if (!moved && !$(e.target).is("a")) {
index abae983..5635e3f 100644 (file)
@@ -939,15 +939,8 @@ header .search_forms,
 /* Rules for search sidebar */
 
 #sidebar .search_results_entry {
-  ul {
-   padding: 0;
-  }
-
   ul li {
-    border-bottom: $keyline;
     cursor: pointer;
-    list-style-type: none;
-    &:first-child { border-top: $keyline; }
     &.selected { background: $list-highlight; }
   }
 
index deec4ed..94f19d2 100644 (file)
@@ -1,9 +1,13 @@
 <% if @results.empty? %>
-  <p class="search_results_entry inner12"><%= t ".no_results" %></p>
+  <ul class="list-group list-group-flush">
+    <li class="list-group-item">
+      <%= t ".no_results" %>
+    </li>
+  </ul>
 <% else %>
-  <ul class='results-list'>
+  <ul class='results-list list-group list-group-flush'>
     <% @results.each do |result| %>
-      <li><p class="inner12 search_results_entry clearfix"><%= result_to_html(result) %></p></li>
+      <li class="list-group-item search_results_entry"><%= result_to_html(result) %></li>
     <% end %>
   </ul>
   <% if @more_params %>
index f8a4eed..0459eb2 100644 (file)
@@ -489,11 +489,11 @@ class GeocoderControllerTest < ActionController::TestCase
       assert_select "ul.results-list", 0
     else
       assert_select "ul.results-list", 1 do
-        assert_select "p.search_results_entry", results.count
+        assert_select "li.search_results_entry", results.count
 
         results.each do |result|
           attrs = result.collect { |k, v| "[data-#{k}='#{v}']" }.join("")
-          assert_select "p.search_results_entry a.set_position#{attrs}", result[:name]
+          assert_select "li.search_results_entry a.set_position#{attrs}", result[:name]
         end
       end
     end