[#145,view/refactor][m]: switch to a proper sidebar setup where views can have both a main element and a sidebar element and this added to central sidebar.

* this fixes functional and visual bugs with current (new) setup where fields where in separate in RHS sidebar
* Refactored map and graph view to put menu/controls in the sidebar (this is quite nice!)
This commit is contained in:
Rufus Pollock
2012-06-06 14:22:02 +01:00
parent e73be69499
commit ef74f13163
7 changed files with 380 additions and 269 deletions

View File

@@ -31,7 +31,7 @@ test('basics', function () {
//Fire query, otherwise the map won't be initialized
dataset.query();
assertPresent('.editor',view.el);
assertPresent('.editor-field-type', view.elSidebar);
// Check that the Leaflet map was set up
assertPresent('.leaflet-container',view.el);
@@ -42,6 +42,21 @@ test('basics', function () {
view.remove();
});
test('_setupGeometryField', function () {
var dataset = Fixture.getDataset();
var view = new recline.View.Map({
model: dataset
});
var exp = {
geomField: null,
lonField: 'lon',
latField: 'lat',
autoZoom: true
};
deepEqual(view.state.toJSON(), exp);
deepEqual(view.menu.state.toJSON(), exp);
});
test('Lat/Lon geom fields', function () {
var dataset = Fixture.getDataset();
var view = new recline.View.Map({
@@ -138,6 +153,15 @@ test('Popup', function () {
view.remove();
});
test('MapMenu', function () {
var dataset = Fixture.getDataset();
var controls = new recline.View.MapMenu({
model: dataset,
state: {}
});
assertPresent('.editor-field-type', controls.el);
});
var _getFeaturesCount = function(features){
var cnt = 0;
features._iterateLayers(function(layer){