_show.html.haml 1.1 KB
- 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 merge_request_widget;
  var opts = {
    url_to_automerge_check: "#{merge_check_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}",
    check_enable: #{@merge_request.unchecked? ? "true" : "false"},
    url_to_ci_check: "#{ci_status_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}",
    gitlab_icon: "#{asset_path 'gitlab_logo.png'}",
    current_status: ""
  };

- if @merge_request.ci_commit
  :javascript
    opts.ci_message = "Build {{status}} for #{@merge_request.ci_commit.sha}";
- else
  :javascript
    opts.ci_message = "Build {{status}} for #{@merge_request.last_commit.sha}";

:javascript
  if(typeof merge_request_widget === 'undefined') {
    merge_request_widget = new MergeRequestWidget(opts);
  }