mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-05 20:40:14 +01:00
add validation to catch empty descriptions
This commit is contained in:
parent
6e5057138d
commit
abf4524679
6 changed files with 56 additions and 5 deletions
|
|
@ -78,6 +78,8 @@
|
|||
:complete => "$('#todo_multi_new_action_submit').unblock()",
|
||||
:condition => "askIfNewContextProvided('multi_')") do -%>
|
||||
|
||||
<div id="multiple_status"><%= error_messages_for("item", :object_name => 'action') %></div>
|
||||
|
||||
<label for="todo_notes">Multiple next actions (one on each line)</label>
|
||||
<%= text_area( "todo", "multiple_todos", "cols" => 29, "rows" => 6, "tabindex" => 2) %>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
if @saved
|
||||
page.hide 'status'
|
||||
page.hide 'multiple_status'
|
||||
|
||||
status_message = 'Added new next action'
|
||||
status_message += 's' if @todos.size > 1
|
||||
|
|
@ -37,6 +37,14 @@ if @saved
|
|||
# make sure the behavior of the new/updated todo is enabled
|
||||
page << "enable_rich_interaction();"
|
||||
else
|
||||
page.show 'status'
|
||||
page.replace_html 'status', "#{error_messages_for('todo', :object_name => 'action')}"
|
||||
page.show 'multiple_status'
|
||||
# add error about missing todo description that is not available in @todos
|
||||
@multiple_error = content_tag(:div, content_tag(:p, @multiple_error), {:class => 'errorExplanation', :id => 'errorExplanation'}) unless @multiple_error.blank?
|
||||
error_messages = @multiple_error || ""
|
||||
# add errors of individual @todos
|
||||
@todos.each do |todo|
|
||||
@todo_i = todo
|
||||
error_messages += error_messages_for('todo_i', :object_name => 'action')
|
||||
end
|
||||
page.replace_html 'multiple_status', error_messages
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue