Commit 1af1b6c8 authored by Phil Hughes's avatar Phil Hughes

Fixed target project update

parent beab104d
...@@ -30,34 +30,40 @@ class @Compare ...@@ -30,34 +30,40 @@ class @Compare
@getTargetHtml() @getTargetHtml()
getTargetProject: -> getTargetProject: ->
$.ajax(
url: @opts.targetProjectUrl
data:
target_project_id: $("input[name='merge_request[target_project_id]']").val()
beforeSend: ->
$('.mr_target_commit').empty()
success: (html) ->
$('.js-target-branch-dropdown .dropdown-content').html html
)
$.get @opts.targetProjectUrl, $.get @opts.targetProjectUrl,
target_project_id: $("input[name='merge_request[source_project]']").val() target_project_id: $("input[name='merge_request[target_project_id]']").val()
getSourceHtml: -> getSourceHtml: ->
$.ajax( @sendAjax(@opts.sourceBranchUrl, @source_loading, '.mr_source_commit',
url: @opts.sourceBranchUrl
data:
ref: $("input[name='merge_request[source_branch]']").val() ref: $("input[name='merge_request[source_branch]']").val()
beforeSend: =>
@source_loading.show()
$(".mr_source_commit").html ""
success: (html) =>
@source_loading.hide()
$(".mr_source_commit").html html
$(".mr_source_commit .js-timeago").timeago()
) )
getTargetHtml: -> getTargetHtml: ->
$.ajax( @sendAjax(@opts.targetBranchUrl, @target_loading, '.mr_target_commit',
url: @opts.targetBranchUrl
data:
target_project_id: $("input[name='merge_request[target_project_id]']").val() target_project_id: $("input[name='merge_request[target_project_id]']").val()
ref: $("input[name='merge_request[target_branch]']").val() ref: $("input[name='merge_request[target_branch]']").val()
beforeSend: => )
@target_loading.show()
$(".mr_target_commit").html "" sendAjax: (url, loading, target, data) ->
success: (html) => $target = $(target)
@target_loading.hide()
$(".mr_target_commit").html html $.ajax(
$(".mr_target_commit .js-timeago").timeago() url: url
data: data
beforeSend: ->
loading.show()
$target.empty()
success: (html) ->
loading.hide()
$target.html html
$('.js-timeago', $target).timeago()
) )
...@@ -89,6 +89,10 @@ li.commit { ...@@ -89,6 +89,10 @@ li.commit {
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
a {
color: $gl-dark-link-color;
}
} }
.commit-row-info { .commit-row-info {
......
...@@ -220,9 +220,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -220,9 +220,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@target_project = selected_target_project @target_project = selected_target_project
@target_branches = @target_project.repository.branch_names @target_branches = @target_project.repository.branch_names
respond_to do |format| render layout: false
format.js
end
end end
def ci_status def ci_status
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
- projects = @project.forked_from_project.nil? ? [@project] : [@project, @project.forked_from_project] - projects = @project.forked_from_project.nil? ? [@project] : [@project, @project.forked_from_project]
.merge-request-select.dropdown .merge-request-select.dropdown
= f.hidden_field :target_project_id = f.hidden_field :target_project_id
= dropdown_toggle projects.first.path_with_namespace, { toggle: "dropdown", field_name: "#{f.object_name}[target_project_id]", disabled: @merge_request.persisted? }, { toggle_class: "js-compare-dropdown js-target-project" } = dropdown_toggle f.object.target_project.path_with_namespace, { toggle: "dropdown", field_name: "#{f.object_name}[target_project_id]", disabled: @merge_request.persisted? }, { toggle_class: "js-compare-dropdown js-target-project" }
.dropdown-menu.dropdown-menu-selectable .dropdown-menu.dropdown-menu-selectable
= dropdown_title("Select target project") = dropdown_title("Select target project")
= dropdown_filter("Search projects") = dropdown_filter("Search projects")
...@@ -56,8 +56,8 @@ ...@@ -56,8 +56,8 @@
= project.path_with_namespace = project.path_with_namespace
.merge-request-select.dropdown .merge-request-select.dropdown
= f.hidden_field :target_branch = f.hidden_field :target_branch
= dropdown_toggle "Select target branch", { toggle: "dropdown", field_name: "#{f.object_name}[target_branch]" }, { toggle_class: "js-compare-dropdown js-target-branch" } = dropdown_toggle f.object.target_branch, { toggle: "dropdown", field_name: "#{f.object_name}[target_branch]" }, { toggle_class: "js-compare-dropdown js-target-branch" }
.dropdown-menu.dropdown-menu-selectable .dropdown-menu.dropdown-menu-selectable.js-target-branch-dropdown
= dropdown_title("Select target branch") = dropdown_title("Select target branch")
= dropdown_filter("Search branches") = dropdown_filter("Search branches")
= dropdown_content do = dropdown_content do
......
%ul
- @target_branches.each do |branch|
%li
%a{ href: "#", class: "#{("is-active" if "a" == branch)}", data: { id: branch } }
= branch
:plain
$(".target_branch").html("#{escape_javascript(options_for_select(@target_branches))}");
$('select.target_branch').select2({
width: 'resolve',
dropdownAutoWidth: true
});
$(".mr_target_commit").html("");
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