[#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

@@ -8,7 +8,7 @@ test('basics', function () {
$('.fixtures').append(view.el);
equal(view.state.get('graphType'), 'lines-and-points');
// view will auto render ...
assertPresent('.editor', view.el);
assertPresent('.editor', view.elSidebar);
view.remove();
});
@@ -27,9 +27,9 @@ test('initialize', function () {
deepEqual(view.state.get('series'), ['y', 'z']);
// check we have updated editor with state info
equal(view.el.find('.editor-type select').val(), 'lines');
equal(view.el.find('.editor-group select').val(), 'x');
var out = _.map(view.el.find('.editor-series select'), function($el) {
equal(view.elSidebar.find('.editor-type select').val(), 'lines');
equal(view.elSidebar.find('.editor-group select').val(), 'x');
var out = _.map(view.elSidebar.find('.editor-series select'), function($el) {
return $($el).val();
});
deepEqual(out, ['y', 'z']);
@@ -51,3 +51,20 @@ test('dates in graph view', function () {
view.remove();
});
test('GraphControls basics', function () {
var dataset = Fixture.getDataset();
var view = new recline.View.GraphControls({
model: dataset,
state: {
graphType: 'bars',
series: []
}
});
$('.fixtures').append(view.el);
equal(view.state.get('graphType'), 'bars');
// view will auto render ...
assertPresent('.editor', view.el);
view.remove();
});