sanitize_violation(violation)
unless violation.review
- assignee = User.find params[:assignee_id] unless params[:assignee_id].blank?
+ assignee = findUserByLogin(params[:assignee_login]) unless params[:assignee_login].blank?
violation.create_review!(
:assignee => assignee,
:user => current_user)
# (for the moment 'class' is supported).
#
# Example:
- # <%= user_autocomplete_field "assignee_id", @assignee_id -%>
- # # => generates an input field for the parameter 'assignee_id'
+ # <%= user_autocomplete_field "assignee_login", @assignee_login -%>
+ # # => generates an input field for the parameter 'assignee_login'
#
def user_autocomplete_field(param_id, param_value, options={})
param_id_name = param_id
<%= link_to_remote (violation.review.assignee_id ? "Reassign" : "Assign"),
:url => { :controller => "reviews", :action => "violation_assign_form", :violation_id => violation.id},
:update => "vActions" + violation.id.to_s,
- :complete => "$('vActions" + violation.id.to_s + "').show();$('commentActions" + violation.id.to_s + "').hide();$('assignee_id').focus();" -%>
+ :complete => "$('vActions" + violation.id.to_s + "').show();$('commentActions" + violation.id.to_s + "').hide();$('assignee_login').focus();" -%>
<%
end
end
<% end %>
- <% if violation.review && violation.review.can_change_false_positive_flag? %>
+ <% if (!violation.review) || (violation.review && violation.review.can_change_false_positive_flag?) %>
<%= link_to_remote (violation.switched_off? ? "Unflag as false-positive" : "Flag as false-positive"),
:url => { :controller => "reviews", :action => "violation_false_positive_form", :id => violation.id, :false_positive => !violation.switched_off? },
:update => "reviewForm" + violation.id.to_s,
<%= link_to_remote (review.assignee_id ? "Reassign" : "Assign"),
:url => { :controller => "reviews", :action => "assign_form", :review_id => review.id},
:update => "assignForm",
- :complete => "$('rActions').hide(); $('editActions').hide(); $('assignee_id').focus();" -%>
+ :complete => "$('rActions').hide(); $('editActions').hide(); $('assignee_login').focus();" -%>
<% end %>
<% if @violation.review.nil? || @violation.review.comments.size==0 %>
<span>Assignee:</span>
- <%= user_autocomplete_field "assignee_id", current_user.id -%>
+ <%= user_autocomplete_field "assignee_login", current_user.login -%>
<% end %>
</td>
<td class="sep"></td>
$('statuses').value = ''
$('severities').value = ''
$('projects').value = ''
- $('author_id').value = ''
- $('autocompleteText-author_id').value = ''
- $('assignee_id').value = ''
- $('autocompleteText-assignee_id').value = ''
+ $('author_login').value = ''
+ $('autocompleteText-author_login').value = ''
+ $('assignee_login').value = ''
+ $('autocompleteText-assignee_login').value = ''
$('false_positives').value = 'with'
}
}
<%= user_autocomplete_field "assignee_login", @assignee_login, { :class => "max-width" } -%>
<br/>
<br/>
- <select name="false_positives" id="false_positives" onchange="if(this.value=='only' || this.value=='with') {$('assignee_id').value = ''; $('autocompleteText-assignee_id').value = '';};">
+ <select name="false_positives" id="false_positives" onchange="if(this.value=='only' || this.value=='with') {$('assignee_login').value = ''; $('autocompleteText-assignee_login').value = ''; $('statuses').value = '';};">
<option <%= 'selected' if @false_positives=='without' -%> value="without">Without false positives</option>
<option <%= 'selected' if @false_positives=='only' -%> value="only">Only false positives</option>
</select>