From 1cdcc50c634ba469ec3db93a4fb687dcbf5f2fd2 Mon Sep 17 00:00:00 2001 From: realtin Date: Fri, 11 Sep 2015 10:06:32 +0200 Subject: [PATCH] fix all the pronto remarks finally - fix map controls in stream --- app/assets/javascripts/app/views/location_stream.js | 4 +++- .../views/single-post-viewer/single_post_content_view.js | 4 +++- app/assets/stylesheets/stream_element.scss | 3 +++ spec/factories.rb | 7 +++---- spec/javascripts/app/views/location_stream_spec.js | 2 ++ spec/javascripts/app/views/locator_spec.js | 1 - spec/javascripts/helpers/factory.js | 2 +- spec/models/status_message_spec.rb | 2 +- 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/app/views/location_stream.js b/app/assets/javascripts/app/views/location_stream.js index d9f727347..1db156dea 100644 --- a/app/assets/javascripts/app/views/location_stream.js +++ b/app/assets/javascripts/app/views/location_stream.js @@ -30,7 +30,9 @@ app.views.LocationStream = app.views.Content.extend({ tiles = L.tileLayer("https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}", { id: gon.appConfig.map.mapbox.id, + /* jshint camelcase: false */ accessToken: gon.appConfig.map.mapbox.access_token, + /* jshint camelcase: true */ attribution: "Map data © OpenStreetMap contributors, " + "CC-BY-SA, " + "Imagery © Mapbox", @@ -40,7 +42,7 @@ app.views.LocationStream = app.views.Content.extend({ tiles.addTo(map); - var markerOnMap = L.marker(location).addTo(map); + L.marker(location).addTo(map); mapContainer.removeClass("empty"); return map; } diff --git a/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js b/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js index 0bfb35b2d..b105a74c4 100644 --- a/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js +++ b/app/assets/javascripts/app/views/single-post-viewer/single_post_content_view.js @@ -53,7 +53,9 @@ app.views.SinglePostContent = app.views.Base.extend({ tiles = L.tileLayer("https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}", { id: gon.appConfig.map.mapbox.id, + /* jshint camelcase: false */ accessToken: gon.appConfig.map.mapbox.access_token, + /* jshint camelcase: true */ attribution: "Map data © OpenStreetMap contributors, " + "CC-BY-SA, " + "Imagery © Mapbox", @@ -68,7 +70,7 @@ app.views.SinglePostContent = app.views.Base.extend({ map.invalidateSize(); // put marker on map - var markerOnMap = L.marker(location).addTo(map); + L.marker(location).addTo(map); return map; } }, diff --git a/app/assets/stylesheets/stream_element.scss b/app/assets/stylesheets/stream_element.scss index 46ed66c96..cbb826492 100644 --- a/app/assets/stylesheets/stream_element.scss +++ b/app/assets/stylesheets/stream_element.scss @@ -87,6 +87,9 @@ font-size: $font-size-small; color: $text-grey; } + .leaflet-control-zoom { + display: block; + } .grey { color: $text-grey; } .post-content p:last-of-type { margin-bottom: 0; } .nsfw-shield { diff --git a/spec/factories.rb b/spec/factories.rb index a7cddc2b7..056bb1928 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -140,10 +140,9 @@ FactoryGirl.define do end factory(:location) do - address "Starco Mart, Mission Street, West SoMa, San Francisco, San Francisco "\ - "City and County, Kalifornien, 94103, Vereinigte Staaten von Amerika" - lat 37.78 - lng -122.41 + address "Fernsehturm Berlin, Berlin, Germany" + lat 52.520645 + lng 13.409779 end factory(:poll) do diff --git a/spec/javascripts/app/views/location_stream_spec.js b/spec/javascripts/app/views/location_stream_spec.js index 6f8683b2a..ba0d2e2db 100644 --- a/spec/javascripts/app/views/location_stream_spec.js +++ b/spec/javascripts/app/views/location_stream_spec.js @@ -2,7 +2,9 @@ describe("app.views.LocationStream", function() { beforeEach(function(){ this.post = factory.post(); this.view = new app.views.LocationStream({model : this.post}); + /* jshint camelcase: false */ gon.appConfig = {map: { mapbox: {enabled: true, id: "yourID", access_token: "yourAccessToken" }}}; + /* jshint camelcase: true */ }); describe("toggleMap", function() { diff --git a/spec/javascripts/app/views/locator_spec.js b/spec/javascripts/app/views/locator_spec.js index 42e04741c..f600de8b9 100644 --- a/spec/javascripts/app/views/locator_spec.js +++ b/spec/javascripts/app/views/locator_spec.js @@ -1,6 +1,5 @@ describe("app.views.Location", function(){ beforeEach(function(){ - OSM = {}; OSM.Locator = function(){return { getAddress:function(){}}}; this.view = new app.views.Location(); diff --git a/spec/javascripts/helpers/factory.js b/spec/javascripts/helpers/factory.js index f8a40b874..856e8301a 100644 --- a/spec/javascripts/helpers/factory.js +++ b/spec/javascripts/helpers/factory.js @@ -150,7 +150,7 @@ var factory = { location : function() { return { - address: "Starco Mart, Mission Street, West SoMa, San Francisco, San Francisco City and County, Kalifornien, 94103, Vereinigte Staaten von Amerika", + address: "Starco Mart, Mission Street, San Francisco, Kalifornien, 94103, Vereinigte Staaten von Amerika", lat: 37.78, lng: -122.41 }; diff --git a/spec/models/status_message_spec.rb b/spec/models/status_message_spec.rb index d17a103fa..7172ae590 100644 --- a/spec/models/status_message_spec.rb +++ b/spec/models/status_message_spec.rb @@ -63,7 +63,7 @@ describe StatusMessage, type: :model do describe ".guids_for_author" do it "returns an array of the status_message guids" do status_message_1 = FactoryGirl.create(:status_message, author: alice.person) - status_message_2 = FactoryGirl.create(:status_message, author: bob.person) + FactoryGirl.create(:status_message, author: bob.person) guids = StatusMessage.guids_for_author(alice.person) expect(guids).to eq([status_message_1.guid]) end