refactor application.rb further and migrate recurring todos

next: get tests for recurring todos
This commit is contained in:
Reinier Balt 2010-12-03 17:52:24 +01:00
parent 484356fe07
commit cafa774b4c
33 changed files with 688 additions and 571 deletions

View file

@ -4,7 +4,7 @@
<% else -%>
TracksPages.hide_errors();
hide_empty_message();
set_page_badge(<%= @down_count %>);
TracksPages.set_page_badge(<%= @down_count %>);
update_active_projects_container();
add_project();
clear_form();
@ -13,19 +13,23 @@
TracksPages.show_errors(html_for_error_messages());
<% 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%>);

View file

@ -1,9 +1,10 @@
remove_deleted_project();
ProjectListPage.update_all_states_count(<%=@active_projects_count%>, <%=@hidden_projects_count%>, <%=@completed_projects_count%>)
ProjectListPage.show_or_hide_all_state_containers(<%= @show_active_projects %>, <%= @show_hidden_projects %>, <%= @show_completed_projects %>);
page_notify('notice', "Deleted project '<%= @project.name%>'", 5);
set_page_badge(<%=@down_count%>);
TracksPages.page_notify('notice', "Deleted project '<%= @project.name%>'", 5);
TracksPages.set_page_badge(<%=@down_count%>);
/* TODO: refactor and move function to application.js */
function remove_deleted_project() {
$('div#<%=dom_id(@project, "container")%>').slideUp(1000,
function() {

View file

@ -1,6 +1,6 @@
<% if @saved -%>
page_notify('notice', '<%=t('projects.project_saved_status')%>', 5);
TracksPages.page_notify('notice', '<%=t('projects.project_saved_status')%>', 5);
<% if source_view_is :project_list -%>
@ -27,23 +27,16 @@
TracksForm.set_tag_list("<%= escape_javascript(@project.default_tags)%>");
<% end %>
update_sidebar();
TracksPages.update_sidebar(html_for_sidebar());
<% end %>
TracksForm.set_project_name_and_default_project_name("<%= escape_javascript(@project.name)%>");
<% else -%>
show_errors();
TracksPages.show_edit_errors(html_for_error_messages());
<% end %>
enable_rich_interaction();
function show_errors() {
$('div#edit_error_status').html(html_for_error_messages());
$('div#edit_error_status').show();
}
function remove_project_edit_form() {
$('#<%=dom_id(@project, 'edit')%>').hide(500, function() {$('#<%=dom_id(@project, 'edit')%>').remove();} );
}
@ -53,10 +46,6 @@ function update_and_show_project_settings() {
$('#<%=dom_id(@project)%>').show();
}
function update_sidebar() {
$('#sidebar').html(html_for_sidebar());
}
function replace_project_form_with_updated_project() {
$('#<%=dom_id(@project, 'container')%>').fadeOut(250, function() {
<%
@ -97,4 +86,4 @@ function html_for_project_settings() {
function html_for_error_messages() {
return "<%= escape_javascript(error_messages_for('project')) %>";
}
}