39 lines
1.8 KiB
Text
39 lines
1.8 KiB
Text
- if @merge_request.open?
|
|
= render 'projects/merge_requests/widget/open'
|
|
- elsif @merge_request.merged?
|
|
= render 'projects/merge_requests/widget/merged'
|
|
- elsif @merge_request.closed?
|
|
= render 'projects/merge_requests/widget/closed'
|
|
- elsif @merge_request.locked?
|
|
= render 'projects/merge_requests/widget/locked'
|
|
|
|
:javascript
|
|
var opts = {
|
|
merge_check_url: "#{merge_check_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}",
|
|
check_enable: #{@merge_request.unchecked? ? "true" : "false"},
|
|
ci_status_url: "#{ci_status_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}",
|
|
ci_environments_status_url: "#{ci_environments_status_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}",
|
|
gitlab_icon: "#{asset_path 'gitlab_logo.png'}",
|
|
ci_status: "#{@merge_request.head_pipeline ? @merge_request.head_pipeline.status : ''}",
|
|
ci_message: {
|
|
normal: "Build {{status}} for \"{{title}}\"",
|
|
preparing: "{{status}} build for \"{{title}}\""
|
|
},
|
|
ci_enable: #{@project.ci_service ? "true" : "false"},
|
|
ci_title: {
|
|
preparing: "{{status}} build",
|
|
normal: "Build {{status}}"
|
|
},
|
|
ci_sha: "#{@merge_request.head_pipeline ? @merge_request.head_pipeline.short_sha : ''}",
|
|
ci_pipeline: #{@merge_request.head_pipeline.try(:id).to_json},
|
|
commits_path: "#{project_commits_path(@project)}",
|
|
pipeline_path: "#{project_pipelines_path(@project)}",
|
|
pipelines_path: "#{pipelines_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}"
|
|
};
|
|
|
|
if (typeof merge_request_widget !== 'undefined') {
|
|
merge_request_widget.cancelPolling();
|
|
merge_request_widget.clearEventListeners();
|
|
}
|
|
|
|
merge_request_widget = new window.gl.MergeRequestWidget(opts);
|