mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-24 15:54:00 +08:00
Merge pull request #4831 from aignatov-bio/ai-sci-7722-fix-new-task-modal-error-handling
Fix error handling new task modal and completed task duplication [SCI-7722][SCI-7730]
This commit is contained in:
commit
8a4599bed1
4 changed files with 19 additions and 4 deletions
|
@ -11,10 +11,18 @@
|
|||
// Modal's submit handler function
|
||||
$(experimentWrapper)
|
||||
.on('ajax:success', newMyModuleModal, function() {
|
||||
$(this).find('sci-input-container').removeClass('error');
|
||||
$(newMyModuleModal).modal('hide');
|
||||
})
|
||||
.on('ajax:error', newMyModuleModal, function(ev, data) {
|
||||
$(this).renderFormErrors('my_module', data.responseJSON);
|
||||
let errors = data.responseJSON;
|
||||
$(this).find('sci-input-container').removeClass('error');
|
||||
if (errors.name) {
|
||||
$(this).find('#my_module_name')
|
||||
.parent()
|
||||
.addClass('error')
|
||||
.attr('data-error-text', errors.name.join(', '));
|
||||
}
|
||||
})
|
||||
.on('submit', newMyModuleModal, function() {
|
||||
// To submit correct assigned user ids to new modal
|
||||
|
|
|
@ -81,6 +81,10 @@
|
|||
&.error {
|
||||
padding-bottom: 6px;
|
||||
|
||||
label {
|
||||
color: $brand-danger;
|
||||
}
|
||||
|
||||
.sci-input-field {
|
||||
border: $border-danger;
|
||||
}
|
||||
|
|
|
@ -476,6 +476,7 @@ class ExperimentsController < ApplicationController
|
|||
created_by: current_user,
|
||||
due_date: nil,
|
||||
started_on: nil,
|
||||
state: 'uncompleted',
|
||||
completed_on: nil
|
||||
}.merge(new_my_module.get_new_position)
|
||||
)
|
||||
|
|
|
@ -10,9 +10,11 @@
|
|||
<div class="modal-body">
|
||||
<%= f.hidden_field :view_mode, value: view_mode%>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 sci-input-container form-group">
|
||||
<label><%= t('experiments.canvas.new_my_module_modal.name') %></label>
|
||||
<%= text_field_tag 'my_module[name]', '', placeholder: t('experiments.canvas.new_my_module_modal.name_placeholder'), class: "sci-input-field" %>
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||
<div class="sci-input-container form-group">
|
||||
<label><%= t('experiments.canvas.new_my_module_modal.name') %></label>
|
||||
<%= text_field_tag 'my_module[name]', '', placeholder: t('experiments.canvas.new_my_module_modal.name_placeholder'), class: "sci-input-field" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
Loading…
Reference in a new issue