2010-10-22 20:46:06 +02:00
|
|
|
<% if @saved -%>
|
|
|
|
|
hide_empty_message();
|
2010-11-25 23:29:32 +01:00
|
|
|
TracksPages.hide_errors();
|
2010-12-03 17:52:24 +01:00
|
|
|
TracksPages.set_page_badge(<%= @down_count %>);
|
2013-03-01 16:20:15 +01:00
|
|
|
add_context("<%=@context.state%>");
|
2010-10-22 20:46:06 +02:00
|
|
|
clear_form();
|
|
|
|
|
<% else -%>
|
2010-11-25 23:29:32 +01:00
|
|
|
TracksPages.show_errors(html_for_error_messages());
|
2010-10-22 20:46:06 +02:00
|
|
|
<% end -%>
|
|
|
|
|
|
|
|
|
|
function hide_empty_message() {
|
2013-03-01 16:20:15 +01:00
|
|
|
$('div#<%=@context.state%>-contexts-empty-nd').hide();
|
2010-10-22 20:46:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function add_context(state) {
|
|
|
|
|
$('#list-contexts-'+state).append(html_for_context_listing());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clear_form() {
|
|
|
|
|
$('#context-form').clearForm();
|
|
|
|
|
$('#context-form input:text:first').focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function html_for_context_listing() {
|
2014-08-10 20:43:27 +02:00
|
|
|
return "<%= @saved ? js_render('context_listing', {}, @context) : "" %>";
|
2010-10-22 20:46:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function html_for_error_messages() {
|
2014-08-10 20:43:27 +02:00
|
|
|
return "<%= js_error_messages_for(@context) %>";
|
2010-10-22 20:46:06 +02:00
|
|
|
}
|