diff --git a/carte_fluviale/static/carte_fluviale/CustomRevealOSM.js b/carte_fluviale/static/carte_fluviale/CustomRevealOSM.js new file mode 100644 index 0000000..1d95691 --- /dev/null +++ b/carte_fluviale/static/carte_fluviale/CustomRevealOSM.js @@ -0,0 +1,110 @@ +var RevealOSM = L.Control.RevealOSM.extend({ + + initialize: function (options) { + L.Control.RevealOSM.prototype.initialize.call(this, options); + this.options.excludeKeys = [ + /source/, + /^ref/, + /seamark/, + /^name$/, + /^harbour$/, + /^leisure$/, + /^lock$/, + /^boat$/, + /^motorboat$/, + /^waterway$/, + /^lock_name$/, + /^man_made$/, + /^harbour\:category$/ + ]; + this.options.helpText = "Click on harbours, locks or piers"; + this.options.translateKeys = { + 'harbour:channel': 'VHF', + 'harbour:draft': 'max draft', + 'harbour:length': 'max length' + }; + }, + + getQueryTemplate: function () { + var template; + if (this._map.getZoom() < 13) { + template = '[out:json];node(around:{radius},{lat},{lng})[harbour];out body qt 1;'; + } + else { + template = '[out:json];(node(around:{radius},{lat},{lng})[harbour];way(around:{radius},{lat},{lng})[lock];way(around:{radius},{lat},{lng})[man_made=pier]);out body qt 1;'; + } + return template; + }, + + getRadius: function () { + return this.options.radius || 300 - (15 * this._map.getZoom()); + }, + + formatTitle: function (element) { + var title, + className, + keys = ['lock:name', 'lock_name', 'name']; + for (var i=0, l=keys.length; i" + title + ""; + } + return title; + }, + + cleanKey: function (element, key) { + key = L.Control.RevealOSM.prototype.cleanKey.call(this, element, key); + return key.replace('harbour', ''); + }, + + formatIcon: function (element, key) { + var icon = ""; + if (key.match(/vhf|channel/i)) { + icon = '
' + element.tags[key] + "
"; + } + return icon; + }, + + formatPhone: function (element, key) { + var output = ""; + if (key.match(/phone/i)) { + output = '
' + element.tags[key] + "
"; + } + return output; + } + + // formatContent: function (element) { + // var content = "", + // raw_tags = "", + // phone = "", + // title = this.formatTitle(element); + // if (title) { + // content += title; + // } + // for (var tag in element.tags) { + // content += this.formatIcon(element, tag); + // phone += this.formatPhone(element, tag); + // if (!this.isAllowedKey(tag)) { continue;} + // raw_tags += this.formatKey(element, tag); + // } + // content += phone; + // content += '
' + raw_tags + '
'; + // return content; + // } + +}); diff --git a/carte_fluviale/static/carte_fluviale/carte_fluviale.css b/carte_fluviale/static/carte_fluviale/carte_fluviale.css new file mode 100644 index 0000000..cb01672 --- /dev/null +++ b/carte_fluviale/static/carte_fluviale/carte_fluviale.css @@ -0,0 +1,55 @@ +.leaflet-popup-content h4.harbour, +.leaflet-popup-content h4.seasonal, +.leaflet-popup-content h4.pier { + text-indent: 26px; +} +.leaflet-popup-content h4.harbour { + background: url("./harbour.png") no-repeat scroll center left transparent; +} +.leaflet-popup-content h4.seasonal { + background: url("./seasonal.png") no-repeat scroll center left transparent; +} +.leaflet-popup-content h4.pier { + background: url("./pier.png") no-repeat scroll center left transparent; +} +.leaflet-popup-content .icon { + display: inline-block; + height: 36px; + line-height: 36px; + text-align: center; + width: 36px; + margin: 0 10px 10px 0; +} +.leaflet-popup-content .raw_tags { + background-color: #e5e5e5; + padding: 10px; +} +.leaflet-popup-content .phone { + background: url("./phone.png") no-repeat scroll center left transparent; + height: 36px; + line-height: 36px; + text-indent: 40px; + font-size: 1.2em; +} +.leaflet-popup-content .info { + background: white; + color: black; +} +.leaflet-popup-content .vhf { + border: 4px solid red; + position: relative; + font-weight: bold; + font-size: 1.3em; + line-height: 45px; +} +.leaflet-popup-content .vhf:before { + content: "VHF"; + left: 6px; + position: absolute; + top: -12px; + font-size: 0.8em; +} +.reveal-osm-popup li strong { + display: inline-block; + width: 100px; +} \ No newline at end of file diff --git a/carte_fluviale/static/carte_fluviale/harbour.png b/carte_fluviale/static/carte_fluviale/harbour.png new file mode 100644 index 0000000..09556f9 Binary files /dev/null and b/carte_fluviale/static/carte_fluviale/harbour.png differ diff --git a/carte_fluviale/static/carte_fluviale/pier.png b/carte_fluviale/static/carte_fluviale/pier.png new file mode 100644 index 0000000..8aa3e42 Binary files /dev/null and b/carte_fluviale/static/carte_fluviale/pier.png differ diff --git a/carte_fluviale/static/carte_fluviale/seasonal.png b/carte_fluviale/static/carte_fluviale/seasonal.png new file mode 100644 index 0000000..e2eabed Binary files /dev/null and b/carte_fluviale/static/carte_fluviale/seasonal.png differ diff --git a/carte_fluviale/templates/leaflet_storage/map_detail.html b/carte_fluviale/templates/leaflet_storage/map_detail.html index 37f5761..6c07f2f 100644 --- a/carte_fluviale/templates/leaflet_storage/map_detail.html +++ b/carte_fluviale/templates/leaflet_storage/map_detail.html @@ -8,11 +8,15 @@ {% compress css %} {% leaflet_storage_css %} + + {% endcompress css %} {% compress js %} {% leaflet_storage_js %} + + {% endcompress js %} {% endblock %} diff --git a/carte_fluviale/templates/leaflet_storage/map_init.html b/carte_fluviale/templates/leaflet_storage/map_init.html index d9c0304..bc042f7 100644 --- a/carte_fluviale/templates/leaflet_storage/map_init.html +++ b/carte_fluviale/templates/leaflet_storage/map_init.html @@ -1,10 +1,5 @@
diff --git a/fabfile.py b/fabfile.py index 8a4d3b2..70e3552 100644 --- a/fabfile.py +++ b/fabfile.py @@ -251,15 +251,17 @@ def collect_remote_statics(): remote_static_dir = '{project_dir}/{project_name}/remote_static'.format(**env) run('mkdir -p {0}'.format(remote_static_dir)) remote_repositories = { - 'leaflet': "git://github.com/Leaflet/Leaflet.git", - 'draw': "git://github.com/Leaflet/Leaflet.draw.git", - 'hash': "git://github.com/mlevans/leaflet-hash.git", - 'storage': 'git://github.com/yohanboniface/Leaflet.Storage.git', - 'edit_in_osm': 'git://github.com/yohanboniface/Leaflet.EditInOSM.git', - 'minimap': 'git://github.com/Norkart/Leaflet-MiniMap.git', + 'leaflet': "git://github.com/Leaflet/Leaflet.git@master", + 'draw': "git://github.com/Leaflet/Leaflet.draw.git@master", + 'hash': "git://github.com/mlevans/leaflet-hash.git@master", + 'storage': 'git://github.com/yohanboniface/Leaflet.Storage.git@master', + 'edit_in_osm': 'git://github.com/yohanboniface/Leaflet.EditInOSM.git@master', + 'reveal_osm': 'git://github.com/yohanboniface/Leaflet.RevealOSM.git@master', + 'minimap': 'git://github.com/Norkart/Leaflet-MiniMap.git@master', } with cd(remote_static_dir): - for subdir, repository in remote_repositories.iteritems(): + for subdir, path in remote_repositories.iteritems(): + repository, branch = path.split('@') with hide("running", "stdout"): exists = run('if [ -d "{0}" ]; then echo 1; fi'.format(subdir)) if exists: @@ -267,3 +269,5 @@ def collect_remote_statics(): run('git pull') else: run('git clone {0} {1}'.format(repository, subdir)) + with cd(subdir): + run('git checkout {0}'.format(branch))