decorators & tree model

This commit is contained in:
Dmitriy Zaporozhets 2011-11-20 22:32:12 +02:00
parent 6721ef01f4
commit 4bf4efe712
12 changed files with 120 additions and 29 deletions

View file

@ -84,4 +84,10 @@ class ApplicationController < ActionController::Base
nil
end
end
def no_cache_headers
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
end

View file

@ -25,16 +25,14 @@ class RefsController < ApplicationController
@repo = project.repo
@commit = @repo.commits(@ref).first
@tree = @commit.tree
@tree = @tree / params[:path] if params[:path]
@tree = Tree.new(@commit.tree, project, @ref, params[:path])
@tree = TreeDecorator.new(@tree)
respond_to do |format|
format.html # show.html.erb
format.html
format.js do
# diasbale cache to allow back button works
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
# disable cache to allow back button works
no_cache_headers
end
end
rescue