Commit 2e087485 authored by Bryce Johnson's avatar Bryce Johnson

Improve pageload logic of approvals body and footer.

parent fc5e5b6a
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
}); });
}, },
template: ` template: `
<div v-if='loaded'> <div v-if='loaded && approvalsLeft'>
<h4> Requires {{ approvalsRequiredStringified }} (from {{ approverNamesStringified }})</h4> <h4> Requires {{ approvalsRequiredStringified }} (from {{ approverNamesStringified }})</h4>
<div v-if='showApproveButton' class='append-bottom-10'> <div v-if='showApproveButton' class='append-bottom-10'>
<button <button
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
//= require ./approvals/approvals_bundle //= require ./approvals/approvals_bundle
(() => { (() => {
$(() => { $(() => {
const rootEl = document.getElementById('merge-request-widget-app'); const rootEl = document.getElementById('merge-request-widget-app');
const widgetSharedStore = new gl.MergeRequestWidgetStore(rootEl); const widgetSharedStore = new gl.MergeRequestWidgetStore(rootEl);
......
...@@ -27,7 +27,8 @@ ...@@ -27,7 +27,8 @@
} }
assignToData(key, val) { assignToData(key, val) {
return _.assign(this.data[key], val); this.data[key] = val;
return this.data[key];
} }
} }
gl.MergeRequestWidgetStore = MergeRequestWidgetStore; gl.MergeRequestWidgetStore = MergeRequestWidgetStore;
......
- content_for :page_specific_javascripts do - content_for :page_specific_javascripts do
= page_specific_javascript_tag('merge_request_widget/widget_bundle.js') = page_specific_javascript_tag('merge_request_widget/widget_bundle.js')
- approvers_names = @merge_request.approvers_left.map(&:name) #merge-request-widget-app.mr-state-widget{ 'data-endpoint'=> merge_request_path(@merge_request) }
#merge-request-widget-app.mr-state-widget{ 'data-endpoint'=> merge_request_path(@merge_request), 'data-suggested-approvers' => approvers_names }
= render 'projects/merge_requests/widget/heading' = render 'projects/merge_requests/widget/heading'
.mr-widget-body .mr-widget-body
-# After conflicts are resolved, the user is redirected back to the MR page. -# After conflicts are resolved, the user is redirected back to the MR page.
...@@ -28,9 +26,8 @@ ...@@ -28,9 +26,8 @@
= render 'projects/merge_requests/widget/open/conflicts' = render 'projects/merge_requests/widget/open/conflicts'
- elsif @merge_request.work_in_progress? - elsif @merge_request.work_in_progress?
= render 'projects/merge_requests/widget/open/wip' = render 'projects/merge_requests/widget/open/wip'
- elsif @merge_request.requires_approve? && !@merge_request.approved? - elsif @merge_request.requires_approve?
%approvals-body{':user-can-approve' => 'approvals.user_can_approve', ':user-has-approved' => 'approvals.user_has_approved', ':approved-by' => 'approvals.approved_by', ':approvals-left':'approvals.approvals_left', ':suggested-approvers' => 'approvals.suggested_approvers'} = render 'projects/merge_requests/widget/open/approvals_body'
- elsif @merge_request.merge_when_build_succeeds? - elsif @merge_request.merge_when_build_succeeds?
= render 'projects/merge_requests/widget/open/merge_when_build_succeeds' = render 'projects/merge_requests/widget/open/merge_when_build_succeeds'
- elsif !@merge_request.can_be_merged_by?(current_user) - elsif !@merge_request.can_be_merged_by?(current_user)
...@@ -53,7 +50,7 @@ ...@@ -53,7 +50,7 @@
!= markdown issues_sentence(mr_closes_issues), pipeline: :gfm, author: @merge_request.author != markdown issues_sentence(mr_closes_issues), pipeline: :gfm, author: @merge_request.author
= mr_assign_issues_link = mr_assign_issues_link
- if @merge_request.approvals.any? - if @merge_request.requires_approve?
%approvals-footer{'pending-avatar-svg' => custom_icon('icon_dotted_circle'), 'checkmark-svg' => custom_icon('icon_checkmark'), ':user-can-approve' => 'approvals.user_can_approve', ':user-has-approved' => 'approvals.user_has_approved', ':approved-by' => 'approvals.approved_by', ':approvals-left':'approvals.approvals_left'} = render 'projects/merge_requests/widget/open/approvals_footer'
%approvals-body{':user-can-approve' => 'approvals.user_can_approve', ':user-has-approved' => 'approvals.user_has_approved', ':approved-by' => 'approvals.approved_by', ':approvals-left':'approvals.approvals_left', ':suggested-approvers' => 'approvals.suggested_approvers'}
%approvals-footer{'pending-avatar-svg' => custom_icon('icon_dotted_circle'), 'checkmark-svg' => custom_icon('icon_checkmark'), ':user-can-approve' => 'approvals.user_can_approve', ':user-has-approved' => 'approvals.user_has_approved', ':approved-by' => 'approvals.approved_by', ':approvals-left':'approvals.approvals_left'}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment