Note mandatory when rejecting or delegating

This commit is contained in:
karel.picman@lbcfree.net 2020-10-15 15:02:35 +02:00
parent e3912119bb
commit cf8e310d81
3 changed files with 13 additions and 5 deletions

View File

@ -95,7 +95,7 @@ module DmsfWorkflowsHelper
def principals_radio_button_tags(name, principals)
s = +''
principals.each do |principal|
s << "<label>#{ radio_button_tag name, principal.id * 10, false, id: nil } #{h principal}</label>\n"
s << "<label>#{ radio_button_tag name, principal.id * 10, false, onclick: 'noteMandatory(true);', id: nil } #{h principal}</label>\n"
end
s.html_safe
end

View File

@ -27,13 +27,13 @@
<%= hidden_field_tag :dmsf_file_revision_id, params[:dmsf_file_revision_id] %>
<p>
<label>
<%= radio_button_tag 'step_action', DmsfWorkflowStepAction::ACTION_APPROVE, true %>
<%= radio_button_tag 'step_action', DmsfWorkflowStepAction::ACTION_APPROVE, true, onclick: 'noteMandatory(false);' %>
<%= l(:label_dmsf_wokflow_action_approve) %>
</label>
</p>
<p>
<label>
<%= radio_button_tag 'step_action', DmsfWorkflowStepAction::ACTION_REJECT %>
<%= radio_button_tag 'step_action', DmsfWorkflowStepAction::ACTION_REJECT, false, onclick: 'noteMandatory(true);' %>
<%= l(:label_dmsf_wokflow_action_reject) %>
</label>
<br/>
@ -51,7 +51,7 @@
</div>
<p class="buttons">
<%= submit_tag l(:button_submit), name: 'commit', onclick: 'hideModal(this);' %>
<%= submit_tag l(:button_cancel), name: 'commit', onclick: 'hideModal(this);' %>
<%= submit_tag l(:button_submit), name: 'commit' %>
<%= submit_tag l(:button_cancel), name: 'cancel', onclick: 'hideModal(this);' %>
</p>
<% end %>

View File

@ -147,3 +147,11 @@ function dmsfExpandRows(id, parentRow, url) {
alert('An error in rows expanding');
});
}
function noteMandatory(mandatory) {
let note = $('textarea#note');
note.prop('required', mandatory);
if(mandatory){
note.focus();
}
}