= form_tag namespace_project_compare_index_path(@project.namespace, @project), method: :post, class: 'form-inline js-requires-input' do
  .clearfix
    - if params[:to] && params[:from]
      = link_to icon('exchange'), {from: params[:to], to: params[:from]}, {class: 'commits-compare-switch has-tooltip', title: 'Switch base of comparison'}
    .form-group.dropdown.compare-form-group.js-compare-from-dropdown
      .input-group.inline-input-group
        %span.input-group-addon from
        = text_field_tag :from, params[:from], class: "form-control js-compare-dropdown", required: true, data: { refs_url: refs_namespace_project_path(@project.namespace, @project), toggle: "dropdown", target: ".js-compare-from-dropdown", selected: params[:from].presence }
      = render "ref_dropdown"
    = "..."
    .form-group.dropdown.compare-form-group.js-compare-to-dropdown
      .input-group.inline-input-group
        %span.input-group-addon to
        = text_field_tag :to, params[:to], class: "form-control js-compare-dropdown", required: true, data: { refs_url: refs_namespace_project_path(@project.namespace, @project), toggle: "dropdown", target: ".js-compare-to-dropdown", selected: params[:to].presence }
      = render "ref_dropdown"
    &nbsp;
    = button_tag "Compare", class: "btn btn-create commits-compare-btn"
    - if @merge_request.present?
      = link_to "View Open Merge Request", namespace_project_merge_request_path(@project.namespace, @project, @merge_request), class: 'prepend-left-10 btn'
    - elsif create_mr_button?
      = link_to create_mr_path, class: 'prepend-left-10 btn' do
        = icon("plus")
        Create Merge Request
