diff --git a/CHANGELOG b/CHANGELOG index 2db5beb00220862a77fdba54556747ee6e605a73..906315502c75c3956519435103b004f3fd7602d4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -54,7 +54,7 @@ v 7.8.0 - - - - - + - Added link to milestone and keeping resource context on smaller viewports for issues and merge requests (Jason Blanchard) - - - API: Add support for editing an existing project (Mika Mäenpää and Hannes Rosenögger) diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml index b5d6a16a1e10312408a7df3c780a7ea9f02498a8..e04e1985f1f03e227162ceef8a01e124355dc97c 100644 --- a/app/views/projects/issues/_discussion.html.haml +++ b/app/views/projects/issues/_discussion.html.haml @@ -13,7 +13,7 @@ = link_to_member(@project, participant, name: false, size: 24) .voting_notes#notes= render "projects/notes/notes_with_form" - .col-md-3.hidden-sm.hidden-xs + .col-md-3 %div .clearfix %span.slead.has_tooltip{:"data-original-title" => 'Cross-project reference'} diff --git a/app/views/projects/issues/_issue_context.html.haml b/app/views/projects/issues/_issue_context.html.haml index 98777a58f9d7e03872f91007775f57849153ea14..3daa18ba346fe84160cd7920268cffbe5af02cfd 100644 --- a/app/views/projects/issues/_issue_context.html.haml +++ b/app/views/projects/issues/_issue_context.html.haml @@ -2,23 +2,21 @@ %div.prepend-top-20 %p Assignee: - + - if issue.assignee + = link_to_member(@project, @issue.assignee) + - else + none - if can?(current_user, :modify_issue, @issue) = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @issue.assignee_id) - - elsif issue.assignee - = link_to_member(@project, @issue.assignee) - - else - None %div.prepend-top-20 %p Milestone: + - if issue.milestone + #{link_to @issue.milestone.title, project_milestone_path(@project, @issue.milestone)} + - else + none - if can?(current_user, :modify_issue, @issue) = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'}) = hidden_field_tag :issue_context = f.submit class: 'btn' - - elsif issue.milestone - = link_to project_milestone_path(@project, @issue.milestone) do - = @issue.milestone.title - - else - None diff --git a/app/views/projects/issues/update.js.haml b/app/views/projects/issues/update.js.haml index 6e50667b084b799a16fa87e6eda4064779aa12a0..7a5e05175561cf155527ad8c06f531991869c5af 100644 --- a/app/views/projects/issues/update.js.haml +++ b/app/views/projects/issues/update.js.haml @@ -3,8 +3,15 @@ :plain $("##{dom_id(@issue)}").fadeOut(); - elsif params[:issue_context] + $('.context').html("#{escape_javascript(render partial: 'issue_context', locals: { issue: @issue })}"); $('.context').effect('highlight'); - if @issue.milestone $('.milestone-nav-link').replaceWith("<span class='milestone-nav-link'>| <span class='light'>Milestone</span> #{escape_javascript(link_to @issue.milestone.title, project_milestone_path(@issue.project, @issue.milestone))}</span>") - else $('.milestone-nav-link').html('') + + +$('select.select2').select2({width: 'resolve', dropdownAutoWidth: true}) +$('.edit-issue.inline-update input[type="submit"]').hide(); +new ProjectUsersSelect(); +new Issue(); diff --git a/app/views/projects/merge_requests/_discussion.html.haml b/app/views/projects/merge_requests/_discussion.html.haml index 64bae8007853940e444abc63f110b2f20163c475..f1f66569a9f95e6d23a98152461ee38609aecf92 100644 --- a/app/views/projects/merge_requests/_discussion.html.haml +++ b/app/views/projects/merge_requests/_discussion.html.haml @@ -9,7 +9,7 @@ .col-md-9 = render "projects/merge_requests/show/participants" = render "projects/notes/notes_with_form" - .col-md-3.hidden-sm.hidden-xs + .col-md-3 .clearfix %span.slead.has_tooltip{:"data-original-title" => 'Cross-project reference'} = cross_project_reference(@project, @merge_request) @@ -18,7 +18,7 @@ %cite.cgray = render partial: 'projects/merge_requests/show/context', locals: { merge_request: @merge_request } %hr - .votes-holder.hidden-sm.hidden-xs + .votes-holder %h6 Votes #votes= render 'votes/votes_block', votable: @merge_request diff --git a/app/views/projects/merge_requests/show/_context.html.haml b/app/views/projects/merge_requests/show/_context.html.haml index 5b6e64f06573bf2a057e04eade0823c98894d3c2..21718ca2acf9d93e60a0c5fb87015e87020d8a4e 100644 --- a/app/views/projects/merge_requests/show/_context.html.haml +++ b/app/views/projects/merge_requests/show/_context.html.haml @@ -2,22 +2,22 @@ %div.prepend-top-20 %p Assignee: - + - if @merge_request.assignee + = link_to_member(@project, @merge_request.assignee) + - else + none - if can?(current_user, :modify_merge_request, @merge_request) = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @merge_request.assignee_id) - - elsif merge_request.assignee - = link_to_member(@project, @merge_request.assignee) - - else - None %div.prepend-top-20 %p Milestone: + - if @merge_request.milestone + %span.back-to-milestone + #{link_to @merge_request.milestone.title, project_milestone_path(@project, @merge_request.milestone)} + - else + none - if can?(current_user, :modify_merge_request, @merge_request) = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'}) = hidden_field_tag :merge_request_context = f.submit class: 'btn' - - elsif merge_request.milestone - = link_to merge_request.milestone.title, project_milestone_path - - else - None diff --git a/app/views/projects/merge_requests/update.js.haml b/app/views/projects/merge_requests/update.js.haml index 6f4c5dd7a3b2d162d2d4ee4bdc32419c828937c3..f5cc98c7fa4160cfcb8f66cdb361f28b842140a4 100644 --- a/app/views/projects/merge_requests/update.js.haml +++ b/app/views/projects/merge_requests/update.js.haml @@ -1,2 +1,8 @@ - if params[:merge_request_context] + $('.context').html("#{escape_javascript(render partial: 'projects/merge_requests/show/context', locals: { issue: @issue })}"); $('.context').effect('highlight'); + + new ProjectUsersSelect(); + + $('select.select2').select2({width: 'resolve', dropdownAutoWidth: true}); + merge_request = new MergeRequest(); diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 26607b0090c34bd427a8291fc7674898f7ab5609..e6fa376f3eb98b1be599927bebc19c9118ded63d 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -65,7 +65,7 @@ describe "Issues", feature: true do click_button "Save changes" - page.should have_content "Assignee: Select assignee" + page.should have_content 'Assignee: none' issue.reload.assignee.should be_nil end end @@ -249,6 +249,7 @@ describe "Issues", feature: true do click_button 'Update Issue' page.should have_content "Milestone changed to #{milestone.title}" + page.should have_content "Milestone: #{milestone.title}" has_select?('issue_assignee_id', :selected => milestone.title) end end @@ -287,7 +288,7 @@ describe "Issues", feature: true do sleep 2 # wait for ajax stuff to complete first('.user-result').click - page.should have_content "Assignee: Unassigned" + page.should have_content 'Assignee: none' sleep 2 # wait for ajax stuff to complete issue.reload.assignee.should be_nil end