Skip to content

Commit

Permalink
Merge pull request #100 from haiafara/development
Browse files Browse the repository at this point in the history
[release] 2019-05-28 - Fullscreen button & depfu updates
  • Loading branch information
janosrusiczki authored May 28, 2019
2 parents cbbf2c7 + 52e94d0 commit 3a01644
Show file tree
Hide file tree
Showing 12 changed files with 1,226 additions and 269 deletions.
23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
'env': {
'browser': true,
'es6': true
},
'extends': [
'eslint:recommended',
'plugin:vue/recommended'
],
'globals': {
'Atomics': 'readonly',
'SharedArrayBuffer': 'readonly'
},
'parserOptions': {
'ecmaVersion': 2018,
'sourceType': 'module'
},
'plugins': [
'vue'
],
'rules': {
}
}
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ gem 'webpacker', '>= 4.0.x'
# gem 'mini_racer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
gem 'coffee-rails', '~> 5.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use ActiveModel has_secure_password
Expand Down
32 changes: 15 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,34 +88,34 @@ GEM
capistrano-sidekiq (1.0.2)
capistrano (>= 3.9.0)
sidekiq (>= 3.4)
capybara (3.18.0)
capybara (3.21.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
regexp_parser (~> 1.5)
xpath (~> 3.2)
childprocess (1.0.1)
rake (< 13.0)
chromedriver-helper (2.1.1)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-rails (5.0.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
railties (>= 5.2.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
connection_pool (2.2.2)
coveralls (0.8.22)
coveralls (0.8.23)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
term-ansicolor (~> 1.3)
thor (~> 0.19.4)
thor (>= 0.19.4, < 2.0)
tins (~> 1.6)
crass (1.0.4)
database_cleaner (1.7.0)
Expand All @@ -142,9 +142,8 @@ GEM
i18n (1.6.0)
concurrent-ruby (~> 1.0)
io-like (0.3.0)
jbuilder (2.8.0)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
Expand Down Expand Up @@ -181,7 +180,6 @@ GEM
momentjs-rails (2.20.1)
railties (>= 3.1)
msgpack (1.2.10)
multi_json (1.13.1)
multipart-post (2.0.0)
net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0)
Expand Down Expand Up @@ -231,7 +229,7 @@ GEM
rb-inotify (0.10.0)
ffi (~> 1.0)
redis (4.1.0)
regexp_parser (1.4.0)
regexp_parser (1.5.1)
rgeo (2.0.1)
rgeo-activerecord (6.1.0)
activerecord (~> 5.0)
Expand Down Expand Up @@ -269,7 +267,7 @@ GEM
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selectize-rails (0.12.6)
selenium-webdriver (3.142.0)
selenium-webdriver (3.142.3)
childprocess (>= 0.5, < 2.0)
rubyzip (~> 1.2, >= 1.2.2)
sentry-raven (2.9.0)
Expand All @@ -286,9 +284,9 @@ GEM
simplecov-html (0.10.2)
sitemap_generator (6.0.2)
builder (~> 3.0)
skylight (3.1.5)
skylight-core (= 3.1.5)
skylight-core (3.1.5)
skylight (4.0.2)
skylight-core (= 4.0.2)
skylight-core (4.0.2)
activesupport (>= 4.2.0)
spring (2.0.2)
activesupport (>= 4.2)
Expand All @@ -307,15 +305,15 @@ GEM
net-ssh (>= 2.8.0)
term-ansicolor (1.7.1)
tins (~> 1.0)
thor (0.19.4)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
tins (1.20.2)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
underpass (0.0.6)
underpass (0.0.7)
rgeo (~> 2.0, >= 2.0.0)
web-console (3.7.0)
actionview (>= 5.0)
Expand Down Expand Up @@ -347,7 +345,7 @@ DEPENDENCIES
capistrano-sidekiq
capybara (>= 2.15)
chromedriver-helper
coffee-rails (~> 4.2)
coffee-rails (~> 5.0)
coveralls
database_cleaner
factory_bot_rails (~> 5.0)
Expand Down
166 changes: 84 additions & 82 deletions app/javascript/Map.vue
Original file line number Diff line number Diff line change
@@ -1,97 +1,99 @@
<template>
<div id="map"></div>
<div id="map" />
</template>

<script>
import { eventBus } from 'packs/haiafara'
import L from 'leaflet'
import 'leaflet/dist/leaflet.css'
import { eventBus } from 'packs/haiafara'
import L from 'leaflet'
import 'leaflet/dist/leaflet.css'
import 'leaflet.fullscreen'
import 'leaflet.fullscreen/Control.FullScreen.css'
export default {
data() {
return {
map: null,
geoJSONLayer: null
}
},
created() {
eventBus.$on('mapInvalidateSize', () => {
this.map.invalidateSize(true)
})
eventBus.$on('mapSetView', (coordinates, zoom) => {
this.map.setView(coordinates, zoom)
})
eventBus.$on('mapFitBounds', (bounds) => {
this.map.fitBounds(bounds)
})
eventBus.$on('mapAddGeoJSON', (type, id, name, shape) => {
this.geoJSONLayer.addData({ type: 'Feature', id: id, properties: { type: type, name: name }, geometry: shape })
})
eventBus.$on('mapClearGeoJSONLayer', () => {
this.geoJSONLayer.clearLayers()
})
},
mounted() {
var customControl = L.Control.extend({
options: {
export default {
data () {
return {
map: null,
geoJSONLayer: null
}
},
created () {
eventBus.$on('mapInvalidateSize', () => {
this.map.invalidateSize(true)
})
eventBus.$on('mapSetView', (coordinates, zoom) => {
this.map.setView(coordinates, zoom)
})
eventBus.$on('mapFitBounds', (bounds) => {
this.map.fitBounds(bounds)
})
eventBus.$on('mapAddGeoJSON', (type, id, name, geometry) => {
this.geoJSONLayer.addData({ type: 'Feature', properties: { name, type }, id, geometry })
})
eventBus.$on('mapClearGeoJSONLayer', () => {
this.geoJSONLayer.clearLayers()
})
},
mounted () {
var CustomControl = L.Control.extend({
options: {
position: 'topright'
},
onAdd: function (map) {
var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control leaflet-control-custom')
},
onAdd () {
var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control leaflet-control-custom')
container.style.backgroundColor = 'white'
container.style.width = '40px'
container.style.height = '30px'
container.style.padding = '5px'
container.style.cursor = 'pointer'
container.style.textAlign = 'center'
container.innerHTML = 'Info'
container.style.backgroundColor = 'white'
container.style.width = '40px'
container.style.height = '30px'
container.style.padding = '5px'
container.style.cursor = 'pointer'
container.style.textAlign = 'center'
container.innerHTML = 'Info'
container.onclick = function() {
eventBus.$emit('toggleInfoPanel')
}
return container;
container.onclick = function () {
eventBus.$emit('toggleInfoPanel')
}
});
this.map = L.map('map', { maxZoom: 20, trackResize: true })
var tileLayer = L.tileLayer("//tileserver.haiafara.ro/hot/{z}/{x}/{y}.png", {
attribution: '&copy; Contribuitori <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
maxZoom: 20
});
tileLayer.addTo(this.map)
this.map.addControl(new customControl())
this.geoJSONLayer = L.geoJSON(
undefined,
{
onEachFeature: (feature, layer) => {
layer.on({
click: () => {
this.$router.push({ name: feature.properties.type, params: { id: feature.id }})
}
})
layer.bindTooltip(feature.properties.name)
},
pointToLayer: (feature, latlng) => {
return L.marker(
latlng,
{
icon: new L.Icon(
{
iconSize: [25, 41],
iconAnchor: [13, 41],
popupAnchor: [1, -24],
iconUrl: '/marker-icon-blue.png'
}
)
}
)
}
return container
}
})
this.map = L.map('map', { fullscreenControl: true, maxZoom: 20, trackResize: true })
var tileLayer = L.tileLayer('//tileserver.haiafara.ro/hot/{z}/{x}/{y}.png', {
attribution: "&copy; Contribuitori <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a>",
maxZoom: 20
})
tileLayer.addTo(this.map)
this.map.addControl(new CustomControl())
this.geoJSONLayer = L.geoJSON(
undefined,
{
onEachFeature: (feature, layer) => {
layer.on({
click: () => {
this.$router.push({ name: feature.properties.type, params: { id: feature.id } })
}
})
layer.bindTooltip(feature.properties.name)
},
pointToLayer: (feature, latlng) => {
return L.marker(
latlng,
{
icon: new L.Icon(
{
iconSize: [25, 41],
iconAnchor: [13, 41],
popupAnchor: [1, -24],
iconUrl: '/marker-icon-blue.png'
}
)
}
)
}
).addTo(this.map)
}
}
).addTo(this.map)
}
}
</script>

<style>
Expand Down
Loading

0 comments on commit 3a01644

Please sign in to comment.