- App.fetchList = (firstPage) ->
+ App.fetchList = (firstPage, fetchFacets = true) ->
query = @getQuery()
fetchQuery = _.extend { pageIndex: @pageIndex }, query
sort: @codingRules.sorting.sort,
asc: @codingRules.sorting.asc
+ unless fetchFacets
+ _.extend fetchQuery, facets: false
+
@storeQuery query, @codingRules.sorting
@layout.showSpinner 'resultsRegion'
- @layout.showSpinner 'facetsRegion'
+ @layout.showSpinner 'facetsRegion' if fetchFacets
jQuery.ajax
url: "#{baseUrl}/api/codingrules/search"
data: fetchQuery
@layout.resultsRegion.show @codingRulesListView
@codingRulesListView.selectFirst()
- @facets.reset r.facets
- @codingRulesFacetsView = new CodingRulesFacetsView
- app: @
- collection: @facets
- @layout.facetsRegion.show @codingRulesFacetsView
+ if fetchFacets
+ @facets.reset r.facets
+ @codingRulesFacetsView = new CodingRulesFacetsView
+ app: @
+ collection: @facets
+ @layout.facetsRegion.show @codingRulesFacetsView
- App.fetchFirstPage = ->
+ App.fetchFirstPage = (fetchFacets = true) ->
@pageIndex = 1
- App.fetchList true
+ App.fetchList true, fetchFacets
App.fetchNextPage = ->
replace: true
});
};
- App.fetchList = function(firstPage) {
+ App.fetchList = function(firstPage, fetchFacets) {
var fetchQuery, query,
_this = this;
+ if (fetchFacets == null) {
+ fetchFacets = true;
+ }
query = this.getQuery();
fetchQuery = _.extend({
pageIndex: this.pageIndex
asc: this.codingRules.sorting.asc
});
}
+ if (!fetchFacets) {
+ _.extend(fetchQuery, {
+ facets: false
+ });
+ }
this.storeQuery(query, this.codingRules.sorting);
this.layout.showSpinner('resultsRegion');
- this.layout.showSpinner('facetsRegion');
+ if (fetchFacets) {
+ this.layout.showSpinner('facetsRegion');
+ }
return jQuery.ajax({
url: "" + baseUrl + "/api/codingrules/search",
data: fetchQuery
});
_this.layout.resultsRegion.show(_this.codingRulesListView);
_this.codingRulesListView.selectFirst();
- _this.facets.reset(r.facets);
- _this.codingRulesFacetsView = new CodingRulesFacetsView({
- app: _this,
- collection: _this.facets
- });
- return _this.layout.facetsRegion.show(_this.codingRulesFacetsView);
+ if (fetchFacets) {
+ _this.facets.reset(r.facets);
+ _this.codingRulesFacetsView = new CodingRulesFacetsView({
+ app: _this,
+ collection: _this.facets
+ });
+ return _this.layout.facetsRegion.show(_this.codingRulesFacetsView);
+ }
});
};
- App.fetchFirstPage = function() {
+ App.fetchFirstPage = function(fetchFacets) {
+ if (fetchFacets == null) {
+ fetchFacets = true;
+ }
this.pageIndex = 1;
- return App.fetchList(true);
+ return App.fetchList(true, fetchFacets);
};
App.fetchNextPage = function() {
if (this.pageIndex < this.codingRules.paging.pages) {
tagName: 'ul'
className: 'navigator-facets-list'
itemView: CodingRulesFacetsItemView
+
+
+ ui:
+ options: '.navigator-facets-list-item-option'
+
+
+ events:
+ 'click @ui.options': 'toggleOption'
+
+
+ toggleOption: (e) ->
+ jQuery(e.currentTarget).toggleClass 'active'
+ @options.app.fetchFirstPage false
CodingRulesFacetsView.prototype.itemView = CodingRulesFacetsItemView;
+ CodingRulesFacetsView.prototype.ui = {
+ options: '.navigator-facets-list-item-option'
+ };
+
+ CodingRulesFacetsView.prototype.events = {
+ 'click @ui.options': 'toggleOption'
+ };
+
+ CodingRulesFacetsView.prototype.toggleOption = function(e) {
+ jQuery(e.currentTarget).toggleClass('active');
+ return this.options.app.fetchFirstPage(false);
+ };
+
return CodingRulesFacetsView;
})(Marionette.CollectionView);
.navigator-facets-list-item-option:hover .navigator-facets-list-item-option-name {
text-decoration: underline;
}
+.navigator-facets-list-item-option.active .navigator-facets-list-item-option-name {
+ font-weight: bold;
+ text-decoration: underline;
+}
.navigator-facets-list-item-option-stat:before {
content: "(";
}
.navigator-facets-list-item-option:hover .navigator-facets-list-item-option-name {
text-decoration: underline;
}
+.navigator-facets-list-item-option.active .navigator-facets-list-item-option-name {
+ font-weight: bold;
+ text-decoration: underline;
+}
.navigator-facets-list-item-option-stat:before {
content: "(";
}
text-decoration: underline;
}
}
+
+ &.active {
+ .navigator-facets-list-item-option-name {
+ font-weight: bold;
+ text-decoration: underline;
+ }
+ }
}
.navigator-facets-list-item-option-name {