seminar/app/views/admin/seminars/seminar_signup.html.erb

83 lines
3.2 KiB
Plaintext
Raw Normal View History

2021-04-24 12:11:23 +00:00
<% unless request.xhr? %>
<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<div id="jquery_form_dialog">
<div style="clear:both;"></div>
<div id="jquery_form_content">
</div>
</div>
2021-04-24 12:11:23 +00:00
<% if @can_edit %>
<% if params[:type].blank?%>
<label><input id="copy_mode_on" type="checkbox"><%=t("seminar.copy_mode_on")%></label>
<% end %>
2021-04-24 12:11:23 +00:00
<ul class="pull-right">
<li><a href="?type=" class="btn <%='active' if params[:type].blank? %>"><%= t('seminar.dashboard') %></a></li>
<% if @seminar.enable_summary_choice %>
<li><a href="?type=session" class="btn <%='active' if params[:type] == 'session'%>"><%= t('seminar.session_dashboard') %></a></li>
<% end %>
<li><a href="?type=table" class="btn <%='active' if params[:type] == 'table'%>"><%= t('seminar.table') %></a></li>
</ul>
<% end %>
<% end %>
<% if params[:type] == "table" || (!@can_edit) %>
<div style="clear: both;"></div>
<%= render :partial => 'seminar_signup_table' %>
<% elsif params[:type] == "session" %>
<%=render :partial => 'seminar_signup_session_dashboard' %>
<% else %>
<%= render :partial => 'seminar_signup_dashboard' %>
<% end %>
2021-04-24 12:11:23 +00:00
<% unless request.xhr? %>
<style type="text/css">
.pull-right li{
float: left;
}
li{
list-style: none;
}
</style>
<script>
$(document).on("submit","#jquery_form",function(e) {
var form = $(this);
var url = form.attr('action');
var method = form.attr('method');
method = method || "POST";
$.ajax({
type: method,
url: url,
data: form.serialize(), // serializes the form's elements.
success: function(data)
{
if(data["success"]){
window.open_target_td.html(data["val"]+Array.from(window.open_target_td.find(">*").map(function(i,v){
return $(v).prop("outerHTML");
})).join(""));
}else{
console.log(data);
}
}
});
2021-04-24 12:11:23 +00:00
e.preventDefault(); // avoid to execute the actual submit of the form.
});
$(document).on('click', '.jquery_edit', function(){
var href = $(this).data("href");
window.open_target_td = $(this).parents("td");
$.get(href).done(function(html){
$("#jquery_form_content").html(html);
$("#jquery_form_dialog").dialog({
resizable: true,
minHeight: 300,
maxHeight: 400,
modal: true,
width: '80%',
close: function(){$( this ).dialog( "close" )},
buttons: {
"<%= t('submit') %>": function(){$( this ).dialog( "close" );$("#jquery_form").submit()}
}
});
})
})
2021-04-24 12:11:23 +00:00
</script>
<% end %>