]> git.openstreetmap.org Git - rails.git/commitdiff
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 ba66f478255d4e9d65e6c16066743b38da28ae97..9ed243466d2a9402053e24a1247f8a5053085d85 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 abae98392b143305c35c024bbf2d0d6807582a4e..5635e3f9d5a8b8796e7ff9732f212fbb3c99e050 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 deec4ed3939665f725c89133a3a73d75fbcd6f7c..94f19d2feec9960627c916edf0d6216b013793ef 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 f8a4eed1964e84fd44cd7ff31f9a0dbf6a2769cf..0459eb2946ebb4762331445afbb248eb0ad91899 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