Fix xhr bug.

This commit is contained in:
BoHung Chiu 2021-04-24 20:11:23 +08:00
parent 67e1dd153f
commit a6fde99d96
2 changed files with 89 additions and 78 deletions

View File

@ -1,7 +1,15 @@
<% if request.xhr? %> <% if request.xhr? %>
<div id="index_table">
<%= render :partial => "seminar_signup_render_table" %> <%= render :partial => "seminar_signup_render_table" %>
<div class="bottomnav clearfix">
<div class="pagination pagination-centered"><%= (paginate(@seminar_signups) rescue nil) %></div>
<% if @can_edit %>
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t("seminar.field_display_setting"), seminar_signup_admin_setting_admin_seminar_path(params[:id]) + "?page=table", :class => 'btn btn-primary' %>
</div> </div>
<% end %>
</div>
<%= render 'layouts/delete_modal', delete_options: @delete_options %>
<% else %> <% else %>
<form id="module-search-form"> <form id="module-search-form">
<div class="sc-field"> <div class="sc-field">
@ -15,8 +23,6 @@
<h4><%= @seminar.title %></h4> <h4><%= @seminar.title %></h4>
<div id="index_table"> <div id="index_table">
<%= render :partial => "seminar_signup_render_table" %> <%= render :partial => "seminar_signup_render_table" %>
</div>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="pagination pagination-centered"><%= (paginate(@seminar_signups) rescue nil) %></div> <div class="pagination pagination-centered"><%= (paginate(@seminar_signups) rescue nil) %></div>
<% if @can_edit %> <% if @can_edit %>
@ -27,4 +33,5 @@
</div> </div>
<%= render 'layouts/delete_modal', delete_options: @delete_options %> <%= render 'layouts/delete_modal', delete_options: @delete_options %>
</div>
<% end %> <% end %>

View File

@ -1,12 +1,13 @@
<script> <% unless request.xhr? %>
<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload(); if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script> </script>
<div id="jquery_form_dialog"> <div id="jquery_form_dialog">
<div style="clear:both;"></div> <div style="clear:both;"></div>
<div id="jquery_form_content"> <div id="jquery_form_content">
</div> </div>
</div> </div>
<% if @can_edit %> <% if @can_edit %>
<% if params[:type].blank?%> <% if params[:type].blank?%>
<label><input id="copy_mode_on" type="checkbox"><%=t("seminar.copy_mode_on")%></label> <label><input id="copy_mode_on" type="checkbox"><%=t("seminar.copy_mode_on")%></label>
<% end %> <% end %>
@ -17,6 +18,7 @@
<% end %> <% end %>
<li><a href="?type=table" class="btn <%='active' if params[:type] == 'table'%>"><%= t('seminar.table') %></a></li> <li><a href="?type=table" class="btn <%='active' if params[:type] == 'table'%>"><%= t('seminar.table') %></a></li>
</ul> </ul>
<% end %>
<% end %> <% end %>
<% if params[:type] == "table" || (!@can_edit) %> <% if params[:type] == "table" || (!@can_edit) %>
<div style="clear: both;"></div> <div style="clear: both;"></div>
@ -26,15 +28,16 @@
<% else %> <% else %>
<%= render :partial => 'seminar_signup_dashboard' %> <%= render :partial => 'seminar_signup_dashboard' %>
<% end %> <% end %>
<style type="text/css"> <% unless request.xhr? %>
<style type="text/css">
.pull-right li{ .pull-right li{
float: left; float: left;
} }
li{ li{
list-style: none; list-style: none;
} }
</style> </style>
<script> <script>
$(document).on("submit","#jquery_form",function(e) { $(document).on("submit","#jquery_form",function(e) {
var form = $(this); var form = $(this);
var url = form.attr('action'); var url = form.attr('action');
@ -76,4 +79,5 @@
}); });
}) })
}) })
</script> </script>
<% end %>