##// END OF EJS Templates
drafts: draft finize boilerplate
milka -
r4549:883fcc39 default
parent child Browse files
Show More
@@ -554,6 +554,10 b' form.comment-form {'
554 margin-right: 0;
554 margin-right: 0;
555 }
555 }
556
556
557 #save_general {
558 margin-left: -6px;
559 }
560
557 }
561 }
558
562
559
563
@@ -386,6 +386,7 b' function registerRCRoutes() {'
386 pyroutes.register('my_account_auth_tokens_add', '/_admin/my_account/auth_tokens/new', []);
386 pyroutes.register('my_account_auth_tokens_add', '/_admin/my_account/auth_tokens/new', []);
387 pyroutes.register('my_account_external_identity', '/_admin/my_account/external-identity', []);
387 pyroutes.register('my_account_external_identity', '/_admin/my_account/external-identity', []);
388 pyroutes.register('my_account_external_identity_delete', '/_admin/my_account/external-identity/delete', []);
388 pyroutes.register('my_account_external_identity_delete', '/_admin/my_account/external-identity/delete', []);
389 pyroutes.register('pullrequest_draft_comments_submit', '/%(repo_name)s/pull-request/%(pull_request_id)s/draft_comments_submit', ['repo_name', 'pull_request_id']);
389 pyroutes.register('repo_artifacts_list', '/%(repo_name)s/artifacts', ['repo_name']);
390 pyroutes.register('repo_artifacts_list', '/%(repo_name)s/artifacts', ['repo_name']);
390 pyroutes.register('repo_artifacts_data', '/%(repo_name)s/artifacts_data', ['repo_name']);
391 pyroutes.register('repo_artifacts_data', '/%(repo_name)s/artifacts_data', ['repo_name']);
391 pyroutes.register('repo_artifacts_new', '/%(repo_name)s/artifacts/new', ['repo_name']);
392 pyroutes.register('repo_artifacts_new', '/%(repo_name)s/artifacts/new', ['repo_name']);
@@ -735,8 +735,6 b' var CommentsController = function() {'
735 };
735 };
736 ajaxPOST(url, postData, success, failure);
736 ajaxPOST(url, postData, success, failure);
737
737
738
739
740 }
738 }
741
739
742 this.deleteComment = function(node) {
740 this.deleteComment = function(node) {
@@ -757,7 +755,32 b' var CommentsController = function() {'
757 };
755 };
758
756
759 this._finalizeDrafts = function(commentIds) {
757 this._finalizeDrafts = function(commentIds) {
760 window.finalizeDrafts(commentIds)
758
759 // remove the drafts so we can lock them before submit.
760 $.each(commentIds, function(idx, val){
761 $('#comment-{0}'.format(val)).remove();
762 })
763
764 var params = {
765 'pull_request_id': templateContext.pull_request_data.pull_request_id,
766 'repo_name': templateContext.repo_name,
767 };
768 var url = pyroutes.url('pullrequest_draft_comments_submit', params)
769 var postData = {'comments': commentIds, 'csrf_token': CSRF_TOKEN};
770
771 var submitSuccessCallback = function(json_data) {
772 self.attachInlineComment(json_data);
773
774 if (window.refreshDraftComments !== undefined) {
775 // if we have this handler, run it, and refresh all comments boxes
776 refreshDraftComments()
777 }
778
779 return false;
780 };
781
782 ajaxPOST(url, postData, submitSuccessCallback)
783
761 }
784 }
762
785
763 this.finalizeDrafts = function(commentIds) {
786 this.finalizeDrafts = function(commentIds) {
@@ -766,7 +789,7 b' var CommentsController = function() {'
766 title: _ngettext('Submit {0} draft comment.', 'Submit {0} draft comments.', commentIds.length).format(commentIds.length),
789 title: _ngettext('Submit {0} draft comment.', 'Submit {0} draft comments.', commentIds.length).format(commentIds.length),
767 icon: 'warning',
790 icon: 'warning',
768 showCancelButton: true,
791 showCancelButton: true,
769 confirmButtonText: _gettext('Yes, finalize drafts'),
792 confirmButtonText: _gettext('Yes'),
770
793
771 }).then(function(result) {
794 }).then(function(result) {
772 if (result.value) {
795 if (result.value) {
@@ -1066,14 +1066,14 b' window.ReviewerPresenceController = func'
1066 this.handlePresence = function (data) {
1066 this.handlePresence = function (data) {
1067 if (data.type == 'presence' && data.channel === self.channel) {
1067 if (data.type == 'presence' && data.channel === self.channel) {
1068 this.storeUsers(data.users);
1068 this.storeUsers(data.users);
1069 this.render()
1069 this.render();
1070 }
1070 }
1071 };
1071 };
1072
1072
1073 this.handleChannelUpdate = function (data) {
1073 this.handleChannelUpdate = function (data) {
1074 if (data.channel === this.channel) {
1074 if (data.channel === this.channel) {
1075 this.storeUsers(data.state.users);
1075 this.storeUsers(data.state.users);
1076 this.render()
1076 this.render();
1077 }
1077 }
1078
1078
1079 };
1079 };
@@ -1181,6 +1181,10 b' window.refreshAllComments = function (ve'
1181 refreshTODOs(version);
1181 refreshTODOs(version);
1182 };
1182 };
1183
1183
1184 window.refreshDraftComments = function () {
1185 alert('TODO: refresh Draft Comments needs implementation')
1186 };
1187
1184 window.sidebarComment = function (commentId) {
1188 window.sidebarComment = function (commentId) {
1185 var jsonData = $('#commentHovercard{0}'.format(commentId)).data('commentJsonB64');
1189 var jsonData = $('#commentHovercard{0}'.format(commentId)).data('commentJsonB64');
1186 if (!jsonData) {
1190 if (!jsonData) {
@@ -51,9 +51,7 b''
51 <div class="tooltip comment-draft" title="${_('Draft comments are only visible to the author until submitted')}.">
51 <div class="tooltip comment-draft" title="${_('Draft comments are only visible to the author until submitted')}.">
52 DRAFT
52 DRAFT
53 </div>
53 </div>
54 % endif
54 % elif is_new:
55
56 % if is_new:
57 <div class="tooltip comment-new" title="${_('This comment was added while you browsed this page')}.">
55 <div class="tooltip comment-new" title="${_('This comment was added while you browsed this page')}.">
58 NEW
56 NEW
59 </div>
57 </div>
@@ -515,7 +513,7 b''
515 ## Disable the button for CE, the "real" validation is in the backend code anyway
513 ## Disable the button for CE, the "real" validation is in the backend code anyway
516 <input class="btn btn-warning comment-button-input submit-draft-action" id="save_draft_${lineno_id}" name="save_draft" type="submit" value="${_('Add draft')}" data-is-draft=true onclick="$(this).addClass('submitter')">
514 <input class="btn btn-warning comment-button-input submit-draft-action" id="save_draft_${lineno_id}" name="save_draft" type="submit" value="${_('Add draft')}" data-is-draft=true onclick="$(this).addClass('submitter')">
517 % else:
515 % else:
518 <input class="tooltip btn btn-warning comment-button-input submit-draft-action disabled" type="submit" disabled="disabled" value="${_('Add draft')}" onclick="return false;" title="Draft comments only available in EE edition of RhodeCode">
516 <input class="btn btn-warning comment-button-input submit-draft-action disabled" disabled="disabled" type="submit" value="${_('Add draft')}" onclick="return false;" title="Draft comments only available in EE edition of RhodeCode">
519 % endif
517 % endif
520 % endif
518 % endif
521
519
@@ -552,6 +552,35 b''
552 ## CONTENT
552 ## CONTENT
553 <div class="sidebar-content">
553 <div class="sidebar-content">
554
554
555 ## Drafts
556 % if c.rhodecode_edition_id == 'EE':
557 <div class="sidebar-element clear-both">
558 <div class="tooltip right-sidebar-collapsed-state" style="display: none" onclick="toggleSidebar(); return false" title="${_('Drafts')}">
559 <i class="icon-comment icon-draft"></i>
560 <span id="comments-count">${0}</span>
561 </div>
562
563 <div class="right-sidebar-expanded-state pr-details-title">
564 <span class="sidebar-heading noselect">
565 <i class="icon-comment icon-draft"></i>
566 ${_('Drafts')}
567 </span>
568 </div>
569
570 <div id="drafts" class="right-sidebar-expanded-state pr-details-content reviewers">
571 ## members redering block
572
573
574 ???
575
576
577 ## end members redering block
578
579 </div>
580
581 </div>
582 % endif
583
555 ## RULES SUMMARY/RULES
584 ## RULES SUMMARY/RULES
556 <div class="sidebar-element clear-both">
585 <div class="sidebar-element clear-both">
557 <% vote_title = _ungettext(
586 <% vote_title = _ungettext(
@@ -997,12 +1026,6 b' window.setObserversData = ${c.pull_reque'
997
1026
998 var channel = '${c.pr_broadcast_channel}';
1027 var channel = '${c.pr_broadcast_channel}';
999 new ReviewerPresenceController(channel)
1028 new ReviewerPresenceController(channel)
1000
1001
1002 window.finalizeDrafts = function(commentIds) {
1003 alert('okok !' + commentIds)
1004
1005 }
1006 // register globally so inject comment logic can re-use it.
1029 // register globally so inject comment logic can re-use it.
1007 window.commentsController = commentsController;
1030 window.commentsController = commentsController;
1008
1031
General Comments 0
You need to be logged in to leave comments. Login now