##// END OF EJS Templates
sidebar: few fixes for panel rendering of reviewers/observers for both commits and PRS.
marcink -
r4503:3bcf2943 stable
parent child Browse files
Show More
@@ -171,6 +171,9 b' class RepoCommitsView(RepoAppView):'
171 reviewers_duplicates.add(_user_id)
171 reviewers_duplicates.add(_user_id)
172
172
173 c.allowed_reviewers = reviewers
173 c.allowed_reviewers = reviewers
174 c.reviewers_count = len(reviewers)
175 c.observers_count = 0
176
174 # from associated statuses, check the pull requests, and
177 # from associated statuses, check the pull requests, and
175 # show comments from them
178 # show comments from them
176 for pr in prs:
179 for pr in prs:
@@ -806,6 +806,7 b' window.ReviewersPanel = {'
806 removeButtons: null,
806 removeButtons: null,
807 reviewRules: null,
807 reviewRules: null,
808 setReviewers: null,
808 setReviewers: null,
809 controller: null,
809
810
810 setSelectors: function () {
811 setSelectors: function () {
811 var self = this;
812 var self = this;
@@ -815,17 +816,18 b' window.ReviewersPanel = {'
815 self.removeButtons = $('.reviewer_member_remove,.reviewer_member_mandatory_remove');
816 self.removeButtons = $('.reviewer_member_remove,.reviewer_member_mandatory_remove');
816 },
817 },
817
818
818 init: function (reviewRules, setReviewers) {
819 init: function (controller, reviewRules, setReviewers) {
819 var self = this;
820 var self = this;
820 self.setSelectors();
821 self.setSelectors();
821
822
822 this.reviewRules = reviewRules;
823 self.controller = controller;
823 this.setReviewers = setReviewers;
824 self.reviewRules = reviewRules;
825 self.setReviewers = setReviewers;
824
826
825 this.editButton.on('click', function (e) {
827 self.editButton.on('click', function (e) {
826 self.edit();
828 self.edit();
827 });
829 });
828 this.closeButton.on('click', function (e) {
830 self.closeButton.on('click', function (e) {
829 self.close();
831 self.close();
830 self.renderReviewers();
832 self.renderReviewers();
831 });
833 });
@@ -835,20 +837,22 b' window.ReviewersPanel = {'
835 },
837 },
836
838
837 renderReviewers: function () {
839 renderReviewers: function () {
838 if (this.setReviewers.reviewers === undefined) {
840 var self = this;
841
842 if (self.setReviewers.reviewers === undefined) {
839 return
843 return
840 }
844 }
841 if (this.setReviewers.reviewers.length === 0) {
845 if (self.setReviewers.reviewers.length === 0) {
842 reviewersController.emptyReviewersTable('<tr id="reviewer-empty-msg"><td colspan="6">No reviewers</td></tr>');
846 self.controller.emptyReviewersTable('<tr id="reviewer-empty-msg"><td colspan="6">No reviewers</td></tr>');
843 return
847 return
844 }
848 }
845
849
846 reviewersController.emptyReviewersTable();
850 self.controller.emptyReviewersTable();
847
851
848 $.each(this.setReviewers.reviewers, function (key, val) {
852 $.each(self.setReviewers.reviewers, function (key, val) {
849
853
850 var member = val;
854 var member = val;
851 if (member.role === reviewersController.ROLE_REVIEWER) {
855 if (member.role === self.controller.ROLE_REVIEWER) {
852 var entry = renderTemplate('reviewMemberEntry', {
856 var entry = renderTemplate('reviewMemberEntry', {
853 'member': member,
857 'member': member,
854 'mandatory': member.mandatory,
858 'mandatory': member.mandatory,
@@ -861,7 +865,7 b' window.ReviewersPanel = {'
861 'create': false
865 'create': false
862 });
866 });
863
867
864 $(reviewersController.$reviewMembers.selector).append(entry)
868 $(self.controller.$reviewMembers.selector).append(entry)
865 }
869 }
866 });
870 });
867
871
@@ -869,21 +873,23 b' window.ReviewersPanel = {'
869 },
873 },
870
874
871 edit: function (event) {
875 edit: function (event) {
872 this.editButton.hide();
876 var self = this;
873 this.closeButton.show();
877 self.editButton.hide();
874 this.addButton.show();
878 self.closeButton.show();
875 $(this.removeButtons.selector).css('visibility', 'visible');
879 self.addButton.show();
880 $(self.removeButtons.selector).css('visibility', 'visible');
876 // review rules
881 // review rules
877 reviewersController.loadReviewRules(this.reviewRules);
882 self.controller.loadReviewRules(this.reviewRules);
878 },
883 },
879
884
880 close: function (event) {
885 close: function (event) {
886 var self = this;
881 this.editButton.show();
887 this.editButton.show();
882 this.closeButton.hide();
888 this.closeButton.hide();
883 this.addButton.hide();
889 this.addButton.hide();
884 $(this.removeButtons.selector).css('visibility', 'hidden');
890 $(this.removeButtons.selector).css('visibility', 'hidden');
885 // hide review rules
891 // hide review rules
886 reviewersController.hideReviewRules();
892 self.controller.hideReviewRules();
887 }
893 }
888 };
894 };
889
895
@@ -897,6 +903,7 b' window.ObserversPanel = {'
897 removeButtons: null,
903 removeButtons: null,
898 reviewRules: null,
904 reviewRules: null,
899 setReviewers: null,
905 setReviewers: null,
906 controller: null,
900
907
901 setSelectors: function () {
908 setSelectors: function () {
902 var self = this;
909 var self = this;
@@ -906,17 +913,18 b' window.ObserversPanel = {'
906 self.removeButtons = $('.observer_member_remove,.observer_member_mandatory_remove');
913 self.removeButtons = $('.observer_member_remove,.observer_member_mandatory_remove');
907 },
914 },
908
915
909 init: function (reviewRules, setReviewers) {
916 init: function (controller, reviewRules, setReviewers) {
910 var self = this;
917 var self = this;
911 self.setSelectors();
918 self.setSelectors();
912
919
913 this.reviewRules = reviewRules;
920 self.controller = controller;
914 this.setReviewers = setReviewers;
921 self.reviewRules = reviewRules;
922 self.setReviewers = setReviewers;
915
923
916 this.editButton.on('click', function (e) {
924 self.editButton.on('click', function (e) {
917 self.edit();
925 self.edit();
918 });
926 });
919 this.closeButton.on('click', function (e) {
927 self.closeButton.on('click', function (e) {
920 self.close();
928 self.close();
921 self.renderObservers();
929 self.renderObservers();
922 });
930 });
@@ -926,19 +934,20 b' window.ObserversPanel = {'
926 },
934 },
927
935
928 renderObservers: function () {
936 renderObservers: function () {
929 if (this.setReviewers.observers === undefined) {
937 var self = this;
938 if (self.setReviewers.observers === undefined) {
930 return
939 return
931 }
940 }
932 if (this.setReviewers.observers.length === 0) {
941 if (self.setReviewers.observers.length === 0) {
933 reviewersController.emptyObserversTable('<tr id="observer-empty-msg"><td colspan="6">No observers</td></tr>');
942 self.controller.emptyObserversTable('<tr id="observer-empty-msg"><td colspan="6">No observers</td></tr>');
934 return
943 return
935 }
944 }
936
945
937 reviewersController.emptyObserversTable();
946 self.controller.emptyObserversTable();
938
947
939 $.each(this.setReviewers.observers, function (key, val) {
948 $.each(self.setReviewers.observers, function (key, val) {
940 var member = val;
949 var member = val;
941 if (member.role === reviewersController.ROLE_OBSERVER) {
950 if (member.role === self.controller.ROLE_OBSERVER) {
942 var entry = renderTemplate('reviewMemberEntry', {
951 var entry = renderTemplate('reviewMemberEntry', {
943 'member': member,
952 'member': member,
944 'mandatory': member.mandatory,
953 'mandatory': member.mandatory,
@@ -951,7 +960,7 b' window.ObserversPanel = {'
951 'create': false
960 'create': false
952 });
961 });
953
962
954 $(reviewersController.$observerMembers.selector).append(entry)
963 $(self.controller.$observerMembers.selector).append(entry)
955 }
964 }
956 });
965 });
957
966
@@ -420,7 +420,8 b''
420 e.preventDefault();
420 e.preventDefault();
421 });
421 });
422
422
423 ReviewersPanel.init(null, setReviewersData);
423 reviewersController = new ReviewersController();
424 ReviewersPanel.init(reviewersController, null, setReviewersData);
424
425
425 var channel = '${c.commit_broadcast_channel}';
426 var channel = '${c.commit_broadcast_channel}';
426 new ReviewerPresenceController(channel)
427 new ReviewerPresenceController(channel)
@@ -853,8 +853,8 b' window.setObserversData = ${c.pull_reque'
853 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
853 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
854
854
855 PRDetails.init();
855 PRDetails.init();
856 ReviewersPanel.init(reviewerRulesData, setReviewersData);
856 ReviewersPanel.init(reviewersController, reviewerRulesData, setReviewersData);
857 ObserversPanel.init(reviewerRulesData, setObserversData);
857 ObserversPanel.init(reviewersController, reviewerRulesData, setObserversData);
858
858
859 window.showOutdated = function (self) {
859 window.showOutdated = function (self) {
860 $('.comment-inline.comment-outdated').show();
860 $('.comment-inline.comment-outdated').show();
General Comments 0
You need to be logged in to leave comments. Login now