mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-30 13:58:49 +01:00
fix updating dependency trees when changin a name. Including invalidating cache when
necessary
This commit is contained in:
parent
1d359b22d4
commit
1a82f68d4b
5 changed files with 23 additions and 14 deletions
|
|
@ -470,7 +470,7 @@ class TodosController < ApplicationController
|
|||
def update
|
||||
@todo = current_user.todos.find_by_id(params['id'])
|
||||
@source_view = params['_source_view'] || 'todo'
|
||||
init_data_for_sidebar unless mobile?
|
||||
# init_data_for_sidebar unless mobile?
|
||||
|
||||
cache_attributes_from_before_update
|
||||
|
||||
|
|
@ -497,6 +497,8 @@ class TodosController < ApplicationController
|
|||
determine_down_count
|
||||
determine_deferred_tag_count(params['_tag_name']) if source_view_is(:tag)
|
||||
|
||||
@todo.touch_predecessors if @original_item_description != @todo.description
|
||||
|
||||
respond_to do |format|
|
||||
format.js {
|
||||
@status_message = @todo.deferred? ? t('todos.action_saved_to_tickler') : t('todos.action_saved')
|
||||
|
|
@ -1196,6 +1198,7 @@ class TodosController < ApplicationController
|
|||
@original_item_due = @todo.due
|
||||
@original_item_due_id = get_due_id_for_calendar(@todo.due)
|
||||
@original_item_predecessor_list = @todo.predecessors.map{|t| t.specification}.join(', ')
|
||||
@original_item_description = @todo.description
|
||||
@todo_was_deferred_or_blocked = @todo.deferred? || @todo.pending?
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -172,6 +172,11 @@ class Todo < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def touch_predecessors
|
||||
self.touch
|
||||
predecessors.each { |p| p.touch_predecessors }
|
||||
end
|
||||
|
||||
def removed_predecessors
|
||||
return @removed_predecessors
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,13 +1,7 @@
|
|||
<%
|
||||
suppress_context ||= false
|
||||
suppress_project ||= false
|
||||
suppress_dependencies ||= false
|
||||
parameters = "_source_view=#{@source_view}"
|
||||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
||||
@z_index_counter = @z_index_counter - 1 # for IE z-index bug
|
||||
@rec_depth ||= 0
|
||||
|
||||
cache successor do
|
||||
cache [successor, "successor"] do
|
||||
%>
|
||||
<div id="<%= dom_id(successor, 'successor') %>" class="item-container">
|
||||
<div id="<%= dom_id(successor, 'successor_line') %>">
|
||||
|
|
|
|||
|
|
@ -114,11 +114,7 @@ function html_for_error_messages() {
|
|||
}
|
||||
|
||||
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 }))%>');
|
||||
}
|
||||
<% end -%>
|
||||
regenerate_predecessor_family();
|
||||
<% if @removed_predecessors
|
||||
@removed_predecessors.each do |p| -%>
|
||||
if ($('#<%=item_container_id(p)%>')) {
|
||||
|
|
@ -127,4 +123,15 @@ function update_predecessors(next_steps) {
|
|||
<% end -%>
|
||||
<% end -%>
|
||||
next_steps.go();
|
||||
}
|
||||
|
||||
function regenerate_predecessor_family() {
|
||||
<%
|
||||
parents = @todo.predecessors
|
||||
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
|
||||
-%>
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ Tracksapp::Application.configure do
|
|||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue