Skip to content
Browse files

add some more informations on cache management page

  • Loading branch information...
1 parent 469efd6 commit 68a0524b193d038c9dc0d769ba700d4c20611f29 Jean-Philippe Boily committed Oct 2, 2012
View
2 CHANGELOG.md
@@ -2,7 +2,7 @@
(for upgrade informations, see UPGRADE.md)
## 0.2.0.beta
-- **IMPORTANT: add cache management config and UI. Please review the new config options!**
+- **IMPORTANT: add cache management config and UI. [Please review the new config options](https://github.com/jipiboily/monologue/wiki/Configure-Monologue's-cache)!**
- add tags
- add a UI to manage current user's account (welcome in 2012, you can now change your password!)
- add RSS icon
View
17 app/controllers/monologue/admin/cache_controller.rb
@@ -1,10 +1,7 @@
class Monologue::Admin::CacheController < Monologue::Admin::BaseController
+ before_filter :prepare_file_list
+
def show
- @wipe_after_save = Monologue::PageCache.wipe_after_save
- # puts "ActionController::Base.perform_caching #{ActionController::Base.perform_caching}"
- # puts "Monologue::PageCache.enabled #{Monologue::PageCache.enabled}"
- # puts "Monologue::PageCache.wipe_enabled #{Monologue::PageCache.wipe_enabled}"
- # puts "ActionController::Base.page_cache_directory #{ActionController::Base.page_cache_directory} || Rails.public_path #{Rails.public_path}"
if ActionController::Base.perform_caching && Monologue::PageCache.enabled && Monologue::PageCache.wipe_enabled && ActionController::Base.page_cache_directory != Rails.public_path
render :show
else
@@ -17,4 +14,14 @@ def destroy
flash.notice = I18n.t("monologue.admin.cache.show.cache_wiped")
render :show
end
+
+ private
+ def prepare_file_list
+ @files = []
+ Dir.glob("#{ActionController::Base.page_cache_directory}/**/*").each do |file|
+ next if File.directory?(file)
+ @files << file.gsub(ActionController::Base.page_cache_directory,"")
+ end
+ @files
+ end
end
View
18 app/views/monologue/admin/cache/_config.html.erb
@@ -0,0 +1,18 @@
+<h1>Current config</h1>
+<p>Want to know more about those configs? See here: <%= link_to "Configure Monologue's cache (english only)", "https://github.com/jipiboily/monologue/wiki/Configure-Monologue's-cache", :target => "_blank" %></p>
+
+<div class="alert alert-<%= ActionController::Base.perform_caching ? "success" : "error" %>">
+ ActionController::Base.perform_caching = <%= ActionController::Base.perform_caching %>
+</div>
+
+<div class="alert alert-<%= ActionController::Base.page_cache_directory != Rails.public_path ? "success" : "error" %>">
+ ActionController::Base.page_cache_directory = <%= ActionController::Base.page_cache_directory %>
+</div>
+
+<div class="alert alert-<%= Monologue::PageCache.enabled ? "success" : "error" %>">
+ Monologue::PageCache.enabled = <%= Monologue::PageCache.enabled %>
+</div>
+
+<div class="alert alert-<%= Monologue::PageCache.wipe_enabled ? "success" : "error" %>">
+ Monologue::PageCache.wipe_enabled = <%= Monologue::PageCache.wipe_enabled %>
+</div>
View
6 app/views/monologue/admin/cache/how_to_enable.html.erb
@@ -1,6 +1,6 @@
<div class="alert alert-block">
<h4><%= t(".warning") %></h4>
<%= t(".explanations") %>
- <br /><br /><br />
- <%= link_to "Configure Monologue's cache (english only)", "https://github.com/jipiboily/monologue/wiki/Configure-Monologue's-cache", :target => "_blank" %>
-</div>
+</div>
+
+<%= render "config" %>
View
13 app/views/monologue/admin/cache/show.html.erb
@@ -10,12 +10,17 @@
<hr>
<h2><%= t(".files_in_cache") %></h2>
-<% files = Dir.glob("#{ActionController::Base.page_cache_directory}/**/*") %>
-<% if files.any? %>
+<% if @files.any? %>
<ul>
- <% Dir.glob("#{ActionController::Base.page_cache_directory}/**/*").each do |file| %>
+ <% @files.each do |file| %>
<% next if File.directory?(file) %>
<li><%= file.gsub(ActionController::Base.page_cache_directory,"") %></li>
<% end %>
</ul>
-<% end %>
+<% else %>
+ <p><%= t(".no_files_are_cached") %></p>
+<% end %>
+
+<hr>
+
+<%= render "config" %>
View
3 config/locales/en.yml
@@ -110,8 +110,9 @@ en:
cache:
show:
title: "Manage cache"
- description: "You can wompletely wipe cache here."
+ description: "You can completely wipe cache here."
files_in_cache: "Here are the files actually cached:"
+ no_files_are_cached: "There are actually no file in cache."
delete: "Completely wipe cache?"
confirm: 'Are you sure you want to competely clear cache?'
cache_wiped: "Cache was wiped!"
View
1 config/locales/fr.yml
@@ -108,6 +108,7 @@ fr:
title: "Gérer la cache"
description: "Vous pouvez complètement effacer la cache ici."
files_in_cache: "Voici les fichiers en cache:"
+ no_files_are_cached: "Il n'y a aucun fichier en cache."
delete: "Effacer complètement la cache?"
confirm: 'Voulez-vous vraiment effacer la cache?'
cache_wiped: "La cache a été effacée!"

0 comments on commit 68a0524

Please sign in to comment.
Something went wrong with that request. Please try again.