summaryrefslogtreecommitdiffstats
path: root/app/views/repositories/_related_issues.html.erb
blob: a90fbc3b64b9db32744096300d2451df296b7e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<% manage_allowed = User.current.allowed_to?(:manage_related_issues, @repository.project) %>

<div id="related-issues">
<% if manage_allowed %>
  <div class="contextual">
    <%= toggle_link l(:button_add), 'new-relation-form', {:focus => 'issue_id'} %>
  </div>
<% end %>

<h3><%= l(:label_related_issues) %></h3>
<ul>
<% @changeset.issues.visible.each do |issue| %>
  <li id="<%= "related-issue-#{issue.id}" %>"><%= link_to_issue issue %>
    <%= link_to(l(:label_relation_delete),
                {:controller => 'repositories', :action => 'remove_related_issue',
                  :id => @project, :repository_id => @repository.identifier_param,
                  :rev => @changeset.identifier, :issue_id => issue},
                :remote => true,
                :method => :delete,
                :data => {:confirm => l(:text_are_you_sure)},
                :title => l(:label_relation_delete),
                :class => 'icon-only icon-link-break'
               ) if manage_allowed %>
  </li>
<% end %>
</ul>

<% if manage_allowed %>
  <%= form_tag({:controller => 'repositories', :action => 'add_related_issue',
                :id => @project, :repository_id => @repository.identifier_param,
                :rev => @changeset.identifier},
       :remote => true,
       :method => :post,
       :id => 'new-relation-form', :style => (@issue ? '' : 'display: none;')) do |f| %>
  <%= l(:label_issue) %> #<%= text_field_tag 'issue_id', '', :size => 10 %>
  <%= submit_tag l(:button_add) %>
  <%= toggle_link l(:button_cancel), 'new-relation-form'%>
  <% end %>
<% end %>
</div>

<%= javascript_tag "observeAutocompleteField('issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project, :scope => 'all')}')" %>