Project

General

Profile

Feature #31322 » issue-31322-ver.2.diff

Toshi MARUYAMA, 2019-09-30 20:01

View differences:

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
             <%= @allowed_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 %>
(2-2/15)