Sha256: 2c77d3f2e25a69fdc4c48c35029b812155e331826e882fd27f0475398eede9cb
Contents?: true
Size: 1.52 KB
Versions: 8
Compression:
Stored size: 1.52 KB
Contents
<% html_class = "new_#{@model_to_relate.model_name.param_key}" html_modal_class = "modal-from-dom-#{@model_to_relate.model_name.param_key}" modal_association = @model_to_relate.model_name.param_key %> <div id="<%= html_modal_class %>" class="modal hide fade"> <div class="modal-header"> <a class="close" data-dismiss="modal">×</a> <h3><%= Typus::I18n.t("Add %{resource}", resource: @model_to_relate.model_name.human) %></h3> </div> <div class="modal-body"></div> <div class="modal-footer"> <% html_options = { :id => "modal-form-submit-#{modal_association}", :class => "btn btn-primary" } %> <%= link_to Typus::I18n.t("Save"), "#", html_options %> </div> <script> $('#modal-form-submit-<%= modal_association %>').on('click', function(e) { e.preventDefault(); $('#<%= html_class %>').on('submit', function(event) { event.preventDefault(); // Get the action url: var action = $('#<%= html_class %>').attr('action'); var form_data = $('#<%= html_class %>').serialize(); $.post(action, form_data, function(data){}) .success(function(data, text, xhr) { $("#<%= html_modal_class %>").modal('hide'); parent.location.reload(); }) .error(function(request, status, error) { $('#<%= html_modal_class %> .modal-body').html(request.responseText); }); return false; }); $('#<%= html_class %>').submit(); return false; }); </script> </div>
Version data entries
8 entries across 8 versions & 1 rubygems