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,3 +1,4 @@
<% unless request.xhr? %>
<script> <script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload(); if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script> </script>
@ -18,6 +19,7 @@
<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>
<%= render :partial => 'seminar_signup_table' %> <%= render :partial => 'seminar_signup_table' %>
@ -26,6 +28,7 @@
<% else %> <% else %>
<%= render :partial => 'seminar_signup_dashboard' %> <%= render :partial => 'seminar_signup_dashboard' %>
<% end %> <% end %>
<% unless request.xhr? %>
<style type="text/css"> <style type="text/css">
.pull-right li{ .pull-right li{
float: left; float: left;
@ -77,3 +80,4 @@
}) })
}) })
</script> </script>
<% end %>