Skip to content

Commit

Permalink
Remove some search/directions custom css
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Oct 20, 2023
1 parent 574231c commit 62ba143
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/index/directions.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ OSM.Directions = function (map) {
map.removeLayer(polyline);

if (reportErrors) {
$("#sidebar_content").html("<p class=\"search_results_error\">" + I18n.t("javascripts.directions.errors.no_route") + "</p>");
$("#sidebar_content").html("<div class=\"alert alert-danger\">" + I18n.t("javascripts.directions.errors.no_route") + "</div>");
}

return;
Expand Down Expand Up @@ -307,7 +307,7 @@ OSM.Directions = function (map) {
var row = $("<tr class='turn'/>");
row.append("<td class='border-0'><div class='direction i" + direction + "'/></td> ");
row.append("<td>" + instruction);
row.append("<td class='distance'>" + dist);
row.append("<td class='distance text-muted text-end'>" + dist);

row.on("click", function () {
popup
Expand Down
12 changes: 2 additions & 10 deletions app/assets/stylesheets/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -638,21 +638,15 @@ header .search_forms,
/* Rules for search sidebar */

#sidebar .search_results_entry {
ul li {
cursor: pointer;
&.selected { background: $list-highlight; }
ul li.selected {
background: $list-highlight;
}

.search_more .loader {
display: none;
}
}

.search_results_error {
color: #f00;
padding: 10px 20px;
}

/* Rules for routing */

div.direction {
Expand All @@ -666,8 +660,6 @@ div.direction.i#{$i} { background-position: #{($i)*-20}px 0px; }
}

td.distance {
color: $darkgrey;
text-align: right;
font-size: x-small;
}
tr.turn {
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/geocoder_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module GeocoderHelper
def result_to_html(result)
html_options = { :class => "set_position", :data => {} }
html_options = { :class => "set_position stretched-link", :data => {} }

url = if result[:type] && result[:id]
url_for(:controller => :browse, :action => result[:type], :id => result[:id])
Expand Down
2 changes: 1 addition & 1 deletion app/views/geocoder/error.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<p class="search_results_error"><%= h(@error) %></p>
<div class="alert alert-danger mx-2 px-2"><%= h(@error) %></div>
2 changes: 1 addition & 1 deletion test/controllers/geocoder_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,6 @@ def results_check_error(error)
assert_response :success
assert_template :error
assert_template :layout => nil
assert_select "p.search_results_error", error
assert_select ".alert.alert-danger", error
end
end
12 changes: 6 additions & 6 deletions test/helpers/geocoder_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
class GeocoderHelperTest < ActionView::TestCase
def test_result_to_html
html = result_to_html(:lat => 1.23, :lon => 4.56, :zoom => 16, :name => "Name")
assert_dom_equal '<a class="set_position" data-lat="1.23" data-lon="4.56" data-zoom="16" data-name="Name" href="/#map=16/1.23/4.56">Name</a>', html
assert_dom_equal '<a class="set_position stretched-link" data-lat="1.23" data-lon="4.56" data-zoom="16" data-name="Name" href="/#map=16/1.23/4.56">Name</a>', html

html = result_to_html(:lat => 1.23, :lon => 4.56, :zoom => 16, :prefix => "Prefix", :name => "Name")
assert_dom_equal 'Prefix <a class="set_position" data-lat="1.23" data-lon="4.56" data-zoom="16" data-prefix="Prefix" data-name="Name" href="/#map=16/1.23/4.56">Name</a>', html
assert_dom_equal 'Prefix <a class="set_position stretched-link" data-lat="1.23" data-lon="4.56" data-zoom="16" data-prefix="Prefix" data-name="Name" href="/#map=16/1.23/4.56">Name</a>', html

html = result_to_html(:lat => 1.23, :lon => 4.56, :zoom => 16, :name => "Name", :suffix => "Suffix")
assert_dom_equal '<a class="set_position" data-lat="1.23" data-lon="4.56" data-zoom="16" data-name="Name" data-suffix="Suffix" href="/#map=16/1.23/4.56">Name</a> Suffix', html
assert_dom_equal '<a class="set_position stretched-link" data-lat="1.23" data-lon="4.56" data-zoom="16" data-name="Name" data-suffix="Suffix" href="/#map=16/1.23/4.56">Name</a> Suffix', html

html = result_to_html(:lat => 1.23, :lon => 4.56, :zoom => 16, :prefix => "Prefix", :name => "Name", :suffix => "Suffix")
assert_dom_equal 'Prefix <a class="set_position" data-lat="1.23" data-lon="4.56" data-zoom="16" data-prefix="Prefix" data-name="Name" data-suffix="Suffix" href="/#map=16/1.23/4.56">Name</a> Suffix', html
assert_dom_equal 'Prefix <a class="set_position stretched-link" data-lat="1.23" data-lon="4.56" data-zoom="16" data-prefix="Prefix" data-name="Name" data-suffix="Suffix" href="/#map=16/1.23/4.56">Name</a> Suffix', html

html = result_to_html(:type => "node", :id => 123456, :name => "Name")
assert_dom_equal '<a class="set_position" data-type="node" data-id="123456" data-name="Name" href="/node/123456">Name</a>', html
assert_dom_equal '<a class="set_position stretched-link" data-type="node" data-id="123456" data-name="Name" href="/node/123456">Name</a>', html

html = result_to_html(:min_lat => 1.23, :max_lat => 4.56, :min_lon => -1.23, :max_lon => 2.34, :name => "Name")
assert_dom_equal '<a class="set_position" data-min-lat="1.23" data-max-lat="4.56" data-min-lon="-1.23" data-max-lon="2.34" data-name="Name" href="/?bbox=-1.23,1.23,2.34,4.56">Name</a', html
assert_dom_equal '<a class="set_position stretched-link" data-min-lat="1.23" data-max-lat="4.56" data-min-lon="-1.23" data-max-lon="2.34" data-name="Name" href="/?bbox=-1.23,1.23,2.34,4.56">Name</a', html
end
end

0 comments on commit 62ba143

Please sign in to comment.