reviews.showing_false_positives_only=Showing false positives only
reviews.why_false_positive=Why is it a false-positive ?
reviews.why_not_false_positive=Why is it not a false-positive anymore ?
+reviews.user_does_not_exist=\ : user does not exist. \\nPlease select a valid user or leave the field blank.
#------------------------------------------------------------------------------
<input type="text"
id="autocompleteText-<%= param_id_name -%>"
- value="<%= param_displayed_value -%>"
- onfocus="$('<%= param_id_name -%>').value=''; this.value=''"
- <%= "class=\"" + options[:class] + "\"" if options[:class] -%>/>
+ value="<%= param_displayed_value -%>"
+ <%= "class=\"" + options[:class] + "\"" if options[:class] -%>
+ onKeyUp="if (this.value.length== 0 || this.value.length== 1) $('<%= param_id_name -%>').value = '';"/>
<input type="hidden" id="<%= param_id_name -%>" name="<%= param_id_name -%>" value="<%= param_id_value -%>"/>
<div id="autocomplete-<%= param_id_name -%>" class="autocomplete"></div>
<script>
new Ajax.Autocompleter("autocompleteText-<%= param_id_name -%>", "autocomplete-<%= param_id_name -%>", "<%= server_url -%>", {
paramName: "user_name_start",
minChars: 2,
- afterUpdateElement : getSelection<%= param_id_name -%>
+ afterUpdateElement : getSelection<%= param_id_name -%>,
+ callback : callBack<%= param_id_name -%>
});
function getSelection<%= param_id_name -%>(text, li) {
- $('<%= param_id_name -%>').value = li.id
+ $('<%= param_id_name -%>').value = li.id;
+ }
+ function callBack<%= param_id_name -%>(field, queryString) {
+ $('<%= param_id_name -%>').value = '';
+ return queryString;
}
</script>
\ No newline at end of file
+<%
+ assignee_check_script = "if ($('autocompleteText-assignee_login').value != '' && $('assignee_login').value == '') { alert($('autocompleteText-assignee_login').value + '" + message('reviews.user_does_not_exist') + "'); return false;}"
+%>
+
<form method="post"
- onsubmit="if ($('assignee_login').value != '') { new Ajax.Updater('review', '<%= url_for :action => 'assign' -%>', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); };return false;">
+ onsubmit="<%= assignee_check_script -%> new Ajax.Updater('review', '<%= url_for :action => 'assign' -%>', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">
<%= hidden_field_tag :id, params[:review_id] -%>
<%= user_autocomplete_field "assignee_login", "" -%>
<%= submit_to_remote "submit_btn", message('assign'),
:url => { :action => 'assign' },
- :update => "review" -%>
+ :update => "review",
+ :before => assignee_check_script -%>
<%= link_to_remote message('cancel'),
:url => { :action => 'show', :id => params[:review_id] },
+<%
+ assignee_check_script = "if ($('autocompleteText-assignee_login').value != '' && $('assignee_login').value == '') { alert($('autocompleteText-assignee_login').value + '" + message('reviews.user_does_not_exist') + "'); return false;}"
+%>
+
<%= image_tag("sep12.png") -%>
<form method="post"
- onsubmit="if ($('assignee_login').value != '') { new Ajax.Updater('vId<%= params[:violation_id] -%>', '<%= url_for :action => 'violation_assign' -%>', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); };return false;">
+ onsubmit="<%= assignee_check_script -%> new Ajax.Updater('vId<%= params[:violation_id] -%>', '<%= url_for :action => 'violation_assign' -%>', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">
<%= hidden_field_tag :id, params[:violation_id] -%>
<%= user_autocomplete_field "assignee_login", "" -%>
<%= submit_to_remote "submit_btn", message('assign'),
:url => { :action => 'violation_assign' },
- :update => "vId" + params[:violation_id] -%>
+ :update => "vId" + params[:violation_id],
+ :before => assignee_check_script -%>
<%= link_to_remote message('cancel'),
:url => { :action => 'display_violation', :id => params[:violation_id] },
<%
button=(@comment ? message('update_comment') : message('add_comment'))
+
+ if @violation.review.nil? || @violation.review.comments.size==0
+ # This is the first comment, we must ask for the assignee
+ assignee_check_script = "if ($('autocompleteText-assignee_login').value != '' && $('assignee_login').value == '') { alert($('autocompleteText-assignee_login').value + '" + message('reviews.user_does_not_exist') + "'); return false;}"
+ end
%>
<form method="POST"
- onsubmit="new Ajax.Updater('vId<%= params[:id] -%>', '<%= url_for :action => 'violation_save_comment' -%>', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)});return false;">
+ onsubmit="<%= assignee_check_script if assignee_check_script -%> new Ajax.Updater('vId<%= params[:id] -%>', '<%= url_for :action => 'violation_save_comment' -%>', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)});return false;">
<input type="hidden" name="id" value="<%= params[:id] -%>"/>
<% if @comment %>
<input type="hidden" name="comment_id" value="<%= @comment.id -%>"/>
<%= submit_to_remote "submit_btn"+params[:id] , button,
:url => { :action => 'violation_save_comment'},
:html => { :id => "submit_btn"+params[:id], :disabled => "true" },
- :update => 'vId'+params[:id] -%>
+ :update => 'vId'+params[:id],
+ :before => assignee_check_script ? assignee_check_script : "" -%>
<%= link_to_remote message('cancel'), :url => {:action => 'display_violation', :id => params[:id]}, :update => 'vId' + params[:id] -%>