extract Control from Profile class into Tabs control

This commit is contained in:
Norbert Renner 2014-08-29 15:32:06 +02:00
parent c190f6d48a
commit bb371a30a7
4 changed files with 19 additions and 15 deletions

View file

@ -50,7 +50,7 @@
</td></tr> </td></tr>
</table> </table>
</div> </div>
<div id="profile_div" class="hidden"> <div id="tabs_div" class="hidden">
<ul id="tab" class="nav nav-tabs" role="tablist"> <ul id="tab" class="nav nav-tabs" role="tablist">
<li class="active"><a href="#tab_profile" role="tab">Profile</a></li> <li class="active"><a href="#tab_profile" role="tab">Profile</a></li>
@ -116,6 +116,7 @@
<script src="js/plugin/Permalink.Routing.js"></script> <script src="js/plugin/Permalink.Routing.js"></script>
<script src="js/control/TrackStats.js"></script> <script src="js/control/TrackStats.js"></script>
<script src="js/control/Download.js"></script> <script src="js/control/Download.js"></script>
<script src="js/control/Tabs.js"></script>
<script src="js/control/Profile.js"></script> <script src="js/control/Profile.js"></script>
<script src="js/control/RoutingOptions.js"></script> <script src="js/control/RoutingOptions.js"></script>
<script src="js/control/Message.js"></script> <script src="js/control/Message.js"></script>

View file

@ -1,18 +1,7 @@
BR.Profile = BR.Control.extend({ BR.Profile = L.Class.extend({
options: { initialize: function () {
divId: 'profile_div'
},
onAdd: function (map) {
L.DomUtil.get('profile_upload').onsubmit = L.bind(this._submit, this); L.DomUtil.get('profile_upload').onsubmit = L.bind(this._submit, this);
L.DomUtil.get('clear').onclick = L.bind(this.clear, this); L.DomUtil.get('clear').onclick = L.bind(this.clear, this);
$('#tab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
return BR.Control.prototype.onAdd.call(this, map);
}, },
clear: function(evt) { clear: function(evt) {

14
js/control/Tabs.js Normal file
View file

@ -0,0 +1,14 @@
BR.Tabs = BR.Control.extend({
options: {
divId: 'tabs_div'
},
onAdd: function (map) {
$('#tab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
return BR.Control.prototype.onAdd.call(this, map);
}
});

View file

@ -196,7 +196,7 @@
stats.addTo(map); stats.addTo(map);
download.addTo(map); download.addTo(map);
elevation.addTo(map); elevation.addTo(map);
profile.addTo(map); map.addControl(new BR.Tabs());
nogos.addTo(map); nogos.addTo(map);
routing.addTo(map); routing.addTo(map);