diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-06-17 15:09:44 +0200 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-06-17 15:09:55 +0200 |
commit | 0f7a7e52708857da8cef1068747e1594e1d463f1 (patch) | |
tree | 8118f0d82290aa8ac5e48cbf2eb48c02f2f46b58 /sonar-server | |
parent | bba78c52882b8c405f00c037e6f05c597f5ef61f (diff) | |
download | sonarqube-0f7a7e52708857da8cef1068747e1594e1d463f1.tar.gz sonarqube-0f7a7e52708857da8cef1068747e1594e1d463f1.zip |
SONAR-5374 Hide unnecessary details for a manual rule
Diffstat (limited to 'sonar-server')
3 files changed, 51 insertions, 42 deletions
diff --git a/sonar-server/src/main/coffee/coding-rules/app.coffee b/sonar-server/src/main/coffee/coding-rules/app.coffee index d18941d2a1e..f2f2b68f993 100644 --- a/sonar-server/src/main/coffee/coding-rules/app.coffee +++ b/sonar-server/src/main/coffee/coding-rules/app.coffee @@ -259,6 +259,12 @@ requirejs [ App.layout.detailsRegion.show App.detailView + App.manualRepository = -> + key: 'manual' + name: 'Manual Rules' + language: 'none' + + # Construct layout App.addInitializer -> @layout = new CodingRulesLayout app: @ @@ -456,10 +462,7 @@ requirejs [ _.map App.qualityProfiles, (profile) -> profile.language = App.languages[profile.lang] App.repositories = r.repositories - App.repositories.push - key: 'manual' - name: 'Manual Rules' - language: 'none' + App.repositories.push App.manualRepository() App.statuses = r.statuses App.characteristics = r.characteristics diff --git a/sonar-server/src/main/coffee/coding-rules/views/coding-rules-detail-view.coffee b/sonar-server/src/main/coffee/coding-rules/views/coding-rules-detail-view.coffee index ad83d94b5bf..5f00924ff4e 100644 --- a/sonar-server/src/main/coffee/coding-rules/views/coding-rules-detail-view.coffee +++ b/sonar-server/src/main/coffee/coding-rules/views/coding-rules-detail-view.coffee @@ -245,6 +245,7 @@ define [ serializeData: -> contextQualityProfile = @options.app.getQualityProfile() repoKey = @model.get 'repo' + isManual = (@options.app.manualRepository().key == repoKey) _.extend super, contextQualityProfile: contextQualityProfile @@ -252,8 +253,9 @@ define [ qualityProfile: @contextProfile language: @options.app.languages[@model.get 'lang'] repository: _.find(@options.app.repositories, (repo) -> repo.key == repoKey).name + isManual: isManual canWrite: @options.app.canWrite - qualityProfilesVisible: not @model.get('isTemplate') and (@options.app.canWrite or not _.isEmpty(@options.actives)) + qualityProfilesVisible: not @model.get('isTemplate') and not isManual and (@options.app.canWrite or not _.isEmpty(@options.actives)) subcharacteristic: (@options.app.characteristics[@model.get 'debtSubChar'] || '').replace ': ', ' > ' createdAt: new Date(@model.get 'createdAt') allTags: _.union @model.get('sysTags'), @model.get('tags') diff --git a/sonar-server/src/main/hbs/coding-rules/coding-rules-detail.hbs b/sonar-server/src/main/hbs/coding-rules/coding-rules-detail.hbs index 2e5b622c283..f49e514f227 100644 --- a/sonar-server/src/main/hbs/coding-rules/coding-rules-detail.hbs +++ b/sonar-server/src/main/hbs/coding-rules/coding-rules-detail.hbs @@ -9,7 +9,9 @@ <span class="subtitle">{{key}}</span> <ul class="coding-rules-detail-properties"> - <li class="coding-rules-detail-property">{{severityIcon severity}} {{t "severity" severity}}</li> + {{#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">{{status}}</span> @@ -34,7 +36,7 @@ <li class="coding-rules-detail-property">{{subcharacteristic}}</li> <li class="coding-rules-detail-property">{{t 'coding_rules.available_since'}} {{d createdAt}}</li> - <li class="coding-rules-detail-property">{{repository}} ({{language}})</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> @@ -57,43 +59,45 @@ </div> {{/if}} {{else}} -<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">{{{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> + {{#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">{{{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 'coding_rules.extend_description'}}</button> - </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> + {{#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 'coding_rules.extend_description'}}</button> + </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> + <div id="coding-rules-detail-extend-description-spinner"> + <i class="spinner"></i> + </div>{{/if}} + </div> + {{/unless}} {{/if}} |