diff --git a/app/lib/forms.coffee b/app/lib/forms.coffee index 4fa9e8b8d..a822815cd 100644 --- a/app/lib/forms.coffee +++ b/app/lib/forms.coffee @@ -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() \ No newline at end of file + $('.has-error', el).removeClass('has-error') + $('.alert', el).remove() + el.find('.help-block').remove() \ No newline at end of file diff --git a/app/styles/kinds/search.sass b/app/styles/kinds/search.sass index 4c6ab5306..863790ac3 100644 --- a/app/styles/kinds/search.sass +++ b/app/styles/kinds/search.sass @@ -20,3 +20,6 @@ .bar width: 100% + + form + margin: 0 20px \ No newline at end of file diff --git a/app/templates/kinds/search.jade b/app/templates/kinds/search.jade index 00014cc42..7f5362696 100644 --- a/app/templates/kinds/search.jade +++ b/app/templates/kinds/search.jade @@ -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 diff --git a/app/views/kinds/SearchView.coffee b/app/views/kinds/SearchView.coffee index 10d1bc4b5..93734bcb3 100644 --- a/app/views/kinds/SearchView.coffee +++ b/app/views/kinds/SearchView.coffee @@ -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()