<%
# Code Review plugin for Redmine
# Copyright (C) 2010-2011  Haruyuki Iida
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-%>
<%
parameters = request.parameters
path = parameters['path']
rev = parameters['rev']
repository_id = @repository.identifier_param if @repository.respond_to?("identifier_param")
unless path.blank? or path.empty?
  changesets = @repository.latest_changesets(path, rev, Setting.repository_log_display_limit.to_i)
  change = changesets[0]

  if change
    link = link_to(l(:label_add_review), {:controller => 'code_review',
        :action => 'forward_to_revision', :id => project, :path => path, :rev => rev, :repository_id => repository_id}, 
      :class => 'icon icon-edit')
  %>

    <script type="text/javascript">
      make_addreview_link('<%=project.name%>', '<%=link%>');
    </script>
  <% end %>

<% end %>