Commit a798a1ac authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Removed fragment caching on gantt and calendar.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1157 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 53a04b0a
......@@ -25,8 +25,6 @@ class IssuesController < ApplicationController
before_filter :authorize, :except => [:index, :changes, :preview, :update_form, :context_menu]
before_filter :find_optional_project, :only => [:index, :changes]
accept_key_auth :index, :changes
cache_sweeper :issue_sweeper, :only => [ :new, :edit, :bulk_edit, :destroy ]
helper :journals
helper :projects
......
......@@ -29,9 +29,6 @@ class ProjectsController < ApplicationController
before_filter :require_admin, :only => [ :add, :archive, :unarchive, :destroy ]
accept_key_auth :activity, :calendar
cache_sweeper :project_sweeper, :only => [ :add, :edit, :archive, :unarchive, :destroy ]
cache_sweeper :version_sweeper, :only => [ :add_version ]
helper :sort
include SortHelper
helper :custom_fields
......
......@@ -20,8 +20,6 @@ class VersionsController < ApplicationController
menu_item :roadmap
before_filter :find_project, :authorize
cache_sweeper :version_sweeper, :only => [ :edit, :destroy ]
def show
end
......
# redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueSweeper < ActionController::Caching::Sweeper
observe Issue
def after_save(issue)
expire_cache_for(issue)
end
def after_destroy(issue)
expire_cache_for(issue)
end
private
def expire_cache_for(issue)
# fragments of the main project
expire_fragment(Regexp.new("projects/(calendar|gantt)/#{issue.project_id}\\."))
# fragments of the root project that include subprojects issues
unless issue.project.parent_id.nil?
expire_fragment(Regexp.new("projects/(calendar|gantt)/#{issue.project.parent_id}\\..*subprojects"))
end
end
end
# redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class ProjectSweeper < ActionController::Caching::Sweeper
observe Project
def before_save(project)
if project.new_record?
expire_cache_for(project.parent) if project.parent
else
project_before_update = Project.find(project.id)
return if project_before_update.parent_id == project.parent_id && project_before_update.status == project.status
expire_cache_for(project.parent) if project.parent
expire_cache_for(project_before_update.parent) if project_before_update.parent
end
end
def after_destroy(project)
expire_cache_for(project.parent) if project.parent
end
private
def expire_cache_for(project)
expire_fragment(Regexp.new("projects/(calendar|gantt)/#{project.id}\\."))
end
end
# redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class VersionSweeper < ActionController::Caching::Sweeper
observe Version
def after_save(version)
expire_cache_for(version)
end
def after_destroy(version)
expire_cache_for(version)
end
private
def expire_cache_for(version)
# calendar and gantt fragments of the project
expire_fragment(Regexp.new("projects/(calendar|gantt)/#{version.project_id}\\."))
end
end
<% cache(:year => @year, :month => @month, :tracker_ids => @selected_tracker_ids, :subprojects => params[:with_subprojects], :lang => current_language) do %>
<h2><%= "#{month_name(@month)} #{@year}" %></h2>
<table width="100%">
......@@ -20,7 +19,6 @@
<%= image_tag 'arrow_from.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_begin_day) %><br />
<%= image_tag 'arrow_to.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_end_day) %><br />
<%= image_tag 'arrow_bw.png' %>&nbsp;&nbsp;<%= l(:text_tip_task_begin_end_day) %><br />
<% end %>
<% content_for :sidebar do %>
<h3><%= l(:label_calendar) %></h3>
......
......@@ -55,8 +55,6 @@ t_height = g_height + headers_height
</table>
<% end %>
<% cache(:year => @year_from, :month => @month_from, :months => @months, :zoom => @zoom, :tracker_ids => @selected_tracker_ids, :subprojects => params[:with_subprojects], :lang => current_language) do %>
<table width="100%" style="border:0; border-collapse: collapse;">
<tr>
<td style="width:<%= subject_width %>px;">
......@@ -205,9 +203,6 @@ top = headers_height + 10
<% top = top + 20
end %>
<% end # cache
%>
<%
#
# Today red line (excluded from cache)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment