showDetails: function () {
+ key.setScope('list');
+ this.options.issuesView.selected = this.$el.parent().children().index(this.$el);
+
this.$el.parent().children().removeClass('active');
this.$el.addClass('active');
},
+ selectFirst: function() {
+ this.selected = -1;
+ this.selectNext();
+ },
+
+
+ selectNext: function() {
+ if (this.selected < this.collection.length - 1) {
+ this.selected++;
+ var child = this.$el.children().eq(this.selected),
+ container = jQuery('.navigator-results'),
+ containerHeight = container.height(),
+ bottom = child.position().top + child.outerHeight();
+ if (bottom > containerHeight) {
+ container.scrollTop(container.scrollTop() - containerHeight + bottom);
+ }
+ child.click();
+ }
+ },
+
+
+ selectPrev: function() {
+ if (this.selected > 0) {
+ this.selected--;
+ var child = this.$el.children().eq(this.selected),
+ container = jQuery('.navigator-results'),
+ top = child.position().top;
+ if (top < 0) {
+ container.scrollTop(container.scrollTop() + top);
+ }
+ child.click();
+ }
+ },
+
+
onRender: function () {
var that = this,
$scrollEl = jQuery('.navigator-results'),
},
throttledScroll = _.throttle(onScroll, 300);
$scrollEl.off('scroll').on('scroll', throttledScroll);
+ this.bindShortcuts();
},
var scrollEl = jQuery('.navigator-results');
scrollEl.off('scroll');
Marionette.CollectionView.prototype.close.call(this);
+ },
+
+
+ bindShortcuts: function () {
+ var that = this;
+ key('up', 'list', function() { that.selectPrev(); });
+ key('down', 'list', function() { that.selectNext(); });
}
});
events: {
+ 'click': 'setDetailScope',
+
'click .code-issue-toggle': 'toggleCollapsed',
'click [href=#tab-issue-rule]': 'fetchRule',
},
+ setDetailScope: function() {
+ key.setScope('detail');
+ },
+
+
onRender: function () {
this.$('.code-issue-details').tabs();
this.$('.code-issue-form').hide();