minor changes, working on refresh after submit

This commit is contained in:
Zanz2 2017-09-20 16:04:52 +02:00
parent 72c707ae88
commit d59234a1e3
3 changed files with 8 additions and 3 deletions

View file

@ -335,9 +335,11 @@ function initModals() {
modal.find(".modal-body").html(""); modal.find(".modal-body").html("");
// Simply re-render table // Simply re-render table
protocolsDatatable.ajax.reload();
} }
// Make private modal hidden action // Make private modal hidden action
$("#make-private-results-modal").on("hidden.bs.modal", function(e) { $("#make-private-results-modal").on("hidden.bs.modal", function(e) {
refresh($(this)); refresh($(this));

View file

@ -835,12 +835,15 @@ def protocolsio_import_save
format.json { format.json {
render json: { name: p_name, status: :bad_request }, status: :bad_request render json: { name: p_name, status: :bad_request }, status: :bad_request
} }
#:location => root_url #:location => root_url
# protocolsDatatable.ajax.reload();
# $('#modal-import-json-protocol-preview').modal('hide');
else else
format.json { format.json {
render json: { render json: {
name: p_name, new_name: protocol.name, status: :ok name: p_name, new_name: protocol.name, status: :ok
},redirect_to: @protocol, },
status: :ok status: :ok
} }
end end

View file

@ -1,4 +1,4 @@
<%= form_for(@protocol, :url => url_for(:controller => 'protocols', :action => 'protocolsio_import_save'),method: :post,format: :json,remote: true) do |f| %> <%= form_for(@protocol, :url => url_for(:controller => 'protocols', :action => 'protocolsio_import_save'),method: :post,format: :json,remote: true,:html => { :id => "protocolsio-import-form" }) do |f| %>
<%#= fields_for :steps do |g| %> <%#= fields_for :steps do |g| %>
<% #json_string= JSON.parse(json_string)%> <% #json_string= JSON.parse(json_string)%>
<% #json_string = JSON.generate(json_string['steps']) <% #json_string = JSON.generate(json_string['steps'])