Project

General

Profile

Patch #26819 » create_related_issue.patch

Sandra Tatarevicova, 2017-08-31 17:43

View differences:

app/controllers/issues_controller.rb
127 127
    call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
128 128
    @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
129 129
    if @issue.save
130
      if params[:related_to]
131
        relation = IssueRelation.new({:relation_type => IssueRelation::TYPE_RELATES, :issue_to => @project.issues.find_by_id(params[:related_to]), :issue_from => @issue})
132
        unless relation.save
133
          logger.error "Could not create relation due to validation errors: #{relation.errors.full_messages.join(', ')}"
134
        end
135
      end
130 136
      call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
131 137
      respond_to do |format|
132 138
        format.html {
app/views/issues/_action_menu.html.erb
1 1
<div class="contextual">
2 2
<%= link_to l(:button_edit), edit_issue_path(@issue), :onclick => 'showAndScrollTo("update", "issue_notes"); return false;', :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? %>
3 3
<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue), :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %>
4
<%= link_to l(:button_create_related_issue), {:controller => 'issues', :action => 'new', :project_id => @project, :related_to => @issue}, :class => 'icon icon-link' if @issue.editable? %>
4 5
<%= watcher_link(@issue, User.current) %>
5 6
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:copy_issues, @project) && Issue.allowed_target_projects.any? %>
6 7
<%= link_to l(:button_delete), issue_path(@issue), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'icon icon-del' if @issue.deletable? %>
app/views/issues/_form.html.erb
39 39
<%= wikitoolbar_for 'issue_description' %>
40 40
<% end %>
41 41

  
42
<%= hidden_field_tag 'related_to', '', :size => 4, :id => nil, :value => params[:related_to] %>
43

  
42 44
<div id="attributes" class="attributes">
43 45
  <%= render :partial => 'issues/attributes' %>
44 46
</div>
config/locales/en.yml
1049 1051
  button_activate: Activate
1050 1052
  button_sort: Sort
1051 1053
  button_log_time: Log time
1054
  button_create_related_issue: Create related issue
1052 1055
  button_rollback: Rollback to this version
1053 1056
  button_watch: Watch
1054 1057
  button_unwatch: Unwatch
public/stylesheets/application.css
1257 1259
.icon-move-bottom { background-image: url(../images/2downarrow.png); }
1258 1260
.icon-ok { background-image: url(../images/true.png); }
1259 1261
.icon-not-ok { background-image: url(../images/false.png); }
1262
.icon-link { background-image: url(../images/link.png); }
1260 1263
.icon-link-break { background-image: url(../images/link_break.png); }
1261 1264
.icon-list { background-image: url(../images/text_list_bullets.png); }
1262 1265
.icon-close { background-image: url(../images/close.png); }
......
1475 1478
  height:1px;
1476 1479
  overflow:hidden;
1477 1480
}
1481

  
(1-1/2)