profile buttons: no group, blur (bootstrap sets focus?), uploading text
This commit is contained in:
parent
9eade5bbb6
commit
ed228a96ce
3 changed files with 20 additions and 9 deletions
|
|
@ -63,11 +63,8 @@
|
|||
<form id="profile_upload" name="profile_upload">
|
||||
<textarea type="text" name="profile" spellcheck="false" wrap="off" maxlength="100000" placeholder="... paste your custom routing profile here ..."></textarea>
|
||||
<div id="profile_buttons">
|
||||
<div class="btn-group">
|
||||
<button type="submit" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-upload"></span> Upload</button>
|
||||
<!-- TODO type="reset" -->
|
||||
<button id="clear" type="button" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-ban-circle"></span> Clear</button>
|
||||
</div>
|
||||
<button id="upload" type="button" class="btn btn-default btn-xs" data-uploading-text="Uploading..."><span class="glyphicon glyphicon-upload"></span> Upload</button>
|
||||
<button id="clear" type="button" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-ban-circle"></span> Clear</button>
|
||||
<a href="http://brouter.de/brouter/costfunctions.html" target="_blank" class="btn-xs">Help</a>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -1,23 +1,33 @@
|
|||
BR.Profile = L.Class.extend({
|
||||
initialize: function () {
|
||||
L.DomUtil.get('profile_upload').onsubmit = L.bind(this._submit, this);
|
||||
L.DomUtil.get('upload').onclick = L.bind(this._upload, this);
|
||||
L.DomUtil.get('clear').onclick = L.bind(this.clear, this);
|
||||
},
|
||||
|
||||
clear: function(evt) {
|
||||
var button = evt.target || evt.srcElement;
|
||||
|
||||
evt.preventDefault();
|
||||
document.profile_upload.profile.value = null;
|
||||
|
||||
this.fire('clear');
|
||||
button.blur();
|
||||
},
|
||||
|
||||
_submit: function(evt) {
|
||||
var form = evt.target || evt.srcElement,
|
||||
_upload: function(evt) {
|
||||
var button = evt.target || evt.srcElement,
|
||||
profile = document.profile_upload.profile.value;
|
||||
|
||||
$(button).button('uploading');
|
||||
evt.preventDefault();
|
||||
|
||||
this.fire('update', { profileText: profile });
|
||||
this.fire('update', {
|
||||
profileText: profile,
|
||||
callback: function () {
|
||||
$(button).button('reset');
|
||||
$(button).blur();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -146,6 +146,10 @@
|
|||
router.setOptions(routingOptions.getOptions());
|
||||
}
|
||||
}
|
||||
|
||||
if (evt.callback) {
|
||||
evt.callback();
|
||||
}
|
||||
});
|
||||
});
|
||||
profile.on('clear', function(evt) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue