Replace sidebar with sidebar-v2, restore old flexbox tabs (#90) (WIP)

This commit is contained in:
Norbert Renner 2018-02-08 21:27:24 +01:00
parent 1393860148
commit 443ca9c03e
9 changed files with 160 additions and 112 deletions

View file

@ -5,7 +5,7 @@ BR.Itinerary = L.Class.extend({
onAdd: function (map) {
this._content = document.getElementById('itinerary');
L.DomUtil.removeClass(this._content.parentElement, 'hidden');
document.getElementById('tab_itinerary').hidden = false;
this.update();
},

View file

@ -5,7 +5,6 @@ BR.Profile = L.Evented.extend({
L.DomUtil.get('upload').onclick = L.bind(this._upload, this);
L.DomUtil.get('clear').onclick = L.bind(this.clear, this);
this.ele = L.DomUtil.get('profile_upload');
autosize(this.ele);
this.message = new BR.Message('profile_message', {
alert: true
});
@ -17,7 +16,6 @@ BR.Profile = L.Evented.extend({
evt.preventDefault();
this.ele.value = null;
this.ele.defaultValue = null;
autosize.update(this.ele);
this.fire('clear');
button.blur();
@ -45,13 +43,11 @@ BR.Profile = L.Evented.extend({
if (!this.profileName || this.profileName === profileName) {
ele.value = profileText;
ele.defaultValue = ele.value;
autosize.update(this.ele);
}
}, this));
} else {
ele.value = this.cache[profileName];
ele.defaultValue = ele.value;
autosize.update(this.ele);
}
}
},

View file

@ -1,47 +0,0 @@
BR.Tabs = BR.Control.extend({
options: {
divId: 'sidebar',
// tab a.hash > instance
tabs: {}
},
initialize: function (options) {
L.setOptions(this, options);
},
onAdd: function (map) {
var tabs = this.options.tabs;
for (var key in tabs) {
$('<li><a href="' + key + '" role="tab">' + tabs[key].options.heading + '</a></li>').appendTo('#tab');
if (tabs[key].onAdd) {
tabs[key].onAdd(map);
}
}
$('#tab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
// e.target = activated tab
// e.relatedTarget = previous tab
$('#tab a').on('shown.bs.tab', L.bind(function (e) {
var tab = this.options.tabs[e.target.hash],
prevTab = e.relatedTarget ? this.options.tabs[e.relatedTarget.hash] : null;
if (tab && tab.show) {
tab.show();
}
if (prevTab && prevTab.hide) {
prevTab.hide();
}
}, this));
// activate first tab (instead of setting 'active' class in html)
$('#tab li:not(.hidden) a:first').tab('show');
return BR.Control.prototype.onAdd.call(this, map);
}
});

View file

@ -67,6 +67,9 @@ BR.TrackMessages = L.Evented.extend({
paging: false,
searching: false,
info: false,
// flexbox workaround: without scrollY height Firefox extends to content height
// (^= minimum height with flexbox?)
scrollY: 50,
scrollX: true,
order: []
});