Reativando o cache nas folhas de estilo
This commit is contained in:
@@ -17,7 +17,7 @@ class AttachmentsController < ApplicationController
|
||||
# :redirect_to => { :controller => 'courses', :action => :show }
|
||||
|
||||
before_filter :find_attachment, :except => [ :undelete ]
|
||||
after_filter :cache_sweep, :only => [ :create, :update, :destroy ]
|
||||
#after_filter :cache_sweep, :only => [ :create, :update, :destroy ]
|
||||
|
||||
def show
|
||||
end
|
||||
@@ -100,6 +100,6 @@ class AttachmentsController < ApplicationController
|
||||
end
|
||||
|
||||
def cache_sweep
|
||||
expire_fragment(:controller => 'courses', :action => 'show')
|
||||
expire_fragment(course_path(@course.id))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,12 +16,10 @@ class CoursesController < ApplicationController
|
||||
before_filter :require_admin, :only => [ :new, :create, :edit, :update, :destroy ]
|
||||
before_filter :require_login, :only => [ :enroll, :unenroll ]
|
||||
before_filter :find_course, :except => [ :index ]
|
||||
after_filter :cache_sweep, :only => [ :create, :update, :destroy ]
|
||||
#after_filter :cache_sweep, :only => [ :create, :update, :destroy ]
|
||||
|
||||
def index
|
||||
@courses = Course.find(:all,
|
||||
:order => 'period asc, full_name asc',
|
||||
:conditions => (logged_in? and !@current_user.courses.empty? ? [ 'id not in (?)', @current_user.courses] : ''))
|
||||
@courses = Course.find(:all, :order => 'period asc, full_name asc')
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
@@ -104,9 +102,8 @@ class CoursesController < ApplicationController
|
||||
end
|
||||
|
||||
def cache_sweep
|
||||
expire_fragment(:action => 'show', :part => 'right')
|
||||
expire_fragment(:action => 'show', :part => 'left')
|
||||
expire_fragment(:action => 'show')
|
||||
expire_fragment(:action => 'index')
|
||||
expire_fragment(course_path(@course.id, :part => 'right'))
|
||||
expire_fragment(course_path(@course.id))
|
||||
expire_fragment(courses_path)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class EventsController < ApplicationController
|
||||
|
||||
before_filter :find_event, :except => [ :mini_calendar, :undelete ]
|
||||
after_filter :cache_sweep, :only => [ :create, :update, :destroy ]
|
||||
#after_filter :cache_sweep, :only => [ :create, :update, :destroy ]
|
||||
|
||||
def index
|
||||
@events = @course.events
|
||||
@@ -113,7 +113,7 @@ class EventsController < ApplicationController
|
||||
end
|
||||
|
||||
def cache_sweep
|
||||
expire_fragment(:controller => 'courses', :action => 'show', :part => 'right')
|
||||
expire_fragment(:action => 'index')
|
||||
expire_fragment(course_path(@course.id, :part => 'right'))
|
||||
expire_fragment(course_events_path(@course.id))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ class NewsController < ApplicationController
|
||||
# :redirect_to => { :action => :list }
|
||||
|
||||
before_filter :find_new, :except => [ :undelete ]
|
||||
after_filter :cache_sweep, :only => [ :create, :update, :destroy ]
|
||||
#after_filter :cache_sweep, :only => [ :create, :update, :destroy ]
|
||||
|
||||
def index
|
||||
@news = @course.news
|
||||
@@ -105,7 +105,7 @@ class NewsController < ApplicationController
|
||||
end
|
||||
|
||||
def cache_sweep
|
||||
expire_fragment(:controller => 'courses', :action => 'show', :part => 'right')
|
||||
expire_fragment(:action => 'index')
|
||||
expire_fragment(course_path(@course.id, :part => :right))
|
||||
expire_fragment(course_news_index_path(@course.id))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class StylesheetsController < ApplicationController
|
||||
|
||||
layout nil
|
||||
caches_page :wiki
|
||||
caches_page :wiki, :color
|
||||
before_filter :set_headers
|
||||
|
||||
private
|
||||
|
||||
@@ -111,7 +111,7 @@ class UsersController < ApplicationController
|
||||
@events = []
|
||||
|
||||
if params[:format] == 'html'
|
||||
return unless require_login
|
||||
return require_login unless logged_in?
|
||||
@user = @current_user
|
||||
else
|
||||
@user = User.find_by_secret(params[:secret])
|
||||
@@ -119,7 +119,7 @@ class UsersController < ApplicationController
|
||||
|
||||
unless @user.courses.empty?
|
||||
@news = News.find(:all, :conditions => [ 'receiver_id in (?)', @user.courses ],
|
||||
:order => 'timestamp desc', :limit => 5)
|
||||
:order => 'timestamp desc', :limit => 20)
|
||||
@events = Event.find(:all, :conditions => [ 'course_id in (?) and (time > ?) and (time < ?)',
|
||||
@user.courses, 1.day.ago, 21.days.from_now ], :order => 'time')
|
||||
end
|
||||
|
||||
@@ -16,7 +16,9 @@ class WikiController < ApplicationController
|
||||
verify :params => :text, :only => :preview, :redirect_to => { :action => :show }
|
||||
verify :params => [:from, :to], :only => :diff, :redirect_to => { :action => :versions }
|
||||
|
||||
after_filter :cache_sweep, :only => [ :create, :update, :destroy ]
|
||||
#after_filter :cache_sweep, :only => [ :create, :update, :destroy, :move_up,
|
||||
# :move_down, :undelete ]
|
||||
|
||||
before_filter :find_wiki, :except => [ :preview, :undelete ]
|
||||
before_filter :require_login, :only => [ :new, :create, :edit, :update, :destroy,
|
||||
:move_up, :move_down, :undelete ]
|
||||
@@ -158,7 +160,7 @@ class WikiController < ApplicationController
|
||||
end
|
||||
|
||||
def cache_sweep
|
||||
expire_fragment(:controller => 'courses', :action => 'show')
|
||||
expire_fragment(:action => 'show')
|
||||
expire_fragment course_path(@course.id)
|
||||
expire_fragment course_wiki_path(@course.id, @wiki_page.id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
- cache(:controller => 'courses', :action => 'show', :id => @course, :part => 'left') do
|
||||
= render 'widgets/menu_disciplina'
|
||||
= render 'widgets/menu_user'
|
||||
= render 'widgets/menu_disciplina'
|
||||
= render 'widgets/menu_user'
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
- cache(:controller => 'courses', :action => 'show', :id => @course, :part => 'right') do
|
||||
= render 'widgets/calendario'
|
||||
= render 'widgets/news'
|
||||
-# cache(course_path(@course.id, :part => :right)) do
|
||||
= render 'widgets/calendario'
|
||||
= render 'widgets/news'
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
.cmd
|
||||
= action_icon('add', 'Cadastrar nova disciplina', new_course_url) if admin?
|
||||
|
||||
- cache do
|
||||
%h4.title= App.title
|
||||
%h1.title Disciplinas
|
||||
%h4.title= App.title
|
||||
%h1.title Disciplinas
|
||||
|
||||
.box
|
||||
.box
|
||||
%ul
|
||||
- if logged_in?
|
||||
%h3 Disciplinas Matriculadas
|
||||
@@ -17,13 +16,14 @@
|
||||
= action_icon('subtract', 'Desmatricular-se', unenroll_course_url(course))
|
||||
= link_to h(course.full_name), course_url(course)
|
||||
|
||||
-# cache(courses_path) do
|
||||
- old_period = 0
|
||||
- for course in @courses
|
||||
- if course.period != old_period
|
||||
%h3= (course.period == 99 ? "Optativas" : "Semestre #{course.period}")
|
||||
- old_period = course.period
|
||||
|
||||
%li{highlight(course.id)}
|
||||
%li
|
||||
.right
|
||||
= action_icon('add', 'Matricular-se', enroll_course_url(course))
|
||||
= link_to h(course.full_name), course_url(course)
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
.cmd
|
||||
- if admin?
|
||||
= action_icon 'edit', 'Editar disciplina', edit_course_url
|
||||
/= action_icon 'trash', 'Excluir disciplina', course_url, :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||
=# action_icon 'trash', 'Excluir disciplina', course_url, :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||
|
||||
- cache do
|
||||
-# cache(course_path(@course.id)) do
|
||||
|
||||
%h4.title Disciplina
|
||||
%h1.title= h(@course.full_name)
|
||||
%h4.title Disciplina
|
||||
%h1.title= h(@course.full_name)
|
||||
|
||||
%p= wiki @course.description
|
||||
%p= wiki @course.description
|
||||
|
||||
.box
|
||||
.box
|
||||
.cmd
|
||||
= action_icon 'add', 'Adicionar página wiki', new_course_wiki_url(@course)
|
||||
|
||||
%h3 Páginas Wiki
|
||||
%ul.wiki
|
||||
- @course.wiki_pages.each do |wiki|
|
||||
%li{highlight(wiki.id)}
|
||||
%li
|
||||
.cmd{:style => 'margin-bottom: -27px; margin-top: -9px;'}
|
||||
=action_icon 'arrow2_n', 'Mover para cima', move_up_course_wiki_url(@course, wiki) unless wiki.first?
|
||||
=action_icon 'arrow2_s', 'Mover para baixo', move_down_course_wiki_url(@course, wiki) unless wiki.last?
|
||||
@@ -38,3 +38,4 @@
|
||||
= link_to h(att.file_name), course_attachment_url(@course, att)
|
||||
- if @course.attachments.empty?
|
||||
%li.no_itens Nenhum arquivo
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
= javascript_include_tag 'events'
|
||||
|
||||
- cache do
|
||||
-# cache(course_events_path(@course.id)) do
|
||||
|
||||
- last_date = nil
|
||||
- last_date = nil
|
||||
|
||||
.cmd
|
||||
.cmd
|
||||
= action_icon 'add', 'Adicionar evento', new_course_event_url
|
||||
|
||||
%h4.title= h(@course.full_name)
|
||||
%h1.title Calendário
|
||||
%h4.title= h(@course.full_name)
|
||||
%h1.title Calendário
|
||||
|
||||
.box.div_calendario
|
||||
.box.div_calendario
|
||||
- if !@events.empty?
|
||||
%table
|
||||
- @events.each do |event|
|
||||
@@ -34,4 +34,4 @@
|
||||
%ul
|
||||
%li.no_itens Nenhum evento
|
||||
|
||||
%br
|
||||
%br
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
%meta{'name' => 'robots', :content => 'noindex,nofollow'}
|
||||
%meta{'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8'}
|
||||
|
||||
%link{'href' => "#{App.base_path}/stylesheets/wiki.css", 'rel' => 'Stylesheet', 'type' => %'text/css'}
|
||||
%link#css_color{'href' => "#{App.base_path}/stylesheets/themes/color.#@color.css", 'rel' => 'Stylesheet', 'type' => %'text/css'}
|
||||
%link{'href' => "#{App.base_path}/stylesheets/cache/wiki.css", 'rel' => 'Stylesheet', 'type' => %'text/css'}
|
||||
%link#css_color{'href' => "#{App.base_path}/stylesheets/cache/color.#@color.css", 'rel' => 'Stylesheet', 'type' => %'text/css'}
|
||||
|
||||
%script{:type => 'text/javascript'}
|
||||
== BASE_PATH = "#{App.base_path}";
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
= javascript_include_tag 'news'
|
||||
|
||||
- cache do
|
||||
-# cache(course_news_index_path(@course.id)) do
|
||||
|
||||
.cmd
|
||||
.cmd
|
||||
= action_icon 'add', 'Adicionar', new_course_news_url
|
||||
|
||||
%h4.title= h(@course.full_name)
|
||||
%h1.title Notícias
|
||||
%h4.title= h(@course.full_name)
|
||||
%h1.title Notícias
|
||||
|
||||
= auto_discovery_link_tag :rss, formatted_course_news_index_url(@course, :rss)
|
||||
= auto_discovery_link_tag :rss, formatted_course_news_index_url(@course, :rss)
|
||||
|
||||
.box.div_news
|
||||
.box.div_news
|
||||
- if !@course.news.empty?
|
||||
%table
|
||||
- @course.news.each do |n|
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
- cache do
|
||||
%h4.title= App.title
|
||||
%h1.title Usuários
|
||||
-# cache(users_path) do
|
||||
%h4.title= App.title
|
||||
%h1.title Usuários
|
||||
|
||||
.box
|
||||
.box
|
||||
%ul
|
||||
= render :partial => @users
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
- cache do
|
||||
#users
|
||||
#users
|
||||
.cmd
|
||||
= action_icon('edit', 'Editar perfil', edit_user_url) if admin? or @current_user == @user
|
||||
/= action_icon 'trash', 'Excluir usuário', user_url, :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||
=# action_icon 'trash', 'Excluir usuário', user_url, :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||
|
||||
.card
|
||||
%img.avatar{:src => gravatar_url_for(@user.email)}
|
||||
@@ -11,4 +10,5 @@
|
||||
%p= "Membro desde {c}"[:member_since, @user.created_at.strftime("%d de %B de %Y")]
|
||||
%p= "Última visita há {c}"[:last_seen, distance_of_time_in_words(Time.now, @user.last_seen)]
|
||||
|
||||
-# cache(user_path(@user.id)) do
|
||||
= wiki @user.description if !@user.description.blank?
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
-# cache(course_wiki_path(@course.id, @wiki_page.id)) do
|
||||
|
||||
= javascript_include_tag 'wiki'
|
||||
|
||||
.cmd
|
||||
@@ -5,12 +7,7 @@
|
||||
= action_icon 'undo', 'Historico', versions_course_wiki_url
|
||||
= action_icon 'trash', 'Excluir página wiki', course_wiki_url, :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||
|
||||
- cache(:action => 'show', :short_name => h(@course.short_name), :title => h(@wiki_page.title) ) do
|
||||
|
||||
%h4.title= h(@course.full_name)
|
||||
%h1.title= h(@wiki_page.title)
|
||||
#wiki_text
|
||||
%h4.title= h(@course.full_name)
|
||||
%h1.title= h(@wiki_page.title)
|
||||
#wiki_text
|
||||
= @wiki_page.to_html
|
||||
|
||||
%script{:language => 'javascript'}
|
||||
== enumerate_headers();
|
||||
|
||||
@@ -9,7 +9,7 @@ config.cache_classes = true
|
||||
|
||||
# Full error reports are disabled and caching is turned on
|
||||
config.action_controller.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Enable serving of images, stylesheets, and javascripts from an asset server
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
|
||||
@@ -75,8 +75,8 @@ ActionController::Routing::Routes.draw do |map|
|
||||
map.formatted_dashboard '/dashboard/:secret.:format', :controller => 'users', :action => 'dashboard'
|
||||
|
||||
# Stylesheets
|
||||
map.connect 'stylesheets/:action.:format', :controller => 'stylesheets'
|
||||
map.connect 'stylesheets/themes/:action.:color.:format', :controller => 'stylesheets'
|
||||
map.connect 'stylesheets/cache/:action.:format', :controller => 'stylesheets'
|
||||
map.connect 'stylesheets/cache/:action.:color.:format', :controller => 'stylesheets'
|
||||
|
||||
# Front page
|
||||
map.index '', :controller => 'courses', :action => 'index'
|
||||
|
||||
@@ -73,8 +73,8 @@ ActiveRecord::Schema.define(:version => 32) do
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
||||
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
|
||||
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "login", :null => false
|
||||
|
||||
Reference in New Issue
Block a user