Commit 8a55636f8974d73c097a52721e2208cea727bc17
1 parent
26ebfa20
Exists in
spb-stable
and in
3 other branches
Dont replace all issue context when change assignee/milestone
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
6 changed files
with
42 additions
and
39 deletions
Show diff stats
app/assets/javascripts/dispatcher.js.coffee
@@ -19,6 +19,8 @@ class Dispatcher | @@ -19,6 +19,8 @@ class Dispatcher | ||
19 | switch page | 19 | switch page |
20 | when 'projects:issues:index' | 20 | when 'projects:issues:index' |
21 | Issues.init() | 21 | Issues.init() |
22 | + when 'projects:issues:show' | ||
23 | + new Issue() | ||
22 | when 'projects:issues:new', 'projects:merge_requests:new' | 24 | when 'projects:issues:new', 'projects:merge_requests:new' |
23 | GitLab.GfmAutoComplete.setup() | 25 | GitLab.GfmAutoComplete.setup() |
24 | when 'dashboard:show' | 26 | when 'dashboard:show' |
@@ -0,0 +1,9 @@ | @@ -0,0 +1,9 @@ | ||
1 | +class Issue | ||
2 | + constructor: -> | ||
3 | + $('.edit-issue.inline-update input[type="submit"]').hide() | ||
4 | + $(".issue-box .inline-update").on "change", "select", -> | ||
5 | + $(this).submit() | ||
6 | + $(".issue-box .inline-update").on "change", "#issue_assignee_id", -> | ||
7 | + $(this).submit() | ||
8 | + | ||
9 | +@Issue = Issue |
app/assets/javascripts/issues.js.coffee
@@ -77,9 +77,3 @@ | @@ -77,9 +77,3 @@ | ||
77 | $("#update_issues_ids").val [] | 77 | $("#update_issues_ids").val [] |
78 | $(".issues_bulk_update").hide() | 78 | $(".issues_bulk_update").hide() |
79 | $(".issues-filters").show() | 79 | $(".issues-filters").show() |
80 | - | ||
81 | -$ -> | ||
82 | - $('.edit-issue.inline-update input[type="submit"]').hide(); | ||
83 | - $("body").on "change", ".edit-issue.inline-update select", -> | ||
84 | - $(this).submit() | ||
85 | - |
app/assets/javascripts/project_users_select.js.coffee
1 | -$ -> | ||
2 | - projectUserFormatResult = (user) -> | 1 | +@projectUsersSelect = |
2 | + init: -> | ||
3 | + $('.ajax-project-users-select').each (i, select) -> | ||
4 | + project_id = $('body').data('project-id') | ||
5 | + | ||
6 | + $(select).select2 | ||
7 | + placeholder: $(select).data('placeholder') || "Search for a user" | ||
8 | + multiple: $(select).hasClass('multiselect') | ||
9 | + minimumInputLength: 0 | ||
10 | + query: (query) -> | ||
11 | + Api.projectUsers project_id, query.term, (users) -> | ||
12 | + data = { results: users } | ||
13 | + query.callback(data) | ||
14 | + | ||
15 | + initSelection: (element, callback) -> | ||
16 | + id = $(element).val() | ||
17 | + if id isnt "" | ||
18 | + Api.user(id, callback) | ||
19 | + | ||
20 | + | ||
21 | + formatResult: projectUsersSelect.projectUserFormatResult | ||
22 | + formatSelection: projectUsersSelect.projectUserFormatSelection | ||
23 | + dropdownCssClass: "ajax-project-users-dropdown" | ||
24 | + dropdownAutoWidth: true | ||
25 | + escapeMarkup: (m) -> # we do not want to escape markup since we are displaying html in results | ||
26 | + m | ||
27 | + | ||
28 | + projectUserFormatResult: (user) -> | ||
3 | if user.avatar_url | 29 | if user.avatar_url |
4 | avatar = user.avatar_url | 30 | avatar = user.avatar_url |
5 | else if gon.gravatar_enabled | 31 | else if gon.gravatar_enabled |
@@ -15,30 +41,8 @@ $ -> | @@ -15,30 +41,8 @@ $ -> | ||
15 | <div class='user-username'>#{user.username}</div> | 41 | <div class='user-username'>#{user.username}</div> |
16 | </div>" | 42 | </div>" |
17 | 43 | ||
18 | - projectUserFormatSelection = (user) -> | 44 | + projectUserFormatSelection: (user) -> |
19 | user.name | 45 | user.name |
20 | 46 | ||
21 | - $('.ajax-project-users-select').each (i, select) -> | ||
22 | - project_id = $('body').data('project-id') | ||
23 | - | ||
24 | - $(select).select2 | ||
25 | - placeholder: $(select).data('placeholder') || "Search for a user" | ||
26 | - multiple: $(select).hasClass('multiselect') | ||
27 | - minimumInputLength: 0 | ||
28 | - query: (query) -> | ||
29 | - Api.projectUsers project_id, query.term, (users) -> | ||
30 | - data = { results: users } | ||
31 | - query.callback(data) | ||
32 | - | ||
33 | - initSelection: (element, callback) -> | ||
34 | - id = $(element).val() | ||
35 | - if id isnt "" | ||
36 | - Api.user(id, callback) | ||
37 | - | ||
38 | - | ||
39 | - formatResult: projectUserFormatResult | ||
40 | - formatSelection: projectUserFormatSelection | ||
41 | - dropdownCssClass: "ajax-project-users-dropdown" | ||
42 | - dropdownAutoWidth: true | ||
43 | - escapeMarkup: (m) -> # we do not want to escape markup since we are displaying html in results | ||
44 | - m | 47 | +$ -> |
48 | + projectUsersSelect.init() |
app/views/projects/issues/_issue_context.html.haml
@@ -4,9 +4,6 @@ | @@ -4,9 +4,6 @@ | ||
4 | \ and currently assigned to | 4 | \ and currently assigned to |
5 | 5 | ||
6 | - if can?(current_user, :modify_issue, @issue) | 6 | - if can?(current_user, :modify_issue, @issue) |
7 | - = link_to profile_path(issue.assignee) do | ||
8 | - = image_tag(avatar_icon(issue.assignee.email), class: 'avatar avatar-inline s16 assignee') if issue.assignee | ||
9 | - | ||
10 | = project_users_select_tag('issue[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @issue.assignee_id) | 7 | = project_users_select_tag('issue[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @issue.assignee_id) |
11 | - elsif issue.assignee | 8 | - elsif issue.assignee |
12 | = link_to_member(@project, @issue.assignee) | 9 | = link_to_member(@project, @issue.assignee) |
app/views/projects/issues/update.js.haml
@@ -3,10 +3,7 @@ | @@ -3,10 +3,7 @@ | ||
3 | :plain | 3 | :plain |
4 | $("##{dom_id(@issue)}").fadeOut(); | 4 | $("##{dom_id(@issue)}").fadeOut(); |
5 | - elsif params[:issue_context] | 5 | - elsif params[:issue_context] |
6 | - $('.issue-box .context').html("#{escape_javascript(render partial: 'issue_context', locals: { issue: @issue })}"); | ||
7 | $('.issue-box .context').effect('highlight'); | 6 | $('.issue-box .context').effect('highlight'); |
8 | - $('.select2').select2(); | ||
9 | - $('.edit-issue.inline-update input[type="submit"]').hide(); | ||
10 | - if @issue.milestone | 7 | - if @issue.milestone |
11 | $('.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>") | 8 | $('.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>") |
12 | - else | 9 | - else |