Project

General

Profile

Download (2.95 KB) Statistics
| Branch: | Tag: | Revision:
1
<%#
2
# Commit Relation Editor plugin for Redmine
3
# Copyright (C) 2011-2012  Haruyuki Iida
4
#rev
5
# This program is free software; you can redistribute it and/or
6
# modify it under the terms of the GNU General Public License
7
# as published by the Free Software Foundation; either version 2
8
# of the License, or (at your option) any later version.
9
#
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
%>
19

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

    
23
    <% if authorize_for('commit_relation_editor', 'new') %>
24
      <%
25
      repository_id = @repository.identifier_param if @repository.identifier_param
26
    %>
27
      <div style="display: none;">
28
        <div id="comit_relation_add">
29
          <span class="icon icon-add">
30
            <%= link_to_function(h(l(:add_related_issue_to_commit)), "new Effect.SlideDown('comit_relation_add_form')") %>
31
          </span>
32
          <div id="comit_relation_add_form" style="display: none;">
33
            <% form_tag :controller => 'commit_relation_editor', :action => 'new', :id => @project do%>            
34
              <%= hidden_field_tag 'changeset_id', @changeset.id %>
35
              <%= hidden_field_tag 'repository_id', repository_id %>
36
              <%=h l(:field_issue) -%>: <%= text_field_tag 'issue_id', '', :size => 7 %>
37
              <%= submit_tag  h(l(:button_apply)), :id => 'add_relation_submit', :onclick => "return issueIdValidation($('issue_id').value);" %>
38
            <% end %>
39
          </div>
40
        </div>
41
      </div>
42
      <script type="text/javascript">
43
        var h3_count = <%= @changeset.issues.empty? ? 0 : 1 %>;
44
        var addform = $('comit_relation_add');
45
        var target = addform.parentNode.removeChild(addform);
46
        Insertion.Before($$('#content h3')[h3_count], target);
47
      </script>
48
    <% end %>
49

    
50
    <% if authorize_for('commit_relation_editor', 'destroy') and @changeset.issues.empty? == false%>
51
      <div style="">
52
        <% @changeset.issues.each do |issue| -%>
53
          <span id="commit_relation_delete_<%=issue.id -%>">
54
            <%= link_to(l(:button_delete), {:controller => 'commit_relation_editor', 
55
                :action => 'destroy', :id => @project, :changeset_id => @changeset.id, :issue_id => issue.id, :repository_id => repository_id},
56
              :class => 'icon icon-del', :confirm => l(:text_are_you_sure)) -%>
57
          <% end -%>
58
        </span>
59
      </div>
60
      <script type="text/javascript">
61
        addRelationRemoveButton();
62
      </script>
63
    <% end %>
64

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