##// 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 171 reviewers_duplicates.add(_user_id)
172 172
173 173 c.allowed_reviewers = reviewers
174 c.reviewers_count = len(reviewers)
175 c.observers_count = 0
176
174 177 # from associated statuses, check the pull requests, and
175 178 # show comments from them
176 179 for pr in prs:
@@ -806,6 +806,7 b' window.ReviewersPanel = {'
806 806 removeButtons: null,
807 807 reviewRules: null,
808 808 setReviewers: null,
809 controller: null,
809 810
810 811 setSelectors: function () {
811 812 var self = this;
@@ -815,17 +816,18 b' window.ReviewersPanel = {'
815 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 820 var self = this;
820 821 self.setSelectors();
821 822
822 this.reviewRules = reviewRules;
823 this.setReviewers = setReviewers;
823 self.controller = controller;
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 828 self.edit();
827 829 });
828 this.closeButton.on('click', function (e) {
830 self.closeButton.on('click', function (e) {
829 831 self.close();
830 832 self.renderReviewers();
831 833 });
@@ -835,20 +837,22 b' window.ReviewersPanel = {'
835 837 },
836 838
837 839 renderReviewers: function () {
838 if (this.setReviewers.reviewers === undefined) {
840 var self = this;
841
842 if (self.setReviewers.reviewers === undefined) {
839 843 return
840 844 }
841 if (this.setReviewers.reviewers.length === 0) {
842 reviewersController.emptyReviewersTable('<tr id="reviewer-empty-msg"><td colspan="6">No reviewers</td></tr>');
845 if (self.setReviewers.reviewers.length === 0) {
846 self.controller.emptyReviewersTable('<tr id="reviewer-empty-msg"><td colspan="6">No reviewers</td></tr>');
843 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 854 var member = val;
851 if (member.role === reviewersController.ROLE_REVIEWER) {
855 if (member.role === self.controller.ROLE_REVIEWER) {
852 856 var entry = renderTemplate('reviewMemberEntry', {
853 857 'member': member,
854 858 'mandatory': member.mandatory,
@@ -861,7 +865,7 b' window.ReviewersPanel = {'
861 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 875 edit: function (event) {
872 this.editButton.hide();
873 this.closeButton.show();
874 this.addButton.show();
875 $(this.removeButtons.selector).css('visibility', 'visible');
876 var self = this;
877 self.editButton.hide();
878 self.closeButton.show();
879 self.addButton.show();
880 $(self.removeButtons.selector).css('visibility', 'visible');
876 881 // review rules
877 reviewersController.loadReviewRules(this.reviewRules);
882 self.controller.loadReviewRules(this.reviewRules);
878 883 },
879 884
880 885 close: function (event) {
886 var self = this;
881 887 this.editButton.show();
882 888 this.closeButton.hide();
883 889 this.addButton.hide();
884 890 $(this.removeButtons.selector).css('visibility', 'hidden');
885 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 903 removeButtons: null,
898 904 reviewRules: null,
899 905 setReviewers: null,
906 controller: null,
900 907
901 908 setSelectors: function () {
902 909 var self = this;
@@ -906,17 +913,18 b' window.ObserversPanel = {'
906 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 917 var self = this;
911 918 self.setSelectors();
912 919
913 this.reviewRules = reviewRules;
914 this.setReviewers = setReviewers;
920 self.controller = controller;
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 925 self.edit();
918 926 });
919 this.closeButton.on('click', function (e) {
927 self.closeButton.on('click', function (e) {
920 928 self.close();
921 929 self.renderObservers();
922 930 });
@@ -926,19 +934,20 b' window.ObserversPanel = {'
926 934 },
927 935
928 936 renderObservers: function () {
929 if (this.setReviewers.observers === undefined) {
937 var self = this;
938 if (self.setReviewers.observers === undefined) {
930 939 return
931 940 }
932 if (this.setReviewers.observers.length === 0) {
933 reviewersController.emptyObserversTable('<tr id="observer-empty-msg"><td colspan="6">No observers</td></tr>');
941 if (self.setReviewers.observers.length === 0) {
942 self.controller.emptyObserversTable('<tr id="observer-empty-msg"><td colspan="6">No observers</td></tr>');
934 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 949 var member = val;
941 if (member.role === reviewersController.ROLE_OBSERVER) {
950 if (member.role === self.controller.ROLE_OBSERVER) {
942 951 var entry = renderTemplate('reviewMemberEntry', {
943 952 'member': member,
944 953 'mandatory': member.mandatory,
@@ -951,7 +960,7 b' window.ObserversPanel = {'
951 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 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 426 var channel = '${c.commit_broadcast_channel}';
426 427 new ReviewerPresenceController(channel)
@@ -853,8 +853,8 b' window.setObserversData = ${c.pull_reque'
853 853 var codeMirrorInstance = $('#pr-description-input').get(0).MarkupForm.cm;
854 854
855 855 PRDetails.init();
856 ReviewersPanel.init(reviewerRulesData, setReviewersData);
857 ObserversPanel.init(reviewerRulesData, setObserversData);
856 ReviewersPanel.init(reviewersController, reviewerRulesData, setReviewersData);
857 ObserversPanel.init(reviewersController, reviewerRulesData, setObserversData);
858 858
859 859 window.showOutdated = function (self) {
860 860 $('.comment-inline.comment-outdated').show();
General Comments 0
You need to be logged in to leave comments. Login now