-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix missing frontend dependencies for leaflet. #3128
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,21 +3,6 @@ | |
{% leaflet_js %} | ||
{% leaflet_css %} | ||
|
||
|
||
<link rel="stylesheet" href="/static/lib/opacity/lib/opacity/Control.Opacity.css" /> | ||
<script src="/static/lib/opacity/lib/opacity/Control.Opacity.js"></script> | ||
|
||
<script src="/static/lib/opacity/lib/jquery/jquery-1.9.1.js"></script> | ||
<script src="/static/lib/opacity/lib/jquery/jquery-ui-1.10.3.custom.min.js"></script> | ||
<link rel="stylesheet" href="/static/lib/opacity/lib/jquery/jquery-ui-1.10.3.custom.min.css" /> | ||
|
||
<link rel="stylesheet" href="/static/lib/navbar/Leaflet.NavBar.css" /> | ||
<script src="/static/lib/navbar/Leaflet.NavBar.js"></script> | ||
|
||
<link rel="stylesheet" href="/static/lib/measure/leaflet.measure.css" /> | ||
<script src="/static/lib/measure/leaflet.measure.js"></script> | ||
|
||
|
||
<style> | ||
.leaflet-container { /* all maps */ | ||
height: 400px; | ||
|
@@ -166,7 +151,8 @@ | |
onAdd: function(map) { | ||
var img = L.DomUtil.create('img'); | ||
|
||
img.src = '../static/img/logo.png'; | ||
// Default to Geonode logo | ||
img.src = '{{ STATIC_URL }}/geonode/img/logo.png'; | ||
img.style.width = '120px'; | ||
|
||
return img; | ||
|
@@ -222,30 +208,26 @@ | |
overlay_layer["{{ resource.title }}"] = tile_layer; | ||
map.addLayer(tile_layer); | ||
} | ||
layerControl = L.control.layers( | ||
var layerControl = L.control.layers( | ||
base_maps, overlay_layer | ||
).addTo(map); | ||
|
||
if (L.control.hasOwnProperty('fullscreen')) { | ||
L.control.fullscreen().addTo(map); | ||
} | ||
|
||
if(L.Control.hasOwnProperty('opacitySlider')) { | ||
//adjust opacity | ||
var opacitySlider = new L.Control.opacitySlider(); | ||
map.addControl(opacitySlider); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Follow fullscreen plugin pattern. Only add when the plugin is resolved. |
||
|
||
//ajout opacity | ||
|
||
var higherOpacity = new L.Control.higherOpacity(); | ||
//map.addControl(higherOpacity); | ||
var lowerOpacity = new L.Control.lowerOpacity(); | ||
//map.addControl(lowerOpacity); | ||
var opacitySlider = new L.Control.opacitySlider(); | ||
map.addControl(opacitySlider); | ||
|
||
var opacitySlider = new L.Control.opacitySlider(); | ||
opacitySlider.setOpacityLayer(tile_layer); | ||
|
||
//ajout info | ||
opacitySlider.setOpacityLayer(tile_layer); | ||
} | ||
|
||
L.control.navbar().addTo(map); | ||
if(L.control.hasOwnProperty('navbar')){ | ||
//adjust info | ||
L.control.navbar().addTo(map); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Follow fullscreen plugin pattern. Only add when the plugin is resolved. |
||
} | ||
}); | ||
function zoom_to_box(map, bbox) { | ||
var bounds = [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -932,11 +932,36 @@ | |
'js': 'lib/js/Leaflet.fullscreen.min.js', | ||
'auto-include': True, | ||
}, | ||
'leaflet-opacity': { | ||
'css': 'lib/css/Control.Opacity.css', | ||
'js': 'lib/js/Control.Opacity.js', | ||
'auto-include': True, | ||
}, | ||
'leaflet-navbar': { | ||
'css': 'lib/css/Leaflet.NavBar.css', | ||
'js': 'lib/js/Leaflet.NavBar.js', | ||
'auto-include': True, | ||
}, | ||
'leaflet-measure': { | ||
'css': 'lib/css/leaflet-measure.css', | ||
'js': 'lib/js/leaflet-measure.js', | ||
'auto-include': True, | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add these 3 plugins with each css and js when DEBUG_STATIC = True |
||
}, | ||
'SRID': 3857, | ||
'RESET_VIEW': False | ||
} | ||
|
||
if not DEBUG_STATIC: | ||
# if not DEBUG_STATIC, use minified css and js | ||
LEAFLET_CONFIG['PLUGINS'] = { | ||
'leaflet-plugins': { | ||
'js': 'lib/js/leaflet-plugins.min.js', | ||
'css': 'lib/css/leaflet-plugins.min.css', | ||
'auto-include': True, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use minified plugins, when not in DEBUG_STATIC |
||
} | ||
} | ||
|
||
# option to enable/disable resource unpublishing for administrators | ||
RESOURCE_PUBLISHING = False | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,9 @@ | |
"angular-leaflet-directive": "0.7.9", | ||
"zeroclipboard": "2.1.5", | ||
"leaflet-fullscreen": "https://github.com/Leaflet/Leaflet.fullscreen.git", | ||
"leaflet-opacity": "https://github.com/lizardtechblog/Leaflet.OpacityControls.git#master", | ||
"leaflet-navbar": "1.0.1", | ||
"leaflet-measure": "2.1.7", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added leaflet plugins reference in bower. |
||
"eonasdan-bootstrap-datetimepicker": "4.17.43", | ||
"bootstrap-treeview": "1.2.0", | ||
"bootstrap-tokenfield": "0.12.1", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,8 +83,9 @@ module.exports = function(grunt) { | |
'jquery-tree-multiselect/dist/jquery.tree-multiselect.min.css', | ||
'bootstrap/dist/css/bootstrap.min.css', | ||
'leaflet-fullscreen/dist/leaflet.fullscreen.css', | ||
'leaflet-fullscreen/dist/[email protected]', | ||
'leaflet-fullscreen/dist/fullscreen.png', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move fullscreen*.png to lib/img |
||
'leaflet-opacity/lib/opacity/Control.Opacity.css', | ||
'leaflet-measure/dist/leaflet-measure.css', | ||
'leaflet-navbar/src/Leaflet.NavBar.css', | ||
'eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css', | ||
'bootstrap-treeview/dist/bootstrap-treeview.min.css', | ||
'bootstrap-tokenfield/dist/css/bootstrap-tokenfield.min.css', | ||
|
@@ -100,8 +101,15 @@ module.exports = function(grunt) { | |
dest: 'lib/img', | ||
src: [ | ||
'bootstrap/img/*.png', | ||
'select2*.png', 'select2-spinner.gif', | ||
'select2/select2*.png', | ||
'select2/select2*.gif', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use proper select2 namespace/folder. |
||
'raty/lib/img/*.png', | ||
'jquery-ui/themes/base/images/*', | ||
'leaflet-fullscreen/dist/*.png', | ||
'leaflet-opacity/lib/opacity/images/*', | ||
'leaflet-opacity/lib/jquery/images/*', | ||
'leaflet-measure/dist/images/*', | ||
'leaflet-navbar/src/img/*', | ||
'multi-select/img/switch.png', | ||
'datatables/media/images/*.png', | ||
'jquery-ui/themes/smoothness/images/animated-overlay.gif', | ||
|
@@ -117,11 +125,11 @@ module.exports = function(grunt) { | |
'datatables/media/js/jquery.dataTables.js', | ||
'jquery-timeago/jquery.timeago.js', | ||
'tinysort/src/jquery.tinysort.js', | ||
'raty/lib/jquery.raty.min.js', | ||
'jquery-waypoints/waypoints.min.js', | ||
'jquery-ui/ui/minified/jquery-ui.custom.min.js', | ||
'raty/lib/jquery.raty.js', | ||
'jquery-waypoints/waypoints.js', | ||
'jquery-ui/ui/jquery-ui.custom.js', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need to change these, because it is what being referenced in |
||
'jquery-ajaxprogress/jquery.ajaxprogress.js', | ||
'jquery.ajaxQueue/dist/jquery.ajaxQueue.min.js', | ||
'jquery.ajaxQueue/dist/jquery.ajaxQueue.js', | ||
'multi-select/js/jquery.multi-select.js', | ||
'jquery-tree-multiselect/dist/jquery.tree-multiselect.min.js', | ||
'json2/json2.js', | ||
|
@@ -130,11 +138,14 @@ module.exports = function(grunt) { | |
'requirejs-text/text.js', | ||
'underscore/underscore-min.js', | ||
'qunit/qunit/qunit.js', | ||
'angular/angular.min.js', | ||
'angular/angular.js', | ||
'angular-leaflet-directive/dist/angular-leaflet-directive.min.js', | ||
'bootstrap/dist/js/bootstrap.min.js', | ||
'zeroclipboard/dist/ZeroClipboard.min.js', | ||
'leaflet-fullscreen/dist/Leaflet.fullscreen.min.js', | ||
'leaflet-opacity/lib/opacity/Control.Opacity.js', | ||
'leaflet-measure/dist/leaflet-measure.js', | ||
'leaflet-navbar/src/Leaflet.NavBar.js', | ||
'moment/min/moment-with-locales.min.js', | ||
'eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js', | ||
'bootstrap-treeview/dist/bootstrap-treeview.min.js', | ||
|
@@ -173,13 +184,68 @@ module.exports = function(grunt) { | |
development: { | ||
src: ['lib/css/*.css'], | ||
overwrite: true, | ||
replacements: [{ | ||
from: /url\((("?images\/)|('(?!(images|\.)))|(?!('|"))|('\.\.\/images\/))/g, | ||
to: 'url(\'../img/' | ||
}, { | ||
from: /(png|gif|jpg)+(\)|'\)|"\))/g, | ||
to: '$1\')' | ||
}] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed the pattern in the hope that it will be more readable and understandable. |
||
/* | ||
* We separate each pattern so it will be easy for us to read | ||
* and recognize | ||
*/ | ||
replacements: [ | ||
/* | ||
* Pattern: | ||
* url('img/image _.png') or url("img/image _.png") | ||
*/ | ||
{ | ||
from: /url\([\"\']?(img\/)([\w-\.\s@]+)[\"\']?\)/g, | ||
to: 'url("../img/$2")' | ||
}, | ||
/* | ||
* Pattern: | ||
* url('images/image _.png') or url("images/image _.png") | ||
*/ | ||
{ | ||
from: /url\([\"\']?(images\/)([\w-\.\s@]+)[\"\']?\)/g, | ||
to: 'url("../img/$2")' | ||
}, | ||
/* | ||
* Pattern: | ||
* url('image/image _.png') or url("image/image _.png") | ||
*/ | ||
{ | ||
from: /url\([\"\']?(image\/)([\w-\.\s@]+)[\"\']?\)/g, | ||
to: 'url("../img/$2")' | ||
}, | ||
/* | ||
* Pattern: | ||
* url('./image _.png') or url("./image _.png") | ||
*/ | ||
{ | ||
from: /url\([\"\']?(\.\/)([\w-\.\s@]+)[\"\']?\)/g, | ||
to: 'url("../img/$2")' | ||
}, | ||
/* | ||
* Pattern: | ||
* url('image _.png') or url("image _.png") | ||
*/ | ||
{ | ||
from: /url\([\"\']?([\w-\.\s@]+)[\"\']?\)/g, | ||
to: 'url("../img/$1")' | ||
}, | ||
/* | ||
* Pattern: | ||
* url('../images/image _.png') or url("../images/image _.png") | ||
*/ | ||
{ | ||
from: /url\([\"\']?(\.\.\/images\/)([\w-\.\s@]+)[\"\']?\)/g, | ||
to: 'url("../img/$1")' | ||
}, | ||
/* | ||
* Pattern: | ||
* url('../image/image _.png') or url("../image/image _.png") | ||
*/ | ||
{ | ||
from: /url\([\"\']?(\.\.\/image\/)([\w-\.\s@]+)[\"\']?\)/g, | ||
to: 'url("../img/$1")' | ||
} | ||
] | ||
} | ||
}, | ||
|
||
|
@@ -202,10 +268,15 @@ module.exports = function(grunt) { | |
'lib/css/jquery.dataTables.css', | ||
'lib/css/jquery.tree-multiselect.min.css', | ||
'lib/css/jquery.treefilter.css', | ||
'lib/css/leaflet.fullscreen.css', | ||
'lib/css/L.Control.Pan.css', | ||
'lib/css/multi-select.css', | ||
'lib/css/select2.css' | ||
], | ||
'lib/css/leaflet-plugins.min.css': [ | ||
'lib/css/leaflet.fullscreen.css', | ||
'lib/css/Leaflet.NavBar.css', | ||
'lib/css/leaflet-measure.css', | ||
'lib/css/Control.Opacity.css' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minified all used leaflet-plugins. |
||
] | ||
} | ||
} | ||
|
@@ -220,12 +291,12 @@ module.exports = function(grunt) { | |
files: { | ||
'lib/js/assets.min.js': [ | ||
'lib/js/jquery.min.js', | ||
'lib/js/jquery-ui.custom.min.js', | ||
'lib/js/jquery-ui.custom.js', | ||
'lib/js/jquery.dataTables.js', | ||
'lib/js/jquery.raty.min.js', | ||
'lib/js/jquery.raty.js', | ||
'lib/js/jquery.timeago.js', | ||
'lib/js/json2.js', | ||
'lib/js/waypoints.min.js', | ||
'lib/js/waypoints.js', | ||
'lib/js/select2.min.js', | ||
'lib/js/moment-with-locales.min.js', | ||
'lib/js/fastselect.standalone.min.js', | ||
|
@@ -235,19 +306,25 @@ module.exports = function(grunt) { | |
'lib/js/bootstrap-treeview.min.js', | ||
'lib/js/bootstrap-select.min.js', | ||
'lib/js/bootstrap-wysihtml5-0.0.2.min.js', | ||
'lib/js/angular.min.js', | ||
'lib/js/jquery.ajaxprogress.js', | ||
'lib/js/jquery.ajaxQueue.min.js', | ||
'lib/js/jquery.ajaxQueue.js', | ||
'lib/js/jquery.multi-select.js', | ||
'lib/js/jquery.tree-multiselect.min.js', | ||
'lib/js/jquery.treefilter-min.js', | ||
'lib/js/angular.js', | ||
'lib/js/angular-leaflet-directive.min.js', | ||
'lib/js/ZeroClipboard.min.js' | ||
], | ||
'lib/js/jquery.js': ['lib/js/jquery.min.js'], | ||
'lib/js/require.js': ['lib/js/require.js'], | ||
'lib/js/text.js': ['lib/js/text.js'], | ||
'lib/js/underscore.js': ['lib/js/underscore-min.js'] | ||
'lib/js/underscore.js': ['lib/js/underscore-min.js'], | ||
'lib/js/leaflet-plugins.min.js': [ | ||
'lib/js/Leaflet.fullscreen.min.js', | ||
'lib/js/Leaflet.NavBar.js', | ||
'lib/js/leaflet-measure.js', | ||
'lib/js/Control.Opacity.js' | ||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minified all used leaflet-plugins. |
||
} | ||
} | ||
}, | ||
|
@@ -278,6 +355,6 @@ module.exports = function(grunt) { | |
grunt.registerTask('default', ['jshint', 'less:development', 'concat:bootstrap', 'copy', 'replace']); | ||
|
||
// build production | ||
grunt.registerTask('production', ['jshint', 'less:production', 'concat:bootstrap', 'copy', 'cssmin', 'uglify' ]); | ||
grunt.registerTask('production', ['jshint', 'less:production', 'concat:bootstrap', 'copy', 'replace', 'cssmin', 'uglify' ]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include |
||
|
||
}; |
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted these so it can be included from {% leaflet_js %} tags