<%= error_messages_for 'review' -%>
<%= error_messages_for 'reply' -%>
<% if @notice -%>
<%= @notice -%>
<% end -%>
<% if @error -%>
<%= @error -%>
<% end -%>
<% if authorize_for('code_review', 'update') -%>
<%= link_to_function l(:button_update), "$('#update-form-#{@review.id}').show();return false;", :class => 'icon icon-edit' %>
<% end %>
<% if authorize_for('code_review', 'destroy') -%>
<%= link_to(l(:button_delete),
{:controller => 'code_review',
:action => 'destroy',
:id => @project,
:review_id => @review},
:update => "show_review_#{@review.id}",
:remote => true,
:confirm => l(:text_are_you_sure),
:success => "deleteReview(#{@review.id})",
:class => 'icon icon-del') %>
<% end -%>
<%= link_to h(@issue.tracker.name) + ' #' +@issue.id.to_s + ' (' + h(@review.issue.status) + ')',
:controller => 'issues', :action => 'show', :id => @review.issue.id %>:
<%=h @review.subject %>
<%= avatar(@review.user, :size => "64") %>
<%= authoring @review.created_at, @review.user %>.
<%= l(:label_updated_time, distance_of_time_in_words(Time.now, @review.updated_at)) + '.' if @review.created_at != @review.updated_at %>
<%= textilizable @review, :comment %>
<%
review_form_id = "review_form_#{@review.id}"
-%>
<%= form_for :review,
:url => {:controller => 'code_review',
:action => 'update',
:id => @project},
:update => "show_review_#{@review.id}",
:html => {:id => review_form_id} do |f| %>
<%= f.hidden_field :lock_version %>
<%= hidden_field :issue, :lock_version%>
<%= hidden_field_tag :review_id, @review.id %>
<%=h l(:field_subject)%>:
<%= f.text_field :subject, :size => 70, :value => @review.subject%>
<% if @allowed_statuses and @allowed_statuses.any? %>
<%=h l(:field_status)%>:
<%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %>
<% end %>
<%= f.text_area :comment,
:cols => 30,
:rows => 10,
:accesskey => accesskey(:edit),
:class => 'wiki-edit',
:id => 'review_comment_' + @review.id.to_s %>
<%
submit_url = url_for(:controller => 'code_review', :action => 'update', :id => @project)
-%>
<%= button_to_function l(:button_apply), "$('#show_review_#{@review.id}').load('#{submit_url}', $('##{review_form_id}').serialize())" %>
<%= link_to_function l(:label_preview), "$('#preview_#{@review.id}').load('#{url_for(:controller => 'code_review', :action => 'preview', :id => @project)}', $('##{review_form_id}').serialize())" %>
<%= wikitoolbar_for 'review_comment_' + @review.id.to_s %>
<% end %>
<% journals = @review.issue.journals.sort {|a, b| a.id <=> b.id } %>
<% if respond_to?('render_journal') %>
<% # ChiliProject -%>
<% if journals.length > 0 %>
<%= l(:label_history) %>
<%= render :partial => 'history', :locals => { :issue => @review.issue, :journals => journals } %>
<% end %>
<% else %>
<% # Redmine -%>
<% if journals.length > 0 %>
<%= l(:label_history) %>
<% end %>
<%= render :partial => 'reply', :collection => journals %>
<% end %>
<% if authorize_for('code_review', 'reply') -%>
<%= toggle_link l(:button_reply), "reply_#{@review.id}", :focus => 'reply_comment_' + @review.id.to_s %>
<%
message_form_id = "message-form-#{@review.id}"
-%>
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @project, :review_id => @review.id}, :html => {:id => message_form_id} do |f| %>
<%= hidden_field_tag :review_id, @review.id %>
<%= hidden_field :review, :lock_version%>
<%= hidden_field :issue, :lock_version%>
<% if @allowed_statuses and @allowed_statuses.any? %>
<%=h l(:field_status) %>:
<% # select :review, :status, {l(:label_review_closed) => CodeReview::STATUS_CLOSED, l(:label_review_open) => CodeReview::STATUS_OPEN} %>
<%= select :review, :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), :required => true %>
<% end %>
<%= f.text_area :comment,
:cols => 30,
:rows => 10,
:accesskey => accesskey(:edit),
:class => 'wiki-edit',
:id => 'reply_comment_' + @review.id.to_s %>
<%
submit_url = url_for(:controller => 'code_review', :action => 'reply', :id => @project)
-%>
<%= button_to_function l(:button_apply), "$('#show_review_#{@review.id}').load('#{submit_url}', $('##{message_form_id}').serialize())" %>
<%
reply_preview_id = "reply_preview_#{@review.id}"
-%>
<%= link_to_function l(:label_preview), "$('##{reply_preview_id}').load('#{url_for(:controller => 'code_review', :action => 'preview', :id => @project)}', $('##{message_form_id}').serialize())" %>
<%= wikitoolbar_for 'reply_comment_' + @review.id.to_s %>
<% end %>
<% end %>