#
module ReviewsHelper
- def options_for_project_select
- options=[['Any', '']]
- projects=Project.find(:all, :select => 'id,name', :conditions => ['enabled=? AND scope=? AND qualifier IN (?)', true, 'PRJ', ['TRK', 'VW','SVW']], :order => 'name ASC')
- projects.each do |project|
- options<<[project.name, project.id]
- end
- options_for_select(options, @projects)
+ def projects_for_select
+ Project.find(:all, :select => 'id,name,long_name', :conditions => ['enabled=? AND scope=? AND qualifier IN (?)', true, 'PRJ', ['TRK', 'VW','SVW']], :order => 'name ASC')
end
end
return STATUS_OPEN
end
- def source?
- resource!=nil && resource.last_snapshot!=nil && resource.last_snapshot.source!=nil
+ def on_project?
+ resource_id==project_id
+ end
+
+ def rule
+ @rule ||=
+ begin
+ rule_failure ? rule_failure.rule : nil
+ end
+ end
+
+ def comments
+ review_comments
end
private
</div>
- <div class="comment">
+ <div class="discussionComment first">
<%= h(violation.message) -%>
</div>
last_comment = current_open_review.review_comments.last
current_open_review.review_comments.each do |review_comment|
%>
- <div class="comment">
+ <div class="discussionComment">
<% duration=Date.today - review_comment.created_at.to_date %>
<h4><%= image_tag("reviews/comment.png") -%> <b><%= review_comment.user.name -%></b> (<%= duration==0 ? 'today' : "#{duration} days ago" -%>)
<% if review_comment == last_comment && current_user && current_user.id == review_comment.user.id %>
--- /dev/null
+<div id="rev_<%= review.id -%>">
+ <div class="reportTitle">
+ <div style="float: right"><span class="violation_date">#<%= review.id.to_s -%></span></div>
+ <h2><%= h(review.title) -%></h2>
+ </div>
+
+ <table class="reportDetails">
+ <tr>
+ <td class="key">
+ Status:
+ </td>
+ <td class="val">
+ <%= image_tag "status/#{review.status}.png" -%> <%= review.status -%>
+ </td>
+ <td class="key">
+ Severity:
+ </td>
+ <td class="val">
+ <%= image_tag "priority/#{review.severity}.png" -%> <%= review.severity -%>
+ </td>
+ </tr>
+ <tr>
+ <td class="key">
+ Assignee:
+ </td>
+ <td class="val">
+ <%= review.assignee ? h(review.assignee.name) : '-'-%>
+ </td>
+ <td class="key">
+ Created:
+ </td>
+ <td class="val">
+ by <%= h(review.user.name) -%> at <%= l(review.created_at) -%>
+ </td>
+ </tr>
+ <% if review.rule %>
+ <tr>
+ <td class="key">
+ Rule:
+ </td>
+ <td class="val" colspan="3">
+ <a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => review.rule.key, :layout => 'false' -%>"><%= h(review.rule.key) -%></a>
+ </td>
+ </tr>
+ <% end %>
+ <tr>
+ <td class="key">
+ File:
+ </td>
+ <td class="val" colspan="3">
+ <%= qualifier_icon(@review.resource) -%>
+ <% if !review.on_project? %> <%= @review.project.long_name -%> <%= image_tag 'sep12.png' -%> <% end %>
+ <%= link_to_resource(review.resource, review.resource.long_name) %>
+ </td>
+ </tr>
+ </table>
+
+ <% if review.rule_failure %>
+
+ <% end %>
+
+ <div class="discussion">
+ <% if review.rule_failure %>
+ <div class="discussionComment first">
+ <%= h(review.rule_failure.message) -%>
+ </div>
+ <% end %>
+ <% review.comments.each do |comment| %>
+ <div class="discussionComment">
+ <h4><%= image_tag("reviews/comment.png") -%> <b><%= comment.user.name -%></b> (<%= distance_of_time_in_words_to_now(comment.created_at) -%>)</h4>
+ <%= h(comment.review_text) -%>
+ </div>
+ <% end %>
+ </div>
+<div>
\ No newline at end of file
-<div>
- <a href="#" onclick="backReviews()">Back to results</a>
+<div class="marginbottom10">
+ <a href="#" onclick="backReviews()">Back to reviews</a>
</div>
-<h1><%= h(@review.project.long_name) -%> | <%= h(@review.resource.long_name) -%></h1>
-
-<% if @review.source? %>
-
-<% end %>
-
-<%= @review.title -%>
-
-
+<%= render :partial => 'reviews/review', :locals => {:review => @review} -%>
\ No newline at end of file
<div id="reviews-search">
<h1>Reviews</h1>
<% form_tag({:action => 'index'}, {:method => 'get'}) do %>
- <table id="reviews-form" class="search-filter-box">
+ <table id="reviews-form" class="searchFilterBox">
<thead>
<tr><th colspan="6"></th></tr>
</thead>
<tr>
<td width="1%" nowrap>
<span class="note">Status</span><br/>
- <select size="6" name="statuses[]" multiple="multiple" id="statuses" class="with-icons">
+ <select size="6" name="statuses[]" multiple="multiple" id="statuses" class="withIcons">
<option <%= 'selected' if @statuses.include?('') -%> value="">Any</option>
<option value="<%= Review::STATUS_OPEN -%>" class="status_open" <%= 'selected' if @statuses.include?(Review::STATUS_OPEN) -%>>Open</option>
<option value="<%= Review::STATUS_CLOSED -%>" class="status_closed" <%= 'selected' if @statuses.include?(Review::STATUS_CLOSED) -%>>Closed</option>
<td width="1%" nowrap>
<span class="note">Project</span><br/>
- <%= select_tag "projects", options_for_project_select(), :multiple => true, :size => 6 %>
+ <select size="6" name="projects[]" multiple="multiple" id="projects">
+ <option <%= 'selected' if @projects.include?('') -%> value="">Any</option>
+ <% projects_for_select.each do |project|
+ name=project.name(true)
+ %>
+ <option value="<%= project.id -%>" title="<%= h(name)-%>" <%= 'selected' if @projects.include?(project.id.to_s) -%>><%= h(truncate(name, :length => 20)) -%></option>
+ <% end %>
+ </select>
</td>
<td width="1%" nowrap>
<span class="note">Severity</span><br/>
- <select size="6" name="severities[]" multiple="multiple" id="severities" class="with-icons">
+ <select size="6" name="severities[]" multiple="multiple" id="severities" class="withIcons">
<option <%= 'selected' if @severities.include?('') -%> value="">Any</option>
<option value="<%= Severity::BLOCKER -%>" class="sev_BLOCKER" <%= 'selected' if @severities.include?(Severity::BLOCKER) -%>>Blocker</option>
<option value="<%= Severity::CRITICAL -%>" class="sev_CRITICAL" <%= 'selected' if @severities.include?(Severity::CRITICAL) -%>>Critical</option>
margin:0;
border: 1px solid #DDD;
}
-.sources2 div.comment{
- background-color:#FBFBFB;
- margin:0;
- padding:5px 10px;
- border-top: 1px solid #DDD;
- line-height: 1.5em;
-}
-.sources2 div.comment h4{
- font-size: 90%;
- margin-bottom: 2px;
-}
.sources2 div.violation .actions{
visibility: hidden;
}
.sources2 div.violation .actions form {
display: inline;
}
-.sources2 div.vtitle{
+div.vtitle{
background-color:#E4ECF3;
margin:0;
padding:0 10px;
text-shadow: 1px 1px 0 #FFF;
color:#777
}
-.sources2 div.vtitle a.action {
+div.vtitle a.action {
color: #777;
}
span.rulename, span.rulename a {
+
+
+div.reportTitle {
+ background-color: #CAE3F2;
+ color: #4B9FD5;
+ line-height: 2.2em;
+ margin: 0;
+ padding: 0 10px;
+ border: 1px solid #4B9FD5;
+}
+div.reportTitle h2 {
+ color: #4183C4;
+ font-weight: bold;
+ display: inline;
+ font-size: 100%;
+ text-shadow: 0 1px 0 #FFFFFF;
+}
+table.reportDetails {
+ width: 100%;
+ border: 0;
+}
+table.reportDetails td {
+ vertical-align: top;
+ text-align: left;
+ padding: 5px 10px;
+}
+table.reportDetails td.key {
+ white-space: nowrap;
+ min-width: 1%;
+ color: #777;
+}
+table.reportDetails td img {
+ vertical-align: bottom;
+}
+
+div.discussion {
+ width: 100%;
+ border: 1px solid #DDDDDD;
+}
+.discussionComment.first {
+ border-top: none;
+}
+div.discussionComment {
+ background-color: #F4F4F4;
+ border-top: 1px solid #DDDDDD;
+ line-height: 1.5em;
+ margin: 0;
+ padding: 5px 10px;
+}
+div.discussionComment h4 {
+ font-size: 90%;
+ margin-bottom: 2px;
+}
+div.discussionComment h4 img {
+ vertical-align: sub;
+}
+
+
+
+
+
+
#gwtpage {
width: 100%;
clear: both;
padding: 10px;
}
-.search-filter-box {
+.searchFilterBox {
background-color: #ECECEC;
color: #444;
border: 1px solid #DDD;
margin: 0 0 10px 0;
}
-.search-filter-box td {
+.searchFilterBox td {
padding: 10px;
text-align: left;
vertical-align: top;
}
-select.with-icons option {
+select.withIcons option {
background-repeat: no-repeat;
background-position: 2px 0;
padding: 0 2px 0 22px;