##// END OF EJS Templates
Fixed: calendar and gantt not updated when adding/editing/deleting a project version....
Jean-Philippe Lang -
r659:c1eb587c6dcc
parent child
Show More
@@ -0,0 +1,34
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 class VersionSweeper < ActionController::Caching::Sweeper
19 observe Version
20
21 def after_save(version)
22 expire_cache_for(version)
23 end
24
25 def after_destroy(version)
26 expire_cache_for(version)
27 end
28
29 private
30 def expire_cache_for(version)
31 # calendar and gantt fragments of the project
32 expire_fragment(Regexp.new("projects/(calendar|gantt)/#{version.project_id}\\."))
33 end
34 end
@@ -25,6 +25,7 class ProjectsController < ApplicationController
25 25
26 26 cache_sweeper :project_sweeper, :only => [ :add, :edit, :archive, :unarchive, :destroy ]
27 27 cache_sweeper :issue_sweeper, :only => [ :add_issue ]
28 cache_sweeper :version_sweeper, :only => [ :add_version ]
28 29
29 30 helper :sort
30 31 include SortHelper
@@ -19,6 +19,8 class VersionsController < ApplicationController
19 19 layout 'base'
20 20 before_filter :find_project, :authorize
21 21
22 cache_sweeper :version_sweeper, :only => [ :edit, :destroy ]
23
22 24 def edit
23 25 if request.post? and @version.update_attributes(params[:version])
24 26 flash[:notice] = l(:notice_successful_update)
General Comments 0
You need to be logged in to leave comments. Login now