<%= render :partial => '/navigator/filter_templates' -%>
<%= render :partial => '/coding_rules/templates/coding_rules_layout.hbs' -%>
<%= render :partial => '/coding_rules/templates/coding_rules_header_template.hbs' -%>
+<%= render :partial => '/coding_rules/templates/coding_rules_header_quality_profiles_template.hbs' -%>
<%= render :partial => '/coding_rules/templates/coding_rules_actions_template.hbs' -%>
<%= render :partial => '/coding_rules/templates/coding_rules_filter_bar_template.hbs' -%>
<%= render :partial => '/coding_rules/templates/coding_rules_list_item_template.hbs' -%>
<%= render :partial => '/coding_rules/templates/coding_rules_list_empty_template.hbs' -%>
<%= render :partial => '/coding_rules/templates/coding_rules_detail_template.hbs' -%>
+<%= render :partial => '/coding_rules/templates/coding_rules_facets_item_template.hbs' -%>
--- /dev/null
+<script id="coding-rules-facets-item-template" type="text/x-handlebars-template">
+ <h3 class="navigator-facets-list-item-name">{{name}}</h3>
+ <ul class="navigator-facets-list-item-options">
+ {{#each options}}
+ <li class="navigator-facets-list-item-option">
+ <span class="navigator-facets-list-item-option-name">{{this}}</span>
+ <span class="navigator-facets-list-item-option-stat subtitle">42</span>
+ </li>
+ {{/each}}
+ </ul>
+</script>
--- /dev/null
+<script id="coding-rules-header-quality-profiles-template" type="text/x-handlebars-template">
+ <ul class="navigator-filter-select-list">
+ <li>
+ <label title="{{t 'coding_rules.page'}}">
+ <span>{{t 'coding_rules.page'}}</span>
+ </label>
+ </li>
+ {{#each items}}
+ <li>
+ <label title="{{name}}">
+ <span>{{name}} <span class="subtitle">{{lang}}</span>
+ </span>
+ </label>
+ </li>
+ {{/each}}
+ </ul>
+</script>
<script id="coding-rules-header-template" type="text/x-handlebars-template">
- <h1 class="navigator-header-title">{{t 'coding_rules.page'}}</h1>
+ <div class="navigator-header-menu-toggle">
+ <i class="icon-list"></i>
+ </div>
+
+ <h1 class="navigator-header-title">
+ {{#if header}}{{{header}}}{{else}}{{t 'coding_rules.page'}}{{/if}}
+ </h1>
<div class="navigator-header-actions button-group">
<button id="issues-new-search">{{t 'coding_rules.new_search'}}</button>
<script id="coding-rules-layout" type="text/x-handlebars-template">
<div class="navigator-header"></div>
<div class="navigator-filters"></div>
+ <div class="navigator-facets"></div>
<div class="navigator-actions"></div>
<div class="navigator-results"></div>
<div class="navigator-details"></div>
<glyph unicode="" d="M877.714 426.667q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
<glyph unicode="" d="M585.143 426.667q0 60.571-42.857 103.429t-103.429 42.857-103.429-42.857-42.857-103.429 42.857-103.429 103.429-42.857 103.429 42.857 42.857 103.429zM877.714 488.953v-126.857q0-6.857-4.571-13.143t-11.429-7.429l-105.714-16q-10.857-30.857-22.286-52 20-28.571 61.143-78.857 5.714-6.857 5.714-14.286t-5.143-13.143q-15.429-21.143-56.571-61.714t-53.714-40.571q-6.857 0-14.857 5.143l-78.857 61.714q-25.143-13.143-52-21.714-9.143-77.714-16.571-106.286-4-16-20.571-16h-126.857q-8 0-14 4.857t-6.571 12.286l-16 105.143q-28 9.143-51.429 21.143l-80.571-61.143q-5.714-5.143-14.286-5.143-8 0-14.286 6.286-72 65.143-94.286 96-4 5.714-4 13.143 0 6.857 4.571 13.143 8.571 12 29.143 38t30.857 40.286q-15.429 28.571-23.429 56.571l-104.571 15.429q-7.429 1.143-12 7.143t-4.571 13.429v126.857q0 6.857 4.571 13.143t10.857 7.429l106.286 16q8 26.286 22.286 52.571-22.857 32.571-61.143 78.857-5.714 6.857-5.714 13.714 0 5.714 5.143 13.143 14.857 20.571 56.286 61.429t54 40.857q7.429 0 14.857-5.714l78.857-61.143q25.143 13.143 52 21.714 9.143 77.714 16.571 106.286 4 16 20.571 16h126.857q8 0 14-4.857t6.571-12.286l16-105.143q28-9.143 51.429-21.143l81.143 61.143q5.143 5.143 13.714 5.143 7.429 0 14.286-5.714 73.714-68 94.286-97.143 4-4.571 4-12.571 0-6.857-4.571-13.143-8.571-12-29.143-38t-30.857-40.286q14.857-28.571 23.429-56l104.571-16q7.429-1.143 12-7.143t4.571-13.429z" />
<glyph unicode="" d="M1024 170.667v-73.143q0-14.857-10.857-25.714t-25.714-10.857h-950.857q-14.857 0-25.714 10.857t-10.857 25.714v73.143q0 14.857 10.857 25.714t25.714 10.857h950.857q14.857 0 25.714-10.857t10.857-25.714zM1024 390.096v-73.143q0-14.857-10.857-25.714t-25.714-10.857h-950.857q-14.857 0-25.714 10.857t-10.857 25.714v73.143q0 14.857 10.857 25.714t25.714 10.857h950.857q14.857 0 25.714-10.857t10.857-25.714zM1024 609.524v-73.143q0-14.857-10.857-25.714t-25.714-10.857h-950.857q-14.857 0-25.714 10.857t-10.857 25.714v73.143q0 14.857 10.857 25.714t25.714 10.857h950.857q14.857 0 25.714-10.857t10.857-25.714zM1024 828.953v-73.143q0-14.857-10.857-25.714t-25.714-10.857h-950.857q-14.857 0-25.714 10.857t-10.857 25.714v73.143q0 14.857 10.857 25.714t25.714 10.857h950.857q14.857 0 25.714-10.857t10.857-25.714z" />
+<glyph unicode="" d="M146.286 188.953v-109.714q0-7.429-5.429-12.857t-12.857-5.429h-109.714q-7.429 0-12.857 5.429t-5.429 12.857v109.714q0 7.429 5.429 12.857t12.857 5.429h109.714q7.429 0 12.857-5.429t5.429-12.857zM146.286 408.381v-109.714q0-7.429-5.429-12.857t-12.857-5.429h-109.714q-7.429 0-12.857 5.429t-5.429 12.857v109.714q0 7.429 5.429 12.857t12.857 5.429h109.714q7.429 0 12.857-5.429t5.429-12.857zM146.286 627.81v-109.714q0-7.429-5.429-12.857t-12.857-5.429h-109.714q-7.429 0-12.857 5.429t-5.429 12.857v109.714q0 7.429 5.429 12.857t12.857 5.429h109.714q7.429 0 12.857-5.429t5.429-12.857zM1024 188.953v-109.714q0-7.429-5.429-12.857t-12.857-5.429h-768q-7.429 0-12.857 5.429t-5.429 12.857v109.714q0 7.429 5.429 12.857t12.857 5.429h768q7.429 0 12.857-5.429t5.429-12.857zM146.286 847.238v-109.714q0-7.429-5.429-12.857t-12.857-5.429h-109.714q-7.429 0-12.857 5.429t-5.429 12.857v109.714q0 7.429 5.429 12.857t12.857 5.429h109.714q7.429 0 12.857-5.429t5.429-12.857zM1024 408.381v-109.714q0-7.429-5.429-12.857t-12.857-5.429h-768q-7.429 0-12.857 5.429t-5.429 12.857v109.714q0 7.429 5.429 12.857t12.857 5.429h768q7.429 0 12.857-5.429t5.429-12.857zM1024 627.81v-109.714q0-7.429-5.429-12.857t-12.857-5.429h-768q-7.429 0-12.857 5.429t-5.429 12.857v109.714q0 7.429 5.429 12.857t12.857 5.429h768q7.429 0 12.857-5.429t5.429-12.857zM1024 847.238v-109.714q0-7.429-5.429-12.857t-12.857-5.429h-768q-7.429 0-12.857 5.429t-5.429 12.857v109.714q0 7.429 5.429 12.857t12.857 5.429h768q7.429 0 12.857-5.429t5.429-12.857z" />
<glyph unicode="" d="M804.571 407.238v-181.714q0-68-48.286-116.286t-116.286-48.286h-475.429q-68 0-116.286 48.286t-48.286 116.286v475.429q0 68 48.286 116.286t116.286 48.286h475.429q36 0 66.857-14.286 8.571-4 10.286-13.143 1.714-9.714-5.143-16.571l-28-28q-5.714-5.714-13.143-5.714-1.714 0-5.143 1.143-13.143 3.429-25.714 3.429h-475.429q-37.714 0-64.571-26.857t-26.857-64.571v-475.429q0-37.714 26.857-64.571t64.571-26.857h475.429q37.714 0 64.571 26.857t26.857 64.571v145.143q0 7.429 5.143 12.571l36.571 36.571q5.714 5.714 13.143 5.714 3.429 0 6.857-1.714 11.429-4.571 11.429-16.571zM936.571 686.667l-465.143-465.143q-13.714-13.714-32.571-13.714t-32.571 13.714l-245.714 245.714q-13.714 13.714-13.714 32.571t13.714 32.571l62.857 62.857q13.714 13.714 32.571 13.714t32.571-13.714l150.286-150.286 369.714 369.714q13.714 13.714 32.571 13.714t32.571-13.714l62.857-62.857q13.714-13.714 13.714-32.571t-13.714-32.571z" horiz-adv-x="951" />
<glyph unicode="" d="M656.571 297.524q0 14.857-10.857 25.714l-103.429 103.429 103.429 103.429q10.857 10.857 10.857 25.714 0 15.429-10.857 26.286l-51.429 51.429q-10.857 10.857-26.286 10.857-14.857 0-25.714-10.857l-103.429-103.429-103.429 103.429q-10.857 10.857-25.714 10.857-15.429 0-26.286-10.857l-51.429-51.429q-10.857-10.857-10.857-26.286 0-14.857 10.857-25.714l103.429-103.429-103.429-103.429q-10.857-10.857-10.857-25.714 0-15.429 10.857-26.286l51.429-51.429q10.857-10.857 26.286-10.857 14.857 0 25.714 10.857l103.429 103.429 103.429-103.429q10.857-10.857 25.714-10.857 15.429 0 26.286 10.857l51.429 51.429q10.857 10.857 10.857 26.286zM877.714 426.667q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
<glyph unicode="" d="M512 152.381v109.714q0 8-5.143 13.143t-13.143 5.143h-109.714q-8 0-13.143-5.143t-5.143-13.143v-109.714q0-8 5.143-13.143t13.143-5.143h109.714q8 0 13.143 5.143t5.143 13.143zM658.286 536.381q0 50.286-31.714 93.143t-79.143 66.286-97.143 23.429q-138.857 0-212-121.714-8.571-13.714 4.571-24l75.429-57.143q4-3.429 10.857-3.429 9.143 0 14.286 6.857 30.286 38.857 49.143 52.571 19.429 13.714 49.143 13.714 27.429 0 48.857-14.857t21.429-33.714q0-21.714-11.429-34.857t-38.857-25.714q-36-16-66-49.429t-30-71.714v-20.571q0-8 5.143-13.143t13.143-5.143h109.714q8 0 13.143 5.143t5.143 13.143q0 10.857 12.286 28.286t31.143 28.286q18.286 10.286 28 16.286t26.286 20 25.429 27.429 16 34.571 7.143 46.286zM877.714 426.667q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
'coding-rules/layout',
'coding-rules/router',
- # models & collections
- 'coding-rules/collections/coding-rules',
-
# views
'coding-rules/views/header-view',
'coding-rules/views/actions-view',
'coding-rules/views/filter-bar-view',
'coding-rules/views/coding-rules-list-view',
+ 'coding-rules/views/coding-rules-facets-view',
# filters
'navigator/filters/base-filters',
CodingRulesLayout,
CodingRulesRouter,
- # models & collections
- CodingRules,
-
# views
CodingRulesHeaderView,
CodingRulesActionsView,
CodingRulesFilterBarView,
CodingRulesListView,
+ CodingRulesFacetsView,
# filters
BaseFilters,
@storeQuery query, @codingRules.sorting
@layout.showSpinner 'resultsRegion'
- @codingRules.fetch(data: fetchQuery, remove: !!firstPage).done =>
+ @layout.showSpinner 'facetsRegion'
+ jQuery.ajax
+ url: "#{baseUrl}/api/codingrules/search"
+ data: fetchQuery
+ .done (r) =>
+ if firstPage
+ @codingRules.reset r.codingrules
+ else
+ @codingRules.add r.codingrules
+ @codingRules.paging = r.paging
@codingRulesListView = new CodingRulesListView
app: @
collection: @codingRules
@layout.resultsRegion.show @codingRulesListView
@codingRulesListView.selectFirst()
+ @facets.reset r.facets
+ @codingRulesFacetsView = new CodingRulesFacetsView
+ app: @
+ collection: @facets
+ @layout.facetsRegion.show @codingRulesFacetsView
+
+
App.fetchFirstPage = ->
@pageIndex = 1
# Define coding rules
App.addInitializer ->
- @codingRules = new CodingRules
+ @codingRules = new Backbone.Collection
+ @facets = new Backbone.Collection
# Construct status bar
.done (r) ->
App.appState = new Backbone.Model
App.state = new Backbone.Model
+ App.qualityProfiles = r.qualityprofiles
window.messages = r.messages
# Remove the initial spinner
}
});
- requirejs(['backbone', 'backbone.marionette', 'coding-rules/layout', 'coding-rules/router', 'coding-rules/collections/coding-rules', 'coding-rules/views/header-view', 'coding-rules/views/actions-view', 'coding-rules/views/filter-bar-view', 'coding-rules/views/coding-rules-list-view', 'navigator/filters/base-filters', 'navigator/filters/choice-filters', 'navigator/filters/string-filters', 'coding-rules/views/filters/quality-profile-filter-view', 'coding-rules/mockjax'], function(Backbone, Marionette, CodingRulesLayout, CodingRulesRouter, CodingRules, CodingRulesHeaderView, CodingRulesActionsView, CodingRulesFilterBarView, CodingRulesListView, BaseFilters, ChoiceFilters, StringFilterView, QualityProfileFilterView) {
+ requirejs(['backbone', 'backbone.marionette', 'coding-rules/layout', 'coding-rules/router', 'coding-rules/views/header-view', 'coding-rules/views/actions-view', 'coding-rules/views/filter-bar-view', 'coding-rules/views/coding-rules-list-view', 'coding-rules/views/coding-rules-facets-view', 'navigator/filters/base-filters', 'navigator/filters/choice-filters', 'navigator/filters/string-filters', 'coding-rules/views/filters/quality-profile-filter-view', 'coding-rules/mockjax'], function(Backbone, Marionette, CodingRulesLayout, CodingRulesRouter, CodingRulesHeaderView, CodingRulesActionsView, CodingRulesFilterBarView, CodingRulesListView, CodingRulesFacetsView, BaseFilters, ChoiceFilters, StringFilterView, QualityProfileFilterView) {
var App, appXHR;
jQuery.ajaxSetup({
error: function(jqXHR) {
}
this.storeQuery(query, this.codingRules.sorting);
this.layout.showSpinner('resultsRegion');
- return this.codingRules.fetch({
- data: fetchQuery,
- remove: !!firstPage
- }).done(function() {
+ this.layout.showSpinner('facetsRegion');
+ return jQuery.ajax({
+ url: "" + baseUrl + "/api/codingrules/search",
+ data: fetchQuery
+ }).done(function(r) {
+ if (firstPage) {
+ _this.codingRules.reset(r.codingrules);
+ } else {
+ _this.codingRules.add(r.codingrules);
+ }
+ _this.codingRules.paging = r.paging;
_this.codingRulesListView = new CodingRulesListView({
app: _this,
collection: _this.codingRules
});
_this.layout.resultsRegion.show(_this.codingRulesListView);
- return _this.codingRulesListView.selectFirst();
+ _this.codingRulesListView.selectFirst();
+ _this.facets.reset(r.facets);
+ _this.codingRulesFacetsView = new CodingRulesFacetsView({
+ app: _this,
+ collection: _this.facets
+ });
+ return _this.layout.facetsRegion.show(_this.codingRulesFacetsView);
});
};
App.fetchFirstPage = function() {
return this.layout.headerRegion.show(this.codingRulesHeaderView);
});
App.addInitializer(function() {
- return this.codingRules = new CodingRules;
+ this.codingRules = new Backbone.Collection;
+ return this.facets = new Backbone.Collection;
});
App.addInitializer(function() {
this.codingRulesActionsView = new CodingRulesActionsView({
return jQuery.when(appXHR).done(function(r) {
App.appState = new Backbone.Model;
App.state = new Backbone.Model;
+ App.qualityProfiles = r.qualityprofiles;
window.messages = r.messages;
jQuery('#coding-rules-page-loader').remove();
return App.start();
+++ /dev/null
-define [
- 'backbone',
- 'coding-rules/models/coding-rule'
-], (
- Backbone,
- CodingRule
-) ->
-
- class CodingRules extends Backbone.Collection
- model: CodingRule
-
-
- url: ->
- "#{baseUrl}/api/codingrules/search"
-
-
- parse: (r) ->
- @paging = r.paging
- r.codingrules
+++ /dev/null
-// Generated by CoffeeScript 1.6.3
-(function() {
- var __hasProp = {}.hasOwnProperty,
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
-
- define(['backbone', 'coding-rules/models/coding-rule'], function(Backbone, CodingRule) {
- var CodingRules, _ref;
- return CodingRules = (function(_super) {
- __extends(CodingRules, _super);
-
- function CodingRules() {
- _ref = CodingRules.__super__.constructor.apply(this, arguments);
- return _ref;
- }
-
- CodingRules.prototype.model = CodingRule;
-
- CodingRules.prototype.url = function() {
- return "" + baseUrl + "/api/codingrules/search";
- };
-
- CodingRules.prototype.parse = function(r) {
- this.paging = r.paging;
- return r.codingrules;
- };
-
- return CodingRules;
-
- })(Backbone.Collection);
- });
-
-}).call(this);
resultsRegion: '.navigator-results'
detailsRegion: '.navigator-details'
filtersRegion: '.navigator-filters'
+ facetsRegion: '.navigator-facets'
onRender: ->
actionsRegion: '.navigator-actions',
resultsRegion: '.navigator-results',
detailsRegion: '.navigator-details',
- filtersRegion: '.navigator-filters'
+ filtersRegion: '.navigator-filters',
+ facetsRegion: '.navigator-facets'
};
AppLayout.prototype.onRender = function() {
jQuery.mockjax
url: "#{baseUrl}/api/codingrules/app"
responseText: JSON.stringify
+ qualityprofiles: [
+ { name: 'Sonar Way', lang: 'Java' }
+ { name: 'Sonar Way', lang: 'JavaScript' }
+ { name: 'Quality Profile 1', lang: 'Java' }
+ ]
messages:
'all': 'All'
'bulk_change': 'Bulk Change'
paging:
total: 5
fTotal: '5'
+ facets: [
+ { name: 'Language', options: ['Java', 'JavaScript'] }
+ { name: 'Repository', options: ['PMD', 'PMD Unit Tests', 'Checkstyle'] }
+ { name: 'Tags', options: ['brain-overload', 'bug', 'comment', 'convention', 'error-handling', 'formatting', 'java8'] }
+ ]
+
# GET /api/codingrules/show
public int[][] getMatrix() { /* ... */ } // Compliant
</pre>'''
- qualityprofiles: [
- {
- name: 'SonarWay'
- severity: 'MINOR'
- canDeactivate: false
- canUpdate: false
- parameters: [
- { key: 'max', value: 8 }
- ]
-
- },
- {
- name: 'Quality Profile 1'
- severity: 'MAJOR'
- canDeactivate: true
- canUpdate: true
- parameters: [
- { key: 'max', value: 6 }
- ]
-
- }
- ]
+ qualityProfiles: [
+ {
+ name: 'SonarWay'
+ severity: 'MINOR'
+ canDeactivate: false
+ canUpdate: false
+ parameters: [
+ { key: 'max', value: 8 }
+ ]
+
+ },
+ {
+ name: 'Quality Profile 1'
+ severity: 'MAJOR'
+ canDeactivate: true
+ canUpdate: true
+ parameters: [
+ { key: 'max', value: 6 }
+ ]
+
+ }
+ ]
jQuery.mockjax({
url: "" + baseUrl + "/api/codingrules/app",
responseText: JSON.stringify({
+ qualityprofiles: [
+ {
+ name: 'Sonar Way',
+ lang: 'Java'
+ }, {
+ name: 'Sonar Way',
+ lang: 'JavaScript'
+ }, {
+ name: 'Quality Profile 1',
+ lang: 'Java'
+ }
+ ],
messages: {
'all': 'All',
'bulk_change': 'Bulk Change',
paging: {
total: 5,
fTotal: '5'
- }
+ },
+ facets: [
+ {
+ name: 'Language',
+ options: ['Java', 'JavaScript']
+ }, {
+ name: 'Repository',
+ options: ['PMD', 'PMD Unit Tests', 'Checkstyle']
+ }, {
+ name: 'Tags',
+ options: ['brain-overload', 'bug', 'comment', 'convention', 'error-handling', 'formatting', 'java8']
+ }
+ ]
})
});
jQuery.mockjax({
codingrule: {
name: 'Array designators "[]" should be located after the type in method signatures',
language: 'Java',
- description: '<p>\nAccording to the Java Language Specification:\n</p>\n\n<pre>For compatibility with older versions of the Java SE platform,\nthe declaration of a method that returns an array is allowed to place (some or all of) the empty bracket pairs that form the declaration of the array type after the formal parameter list.\nThis obsolescent syntax should not be used in new code.\n</pre>\n\n<p>The following code snippet illustrates this rule:</p>\n\n<pre>public int getVector()[] { /* ... */ } // Non-Compliant\n\npublic int[] getVector() { /* ... */ } // Compliant\n\npublic int[] getMatrix()[] { /* ... */ } // Non-Compliant\n\npublic int[][] getMatrix() { /* ... */ } // Compliant\n</pre>'
- },
- qualityprofiles: [
- {
- name: 'SonarWay',
- severity: 'MINOR',
- canDeactivate: false,
- canUpdate: false,
- parameters: [
- {
- key: 'max',
- value: 8
- }
- ]
- }, {
- name: 'Quality Profile 1',
- severity: 'MAJOR',
- canDeactivate: true,
- canUpdate: true,
- parameters: [
- {
- key: 'max',
- value: 6
- }
- ]
- }
- ]
+ description: '<p>\nAccording to the Java Language Specification:\n</p>\n\n<pre>For compatibility with older versions of the Java SE platform,\nthe declaration of a method that returns an array is allowed to place (some or all of) the empty bracket pairs that form the declaration of the array type after the formal parameter list.\nThis obsolescent syntax should not be used in new code.\n</pre>\n\n<p>The following code snippet illustrates this rule:</p>\n\n<pre>public int getVector()[] { /* ... */ } // Non-Compliant\n\npublic int[] getVector() { /* ... */ } // Compliant\n\npublic int[] getMatrix()[] { /* ... */ } // Non-Compliant\n\npublic int[][] getMatrix() { /* ... */ } // Compliant\n</pre>',
+ qualityProfiles: [
+ {
+ name: 'SonarWay',
+ severity: 'MINOR',
+ canDeactivate: false,
+ canUpdate: false,
+ parameters: [
+ {
+ key: 'max',
+ value: 8
+ }
+ ]
+ }, {
+ name: 'Quality Profile 1',
+ severity: 'MAJOR',
+ canDeactivate: true,
+ canUpdate: true,
+ parameters: [
+ {
+ key: 'max',
+ value: 6
+ }
+ ]
+ }
+ ]
+ }
})
});
return jQuery.mockjax({
+++ /dev/null
-define [
- 'backbone'
-], (
- Backbone
-) ->
-
- class CodingRule extends Backbone.Model
-
- url: ->
- "#{baseUrl}/api/codingrules/show"
-
-
- parse: (r) ->
- model = if r.codingrule? then r.codingrule else r
- _.extend model, qualityProfiles: r.qualityprofiles if r.qualityprofiles?
- model
+++ /dev/null
-// Generated by CoffeeScript 1.6.3
-(function() {
- var __hasProp = {}.hasOwnProperty,
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
-
- define(['backbone'], function(Backbone) {
- var CodingRule, _ref;
- return CodingRule = (function(_super) {
- __extends(CodingRule, _super);
-
- function CodingRule() {
- _ref = CodingRule.__super__.constructor.apply(this, arguments);
- return _ref;
- }
-
- CodingRule.prototype.url = function() {
- return "" + baseUrl + "/api/codingrules/show";
- };
-
- CodingRule.prototype.parse = function(r) {
- var model;
- model = r.codingrule != null ? r.codingrule : r;
- if (r.qualityprofiles != null) {
- _.extend(model, {
- qualityProfiles: r.qualityprofiles
- });
- }
- return model;
- };
-
- return CodingRule;
-
- })(Backbone.Model);
- });
-
-}).call(this);
--- /dev/null
+define [
+ 'backbone.marionette',
+ 'common/handlebars-extensions'
+], (
+ Marionette,
+) ->
+
+ class CodingRulesFacetsView extends Marionette.ItemView
+ tagName: 'li'
+ className: 'navigator-facets-list-item'
+ template: getTemplate '#coding-rules-facets-item-template'
--- /dev/null
+// Generated by CoffeeScript 1.6.3
+(function() {
+ var __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ define(['backbone.marionette', 'common/handlebars-extensions'], function(Marionette) {
+ var CodingRulesFacetsView, _ref;
+ return CodingRulesFacetsView = (function(_super) {
+ __extends(CodingRulesFacetsView, _super);
+
+ function CodingRulesFacetsView() {
+ _ref = CodingRulesFacetsView.__super__.constructor.apply(this, arguments);
+ return _ref;
+ }
+
+ CodingRulesFacetsView.prototype.tagName = 'li';
+
+ CodingRulesFacetsView.prototype.className = 'navigator-facets-list-item';
+
+ CodingRulesFacetsView.prototype.template = getTemplate('#coding-rules-facets-item-template');
+
+ return CodingRulesFacetsView;
+
+ })(Marionette.ItemView);
+ });
+
+}).call(this);
--- /dev/null
+define [
+ 'backbone.marionette',
+ 'coding-rules/views/coding-rules-facets-item-view'
+], (
+ Marionette,
+ CodingRulesFacetsItemView
+) ->
+
+ class CodingRulesFacetsView extends Marionette.CollectionView
+ tagName: 'ul'
+ className: 'navigator-facets-list'
+ itemView: CodingRulesFacetsItemView
--- /dev/null
+// Generated by CoffeeScript 1.6.3
+(function() {
+ var __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ define(['backbone.marionette', 'coding-rules/views/coding-rules-facets-item-view'], function(Marionette, CodingRulesFacetsItemView) {
+ var CodingRulesFacetsView, _ref;
+ return CodingRulesFacetsView = (function(_super) {
+ __extends(CodingRulesFacetsView, _super);
+
+ function CodingRulesFacetsView() {
+ _ref = CodingRulesFacetsView.__super__.constructor.apply(this, arguments);
+ return _ref;
+ }
+
+ CodingRulesFacetsView.prototype.tagName = 'ul';
+
+ CodingRulesFacetsView.prototype.className = 'navigator-facets-list';
+
+ CodingRulesFacetsView.prototype.itemView = CodingRulesFacetsItemView;
+
+ return CodingRulesFacetsView;
+
+ })(Marionette.CollectionView);
+ });
+
+}).call(this);
@$el.addClass @activeClass
@options.app.layout.showSpinner 'detailsRegion'
- @model.fetch().done =>
+ jQuery.ajax
+ url: "#{baseUrl}/api/codingrules/show"
+ .done (r) =>
+ @model.set r.codingrule
detailView = new CodingRulesDetailView model: @model
@options.app.layout.detailsRegion.show detailView
this.$el.siblings().removeClass(this.activeClass);
this.$el.addClass(this.activeClass);
this.options.app.layout.showSpinner('detailsRegion');
- return this.model.fetch().done(function() {
+ return jQuery.ajax({
+ url: "" + baseUrl + "/api/codingrules/show"
+ }).done(function(r) {
var detailView;
+ _this.model.set(r.codingrule);
detailView = new CodingRulesDetailView({
model: _this.model
});
--- /dev/null
+define [
+ 'backbone.marionette',
+ 'common/handlebars-extensions'
+], (
+ Marionette
+) ->
+
+ class HeaderQualityProfilesView extends Marionette.ItemView
+ className: 'coding-rules-header-quality-profiles'
+ template: getTemplate '#coding-rules-header-quality-profiles-template'
+
+
+ events:
+ 'click label': 'selectQualityProfile'
+
+
+ selectQualityProfile: (e)->
+ @options.app.header = jQuery(e.target).html()
+ @options.headerView.render()
--- /dev/null
+// Generated by CoffeeScript 1.6.3
+(function() {
+ var __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ define(['backbone.marionette', 'common/handlebars-extensions'], function(Marionette) {
+ var HeaderQualityProfilesView, _ref;
+ return HeaderQualityProfilesView = (function(_super) {
+ __extends(HeaderQualityProfilesView, _super);
+
+ function HeaderQualityProfilesView() {
+ _ref = HeaderQualityProfilesView.__super__.constructor.apply(this, arguments);
+ return _ref;
+ }
+
+ HeaderQualityProfilesView.prototype.className = 'coding-rules-header-quality-profiles';
+
+ HeaderQualityProfilesView.prototype.template = getTemplate('#coding-rules-header-quality-profiles-template');
+
+ HeaderQualityProfilesView.prototype.events = {
+ 'click label': 'selectQualityProfile'
+ };
+
+ HeaderQualityProfilesView.prototype.selectQualityProfile = function(e) {
+ this.options.app.header = jQuery(e.target).html();
+ return this.options.headerView.render();
+ };
+
+ return HeaderQualityProfilesView;
+
+ })(Marionette.ItemView);
+ });
+
+}).call(this);
define [
'backbone.marionette',
+ 'coding-rules/views/header-quality-profiles-view',
'common/handlebars-extensions'
], (
- Marionette
+ Marionette,
+ HeaderQualityProfilesView
) ->
class CodingRulesHeaderView extends Marionette.ItemView
template: getTemplate '#coding-rules-header-template'
+
+
+ ui:
+ menuToggle: '.navigator-header-menu-toggle'
+
+
+ events:
+ 'click @ui.menuToggle': 'toggleQualityProfiles'
+
+
+ initialize: ->
+ @qualityProfilesView = new HeaderQualityProfilesView
+ app: @options.app
+ collection: new Backbone.Collection @options.app.qualityProfiles
+ headerView: @
+ jQuery('body').on 'click', =>
+ @qualityProfilesView.$el.hide()
+ @ui.menuToggle.removeClass 'active'
+
+
+ onRender: ->
+ @qualityProfilesView.render().$el.detach().appendTo jQuery('body')
+
+
+ onDomRefresh: ->
+ @qualityProfilesView.$el.css
+ top: @$el.offset().top + @$el.outerHeight()
+ left: @$el.offset().left + @ui.menuToggle.css('margin-left')
+
+
+ toggleQualityProfiles: (e) ->
+ e.stopPropagation()
+ @qualityProfilesView.$el.toggle()
+ @ui.menuToggle.toggleClass 'active'
+
+
+ serializeData: ->
+ _.extend super, header: @options.app.header
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
- define(['backbone.marionette', 'common/handlebars-extensions'], function(Marionette) {
+ define(['backbone.marionette', 'coding-rules/views/header-quality-profiles-view', 'common/handlebars-extensions'], function(Marionette, HeaderQualityProfilesView) {
var CodingRulesHeaderView, _ref;
return CodingRulesHeaderView = (function(_super) {
__extends(CodingRulesHeaderView, _super);
CodingRulesHeaderView.prototype.template = getTemplate('#coding-rules-header-template');
+ CodingRulesHeaderView.prototype.ui = {
+ menuToggle: '.navigator-header-menu-toggle'
+ };
+
+ CodingRulesHeaderView.prototype.events = {
+ 'click @ui.menuToggle': 'toggleQualityProfiles'
+ };
+
+ CodingRulesHeaderView.prototype.initialize = function() {
+ var _this = this;
+ this.qualityProfilesView = new HeaderQualityProfilesView({
+ app: this.options.app,
+ collection: new Backbone.Collection(this.options.app.qualityProfiles),
+ headerView: this
+ });
+ return jQuery('body').on('click', function() {
+ _this.qualityProfilesView.$el.hide();
+ return _this.ui.menuToggle.removeClass('active');
+ });
+ };
+
+ CodingRulesHeaderView.prototype.onRender = function() {
+ return this.qualityProfilesView.render().$el.detach().appendTo(jQuery('body'));
+ };
+
+ CodingRulesHeaderView.prototype.onDomRefresh = function() {
+ return this.qualityProfilesView.$el.css({
+ top: this.$el.offset().top + this.$el.outerHeight(),
+ left: this.$el.offset().left + this.ui.menuToggle.css('margin-left')
+ });
+ };
+
+ CodingRulesHeaderView.prototype.toggleQualityProfiles = function(e) {
+ e.stopPropagation();
+ this.qualityProfilesView.$el.toggle();
+ return this.ui.menuToggle.toggleClass('active');
+ };
+
+ CodingRulesHeaderView.prototype.serializeData = function() {
+ return _.extend(CodingRulesHeaderView.__super__.serializeData.apply(this, arguments), {
+ header: this.options.app.header
+ });
+ };
+
return CodingRulesHeaderView;
})(Marionette.ItemView);
.coding-rules-page .navigator-results .spinner {
margin: 10px;
}
+.coding-rules-page .navigator-actions,
+.coding-rules-page .navigator-details {
+ top: 324px;
+}
+.coding-rules-page .navigator-results {
+ top: 354px;
+}
/*
* Detail
*/
.coding-rules-detail-quality-profiles-activation {
margin-top: 10px;
}
+.coding-rules-header-quality-profiles {
+ position: absolute;
+ z-index: 1200;
+ display: none;
+ max-width: 300px;
+ border-right: 1px solid #cdcdcd;
+ border-bottom: 1px solid #cdcdcd;
+ background: #fff;
+ box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5);
+}
+.coding-rules-header-quality-profiles .navigator-filter-select-list {
+ max-width: 600px;
+}
+.coding-rules-header-quality-profiles .navigator-filter-select-list label > span {
+ width: auto;
+}
margin: @navigatorPadding;
}
+ .navigator-actions,
+ .navigator-details {
+ top: @navigatorTopOffset + @navigatorHeaderHeight + @navigatorFiltersHeight + @navigatorFacetsHeight;
+ }
+
+ .navigator-results {
+ top: @navigatorTopOffset + @navigatorHeaderHeight + @navigatorFiltersHeight + @navigatorFacetsHeight +
+ @navigatorStatusHeight;
+ }
+
}
.coding-rules-detail-quality-profiles-activation {
margin-top: @navigatorPadding;
}
+
+
+
+.coding-rules-header-quality-profiles {
+ position: absolute;
+ z-index: 1200;
+ display: none;
+ max-width: 300px;
+ border-right: 1px solid @darkGrey;
+ border-bottom: 1px solid @darkGrey;
+ background: #fff;
+ box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5);
+
+ .navigator-filter-select-list {
+ max-width: 600px;
+ }
+
+ .navigator-filter-select-list label > span {
+ width: auto;
+ }
+}
.icon-list:before {
content: "\f039";
}
+.icon-bullet-list:before {
+ content: "\f03a";
+}
.icon-settings:before {
content: "\f015";
}
.icon-list:before {
content: "\f039";
}
+.icon-bullet-list:before {
+ content: "\f03a";
+}
.icon-settings:before {
content: "\f015";
}
width: 100%;
height: 37px;
}
+.navigator-facets {
+ position: fixed;
+ z-index: 2;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ top: 104px;
+ left: 0;
+ width: 100%;
+ height: 220px;
+}
.navigator-results {
position: fixed;
z-index: 2;
font-style: italic;
}
.navigator-header-actions {
- margin-left: 16px;
+ margin-left: 20px;
}
.navigator-header-actions > a {
vertical-align: middle;
margin: 0 8px;
font-size: 11px;
}
+.navigator-header-menu-toggle {
+ display: inline-block;
+ vertical-align: top;
+ height: 36px;
+ margin-right: 10px;
+ margin-left: -10px;
+ padding: 10px;
+ border-right: 1px solid transparent;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ cursor: pointer;
+ transition: all 0.3s ease;
+}
+.navigator-header-menu-toggle:hover {
+ background-color: #e2e2e2;
+}
+.navigator-header-menu-toggle.active {
+ border-color: #cdcdcd;
+ background-color: #fff;
+}
+.navigator-header-menu-toggle [class^="icon-"],
+.navigator-header-menu-toggle [class*=" icon-"] {
+ font-size: 16px;
+}
.navigator-notes {
padding: 0 10px;
border-bottom: 1px solid #cdcdcd;
overflow: hidden;
text-overflow: ellipsis;
}
+.navigator-facets {
+ padding: 10px;
+ border-bottom: 1px solid #cdcdcd;
+ background-color: #efefef;
+}
+.navigator-facets-list {
+ display: table;
+ height: 100%;
+}
+.navigator-facets-list-item {
+ display: table-cell;
+}
+.navigator-facets-list-item {
+ padding-right: 20px;
+}
+.navigator-facets-list-item + .navigator-facets-list-item {
+ padding-left: 20px;
+ border-left: 1px solid #e1e1e1;
+}
+.navigator-facets-list-item-name {
+ font-weight: bold;
+ text-transform: uppercase;
+}
+.navigator-facets-list-item-options {
+ margin-top: 6.666666666666667px;
+}
+.navigator-facets-list-item-option {
+ margin-bottom: -1em;
+ padding: 3.3333333333333335px 0;
+ cursor: pointer;
+ text-align: justify;
+}
+.navigator-facets-list-item-option:hover .navigator-facets-list-item-option-name {
+ text-decoration: underline;
+}
+.navigator-facets-list-item-option:after {
+ content: '';
+ display: inline-block;
+ width: 100%;
+}
+.navigator-facets-list-item-option-name {
+ padding-right: 10px;
+}
.navigator-results {
border-right: 1px solid #e1e1e1;
background-color: #ffffff;
width: 100%;
height: 37px;
}
+.navigator-facets {
+ position: fixed;
+ z-index: 2;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ top: 104px;
+ left: 0;
+ width: 100%;
+ height: 220px;
+}
.navigator-results {
position: fixed;
z-index: 2;
font-style: italic;
}
.navigator-header-actions {
- margin-left: 16px;
+ margin-left: 20px;
}
.navigator-header-actions > a {
vertical-align: middle;
margin: 0 8px;
font-size: 11px;
}
+.navigator-header-menu-toggle {
+ display: inline-block;
+ vertical-align: top;
+ height: 36px;
+ margin-right: 10px;
+ margin-left: -10px;
+ padding: 10px;
+ border-right: 1px solid transparent;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ cursor: pointer;
+ transition: all 0.3s ease;
+}
+.navigator-header-menu-toggle:hover {
+ background-color: #e2e2e2;
+}
+.navigator-header-menu-toggle.active {
+ border-color: #cdcdcd;
+ background-color: #fff;
+}
+.navigator-header-menu-toggle [class^="icon-"],
+.navigator-header-menu-toggle [class*=" icon-"] {
+ font-size: 16px;
+}
.navigator-notes {
padding: 0 10px;
border-bottom: 1px solid #cdcdcd;
overflow: hidden;
text-overflow: ellipsis;
}
+.navigator-facets {
+ padding: 10px;
+ border-bottom: 1px solid #cdcdcd;
+ background-color: #efefef;
+}
+.navigator-facets-list {
+ display: table;
+ height: 100%;
+}
+.navigator-facets-list-item {
+ display: table-cell;
+}
+.navigator-facets-list-item {
+ padding-right: 20px;
+}
+.navigator-facets-list-item + .navigator-facets-list-item {
+ padding-left: 20px;
+ border-left: 1px solid #e1e1e1;
+}
+.navigator-facets-list-item-name {
+ font-weight: bold;
+ text-transform: uppercase;
+}
+.navigator-facets-list-item-options {
+ margin-top: 6.666666666666667px;
+}
+.navigator-facets-list-item-option {
+ margin-bottom: -1em;
+ padding: 3.3333333333333335px 0;
+ cursor: pointer;
+ text-align: justify;
+}
+.navigator-facets-list-item-option:hover .navigator-facets-list-item-option-name {
+ text-decoration: underline;
+}
+.navigator-facets-list-item-option:after {
+ content: '';
+ display: inline-block;
+ width: 100%;
+}
+.navigator-facets-list-item-option-name {
+ padding-right: 10px;
+}
.navigator-results {
border-right: 1px solid #e1e1e1;
background-color: #ffffff;
.size(100%, @navigatorFiltersHeight);
}
+.navigator-facets {
+ .navigator-element;
+ top: @navigatorTopOffset + @navigatorHeaderHeight + @navigatorFiltersHeight;
+ left: 0;
+ .size(100%, @navigatorFacetsHeight);
+}
+
.navigator-results {
.navigator-element;
.box-sizing(content-box);
}
.navigator-header-actions {
- margin-left: 16px;
+ margin-left: 20px;
& > a {
vertical-align: middle;
}
}
+.navigator-header-menu-toggle {
+ display: inline-block;
+ vertical-align: top;
+ height: 36px;
+ margin-right: 10px;
+ margin-left: -10px;
+ padding: 10px;
+ border-right: 1px solid transparent;
+ .box-sizing(border-box);
+ cursor: pointer;
+ .trans;
+
+ &:hover {
+ background-color: @navigatorHover;
+ }
+
+ &.active {
+ border-color: #cdcdcd;
+ background-color: #fff;
+ }
+
+ [class^="icon-"], [class*=" icon-"] {
+ font-size: 16px;
+ }
+}
+
// Notes
+// Facets
+.navigator-facets {
+ padding: @navigatorPadding;
+ border-bottom: 1px solid @navigatorBorderColor;
+ background-color: @navigatorBarBackground;
+}
+
+.navigator-facets-list {
+ display: table;
+ height: 100%;
+}
+
+.navigator-facets-list-item {
+ display: table-cell;
+}
+
+.navigator-facets-list-item {
+ padding-right: 2 * @navigatorPadding;
+}
+
+.navigator-facets-list-item + .navigator-facets-list-item {
+ padding-left: 2 * @navigatorPadding;
+ border-left: 1px solid @navigatorBorderLightColor;
+}
+
+.navigator-facets-list-item-name {
+ font-weight: bold;
+ text-transform: uppercase;
+}
+
+.navigator-facets-list-item-options {
+ margin-top: @navigatorPadding / 3 * 2;
+}
+
+.navigator-facets-list-item-option {
+ margin-bottom: -1em;
+ padding: @navigatorPadding / 3 0;
+ cursor: pointer;
+ text-align: justify;
+
+ &:hover .navigator-facets-list-item-option-name {
+ text-decoration: underline;
+ }
+
+ &:after {
+ content: '';
+ display: inline-block;
+ width: 100%;
+ }
+}
+
+.navigator-facets-list-item-option-name {
+ padding-right: @navigatorPadding;
+}
+
+.navigator-facets-list-item-option-stat {
+
+}
+
+
+
// Results
.navigator-results {
border-right: 1px solid @navigatorBorderLightColor;
@navigatorHeaderHeight: 37px;
@navigatorFiltersHeight: 37px;
+@navigatorFacetsHeight: 220px;
@navigatorStatusHeight: 30px;
@navigatorNotesHeight: 20px;