diff --git a/rhodecode/apps/repository/views/repo_commits.py b/rhodecode/apps/repository/views/repo_commits.py
--- a/rhodecode/apps/repository/views/repo_commits.py
+++ b/rhodecode/apps/repository/views/repo_commits.py
@@ -171,6 +171,9 @@ class RepoCommitsView(RepoAppView):
reviewers_duplicates.add(_user_id)
c.allowed_reviewers = reviewers
+ c.reviewers_count = len(reviewers)
+ c.observers_count = 0
+
# from associated statuses, check the pull requests, and
# show comments from them
for pr in prs:
diff --git a/rhodecode/public/js/src/rhodecode/pullrequests.js b/rhodecode/public/js/src/rhodecode/pullrequests.js
--- a/rhodecode/public/js/src/rhodecode/pullrequests.js
+++ b/rhodecode/public/js/src/rhodecode/pullrequests.js
@@ -806,6 +806,7 @@ window.ReviewersPanel = {
removeButtons: null,
reviewRules: null,
setReviewers: null,
+ controller: null,
setSelectors: function () {
var self = this;
@@ -815,17 +816,18 @@ window.ReviewersPanel = {
self.removeButtons = $('.reviewer_member_remove,.reviewer_member_mandatory_remove');
},
- init: function (reviewRules, setReviewers) {
+ init: function (controller, reviewRules, setReviewers) {
var self = this;
self.setSelectors();
- this.reviewRules = reviewRules;
- this.setReviewers = setReviewers;
+ self.controller = controller;
+ self.reviewRules = reviewRules;
+ self.setReviewers = setReviewers;
- this.editButton.on('click', function (e) {
+ self.editButton.on('click', function (e) {
self.edit();
});
- this.closeButton.on('click', function (e) {
+ self.closeButton.on('click', function (e) {
self.close();
self.renderReviewers();
});
@@ -835,20 +837,22 @@ window.ReviewersPanel = {
},
renderReviewers: function () {
- if (this.setReviewers.reviewers === undefined) {
+ var self = this;
+
+ if (self.setReviewers.reviewers === undefined) {
return
}
- if (this.setReviewers.reviewers.length === 0) {
- reviewersController.emptyReviewersTable('
No reviewers |
');
+ if (self.setReviewers.reviewers.length === 0) {
+ self.controller.emptyReviewersTable('No reviewers |
');
return
}
- reviewersController.emptyReviewersTable();
+ self.controller.emptyReviewersTable();
- $.each(this.setReviewers.reviewers, function (key, val) {
+ $.each(self.setReviewers.reviewers, function (key, val) {
var member = val;
- if (member.role === reviewersController.ROLE_REVIEWER) {
+ if (member.role === self.controller.ROLE_REVIEWER) {
var entry = renderTemplate('reviewMemberEntry', {
'member': member,
'mandatory': member.mandatory,
@@ -861,7 +865,7 @@ window.ReviewersPanel = {
'create': false
});
- $(reviewersController.$reviewMembers.selector).append(entry)
+ $(self.controller.$reviewMembers.selector).append(entry)
}
});
@@ -869,21 +873,23 @@ window.ReviewersPanel = {
},
edit: function (event) {
- this.editButton.hide();
- this.closeButton.show();
- this.addButton.show();
- $(this.removeButtons.selector).css('visibility', 'visible');
+ var self = this;
+ self.editButton.hide();
+ self.closeButton.show();
+ self.addButton.show();
+ $(self.removeButtons.selector).css('visibility', 'visible');
// review rules
- reviewersController.loadReviewRules(this.reviewRules);
+ self.controller.loadReviewRules(this.reviewRules);
},
close: function (event) {
+ var self = this;
this.editButton.show();
this.closeButton.hide();
this.addButton.hide();
$(this.removeButtons.selector).css('visibility', 'hidden');
// hide review rules
- reviewersController.hideReviewRules();
+ self.controller.hideReviewRules();
}
};
@@ -897,6 +903,7 @@ window.ObserversPanel = {
removeButtons: null,
reviewRules: null,
setReviewers: null,
+ controller: null,
setSelectors: function () {
var self = this;
@@ -906,17 +913,18 @@ window.ObserversPanel = {
self.removeButtons = $('.observer_member_remove,.observer_member_mandatory_remove');
},
- init: function (reviewRules, setReviewers) {
+ init: function (controller, reviewRules, setReviewers) {
var self = this;
self.setSelectors();
- this.reviewRules = reviewRules;
- this.setReviewers = setReviewers;
+ self.controller = controller;
+ self.reviewRules = reviewRules;
+ self.setReviewers = setReviewers;
- this.editButton.on('click', function (e) {
+ self.editButton.on('click', function (e) {
self.edit();
});
- this.closeButton.on('click', function (e) {
+ self.closeButton.on('click', function (e) {
self.close();
self.renderObservers();
});
@@ -926,19 +934,20 @@ window.ObserversPanel = {
},
renderObservers: function () {
- if (this.setReviewers.observers === undefined) {
+ var self = this;
+ if (self.setReviewers.observers === undefined) {
return
}
- if (this.setReviewers.observers.length === 0) {
- reviewersController.emptyObserversTable('No observers |
');
+ if (self.setReviewers.observers.length === 0) {
+ self.controller.emptyObserversTable('No observers |
');
return
}
- reviewersController.emptyObserversTable();
+ self.controller.emptyObserversTable();
- $.each(this.setReviewers.observers, function (key, val) {
+ $.each(self.setReviewers.observers, function (key, val) {
var member = val;
- if (member.role === reviewersController.ROLE_OBSERVER) {
+ if (member.role === self.controller.ROLE_OBSERVER) {
var entry = renderTemplate('reviewMemberEntry', {
'member': member,
'mandatory': member.mandatory,
@@ -951,7 +960,7 @@ window.ObserversPanel = {
'create': false
});
- $(reviewersController.$observerMembers.selector).append(entry)
+ $(self.controller.$observerMembers.selector).append(entry)
}
});
diff --git a/rhodecode/templates/changeset/changeset.mako b/rhodecode/templates/changeset/changeset.mako
--- a/rhodecode/templates/changeset/changeset.mako
+++ b/rhodecode/templates/changeset/changeset.mako
@@ -420,7 +420,8 @@
e.preventDefault();
});
- ReviewersPanel.init(null, setReviewersData);
+ reviewersController = new ReviewersController();
+ ReviewersPanel.init(reviewersController, null, setReviewersData);
var channel = '${c.commit_broadcast_channel}';
new ReviewerPresenceController(channel)
diff --git a/rhodecode/templates/pullrequests/pullrequest_show.mako b/rhodecode/templates/pullrequests/pullrequest_show.mako
--- a/rhodecode/templates/pullrequests/pullrequest_show.mako
+++ b/rhodecode/templates/pullrequests/pullrequest_show.mako
@@ -853,8 +853,8 @@ window.setObserversData = ${c.pull_reque
var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
PRDetails.init();
- ReviewersPanel.init(reviewerRulesData, setReviewersData);
- ObserversPanel.init(reviewerRulesData, setObserversData);
+ ReviewersPanel.init(reviewersController, reviewerRulesData, setReviewersData);
+ ObserversPanel.init(reviewersController, reviewerRulesData, setObserversData);
window.showOutdated = function (self) {
$('.comment-inline.comment-outdated').show();