mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-25 21:43:47 -04:00
Fixed the new model modal in search.
This commit is contained in:
parent
b48fb6823e
commit
26d6c2dc5b
4 changed files with 28 additions and 24 deletions
app
|
@ -23,16 +23,15 @@ module.exports.applyErrorsToForm = (el, errors) ->
|
|||
prop = error.property
|
||||
|
||||
input = $("[name='#{prop}']", el)
|
||||
if not input[0]
|
||||
if not input.length
|
||||
missingErrors.push(error)
|
||||
continue
|
||||
controls = input.closest('.controls')
|
||||
controls.append($("<span class='help-inline error-inline'>#{message}</span>"))
|
||||
group = controls.closest('.control-group')
|
||||
group.addClass('error')
|
||||
formGroup = input.closest('.form-group')
|
||||
formGroup.addClass 'has-error'
|
||||
formGroup.append($("<span class='help-block'>#{message}</span>"))
|
||||
return missingErrors
|
||||
|
||||
module.exports.clearFormAlerts = (el) ->
|
||||
$('.error', el).removeClass('error')
|
||||
$('.error-inline', el).remove()
|
||||
$('.alert', el).remove()
|
||||
$('.has-error', el).removeClass('has-error')
|
||||
$('.alert', el).remove()
|
||||
el.find('.help-block').remove()
|
|
@ -20,3 +20,6 @@
|
|||
|
||||
.bar
|
||||
width: 100%
|
||||
|
||||
form
|
||||
margin: 0 20px
|
|
@ -8,19 +8,20 @@ block content
|
|||
hr
|
||||
div.results
|
||||
table
|
||||
div.modal.hide.fade#new-model-modal
|
||||
.modal-header
|
||||
h3 Create New #{modelLabel}
|
||||
.modal-body
|
||||
form.form-horizontal
|
||||
.control-group
|
||||
label.control-label(for="name") Name
|
||||
.controls
|
||||
input#name.input-large(name="name", type="text")
|
||||
.modal-footer
|
||||
button.btn(data-dismiss="modal") Cancel
|
||||
button.btn.btn-primary.new-model-submit Create
|
||||
.modal-body.wait.hide
|
||||
h3 Reticulating Splines...
|
||||
.progress.progress-striped.active
|
||||
.progress-bar
|
||||
div.modal.fade#new-model-modal
|
||||
.modal-dialog
|
||||
.modal-content
|
||||
.modal-header
|
||||
h3 Create New #{modelLabel}
|
||||
.modal-body
|
||||
form.form-horizontal
|
||||
.form-group
|
||||
label.control-label(for="name") Name
|
||||
input#name.form-control(name="name", type="text")
|
||||
.modal-footer
|
||||
button.btn(data-dismiss="modal") Cancel
|
||||
button.btn.btn-primary.new-model-submit Create
|
||||
.modal-body.wait.hide
|
||||
h3 Reticulating Splines...
|
||||
.progress.progress-striped.active
|
||||
.progress-bar
|
||||
|
|
|
@ -85,6 +85,7 @@ module.exports = class ThangTypeHomeView extends View
|
|||
return unless res
|
||||
|
||||
modal = @$el.find('.modal')
|
||||
forms.clearFormAlerts(modal)
|
||||
@showLoading(modal.find('.modal-body'))
|
||||
res.error =>
|
||||
@hideLoading()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue