aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/webapp/WEB-INF/app/views/issue/_issue.html.erb
blob: ea1f85f8ad736c0202437f2218e978d2bf9dde51 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<div class="code-issue" data-issue-key="<%= issue.key -%>" data-issue-component="<%= issue.componentKey() -%>">
  <div class="code-issue-name">
    <img src="<%= ApplicationController.root_context -%>/images/priority/<%= issue.severity -%>.png">
    &nbsp;
      <span class="rulename">
        <% rule_name = Internal.rules.ruleL10nName(@issue_results.rule(issue)) %>
        <a class="open-modal" modal-width="800" href="<%= url_for :controller => 'rules', :action => 'show', :id => issue.rule_key.to_s, :modal => 'true', :layout => 'false' -%>"><%= h rule_name -%></a>
      </span>
    &nbsp;
    <%= image_tag 'sep12.png' -%>
    &nbsp;

    <%
       created_at = Api::Utils.java_to_ruby_datetime(issue.creationDate())
       updated_at = Api::Utils.java_to_ruby_datetime(issue.updateDate())
       dates_title = "Created at #{format_datetime(created_at)} and updated at #{format_datetime(updated_at)}"
    %>
    <span title="<%= h dates_title -%>"><%= distance_of_time_in_words_to_now(created_at) -%></span>
    &nbsp;
    <%
       if issue.resolution
    %>
      <%= image_tag 'sep12.png' -%>
      &nbsp;
      <span><%= message("issue.resolution.#{issue.resolution}") -%></span>
      &nbsp;
    <% else %>
      <%= image_tag 'sep12.png' -%>
      &nbsp;
      <span><%= message("issue.status.#{issue.status}") -%></span>
      &nbsp;
    <% end %>
    <%
       if issue.assignee
    %>
      <%= image_tag 'sep12.png' -%>
      &nbsp;
      <%= message('assigned_to') -%> <%= h(@issue_results.user(issue.assignee).name) -%>
      &nbsp;
    <% end %>
    <%
       if issue.actionPlanKey()
    %>
      <%= image_tag 'sep12.png' -%>
      &nbsp;
      <%= message('issue.planned_for_x', :params => h(@issue_results.actionPlan(issue).name())) if @issue_results.actionPlan(issue) -%>
      &nbsp;
    <% end %>

  </div>

  <% unless issue.message.blank? %>
    <div class="code-issue-msg">
      <%= Api::Utils.split_newlines(h(issue.message)).join('<br/>') -%>
    </div>
  <% end %>

  <%
     issue.comments.each do |comment|
       comment_html_id = "comment-#{comment.key}-#{rand(100)}"
  %>
    <div class="code-issue-comment" id="<%= comment_html_id -%>" data-comment-key="<%= comment.key -%>">
      <h4>
        <%= image_tag('reviews/comment.png') -%> &nbsp;<b><%= @issue_results.user(comment.userLogin()).name() -%></b>
        (<%= distance_of_time_in_words_to_now(Api::Utils.java_to_ruby_datetime(comment.createdAt)) -%>)
        <% if current_user && current_user.login==comment.userLogin %>
            &nbsp;
            <%= image_tag 'sep12.png' -%>
            &nbsp;
            <a class="link-action" href="#" onclick="return formEditIssueComment(this)"><%= message('edit') -%></a>
            <a class="link-action spacer-right" href="#" onclick="return formDeleteIssueComment(this)"><%= message('delete') -%></a>
        <% end %>
      </h4>
      <%= Internal.text.markdownToHtml(comment.markdownText) -%>
    </div>
  <% end %>

  <% if current_user %>
    <div class="code-issue-actions">
      <a href='#' onclick="return issueForm('comment', this)" class="link-action spacer-right"><%= message('issue.comment.formlink') -%></a>
      <% unless issue.resolution %>
        <span class="spacer-right">
        <a href='#' onclick="return issueForm('assign', this)" class="link-action"><%= message('issue.assign.formlink') -%></a>
          <% if issue.assignee!=current_user.login %>
          [<a href="#" onclick="return assignIssueToMe(this)" class="link-action"><%= message('issue.assign.to_me') -%></a>]
        <% end %>
        </span>
      <% end %>

      <% Internal.issues.listTransitions(issue).each do |transition| %>
        <a href="#" onclick="return doIssueTransition(this, '<%= transition.key -%>')" class="link-action spacer-right"><%= message("issue.transition.#{transition.key}") -%></a>
      <% end %>

      <% unless issue.resolution %>
        <a href="#" onclick="return issueForm('severity', this)" class="link-action spacer-right"><%= message("issue.set_severity") -%></a>
        <a href="#" onclick="return issueForm('plan', this)" class="link-action spacer-right"><%= message("issue.do_plan") -%></a>
      <% end %>
    </div>
    <div class="code-issue-form hidden"></div>
  <% end %>
</div>