Project

General

Profile

Feature #31322 » issue-31322.diff

Toshi MARUYAMA, 2019-09-30 19:51

View differences:

app/controllers/issues_controller.rb
85 85
  end
86 86

  
87 87
  def show
88
    @issue_statuses = IssueStatus.sorted.to_a
88 89
    @journals = @issue.visible_journals_with_index
89 90
    @has_changesets = @issue.changesets.visible.preload(:repository, :user).exists?
90 91
    @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
......
474 475
  # Used by #edit and #update to set some common instance variables
475 476
  # from the params
476 477
  def update_issue_from_params
478
    @issue_statuses = IssueStatus.sorted.to_a
477 479
    @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
478 480
    if params[:time_entry]
479 481
      @time_entry.safe_attributes = params[:time_entry]
app/views/issues/_attributes.html.erb
4 4
<div class="splitcontentleft">
5 5
<% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
6 6
<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true},
7
                :onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p>
7
                :onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this);add_confirm_dialog()" %></p>
8 8
<%= hidden_field_tag 'was_default_status', @issue.status_id, :id => nil if @issue.status == @issue.default_status %>
9 9
<% else %>
10 10
<p><label><%= l(:field_status) %></label> <%= @issue.status %></p>
app/views/issues/_edit.html.erb
1
<%= javascript_tag do %>
2
  function add_confirm_dialog (){
3
    var closed_issue_statuses =
4
             <%= @issue_statuses.select{|i| i.is_closed?}.pluck(:id).map(&:to_s).to_json.html_safe %>;
5
    var children = $("#issue_tree").find("tr.issue.child");
6
    if (($.inArray($("#issue_status_id").val(), closed_issue_statuses) > -1) &&
7
        (children.length > 0) &&
8
        ((children.length - $("#issue_tree").find("tr.issue.child.closed").length) > 0)) {
9
      $("#submit_button").attr({
10
          "data-confirm": 'POC'
11
      });
12
    } else {
13
      $("#submit_button").removeAttr("data-confirm");
14
    }
15
    return true;
16
  }
17
<% end %>
1 18
<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %>
2 19
    <%= error_messages_for 'issue', 'time_entry' %>
3 20
    <%= render :partial => 'conflict' if @conflict %>
......
72 89

  
73 90
    <%= f.hidden_field :lock_version %>
74 91
    <%= hidden_field_tag 'last_journal_id', params[:last_journal_id] || @issue.last_journal_id %>
75
    <%= submit_tag l(:button_submit) %>
92
    <%= submit_tag l(:button_submit), :id => "submit_button" %>
76 93
    <%= link_to l(:button_cancel), issue_path(id: @issue.id), :onclick => params[:action] == 'show' ? "$('#update').hide(); return false;" : '' %>
77 94

  
78 95
    <%= hidden_field_tag 'prev_issue_id', @prev_issue_id if @prev_issue_id %>
(1-1/15)