Project

General

Profile

Download (2.75 KB) Statistics
| Branch: | Tag: | Revision:
<%#
# Commit Relation Editor plugin for Redmine
# Copyright (C) 2011 Haruyuki Iida
#rev
# 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.
%>

<% if @project and @project.module_enabled?("commit_relation_editor") %>
<% if controller.class.name == 'RepositoriesController' and action_name == 'revision'%>

<% if authorize_for('commit_relation_editor', 'new') %>
<div style="display: none;">
<div id="comit_relation_add">
<span class="icon icon-add">
<%= link_to_function(h(l(:add_related_issue_to_commit)), "new Effect.SlideDown('comit_relation_add_form')") %>
</span>
<div id="comit_relation_add_form" style="display: none;">
<% form_tag :controller => 'commit_relation_editor', :action => 'new', :id => @project do%>
<%= hidden_field_tag 'changeset_id', @changeset.id %>
<%=h l(:field_issue) -%>: <%= text_field_tag 'issue_id', '', :size => 7 %>
<%= submit_tag h(l(:button_apply)), :id => 'add_relation_submit', :onclick => "return issueIdValidation($('issue_id').value);" %>
<% end %>
</div>
</div>
</div>
<script type="text/javascript">
var h3_count = <%= @changeset.issues.empty? ? 0 : 1 %>;
var addform = $('comit_relation_add');
var target = addform.parentNode.removeChild(addform);
Insertion.Before($$('#content h3')[h3_count], target);
</script>
<% end %>

<% if authorize_for('commit_relation_editor', 'destroy') and @changeset.issues.empty? == false%>
<div style="">
<% @changeset.issues.each do |issue| -%>
<span id="commit_relation_delete_<%=issue.id -%>">
<%= link_to(l(:button_delete), {:controller => 'commit_relation_editor',
:action => 'destroy', :id => @project, :changeset_id => @changeset.id, :issue_id => issue.id},
:class => 'icon icon-del', :confirm => l(:text_are_you_sure)) -%>
<% end -%>
</span>
</div>
<script type="text/javascript">
addRelationRemoveButton();
</script>
<% end %>

<% end %>
<% end %>
(1-1/4)