mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
46 lines
No EOL
1.3 KiB
Text
46 lines
No EOL
1.3 KiB
Text
<% unless @saved -%>
|
|
TracksPages.show_errors(html_for_error_messages());
|
|
|
|
function html_for_error_messages() {
|
|
return "<%= js_error_messages_for(@project) %>";
|
|
}
|
|
<% else -%>
|
|
<% if @go_to_project -%>
|
|
redirect_to("<%= project_path(@project) -%>")
|
|
<% else -%>
|
|
TracksPages.hide_errors();
|
|
hide_empty_message();
|
|
TracksPages.set_page_badge(<%= @down_count %>);
|
|
update_active_projects_container();
|
|
add_project();
|
|
clear_form();
|
|
TracksPages.page_inform("Created new project '<%= @project.name%>'");
|
|
<% end -%>
|
|
|
|
/* TODO: make this generic for all pages with lists */
|
|
function hide_empty_message() {
|
|
$('projects-empty-nd').hide();
|
|
}
|
|
|
|
/* TODO: refactor and move this to application.js */
|
|
function add_project() {
|
|
$('#list-active-projects').append(html_for_project_listing());
|
|
}
|
|
|
|
/* TODO: refactor and move this to application.js */
|
|
function clear_form() {
|
|
$('#project_form').clearForm();
|
|
$('#project_form input:text:first').focus();
|
|
}
|
|
|
|
/* TODO: refactor and move this to application.js */
|
|
function update_active_projects_container() {
|
|
ProjectListPage.set_state_container_visibility('active', true);
|
|
ProjectListPage.update_state_count('active', <%=@active_projects_count%>);
|
|
}
|
|
|
|
function html_for_project_listing() {
|
|
return "<%= @saved ? js_render('project_listing', {}, @project) : "" %>";
|
|
}
|
|
|
|
<% end -%> |