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

79 lines
2.8 KiB
Plaintext
Raw Normal View History

<script>
2016-06-29 06:57:45 +00:00
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>
<% if @can_edit %>
<% if params[:type].blank?%>
<label><input id="copy_mode_on" type="checkbox"><%=t("seminar.copy_mode_on")%></label>
<% end %>
<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 %>
<% 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 %>
<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);
}
}
});
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()}
}
});
})
})
</script>