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,30 +1,30 @@
|
||||
.cmd
|
||||
= action_icon('add', 'Cadastrar nova disciplina', new_course_url) if admin?
|
||||
|
||||
- cache do
|
||||
%h4.title= App.title
|
||||
%h1.title Disciplinas
|
||||
|
||||
.box
|
||||
%ul
|
||||
- if logged_in?
|
||||
%h3 Disciplinas Matriculadas
|
||||
- if @current_user.courses.empty?
|
||||
%li.no_itens Nenhuma disciplina matriculada
|
||||
- for course in @current_user.courses
|
||||
%li{highlight(course.id)}
|
||||
.right
|
||||
= action_icon('subtract', 'Desmatricular-se', unenroll_course_url(course))
|
||||
= link_to h(course.full_name), course_url(course)
|
||||
|
||||
- old_period = 0
|
||||
- for course in @courses
|
||||
- if course.period != old_period
|
||||
%h3= (course.period == 99 ? "Optativas" : "Semestre #{course.period}")
|
||||
- old_period = course.period
|
||||
%h4.title= App.title
|
||||
%h1.title Disciplinas
|
||||
|
||||
.box
|
||||
%ul
|
||||
- if logged_in?
|
||||
%h3 Disciplinas Matriculadas
|
||||
- if @current_user.courses.empty?
|
||||
%li.no_itens Nenhuma disciplina matriculada
|
||||
- for course in @current_user.courses
|
||||
%li{highlight(course.id)}
|
||||
.right
|
||||
= action_icon('add', 'Matricular-se', enroll_course_url(course))
|
||||
= 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
|
||||
.right
|
||||
= action_icon('add', 'Matricular-se', enroll_course_url(course))
|
||||
= link_to h(course.full_name), course_url(course)
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
.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
|
||||
.cmd
|
||||
= action_icon 'add', 'Adicionar página wiki', new_course_wiki_url(@course)
|
||||
.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)}
|
||||
.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?
|
||||
- if wiki.last?
|
||||
%span{:style => 'margin-right: 14px'}
|
||||
=link_to h(wiki.title), course_wiki_url(@course, wiki)
|
||||
- if @course.wiki_pages.empty?
|
||||
%li.no_itens Nenhuma página wiki
|
||||
%h3 Páginas Wiki
|
||||
%ul.wiki
|
||||
- @course.wiki_pages.each do |wiki|
|
||||
%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?
|
||||
- if wiki.last?
|
||||
%span{:style => 'margin-right: 14px'}
|
||||
=link_to h(wiki.title), course_wiki_url(@course, wiki)
|
||||
- if @course.wiki_pages.empty?
|
||||
%li.no_itens Nenhuma página wiki
|
||||
|
||||
.box
|
||||
.cmd= action_icon 'add', 'Adicionar anexo', new_course_attachment_url(@course)
|
||||
@@ -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,37 +1,37 @@
|
||||
= javascript_include_tag 'events'
|
||||
|
||||
- cache do
|
||||
-# cache(course_events_path(@course.id)) do
|
||||
|
||||
- last_date = nil
|
||||
- last_date = nil
|
||||
|
||||
.cmd
|
||||
= action_icon 'add', 'Adicionar evento', new_course_event_url
|
||||
.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
|
||||
- if !@events.empty?
|
||||
%table
|
||||
- @events.each do |event|
|
||||
%tr[event]
|
||||
%td.top.aright{:width => '1%'}
|
||||
= event.time.strftime("%d de %B") #unless event.time == last_date
|
||||
%td.top{:width => '1%'}
|
||||
= event.time.strftime("%H:%M")
|
||||
%td.top
|
||||
.title=link_to h(event.title), course_event_url(@course, event)
|
||||
.description{:style => (event.id == params[:id].to_i ? '' : 'display: none')}
|
||||
%div.cmd
|
||||
= action_icon 'edit', 'Editar', edit_course_event_url(@course, event)
|
||||
= action_icon 'trash', 'Excluir', course_event_url(@course, event), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||
= h(event.description)
|
||||
= "Sem descrição" if event.description.empty?
|
||||
.box.div_calendario
|
||||
- if !@events.empty?
|
||||
%table
|
||||
- @events.each do |event|
|
||||
%tr[event]
|
||||
%td.top.aright{:width => '1%'}
|
||||
= event.time.strftime("%d de %B") #unless event.time == last_date
|
||||
%td.top{:width => '1%'}
|
||||
= event.time.strftime("%H:%M")
|
||||
%td.top
|
||||
.title=link_to h(event.title), course_event_url(@course, event)
|
||||
.description{:style => (event.id == params[:id].to_i ? '' : 'display: none')}
|
||||
%div.cmd
|
||||
= action_icon 'edit', 'Editar', edit_course_event_url(@course, event)
|
||||
= action_icon 'trash', 'Excluir', course_event_url(@course, event), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||
= h(event.description)
|
||||
= "Sem descrição" if event.description.empty?
|
||||
|
||||
- last_date = event.time
|
||||
- else
|
||||
.box
|
||||
%ul
|
||||
%li.no_itens Nenhum evento
|
||||
- last_date = event.time
|
||||
- else
|
||||
.box
|
||||
%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,31 +1,31 @@
|
||||
= javascript_include_tag 'news'
|
||||
|
||||
- cache do
|
||||
-# cache(course_news_index_path(@course.id)) do
|
||||
|
||||
.cmd
|
||||
= action_icon 'add', 'Adicionar', new_course_news_url
|
||||
.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
|
||||
- if !@course.news.empty?
|
||||
%table
|
||||
- @course.news.each do |n|
|
||||
%tr[n]
|
||||
%td.top.aright{:width => '1%'}
|
||||
= n.timestamp.strftime("%d de %B")
|
||||
%td
|
||||
.title= link_to h(n.title), course_news_url(@course, n)
|
||||
.description{:style => (n.id == params[:id].to_i ? '' : 'display: none')}
|
||||
.cmd
|
||||
= action_icon 'edit', 'Editar', edit_course_news_url(@course, n)
|
||||
= action_icon 'trash', 'Excluir', course_news_url(@course, n), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||
= h(n.body)
|
||||
= "Sem descrição" if n.body.empty?
|
||||
- else
|
||||
.box
|
||||
%ul
|
||||
%li.no_itens Nenhuma notícia
|
||||
.box.div_news
|
||||
- if !@course.news.empty?
|
||||
%table
|
||||
- @course.news.each do |n|
|
||||
%tr[n]
|
||||
%td.top.aright{:width => '1%'}
|
||||
= n.timestamp.strftime("%d de %B")
|
||||
%td
|
||||
.title= link_to h(n.title), course_news_url(@course, n)
|
||||
.description{:style => (n.id == params[:id].to_i ? '' : 'display: none')}
|
||||
.cmd
|
||||
= action_icon 'edit', 'Editar', edit_course_news_url(@course, n)
|
||||
= action_icon 'trash', 'Excluir', course_news_url(@course, n), :confirm => 'Tem certeza que deseja excluir?', :method => :delete
|
||||
= h(n.body)
|
||||
= "Sem descrição" if n.body.empty?
|
||||
- else
|
||||
.box
|
||||
%ul
|
||||
%li.no_itens Nenhuma notícia
|
||||
|
||||
@@ -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
|
||||
%ul
|
||||
= render :partial => @users
|
||||
.box
|
||||
%ul
|
||||
= render :partial => @users
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
- cache do
|
||||
#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
|
||||
#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
|
||||
|
||||
.card
|
||||
%img.avatar{:src => gravatar_url_for(@user.email)}
|
||||
%h1.title= h(@user.display_name)
|
||||
%p= h(@user.name)
|
||||
%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)]
|
||||
.card
|
||||
%img.avatar{:src => gravatar_url_for(@user.email)}
|
||||
%h1.title= h(@user.display_name)
|
||||
%p= h(@user.name)
|
||||
%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)]
|
||||
|
||||
= wiki @user.description if !@user.description.blank?
|
||||
-# 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
|
||||
= @wiki_page.to_html
|
||||
|
||||
%script{:language => 'javascript'}
|
||||
== enumerate_headers();
|
||||
%h4.title= h(@course.full_name)
|
||||
%h1.title= h(@wiki_page.title)
|
||||
#wiki_text
|
||||
= @wiki_page.to_html
|
||||
|
||||
Reference in New Issue
Block a user