changed loading state to occur on submit button (previously on the dropdown)
This commit is contained in:
parent
6e01d0bdca
commit
419c9ea354
2 changed files with 12 additions and 8 deletions
|
@ -25,7 +25,7 @@
|
|||
function _handleSelect (e) {
|
||||
e.preventDefault();
|
||||
_setSelectedModel(this);
|
||||
_reset(model.name);
|
||||
_setSelectLabel(model.name);
|
||||
}
|
||||
|
||||
function _handleSubmit(e) {
|
||||
|
@ -41,12 +41,17 @@
|
|||
.data.fetch( model.slug, _getModifier(), _isMinified() )
|
||||
.then(function(response) {
|
||||
CREPE.results.init(model, response);
|
||||
_reset(model.name);
|
||||
_setSelectLabel(model.name);
|
||||
_setReady();
|
||||
});
|
||||
}
|
||||
|
||||
function _setLoading (label) {
|
||||
$trigger.button('loading');
|
||||
function _setLoading(label) {
|
||||
$submit.button('loading');
|
||||
}
|
||||
|
||||
function _setReady() {
|
||||
$submit.button('complete');
|
||||
}
|
||||
|
||||
function _setSelectedModel(option) {
|
||||
|
@ -71,11 +76,10 @@
|
|||
return $modifier.val();
|
||||
}
|
||||
|
||||
function _reset (label) {
|
||||
function _setSelectLabel (label) {
|
||||
var defaultLabel = 'Select a model',
|
||||
spacing = ' ';
|
||||
$trigger
|
||||
.button('reset')
|
||||
.html((label || defaultLabel) + spacing)
|
||||
.append('<span class="caret"></span>');
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ block content
|
|||
p Welcome to #{title}. That that was redudant tag line.
|
||||
form#form-specs.form-inline
|
||||
div#dropdown.btn-group
|
||||
a.btn.btn-large.dropdown-toggle(data-toggle='dropdown', data-loading-text='Fetching specs...', data-complete-text='', href='#') Select a model
|
||||
a.btn.btn-large.dropdown-toggle(data-toggle='dropdown', href='#') Select a model
|
||||
span.caret
|
||||
ul.dropdown-menu
|
||||
each model in models
|
||||
|
@ -18,7 +18,7 @@ block content
|
|||
label#minified.checkbox
|
||||
input(type='checkbox', checked)
|
||||
| Minified output
|
||||
button#submit.btn.btn-primary.btn-large Get Specs
|
||||
button#submit.btn.btn-primary.btn-large(data-loading-text='Fetching specs...', data-complete-text='Get Specs') Get Specs
|
||||
div#results.row-fluid
|
||||
div.span4
|
||||
h3 Model Name
|
||||
|
|
Loading…
Reference in a new issue