@severities = filter_any(params[:severities]) || ['']
@statuses = filter_any(params[:statuses]) || [Review::STATUS_OPEN]
@projects = filter_any(params[:projects]) || ['']
+ @id = params[:id] || ""
end
def options_for_users
conditions << "assignee_id in (:assignees)"
values[:assignees]=@assignees.map{|s| s.to_i}
end
+ unless @id == ""
+ if is_number? @id
+ conditions << "id = :id"
+ values[:id] = @id
+ else
+ conditions << "id = :id"
+ values[:id] = -1
+ end
+ end
@reviews = Review.find( :all, :order => "created_at DESC", :conditions => [ conditions.join(" AND "), values] ).uniq
end
+ def is_number?(s)
+ true if Float(s) rescue false
+ end
+
def has_rights_to_modify?(violation)
current_user && has_role?(:user, violation.snapshot)
end
Created by:
</td>
<td class="val">
- <%= h(review.user.name) -%> on <%= l(review.created_at, :format => :long) -%>
+ <%= h(review.user.name) -%>, on <%= l(review.created_at, :format => :long) -%>
</td>
</tr>
<% if review.rule %>
</table>
<% if review.rule_failure && review.resource_line && review.rule_failure.snapshot %>
- <div class="marginbottom10">
+ <div class="marginbottom10 marginleft10">
<%= snapshot_source_to_html(review.rule_failure.snapshot, {:line_range => (review.resource_line-5)..(review.resource_line+5), :highlighted_lines => [review.resource_line]}) -%>
</div>
<% end %>
<span class="note">Assigned to</span><br/>
<%= select_tag "assignees", options_for_select(@user_names, @assignees), :multiple => true, :size => 6 %>
</td>
- <td>
+ <td width="1%" nowrap>
+ <span class="note">Id</span><br/>
+ <%= text_field_tag "id", @id, :size => 10 -%>
+ <br/>
+ <br/>
<br/>
+ <br/>
+ <div style="width:100%; text-align: right">
<%= submit_tag "Search", :id => 'submit_search' %>
+ </div>
+ </td>
+ <td>
</td>
</tr>
</tbody>
-
+div#review .actions{
+ visibility: hidden;
+}
+div#review:hover .actions{
+ visibility: visible;
+}
div.reportTitle {
background-color: #E4ECF3;
color: #4B9FD5;