mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
small refactorings of generated javascripts
This commit is contained in:
parent
8a3cb66e49
commit
6191cce4c7
33 changed files with 125 additions and 124 deletions
|
|
@ -19,6 +19,11 @@ var TracksPages = {
|
|||
update_sidebar: function(html) {
|
||||
$('#sidebar').html(html);
|
||||
},
|
||||
slide_up_and_remove: function(selector) {
|
||||
$(selector).slideUp(1000, function() {
|
||||
$(selector).remove();
|
||||
});
|
||||
},
|
||||
setup_nifty_corners: function() {
|
||||
Nifty("div#recurring_new_container","normal");
|
||||
Nifty("div#context_new_container","normal");
|
||||
|
|
@ -42,7 +47,7 @@ var TracksPages = {
|
|||
flash.fadeIn(fadein_duration).delay(show_duration).fadeOut(fadeout_duration);
|
||||
},
|
||||
page_error: function(message) {
|
||||
TracksPages.page_notify('error', message, 5);
|
||||
TracksPages.page_notify('error', message, 8);
|
||||
},
|
||||
page_inform: function(message) {
|
||||
TracksPages.page_notify('notice', message, 5);
|
||||
|
|
|
|||
|
|
@ -242,8 +242,16 @@ module ApplicationHelper
|
|||
"#{name}_#{SecureRandom.hex(5)}"
|
||||
end
|
||||
|
||||
def js_render(object, locals = {})
|
||||
escape_javascript(render(partial: object, locals: locals))
|
||||
def js_render(partial, locals = {}, object=nil)
|
||||
if object
|
||||
escape_javascript(render(partial: partial, locals: locals, object: object))
|
||||
else
|
||||
escape_javascript(render(partial: partial, locals: locals))
|
||||
end
|
||||
end
|
||||
|
||||
def js_error_messages_for(object)
|
||||
escape_javascript(get_list_of_error_messages_for(object))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ function clear_form() {
|
|||
}
|
||||
|
||||
function html_for_context_listing() {
|
||||
return "<%= @saved ? escape_javascript(render(:partial => 'context_listing', :object => @context )) : "" %>";
|
||||
return "<%= @saved ? js_render('context_listing', {}, @context) : "" %>";
|
||||
}
|
||||
|
||||
function html_for_error_messages() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@context)) %>";
|
||||
return "<%= js_error_messages_for(@context) %>";
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ remove_deleted_context();
|
|||
ContextListPage.update_all_states_count(<%=@active_contexts_count%>, <%=@hidden_contexts_count%>, <%=@closed_contexts_count%>)
|
||||
|
||||
TracksPages.set_page_badge(<%=@down_count%>);
|
||||
TracksPages.page_notify('notice', "<%= t('contexts.context_deleted', :name=>@context.name)%>", 5);
|
||||
TracksPages.page_inform("<%= t('contexts.context_deleted', :name=>@context.name)%>");
|
||||
|
||||
/* TODO: refactor and move function to application.js */
|
||||
function remove_deleted_context() {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ var <%=object_name%> = {
|
|||
$('input.context-name').focus();
|
||||
},
|
||||
html_for_edit_form: function() {
|
||||
return "<%= escape_javascript(render(:partial => 'context_form', :object => @context)) %>";
|
||||
return "<%= js_render('context_form', {}, @context) %>";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ var <%=object_name%> = {
|
|||
TracksPages.show_edit_errors(<%=object_name%>.html_for_error_messages());
|
||||
},
|
||||
html_for_error_messages: function() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@context)) %>";
|
||||
return "<%= js_error_messages_for(@context) %>";
|
||||
}
|
||||
<% else -%>
|
||||
animate: function() {
|
||||
TracksPages.page_notify('notice', '<%= t('contexts.save_status_message') %>', 5);
|
||||
TracksPages.page_inform('<%= t('contexts.save_status_message') %>');
|
||||
<% if @state_changed -%>
|
||||
<%=object_name%>.remove_and_re_add_context();
|
||||
<%=object_name%>.update_container_states();
|
||||
|
|
@ -42,7 +42,7 @@ var <%=object_name%> = {
|
|||
ContextListPage.update_all_states_count(<%=@active_contexts.count%>, <%=@hidden_contexts.count%>, <%=@closed_contexts.count%>);
|
||||
},
|
||||
html_for_context_listing: function() {
|
||||
return "<%= escape_javascript(render(:partial => 'context_listing', :object => @context))%>";
|
||||
return "<%= js_render('context_listing', {}, @context)%>";
|
||||
}
|
||||
<% end -%>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ function clear_form() {
|
|||
}
|
||||
|
||||
function html_for_error_messages() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@note)) %>";
|
||||
return "<%= js_error_messages_for(@note) %>";
|
||||
}
|
||||
|
||||
function html_for_note_summary() {
|
||||
return "<%= @saved ? escape_javascript(render(:partial => 'notes_summary', :object => @note)) : "" %>";
|
||||
return "<%= @saved ? js_render('notes_summary', {}, @note) : "" %>";
|
||||
}
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
remove_deleted_note();
|
||||
remove_deleted_note(<%=@note.id%>);
|
||||
TracksPages.set_page_badge(<%=@down_count%>);
|
||||
TracksPages.page_notify('notice', "<%= t('notes.deleted_note', :id => @note.id)%>", 5);
|
||||
TracksPages.page_inform("<%= t('notes.deleted_note', :id => @note.id)%>");
|
||||
|
||||
function remove_deleted_note() {
|
||||
$('div#note-<%=@note.id%>-wrapper').slideUp(1000,
|
||||
function() {
|
||||
$('div#note-<%=@note.id%>-wrapper').remove();
|
||||
});
|
||||
function remove_deleted_note(id) {
|
||||
TracksPages.slide_up_and_remove('div#note-'+id+'-wrapper');
|
||||
}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
<% if @saved -%>
|
||||
|
||||
TracksPages.hide_errors();
|
||||
TracksPages.page_notify('notice', 'Note <%=@note.id %> saved', 5);
|
||||
TracksPages.page_inform("<%= t('notes.save_status_message', id: @note.id) %>");
|
||||
replace_note_form_with_updated_note();
|
||||
|
||||
<% else -%>
|
||||
TracksPages.show_errors(html_for_error_messages());
|
||||
<% end %>
|
||||
|
|
@ -17,13 +15,13 @@ function replace_note_form_with_updated_note() {
|
|||
}
|
||||
|
||||
function html_for_error_messages() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@note)) %>";
|
||||
return "<%= js_error_messages_for(@note) %>";
|
||||
}
|
||||
|
||||
function html_for_updated_note_form(){
|
||||
return "<%= escape_javascript(render(:partial => 'note_edit_form', :object => @note)) %>";
|
||||
return "<%= js_render('note_edit_form', {}, @note) %>";
|
||||
}
|
||||
|
||||
function html_for_updated_note_details(){
|
||||
return "<%= escape_javascript(render(:partial => 'note_details', :object => @note)) %>";
|
||||
return "<%= js_render('note_details', {}, @note) %>";
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
TracksPages.show_errors(html_for_error_messages());
|
||||
|
||||
function html_for_error_messages() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@project)) %>";
|
||||
return "<%= js_error_messages_for(@project) %>";
|
||||
}
|
||||
<% else -%>
|
||||
<% if @go_to_project -%>
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
update_active_projects_container();
|
||||
add_project();
|
||||
clear_form();
|
||||
TracksPages.page_notify('notice', "Created new project '<%= @project.name%>'", 5);
|
||||
TracksPages.page_inform("Created new project '<%= @project.name%>'");
|
||||
<% end -%>
|
||||
|
||||
/* TODO: make this generic for all pages with lists */
|
||||
|
|
@ -40,7 +40,7 @@ function update_active_projects_container() {
|
|||
}
|
||||
|
||||
function html_for_project_listing() {
|
||||
return "<%= @saved ? escape_javascript(render(:partial => 'project_listing', :object => @project)) : "" %>";
|
||||
return "<%= @saved ? js_render('project_listing', {}, @project) : "" %>";
|
||||
}
|
||||
|
||||
<% end -%>
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
remove_deleted_project();
|
||||
ProjectListPage.update_all_states_count(<%=@active_projects_count%>, <%=@hidden_projects_count%>, <%=@completed_projects_count%>)
|
||||
TracksPages.page_notify('notice', "Deleted project '<%= @project.name%>'", 5);
|
||||
TracksPages.page_inform("<%= t('projects.project_destroyed_status', name: @project.name) %>");
|
||||
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() {
|
||||
$('div#<%=dom_id(@project, "container")%>').remove();
|
||||
});
|
||||
TracksPages.slide_up_and_remove('div#<%=dom_id(@project, "container")%>');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,14 @@
|
|||
object_name = unique_object_name_for("edit_project_#{@project.id}")
|
||||
-%>
|
||||
var <%=object_name%> = {
|
||||
html_for_edit_form: function() {
|
||||
return "<%= escape_javascript(render(:partial => 'project_form', :object => @project)) %>";
|
||||
animate: function() {
|
||||
<%=object_name%>.replace_project_with_edit_form();
|
||||
},
|
||||
replace_project_with_edit_form: function() {
|
||||
$('<%= selector_project %>').fadeOut(250, function() {
|
||||
<%=object_name%>.show_edit_form();
|
||||
<%=object_name%>.set_focus();
|
||||
});
|
||||
},
|
||||
show_edit_form: function() {
|
||||
$('<%= selector_edit %>').html(<%=object_name%>.html_for_edit_form());
|
||||
|
|
@ -17,14 +23,8 @@ var <%=object_name%> = {
|
|||
set_focus: function() {
|
||||
$('input.project-name').focus();
|
||||
},
|
||||
replace_project_with_edit_form: function() {
|
||||
$('<%= selector_project %>').fadeOut(250, function() {
|
||||
<%=object_name%>.show_edit_form();
|
||||
<%=object_name%>.set_focus();
|
||||
});
|
||||
},
|
||||
animate: function() {
|
||||
<%=object_name%>.replace_project_with_edit_form();
|
||||
html_for_edit_form: function() {
|
||||
return "<%= js_render('project_form', {}, @project) %>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ var <%=object_name%> = {
|
|||
TracksPages.show_edit_errors(<%=object_name%>.html_for_error_messages());
|
||||
},
|
||||
html_for_error_messages: function() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@project)) %>";
|
||||
return "<%= js_error_messages_for(@project) %>";
|
||||
}
|
||||
<%-
|
||||
else
|
||||
-%>
|
||||
animate: function() {
|
||||
TracksPages.page_notify('notice', '<%=t('projects.project_saved_status')%>', 5);
|
||||
TracksPages.page_inform('<%=t('projects.project_saved_status')%>');
|
||||
<% if source_view_is_one_of(:project_list, :review) -%>
|
||||
<%=object_name%>.update_project_list_page();
|
||||
<% else # assume source_view :project -%>
|
||||
|
|
@ -84,13 +84,13 @@ var <%=object_name%> = {
|
|||
# render it into the function.
|
||||
-%>
|
||||
html_for_project_listing: function() {
|
||||
return "<%= source_view_is_one_of(:project_list, :review) ? escape_javascript(render(:partial => 'project_listing', :object => @project, :locals=>{:suppress_drag_handle => source_view_is(:review)} )) : "" %>";
|
||||
return "<%= source_view_is_one_of(:project_list, :review) ? js_render('project_listing', {:suppress_drag_handle => source_view_is(:review)}, @project) : "" %>";
|
||||
},
|
||||
html_for_sidebar: function() {
|
||||
return "<%= source_view_is(:project) ? escape_javascript(render(:file => 'sidebar/sidebar')) : "" %>";
|
||||
},
|
||||
html_for_project_settings: function() {
|
||||
return "<%= source_view_is(:project) ? escape_javascript(render(:partial => 'project_settings', :object => @project )) : "" %>";
|
||||
return "<%= source_view_is(:project) ? js_render('project_settings', {}, @project) : "" %>";
|
||||
}
|
||||
<% end # if @saved -%>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<% if @saved -%>
|
||||
TracksPages.page_notify('notice', '<%=t('projects.status_project_name_changed')%>', 5);
|
||||
TracksPages.page_inform('<%=t('projects.status_project_name_changed')%>');
|
||||
TracksForm.set_project_name("<%= escape_javascript(@project.name)%>");
|
||||
<% end %>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<% if @saved -%>
|
||||
TracksPages.page_notify('notice', "<%=@status_message%>", 5);
|
||||
TracksPages.page_inform("<%=@status_message%>");
|
||||
add_recurring_todo_to_active_container();
|
||||
replace_form_with_empty_form();
|
||||
$( "#new-recurring-todo" ).dialog( "close" );
|
||||
|
|
@ -19,13 +19,13 @@ function add_recurring_todo_to_active_container() {
|
|||
}
|
||||
|
||||
function html_for_recurring_todo() {
|
||||
return "<%= @saved ? escape_javascript(render(:partial => @recurring_todo)) : "" %>";
|
||||
return "<%= @saved ? js_render(@recurring_todo) : "" %>";
|
||||
}
|
||||
|
||||
function html_for_empty_form() {
|
||||
return "<%= @saved ? escape_javascript(render(:partial => 'recurring_todo_form')) : "" %>";
|
||||
return "<%= @saved ? js_render('recurring_todo_form') : "" %>";
|
||||
}
|
||||
|
||||
function html_for_error_messages() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@recurring_todo)) %>";
|
||||
return "<%= js_error_messages_for(@recurring_todo) %>";
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<%- if @saved -%>
|
||||
show_empty_messages();
|
||||
TracksPages.page_notify('notice', '<%= escape_javascript(t('todos.recurring_deleted_success') + t('todos.recurring_pattern_removed', :count => pluralize(@number_of_todos,t('common.todo')))) %>', 5);
|
||||
TracksPages.page_inform('<%= escape_javascript(t('todos.recurring_deleted_success') + t('todos.recurring_pattern_removed', :count => pluralize(@number_of_todos,t('common.todo')))) %>');
|
||||
remove_recurring_todo_from_page();
|
||||
<%- else -%>
|
||||
TracksPages.page_notify('error', '<%= t('todos.error_deleting_recurring', :description => @recurring_todo.description) %>', 8);
|
||||
TracksPages.page_error('<%= t('todos.error_deleting_recurring', :description => @recurring_todo.description) %>');
|
||||
<%- end -%>
|
||||
|
||||
function show_empty_messages() {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ var <%=object_name%> = {
|
|||
$('#edit-recurring-todo').dialog( "open" );
|
||||
},
|
||||
html_for_edit_form: function() {
|
||||
return "<%= escape_javascript(render(:partial => 'edit_form')) %>";
|
||||
return "<%= js_render('edit_form') %>";
|
||||
}
|
||||
}
|
||||
<%=object_name%>.animate();
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<%- unless @saved -%>
|
||||
TracksPages.page_notify('error', '<%= t('todos.error_completing_todo', :description => @recurring_todo.description) %>', 8);
|
||||
TracksPages.page_error('<%= t('todos.error_completing_todo', :description => @recurring_todo.description) %>');
|
||||
<%- else
|
||||
object_name = unique_object_name_for("toggle_check_rec")
|
||||
-%>
|
||||
|
|
@ -10,7 +10,7 @@ var <%=object_name%> = {
|
|||
<%= "#{object_name}.inform_if_new_todo_created();" if @new_recurring_todo -%>
|
||||
},
|
||||
inform_if_new_todo_created: function() {
|
||||
TracksPages.page_notify('notice', '<%= t('todos.new_related_todo_created') %>', 5);
|
||||
TracksPages.page_inform('<%= t('todos.new_related_todo_created') %>');
|
||||
},
|
||||
remove_old_and_add_updated_recurring_todo: function() {
|
||||
$('#<%=dom_id(@recurring_todo)%>').slideUp(1000, function() {
|
||||
|
|
@ -43,7 +43,7 @@ var <%=object_name%> = {
|
|||
<%- end -%>
|
||||
},
|
||||
html_for_recurring_todo: function() {
|
||||
return "<%= @saved ? escape_javascript(render(:partial => @recurring_todo)) : "" %>";
|
||||
return "<%= @saved ? js_render(@recurring_todo) : "" %>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<%- if @saved -%>
|
||||
$('div#recurring_todo_<%= @recurring_todo.id %> a.star_item img').toggleClass('starred');
|
||||
<%- else -%>
|
||||
TracksPages.page_notify('error', '<%= t('todos.error_starring_recurring', :description => @recurring_todo.description) %>', 8);
|
||||
TracksPages.page_error('<%= t('todos.error_starring_recurring', :description => @recurring_todo.description) %>');
|
||||
<%- end -%>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<%- if @saved -%>
|
||||
$( "#edit-recurring-todo" ).dialog( "close" );
|
||||
TracksPages.page_notify('notice', text_for_status_message(), 5);
|
||||
TracksPages.page_inform(text_for_status_message());
|
||||
replace_old_recurring_todo_with_updated();
|
||||
<%- else -%>
|
||||
TracksPages.show_edit_errors(html_for_error_messages());
|
||||
|
|
@ -21,7 +21,7 @@ function replace_old_recurring_todo_with_updated() {
|
|||
}
|
||||
|
||||
function html_for_updated_recurring_todo() {
|
||||
return "<%= escape_javascript(render(:partial => @recurring_todo))%>";
|
||||
return "<%= js_render(@recurring_todo)%>";
|
||||
}
|
||||
|
||||
function text_for_status_message() {
|
||||
|
|
@ -34,5 +34,5 @@ function text_for_status_message() {
|
|||
}
|
||||
|
||||
function html_for_error_messages() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@recurring_todo)) %>";
|
||||
return "<%= js_error_messages_for(@recurring_todo) %>";
|
||||
}
|
||||
|
|
@ -1,20 +1,19 @@
|
|||
<% if !@saved
|
||||
if @predecessor.completed? -%>
|
||||
TracksPages.page_notify('error', "<%= t('todos.cannot_add_dependency_to_completed_todo') %>", 8);
|
||||
TracksPages.page_error("<%= t('todos.cannot_add_dependency_to_completed_todo') %>");
|
||||
$('#<%=dom_id(@todo)%>').html(html_for_todo());
|
||||
<% else -%>
|
||||
TracksPages.page_notify('error', "<%= t('todos.unable_to_add_dependency') %>", 8);
|
||||
TracksPages.page_error("<%= t('todos.unable_to_add_dependency') %>");
|
||||
<% end
|
||||
else -%>
|
||||
remove_successor_from_page();
|
||||
replace_updated_predecessor();
|
||||
regenerate_predecessor_family();
|
||||
<%= "show_in_tickler_box();".html_safe if source_view_is_one_of :project, :tag, :context %>
|
||||
TracksPages.page_notify('notice', "<%= @status_message %>", 5);
|
||||
TracksPages.page_inform("<%= @status_message %>");
|
||||
|
||||
function remove_successor_from_page() {
|
||||
<% # TODO: last todo in context --> remove context??
|
||||
-%>
|
||||
<% # TODO: last todo in context --> remove context?? -%>
|
||||
$('#<%=dom_id(@todo)%>').remove();
|
||||
}
|
||||
|
||||
|
|
@ -33,13 +32,12 @@ function regenerate_predecessor_family() {
|
|||
until parents.empty?
|
||||
parent = parents.pop
|
||||
parents += parent.predecessors -%>
|
||||
$('#<%= dom_id(parent) %>').html("<%= escape_javascript(render(:partial => parent, :locals => { :parent_container_type => parent_container_type })) %>");
|
||||
<%end
|
||||
-%>
|
||||
$('#<%= dom_id(parent) %>').html("<%= js_render(parent, { :parent_container_type => parent_container_type }) %>");
|
||||
<%end-%>
|
||||
}
|
||||
|
||||
function html_for_predecessor() {
|
||||
return "<%= escape_javascript(render(:partial => @predecessor, :locals => { :parent_container_type => parent_container_type })) %>";
|
||||
return "<%= js_render(@predecessor, { :parent_container_type => parent_container_type }) %>";
|
||||
}
|
||||
|
||||
<% end # if !@saved
|
||||
|
|
@ -48,6 +46,5 @@ function html_for_predecessor() {
|
|||
%>
|
||||
|
||||
function html_for_todo() {
|
||||
return "<%= escape_javascript(render(:partial => @todo, :locals => { :parent_container_type => parent_container_type })) %>";
|
||||
return "<%= js_render(@todo, { :parent_container_type => parent_container_type }) %>";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
<% unless @due_tickles.empty? -%>
|
||||
TracksPages.page_notify('notice', "<%=t('todos.tickler_items_due', :count => @due_tickles.length)%>", 8);
|
||||
TracksPages.page_inform("<%=t('todos.tickler_items_due', :count => @due_tickles.length)%>");
|
||||
<% end -%>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
<% unless @saved -%>
|
||||
|
||||
TracksPages.show_errors(html_for_error_messages());
|
||||
|
||||
function html_for_error_messages() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@todo)) %>";
|
||||
return "<%= js_error_messages_for(@todo) %>";
|
||||
}
|
||||
|
||||
<% else
|
||||
|
||||
animation = []
|
||||
|
|
@ -22,7 +20,7 @@
|
|||
-%>
|
||||
|
||||
<%= render_animation(animation) %>
|
||||
TracksPages.page_notify('notice', "<%=escape_javascript @status_message%>", 8);
|
||||
TracksPages.page_inform("<%=escape_javascript @status_message%>");
|
||||
TracksPages.hide_errors();
|
||||
TracksPages.set_page_badge(<%= @down_count %>);
|
||||
|
||||
|
|
@ -60,14 +58,13 @@
|
|||
|
||||
function remove_empty_message_container(next_steps) {
|
||||
$('#no_todos_in_view').slideUp(100, function() { });
|
||||
<%# = "$('#deferred_pending_container-empty-nd').slideUp(100);".html_safe if source_view_is(:deferred) && @todo.deferred? %>
|
||||
next_steps.go();
|
||||
}
|
||||
|
||||
function update_predecessors(next_steps) {
|
||||
<% @todo.uncompleted_predecessors.each do |p| -%>
|
||||
if ($('<%=item_container_id(p)%>')) {
|
||||
$('#<%=dom_id(p)%>').html('<%= escape_javascript(render(:partial => p, :locals => { :parent_container_type => parent_container_type, :source_view => @source_view }))%>');
|
||||
$('#<%=dom_id(p)%>').html('<%= js_render(p, { :parent_container_type => parent_container_type, :source_view => @source_view })%>');
|
||||
}
|
||||
<% end -%>
|
||||
next_steps.go();
|
||||
|
|
@ -77,13 +74,12 @@
|
|||
<%
|
||||
want_render = @group_view_by == 'project' ? @new_project_created : @new_context_created
|
||||
container = @group_view_by == 'project' ? @todo.project : @todo.context
|
||||
js = want_render ? escape_javascript(render(:partial => container, :locals => { :settings => {:collapsible => true} })) : ""
|
||||
%>
|
||||
return "<%= js %>";
|
||||
return "<%= want_render ? js_render(container, { :settings => {:collapsible => true} }) : "" %>";
|
||||
}
|
||||
|
||||
function html_for_new_todo() {
|
||||
return "<%= @saved ? escape_javascript(render(:partial => @todo, :locals => { :parent_container_type => parent_container_type, :source_view => @source_view })) : "" %>";
|
||||
return "<%= @saved ? js_render(@todo, { :parent_container_type => parent_container_type, :source_view => @source_view }) : "" %>";
|
||||
}
|
||||
|
||||
<% end -%>
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
}
|
||||
|
||||
<% else -%>
|
||||
TracksPages.page_notify('notice', "<%=@status_message%>", 5);
|
||||
TracksPages.page_inform("<%=@status_message%>");
|
||||
hide_empty_message();
|
||||
TracksPages.hide_errors();
|
||||
TracksPages.set_page_badge(<%= @down_count %>);
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
<%
|
||||
@todos.each do |todo|
|
||||
if should_show_new_item(todo)
|
||||
html = escape_javascript(render(:partial => todo, :locals => { :parent_container_type => parent_container_type, :source_view => @source_view }))
|
||||
html = js_render(todo, { :parent_container_type => parent_container_type, :source_view => @source_view })
|
||||
-%>
|
||||
$('#<%= empty_container_msg_div_id(todo) %>').hide();
|
||||
$('#<%= item_container_id(todo) %>').append('<%= html %>');
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
}
|
||||
|
||||
function html_for_new_context() {
|
||||
return "<%= @new_context_created ? escape_javascript(render(:partial => @todo.context, :locals => { :settings => {:collapsible => true} })) : "" %>";
|
||||
return "<%= @new_context_created ? js_render(@todo.context, { :settings => {:collapsible => true} }) : "" %>";
|
||||
}
|
||||
|
||||
<% end -%>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<%- unless @saved -%>
|
||||
TracksPages.page_notify('error', "<%= t('todos.error_deleting_item', :description => @todo.description) %>", 8);
|
||||
TracksPages.page_error("<%= t('todos.error_deleting_item', :description => @todo.description) %>");
|
||||
<%- else -%>
|
||||
TracksPages.page_notify('notice', '<%= escape_javascript(t('todos.deleted_success')) %>', 5);
|
||||
TracksPages.page_inform('<%= escape_javascript(t('todos.deleted_success')) %>');
|
||||
TracksPages.set_page_badge(<%=@down_count%>);
|
||||
remove_todo_from_page();
|
||||
show_new_todo_if_todo_was_recurring();
|
||||
|
|
@ -56,10 +56,10 @@ function show_new_todo_if_todo_was_recurring() {
|
|||
TodoItemsContainer.ensureVisibleWithEffectAppear("<%=item_container_id(@new_recurring_todo)%>");
|
||||
$('#<%=item_container_id(@new_recurring_todo)%>_items').append(html_for_new_recurring_todo());
|
||||
$('#<%= dom_id(@new_recurring_todo, 'line')%>').effect('highlight', {}, 2000 );
|
||||
TracksPages.page_notify('notice', "<%=t('todos.recurring_action_deleted')%>", 5);
|
||||
TracksPages.page_inform("<%=t('todos.recurring_action_deleted')%>");
|
||||
<% else -%>
|
||||
<% if @todo.recurring_todo.todos.active.count(:all) == 0 && @new_recurring_todo.nil? -%>
|
||||
TracksPages.page_notify('notice', "<%=t('todos.completed_recurrence_completed')%>", 5);
|
||||
TracksPages.page_inform("<%=t('todos.completed_recurrence_completed')%>");
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
|
@ -70,7 +70,7 @@ function activate_pending_todos() {
|
|||
if @saved && @pending_to_activate
|
||||
# do not render the js in case of an error or if no todos to activate
|
||||
@pending_to_activate.each do |t|
|
||||
html = escape_javascript(render(:partial => t, :locals => { :parent_container_type => parent_container_type }))
|
||||
html = js_render(t, { :parent_container_type => parent_container_type })
|
||||
# only project and tag view have a deferred/blocked container
|
||||
if source_view_is_one_of(:project,:tag) -%>
|
||||
$('#<%= dom_id(t) %>').fadeOut(400, function() {
|
||||
|
|
@ -91,7 +91,7 @@ function update_predecessors() {
|
|||
if @todo_was_destroyed_from_pending_state
|
||||
@uncompleted_predecessors.each do |p| -%>
|
||||
if ($('#<%=item_container_id(p)%>')) {
|
||||
$('#<%=dom_id(p)%>').html('<%=escape_javascript(render(:partial => p, :locals => { :parent_container_type => parent_container_type }))%>');
|
||||
$('#<%=dom_id(p)%>').html('<%=js_render(p, { :parent_container_type => parent_container_type })%>');
|
||||
}
|
||||
<% end
|
||||
end
|
||||
|
|
@ -99,5 +99,5 @@ function update_predecessors() {
|
|||
}
|
||||
|
||||
function html_for_new_recurring_todo() {
|
||||
return "<%= @saved && @new_recurring_todo ? escape_javascript(render(:partial => @new_recurring_todo, :locals => { :parent_container_type => parent_container_type })) : "" %>";
|
||||
return "<%= @saved && @new_recurring_todo ? js_render(@new_recurring_todo, { :parent_container_type => parent_container_type }) : "" %>";
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ var <%=object_name%> = {
|
|||
<% end -%>
|
||||
},
|
||||
html_for_edit_form: function() {
|
||||
return "<%= escape_javascript(render(:partial => 'todos/edit_form', :object => @todo)) %>"
|
||||
return "<%= js_render('todos/edit_form', {}, @todo) %>"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<%
|
||||
# TODO: is this ever called?
|
||||
-%>
|
||||
TracksPages.page_notify('error', "<%=@error_message || t('common.server_error')%>", 8);
|
||||
TracksPages.page_error("<%=@error_message || t('common.server_error')%>");
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<% # TODO: lots of overlap with add_predecessor --> helpers?
|
||||
if @removed -%>
|
||||
TracksPages.page_notify('notice', "<%= t('todos.removed_predecessor', :successor => @successor.description, :predecessor => @predecessor.description) %>", 8);
|
||||
TracksPages.page_inform("<%= t('todos.removed_predecessor', :successor => @successor.description, :predecessor => @predecessor.description) %>");
|
||||
|
||||
replace_updated_predecessor();
|
||||
regenerate_predecessor_family();
|
||||
update_successor();
|
||||
<% else -%>
|
||||
TracksPages.page_notify('error', "<%=t('todos.error_removing_dependency')%>", 8);
|
||||
TracksPages.page_error("<%=t('todos.error_removing_dependency')%>");
|
||||
<% end -%>
|
||||
|
||||
function replace_updated_predecessor() {
|
||||
|
|
@ -19,7 +19,7 @@ function regenerate_predecessor_family() {
|
|||
until parents.empty?
|
||||
parent = parents.pop
|
||||
parents += parent.predecessors -%>
|
||||
$('#<%= dom_id(parent) %>').html("<%= escape_javascript(render(:partial => parent, :locals => { :parent_container_type => parent_container_type })) %>");
|
||||
$('#<%= dom_id(parent) %>').html("<%= js_render(parent, { :parent_container_type => parent_container_type }) %>");
|
||||
<%end -%>
|
||||
}
|
||||
|
||||
|
|
@ -48,16 +48,16 @@ function hide_empty_message() {
|
|||
function show_empty_deferred_message() {
|
||||
$('#deferred_pending_container-empty-d').slideDown(100);
|
||||
}
|
||||
|
||||
function remove_successor() {
|
||||
<% # TODO: last todo in context --> remove context??
|
||||
-%>
|
||||
<% # TODO: last todo in context --> remove context?? -%>
|
||||
$('#<%=dom_id(@successor)%>').remove();
|
||||
}
|
||||
|
||||
function html_for_predecessor() {
|
||||
return "<%= @removed ? escape_javascript(render(:partial => @predecessor, :locals => { :parent_container_type => parent_container_type })) : "" %>";
|
||||
return "<%= @removed ? js_render(@predecessor, { :parent_container_type => parent_container_type }) : "" %>";
|
||||
}
|
||||
|
||||
function html_for_new_successor() {
|
||||
return "<%= @removed ? escape_javascript(render(:partial => @successor, :locals => { :parent_container_type => parent_container_type })) : "" %>";
|
||||
return "<%= @removed ? js_render(@successor, { :parent_container_type => parent_container_type }) : "" %>";
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ var <%= object_name %> = {
|
|||
});
|
||||
<% else
|
||||
if @todo.recurring_todo.todos.active.count(:all) == 0 && @new_recurring_todo.nil? -%>
|
||||
TracksPages.page_notify('notice', "<%=t('todos.recurrence_completed')%>", 6);
|
||||
TracksPages.page_inform("<%=t('todos.recurrence_completed')%>");
|
||||
<% end -%>
|
||||
next_steps.go();
|
||||
<% end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<%- if @saved -%>
|
||||
$('div#line_todo_<%= @todo.id %> a.star_item img').toggleClass('starred');
|
||||
<%- else -%>
|
||||
TracksPages.page_notify('error', '<%= t('todos.error_starring', :description => @todo.description) %>', 8);
|
||||
TracksPages.page_error('<%= t('todos.error_starring', :description => @todo.description) %>');
|
||||
<%- end -%>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<% if @saved -%>
|
||||
remove_user_from_page();
|
||||
TracksPages.set_page_badge(<%= @total_users %>);
|
||||
TracksPages.page_notify('notice', '<%= t('users.destroy_successful', :login => @deleted_user.login) %>', 8);
|
||||
TracksPages.page_inform('<%= t('users.destroy_successful', :login => @deleted_user.login) %>');
|
||||
<% else -%>
|
||||
TracksPages.page_notify('error', '<%= t('users.destroy_error', :login => @deleted_user.login) %>', 8);
|
||||
TracksPages.page_error('<%= t('users.destroy_error', :login => @deleted_user.login) %>');
|
||||
<% end -%>
|
||||
|
||||
function remove_user_from_page() {
|
||||
$("#user-<%= @deleted_user.id%>").remove();
|
||||
TracksPages.slide_up_and_remove("#user-<%= @deleted_user.id%>");
|
||||
}
|
||||
|
|
@ -764,6 +764,7 @@ en:
|
|||
list_projects: TRACKS::List Projects
|
||||
list_reviews: TRACKS::Review
|
||||
project_saved_status: Project saved
|
||||
project_destroyed_status: "Deleted project '%{name}'"
|
||||
add_project: Add Project
|
||||
add_note: Add a note
|
||||
completed_tasks_title: "TRACKS::List Completed Actions in Project '%{project_name}'"
|
||||
|
|
@ -792,6 +793,7 @@ en:
|
|||
note_header: Note %{id}
|
||||
delete_note_confirm: "Are you sure that you want to delete the note '%{id}'?"
|
||||
in_project: "In: "
|
||||
save_status_message: "Note %{id} was saved"
|
||||
integrations:
|
||||
opensearch_description: Search in Tracks
|
||||
applescript_next_action_prompt: "Description of next action:"
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ When /^I edit the state of context "(.*?)" to closed$/ do |context_name|
|
|||
end
|
||||
|
||||
Then /^context "([^"]*)" should be above context "([^"]*)"$/ do |context_high, context_low|
|
||||
sleep 0.2
|
||||
expect(context_list_find_index(context_high)).to be < context_list_find_index(context_low)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue