summaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs
blob: 7da358161f254c6cc33c57f9090a776fcde5a158 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<div class="coding-rules-detail-context"></div>

<h3 class="coding-rules-detail-header">
  {{name}}
  <a class="coding-rules-detail-permalink" href="#rule_key={{key}}">
    <i class="icon-link"></i> {{t 'coding_rules.permalink'}}
  </a>
</h3>
<span class="subtitle">{{key}}</span>

<ul class="coding-rules-detail-properties">
  {{#unless isManual}}
    <li class="coding-rules-detail-property">{{severityIcon severity}} {{t "severity" severity}}</li>
  {{/unless}}
  {{#notEq status 'READY'}}
    <li class="coding-rules-detail-property">
      <span class="coding-rules-detail-status coding-rules-detail-not-ready">{{status}}</span>
    </li>
  {{/notEq}}


  <li class="coding-rules-detail-property coding-rules-detail-tag-list {{#if canWrite}}coding-rules-detail-tags-change{{/if}}">
    <i class="icon-tags"></i>
    <span>{{#if allTags}}{{join allTags ', '}}{{else}}{{t 'coding_rules.no_tags'}}{{/if}}</span>
  </li>
  {{#if canWrite}}<li class="coding-rules-detail-property coding-rules-detail-tag-edit">
    {{#if sysTags}}<i class="icon-tags"></i>
    <span>{{join sysTags ', '}}</span>{{/if}}
    <input class="coding-rules-detail-tag-input" type="text" value="{{#if tags}}{{join tags ','}}{{/if}}">

    <div class="button-group">
      <button class="coding-rules-detail-tag-edit-done">{{t 'Done'}}</button>
    </div>
    <a class="coding-rules-details-tag-edit-cancel">{{t 'cancel'}}</a>
  </li>{{/if}}

  {{#if subcharacteristic}}
    <li class="coding-rules-detail-property coding-rules-subcharacteristic">{{subcharacteristic}}</li>
  {{/if}}
  <li class="coding-rules-detail-property">{{t 'coding_rules.available_since'}} {{d createdAt}}</li>
  <li class="coding-rules-detail-property">{{repository}}{{#unless isManual}} ({{language}}){{/unless}}</li>

  {{#if isTemplate}}
    <li class="coding-rules-detail-property" title="{{t 'coding_rules.rule_template.title'}}">{{t 'coding_rules.rule_template'}}</li>
  {{/if}}
  {{#if templateKey}}
    <li class="coding-rules-detail-property" title="{{t 'coding_rules.custom_rule.title'}}">{{t 'coding_rules.custom_rule'}}
      (<a href="#rule_key={{templateKey}}">{{t 'coding_rules.show_template'}}</a>)
    </li>
  {{/if}}
</ul>

<div class="coding-rules-detail-description rule-desc markdown">{{{htmlDesc}}}</div>

{{#unless isEditable}}
  {{#unless isManual}}
  <div class="coding-rules-detail-description coding-rules-detail-description-extra">
    <div id="coding-rules-detail-description-extra">
      {{#if htmlNote}}
        <div class="rule-desc marginbottom10 markdown">{{{htmlNote}}}</div>{{/if}}
      {{#if canWrite}}<div class="button-group">
        <button id="coding-rules-detail-extend-description">{{t 'coding_rules.extend_description'}}</button>
      </div>{{/if}}
    </div>

    {{#if canWrite}}<div class="coding-rules-detail-extend-description-form">
      <table class="width100">
        <tbody>
        <tr>
          <td class="width100" colspan="2">
            <textarea id="coding-rules-detail-extend-description-text" rows="4"
                      style="width: 100%; margin-bottom: 4px;">{{mdNote}}</textarea>
          </td>
        </tr>
        <tr>
          <td>
            <div class="button-group">
              <button id="coding-rules-detail-extend-description-submit">{{t 'save'}}</button>
              {{#if mdNote}}
              <button id="coding-rules-detail-extend-description-remove" class="button-red">{{t 'remove'}}</button>
              {{/if}}
            </div>
            <a id="coding-rules-detail-extend-description-cancel" class="action">{{t 'cancel'}}</a>
          </td>
          <td class="right">
            {{> '_markdown-tips' }}
          </td>
        </tr>
        </tbody>
      </table>
    </div>

    <div id="coding-rules-detail-extend-description-spinner">
      <i class="spinner"></i>
    </div>{{/if}}
  </div>
  {{/unless}}
{{/unless}}


{{#if params}}
  <h3 class="coding-rules-detail-title">{{t 'coding_rules.parameters'}}</h3>
  <div class="coding-rules-detail-parameters">
    {{#each params}}
    <dl class="coding-rules-detail-parameter">
      <dt class="coding-rules-detail-parameter-name">{{key}}</dt>
      <dd class="coding-rules-detail-parameter-description" data-key="{{key}}">
        <p>{{{htmlDesc}}}</p>
        {{#if ../../templateKey}}
        <div class="subtitle">
          {{#if defaultValue }}
            <span class="value">{{defaultValue}}</span>
          {{else}}
            {{t 'coding_rules.parameter.empty'}}
          {{/if}}
        </div>
        {{else}}
          {{#if defaultValue}}
          <div class="subtitle">{{t 'coding_rules.parameters.default_value'}} <span class="value">{{defaultValue}}</span></div>
          {{/if}}
        {{/if}}
      </dd>
    </dl>
    {{/each}}
  </div>
{{/if}}

{{#if isEditable}}
  <div class="coding-rules-detail-description">
    <div class="button-group">
      {{#if isManual}}
        <button id="coding-rules-detail-manual-rule-change">{{t 'edit'}}</button>
      {{else}}
        <button id="coding-rules-detail-custom-rule-change">{{t 'edit'}}</button>
      {{/if}}
      <button id="coding-rules-detail-rule-delete" class="button-red">{{t 'delete'}}</button>
    </div>
  </div>
{{/if}}


{{#if isTemplate}}
<div class="coding-rules-detail-custom-rules-section">
  <h3 class="coding-rules-detail-title">{{t 'coding_rules.custom_rules'}}</h3>

  {{#if canWrite}}<div class="button-group coding-rules-detail-quality-profiles-activation">
    <button id="coding-rules-custom-rules-create">{{t 'coding_rules.create'}}</button>
  </div>{{/if}}
  <div id="coding-rules-detail-custom-rules"></div>
</div>
{{/if}}


{{#if qualityProfilesVisible}}
<div class="coding-rules-detail-quality-profiles-section">
  <h3 class="coding-rules-detail-title">{{t 'coding_rules.quality_profiles'}}</h3>

  {{#if canWrite}}{{#unless isTemplate}}<div class="button-group coding-rules-detail-quality-profiles-activation">
    <button id="coding-rules-quality-profile-activate">{{t 'coding_rules.activate'}}</button>
  </div>{{/unless}}{{/if}}
  {{#if isTemplate}}
  <div class="coding-rules-detail-quality-profiles-template-caption warning">{{t 'coding_rules.quality_profiles.template_caption'}}</div>
  {{/if}}
  <div id="coding-rules-detail-quality-profiles"></div>
</div>
{{/if}}