app/views/kuppayam/workflows/peacock/update.js.erb in kuppayam-0.1.4 vs app/views/kuppayam/workflows/peacock/update.js.erb in kuppayam-0.1.5dev

- old
+ new

@@ -1,24 +1,29 @@ <% if @r_object.errors.blank? %> // Updating the edited row and highlighting it - $('#tr_<%= @resource_options[:item_name] %>_<%= @r_object.id %>').replaceWith("<%= escape_javascript(render(:partial=>"#{@resource_options[:view_path]}/row", locals: { @resource_options[:item_name].to_sym => @r_object})) %>"); + $('#tr_<%= @resource_options[:item_name] %>_<%= @r_object.id %>').replaceWith("<%= escape_javascript(render(:partial=>"#{@resource_options[:view_path]}/row", locals: { @resource_options[:item_name].to_sym => @r_object, i: -1})) %>"); $("#tr_<%= @resource_options[:item_name] %>_<%= @r_object.id %>").css("background-color", "#fffddd"); - // Showing the saved data in the modal - var heading = "<%= raw @r_object.try(:display_name) %>"; - var bodyContent = "<%= escape_javascript(render(:partial=>"#{@resource_options[:view_path]}/show")) %>"; - showLargeModal(heading, bodyContent, false); + <% if @resource_options[:show_modal_after_update] %> + // Showing the saved data in the modal + var heading = "<%= raw @r_object.try(:display_name) %>"; + var bodyContent = "<%= escape_javascript(render(:partial=>"#{@resource_options[:view_path]}/show")) %>"; + showLargeModal(heading, bodyContent, false); + <% else %> + // Closing the modal if it is opened + closeLargeModal(); + <% end %> // Showing Growl Like Message notifySuccess("<%= @notification[:title] %>", "<%= @notification[:message] %>"); <% else %> // Reload the form with errors var heading = "Edit '<%= raw @r_object.try(:display_name) %>'"; var bodyContent = "<%= escape_javascript(render(:partial=>"#{@resource_options[:view_path]}/form")) %>"; - showLargeModal(heading, bodyContent); + showLargeModal(heading, bodyContent, true); // Show Main Error Message on the form <% error_message = content_tag(:div, I18n.t('errors.errors_highlighted'), class: "alert alert-danger mt-20") %> $("#<%= @resource_options[:item_name] %>_form_error").html("<%= escape_javascript(error_message) %>");