Project

General

Profile

Feature #29076 » 0001-Add-button-to-Create-and-follow-when-adding-a-subtas.patch

Marius BĂLTEANU, 2021-02-27 17:02

View differences:

app/controllers/issues_controller.rb
669 669
        url_params[:issue][:project_id] = @issue.project_id
670 670
        redirect_to new_issue_path(url_params)
671 671
      end
672
    elsif params[:follow]
673
      redirect_to issue_path(@issue)
672 674
    else
673 675
      redirect_back_or_default issue_path(@issue)
674 676
    end
app/views/issues/new.html.erb
38 38
  </div>
39 39

  
40 40
  <%= submit_tag l(:button_create) %>
41
  <% if params[:back_url] && params[:issue] && params[:issue][:parent_issue_id] %>
42
    <%= submit_tag l(:button_create_and_follow), name: 'follow' %>
43
  <% end %>
41 44
  <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
42 45
<% end %>
43 46

  
config/locales/en.yml
1162 1162
  button_filter: Filter
1163 1163
  button_actions: Actions
1164 1164
  button_add_subtask: Add subtask
1165
  button_create_and_follow: Create and follow
1165 1166

  
1166 1167
  status_active: active
1167 1168
  status_registered: registered
test/functional/issues_controller_test.rb
3161 3161
      assert_select 'select[name=?]', 'issue[done_ratio]'
3162 3162
      assert_select 'input[name=?][value=?]', 'issue[custom_field_values][2]', 'Default string'
3163 3163
      assert_select 'input[name=?]', 'issue[watcher_user_ids][]'
3164

  
3165
      # Assert submit buttons
3166
      assert_select 'input[type=submit][name=?]', 'commit'
3167
      assert_select 'input[type=submit][name=?]', 'continue'
3168
      assert_select 'input[type=submit][name=?]', 'follow', 0
3164 3169
    end
3165 3170

  
3166 3171
    # Be sure we don't display inactive IssuePriorities
......
3773 3778
    assert_select 'div#trackers_description', 0
3774 3779
  end
3775 3780

  
3781
  def test_get_new_should_show_create_and_follow_button_when_issue_is_subtask_and_back_urL_is_present
3782
    @request.session[:user_id] = 2
3783
    get :new, params: {
3784
      project_id: 1,
3785
      issue: {
3786
        parent_issue_id: 2
3787
      },
3788
      back_url: "/issues/2"
3789
    }
3790
    assert_response :success
3791

  
3792
    assert_select 'form#issue-form' do
3793
      # Assert submit buttons
3794
      assert_select 'input[type=submit][name=?]', 'commit'
3795
      assert_select 'input[type=submit][name=?]', 'continue'
3796
      assert_select 'input[type=submit][name=?]', 'follow'
3797
    end
3798
  end
3799

  
3776 3800
  def test_update_form_for_new_issue
3777 3801
    @request.session[:user_id] = 2
3778 3802
    post(
(2-2/2)