Project

General

Profile

Download (2.75 KB) Statistics
| Branch: | Tag: | Revision:
1
<%#
2
# Commit Relation Editor plugin for Redmine
3
# Copyright (C) 2011  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
      <div style="display: none;">
25
        <div id="comit_relation_add">
26
          <span class="icon icon-add">
27
          <%= link_to_function(h(l(:add_related_issue_to_commit)), "new Effect.SlideDown('comit_relation_add_form')") %>
28
          </span>
29
          <div id="comit_relation_add_form" style="display: none;">
30
            <% form_tag :controller => 'commit_relation_editor', :action => 'new', :id => @project do%>            
31
              <%= hidden_field_tag 'changeset_id', @changeset.id %>
32
              <%=h l(:field_issue) -%>: <%= text_field_tag 'issue_id', '', :size => 7 %>
33
              <%= submit_tag  h(l(:button_apply)), :id => 'add_relation_submit', :onclick => "return issueIdValidation($('issue_id').value);" %>
34
            <% end %>
35
          </div>
36
        </div>
37
      </div>
38
      <script type="text/javascript">
39
        var h3_count = <%= @changeset.issues.empty? ? 0 : 1 %>;
40
        var addform = $('comit_relation_add');
41
        var target = addform.parentNode.removeChild(addform);
42
        Insertion.Before($$('#content h3')[h3_count], target);
43
      </script>
44
    <% end %>
45

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

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