]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6265 filter similar rules from the detailed view
authorStas Vilchik <vilchiks@gmail.com>
Fri, 24 Apr 2015 12:53:00 +0000 (14:53 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 24 Apr 2015 12:53:00 +0000 (14:53 +0200)
server/sonar-web/src/main/hbs/coding-rules/rule/coding-rules-rule-meta.hbs
server/sonar-web/src/main/js/coding-rules/rule/rule-filter-mixin.js [new file with mode: 0644]
server/sonar-web/src/main/js/coding-rules/rule/rule-meta-view.js
server/sonar-web/src/main/js/coding-rules/workspace-list-item-view.js
server/sonar-web/src/main/less/pages/coding-rules.less

index 31b1ca0925ed00fcf753a3eaeae5f7416921306f..48bf5031ebfb692f7fc8723a85f0aabbf7f88989 100644 (file)
@@ -1,10 +1,18 @@
-<h3 class="coding-rules-detail-header">
-  {{name}}
-  <a class="coding-rules-detail-permalink icon-link" target="_blank" href="{{permalink}}"
-     data-toggle="tooltip" data-placement="left" title="Rule permalink"></a>
-</h3>
+<header class="page-header">
+  <h3 class="page-title coding-rules-detail-header">
+    <big>{{name}}</big>
+  </h3>
+  <div class="page-actions">
+    <a class="coding-rules-detail-permalink icon-link" target="_blank" href="{{permalink}}"
+       data-toggle="tooltip" data-placement="left" title="Rule permalink"></a>
 
-<span class="note">{{key}}</span>
+    <a class="js-rule-filter link-no-underline spacer-left" href="#">
+      <i class="icon-filter icon-half-transparent"></i>&nbsp;<i class="icon-dropdown"></i>
+    </a>
+  </div>
+</header>
+
+<p class="note">{{key}}</p>
 
 <ul class="coding-rules-detail-properties">
   {{#unless isManual}}
diff --git a/server/sonar-web/src/main/js/coding-rules/rule/rule-filter-mixin.js b/server/sonar-web/src/main/js/coding-rules/rule/rule-filter-mixin.js
new file mode 100644 (file)
index 0000000..fed13b8
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+define([
+  'coding-rules/rule-filter-view'
+], function (RuleFilterView) {
+
+  var $ = jQuery;
+
+  return {
+    onRuleFilterClick: function (e) {
+      e.preventDefault();
+      e.stopPropagation();
+      $('body').click();
+      var that = this,
+          popup = new RuleFilterView({
+            triggerEl: $(e.currentTarget),
+            bottomRight: true,
+            model: this.model
+          });
+      popup.on('select', function (property, value) {
+        var obj = {};
+        obj[property] = '' + value;
+        that.options.app.state.updateFilter(obj);
+        popup.close();
+      });
+      popup.render();
+    }
+  };
+
+});
index d3dd8caf4c0155f9377a23aa27cc9738e29f9ae1..80f2662d1ef9b5a6ca9fe721db8c09beb9b26374 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 define([
+  'coding-rules/rule/rule-filter-mixin',
   'templates/coding-rules'
-], function () {
+], function (RuleFilterMixin) {
 
-  return Marionette.ItemView.extend({
+  return Marionette.ItemView.extend(RuleFilterMixin).extend({
     template: Templates['coding-rules-rule-meta'],
 
     modelEvents: {
@@ -40,7 +41,8 @@ define([
     events: {
       'click @ui.tagsChange': 'changeTags',
       'click @ui.tagsEditDone': 'editDone',
-      'click @ui.tagsEditCancel': 'cancelEdit'
+      'click @ui.tagsEditCancel': 'cancelEdit',
+      'click .js-rule-filter': 'onRuleFilterClick'
     },
 
     onRender: function () {
index 0b3f942455de6794b1f83ef24916b9a457bb8cb6..c86c6b61c81d03a2014e012135af9693e98feac3 100644 (file)
 define([
   'components/navigator/workspace-list-item-view',
   'coding-rules/rule/profile-activation-view',
-  'coding-rules/rule-filter-view',
+  'coding-rules/rule/rule-filter-mixin',
   'templates/coding-rules'
-], function (WorkspaceListItemView, ProfileActivationView, RuleFilterView) {
+], function (WorkspaceListItemView, ProfileActivationView, RuleFilterMixin) {
 
   var $ = jQuery;
 
-  return WorkspaceListItemView.extend({
+  return WorkspaceListItemView.extend(RuleFilterMixin).extend({
     className: 'coding-rule',
     template: Templates['coding-rules-workspace-list-item'],
 
@@ -96,25 +96,6 @@ define([
       });
     },
 
-    onRuleFilterClick: function (e) {
-      e.preventDefault();
-      e.stopPropagation();
-      $('body').click();
-      var that = this,
-          popup = new RuleFilterView({
-        triggerEl: $(e.currentTarget),
-        bottomRight: true,
-        model: this.model
-      });
-      popup.on('select', function (property, value) {
-        var obj = {};
-        obj[property] = '' + value;
-        that.options.app.state.updateFilter(obj);
-        popup.close();
-      });
-      popup.render();
-    },
-
     serializeData: function () {
       return _.extend(WorkspaceListItemView.prototype.serializeData.apply(this, arguments), {
         tags: _.union(this.model.get('sysTags'), this.model.get('tags')),
index 118028e77b3b1fa2da603571982847fc12b0f6ef..4d96bfaa478b0ce8a9d6c066ba3dece510fe7e53 100644 (file)
  * Detail
  */
 
-.coding-rules-detail-header,
 .coding-rules-detail-title {
   position: relative;
-  line-height: 1.5;
   font-size: @bigFontSize;
   font-weight: 400;
 }
 
-.coding-rules-detail-header,
 .coding-rules-detail-title,
 .coding-rules-detail-actions {
   margin: 16px 0;
 }
 
-.coding-rules-detail-header {
-  margin: 0;
-  padding-right: 100px;
-  font-size: 18px;
-}
-
 .coding-rules-detail-title {
   display: inline-block;
 }
   margin-top: 6px;
 }
 
-.coding-rules-detail-permalink {
-  position: absolute;
-  top: 0; right: 0;
-  font-size: @baseFontSize;
-  font-weight: normal;
-  text-decoration: none;
-  .trans;
-
-  &:hover { color: @highlighted; }
-}
-
 .coding-rules-detail-context {
   margin-bottom: @navigatorPadding;
   padding: @navigatorPadding / 2;