monologue 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +13 -5
  2. data/README.md +47 -23
  3. data/app/assets/javascripts/monologue/admin/application.js +2 -1
  4. data/app/assets/javascripts/monologue/blog/archive.js +11 -0
  5. data/app/assets/stylesheets/monologue/blog/monologue.css +27 -0
  6. data/app/controllers/monologue/admin/base_controller.rb +2 -8
  7. data/app/controllers/monologue/admin/posts_controller.rb +11 -9
  8. data/app/controllers/monologue/admin/users_controller.rb +6 -3
  9. data/app/controllers/monologue/application_controller.rb +16 -12
  10. data/app/controllers/monologue/controller_helpers/auth.rb +21 -0
  11. data/app/controllers/monologue/controller_helpers/user.rb +18 -0
  12. data/app/controllers/monologue/posts_controller.rb +1 -3
  13. data/app/controllers/monologue/tags_controller.rb +2 -3
  14. data/app/helpers/monologue/application_helper.rb +7 -7
  15. data/app/helpers/monologue/tags_helper.rb +1 -1
  16. data/app/models/monologue/post.rb +7 -9
  17. data/app/models/monologue/tag.rb +1 -3
  18. data/app/models/monologue/tagging.rb +1 -3
  19. data/app/models/monologue/user.rb +1 -3
  20. data/app/views/layouts/monologue/admin/_nav_bar.html.erb +1 -4
  21. data/app/views/layouts/monologue/application.html.erb +2 -2
  22. data/app/views/layouts/monologue/application/_disqus.html.erb +1 -1
  23. data/app/views/layouts/monologue/application/_disqus_embed.html.erb +1 -1
  24. data/app/views/layouts/monologue/application/_fb_open_graph.html.erb +3 -3
  25. data/app/views/layouts/monologue/application/_gauge_analytics.html.erb +2 -2
  26. data/app/views/layouts/monologue/application/_google_analytics.html.erb +2 -2
  27. data/app/views/layouts/monologue/application/_head.html.erb +1 -1
  28. data/app/views/layouts/monologue/application/_meta_description.html.erb +1 -1
  29. data/app/views/layouts/monologue/application/_sidebar.html.erb +2 -2
  30. data/app/views/layouts/monologue/application/_twitter_cards.html.erb +3 -3
  31. data/app/views/monologue/admin/comments/show.html.erb +1 -1
  32. data/app/views/monologue/posts/_social_sharing.html.erb +4 -4
  33. data/app/views/monologue/posts/feed.rss.builder +4 -4
  34. data/app/views/monologue/sidebar/_archive.html.erb +27 -0
  35. data/app/views/monologue/sidebar/_latest_tweets.html.erb +2 -2
  36. data/config/locales/de.yml +136 -0
  37. data/config/locales/en.yml +0 -12
  38. data/config/locales/fr.yml +1 -13
  39. data/config/locales/it.yml +0 -12
  40. data/config/locales/pt.yml +0 -12
  41. data/config/locales/ro.yml +0 -12
  42. data/config/locales/tr.yml +136 -0
  43. data/config/routes.rb +0 -3
  44. data/db/migrate/20130108123111_move_user_id_to_post.rb +0 -1
  45. data/db/migrate/20130509015400_merge_revisions_into_posts.rb +1 -2
  46. data/lib/monologue.rb +2 -36
  47. data/lib/monologue/configuration.rb +40 -0
  48. data/lib/monologue/configuration_extensions.rb +21 -0
  49. data/lib/monologue/engine.rb +8 -0
  50. data/lib/monologue/version.rb +1 -1
  51. data/vendor/assets/javascripts/monologue/bootstrap/bootstrap-datepicker-tr.js +7 -0
  52. metadata +56 -54
  53. data/app/controllers/monologue/admin/cache_controller.rb +0 -27
  54. data/app/sweepers/monologue/posts_sweeper.rb +0 -42
  55. data/app/sweepers/monologue/total_sweeper.rb +0 -5
  56. data/app/views/monologue/admin/cache/_config.html.erb +0 -18
  57. data/app/views/monologue/admin/cache/how_to_enable.html.erb +0 -6
  58. data/app/views/monologue/admin/cache/show.html.erb +0 -26
  59. data/lib/tasks/monologue_cache.rake +0 -26
@@ -1,27 +0,0 @@
1
- class Monologue::Admin::CacheController < Monologue::Admin::BaseController
2
- before_filter :prepare_file_list
3
-
4
- def show
5
- if ActionController::Base.perform_caching && Monologue::PageCache.enabled && Monologue::PageCache.wipe_enabled && ActionController::Base.page_cache_directory != Rails.public_path
6
- render :show
7
- else
8
- render :how_to_enable
9
- end
10
- end
11
-
12
- def destroy
13
- Monologue::TotalSweeper.wipe_all
14
- flash.notice = I18n.t("monologue.admin.cache.show.cache_wiped")
15
- render :show
16
- end
17
-
18
- private
19
- def prepare_file_list
20
- @files = []
21
- Dir.glob("#{ActionController::Base.page_cache_directory}/**/*").each do |file|
22
- next if File.directory?(file)
23
- @files << file.gsub(ActionController::Base.page_cache_directory,"")
24
- end
25
- @files
26
- end
27
- end
@@ -1,42 +0,0 @@
1
- class Monologue::PostsSweeper < ActionController::Caching::Sweeper
2
- observe Monologue::Post
3
-
4
- def sweep(post)
5
- if ActionController::Base.perform_caching && Monologue::PageCache.enabled && Monologue::PageCache.wipe_enabled && Monologue::PageCache.wipe_after_save && (ActionController::Base.page_cache_directory != Rails.public_path)
6
- Monologue::TotalSweeper.wipe_all
7
- else
8
- sweep_for_single_post post
9
- end
10
- end
11
-
12
- def sweep_for_single_post post
13
- return unless post.published
14
- root_path = Monologue::Engine.routes.url_helpers.root_path if root_path.nil? # TODO: why do I have to do this to make tests pass? There must be something much more clean to make tests pass
15
- page_cache_directory = Rails.public_path if page_cache_directory.nil? # TODO: we should not need this either...
16
-
17
- # post
18
- current_post_path = "#{page_cache_directory}#{root_path}#{post.url}.html"
19
- File.delete current_post_path if File.exists? current_post_path
20
-
21
- # tags
22
- tags_path = "#{page_cache_directory}#{root_path}tags"
23
- FileUtils.rm_rf tags_path
24
-
25
- # feed
26
- feed_file_path = "#{page_cache_directory}#{root_path}feed.rss"
27
- File.delete feed_file_path if File.exists? feed_file_path
28
-
29
- # root
30
- root_file_path = "#{page_cache_directory}#{root_path.chomp("/")}.html"
31
- root_file_path = "#{page_cache_directory}/index.html" if root_path.chomp("/") == "" # TODO: add test for that? It would need another dummy app mounted at root...?
32
- File.delete root_file_path if File.exists? root_file_path
33
-
34
- # paging
35
- FileUtils.rm_rf "#{page_cache_directory}/page" # remove pages
36
- end
37
-
38
- alias_method :after_create, :sweep
39
- alias_method :after_update, :sweep
40
- alias_method :after_destroy, :sweep
41
-
42
- end
@@ -1,5 +0,0 @@
1
- class Monologue::TotalSweeper
2
- def self.wipe_all
3
- FileUtils.rm_rf(Dir.glob("#{ActionController::Base.page_cache_directory}/*")) if ActionController::Base.perform_caching && Monologue::PageCache.enabled && Monologue::PageCache.wipe_enabled && (ActionController::Base.page_cache_directory != Rails.public_path)
4
- end
5
- end
@@ -1,18 +0,0 @@
1
- <h1>Current config</h1>
2
- <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>
3
-
4
- <div class="alert alert-<%= ActionController::Base.perform_caching ? "success" : "error" %>">
5
- ActionController::Base.perform_caching = <%= ActionController::Base.perform_caching %>
6
- </div>
7
-
8
- <div class="alert alert-<%= ActionController::Base.page_cache_directory != Rails.public_path ? "success" : "error" %>">
9
- ActionController::Base.page_cache_directory = <%= ActionController::Base.page_cache_directory %>
10
- </div>
11
-
12
- <div class="alert alert-<%= Monologue::PageCache.enabled ? "success" : "error" %>">
13
- Monologue::PageCache.enabled = <%= Monologue::PageCache.enabled %>
14
- </div>
15
-
16
- <div class="alert alert-<%= Monologue::PageCache.wipe_enabled ? "success" : "error" %>">
17
- Monologue::PageCache.wipe_enabled = <%= Monologue::PageCache.wipe_enabled %>
18
- </div>
@@ -1,6 +0,0 @@
1
- <div class="alert alert-block">
2
- <h4><%= t(".warning") %></h4>
3
- <%= t(".explanations") %>
4
- </div>
5
-
6
- <%= render "config" %>
@@ -1,26 +0,0 @@
1
- <h1><%= t(".title") %></h1>
2
-
3
- <p><%= t(".description") %></p>
4
-
5
- <hr>
6
-
7
- <h2><%= t(".delete") %></h2>
8
- <%= link_to t(".delete"), admin_cache_path, data: {confirm: t(".confirm")}, method: :delete, class: "btn btn-large btn-danger" %>
9
-
10
- <hr>
11
-
12
- <h2><%= t(".files_in_cache") %></h2>
13
- <% if @files.any? %>
14
- <ul>
15
- <% @files.each do |file| %>
16
- <% next if File.directory?(file) %>
17
- <li><%= file.gsub(ActionController::Base.page_cache_directory,"") %></li>
18
- <% end %>
19
- </ul>
20
- <% else %>
21
- <p><%= t(".no_files_are_cached") %></p>
22
- <% end %>
23
-
24
- <hr>
25
-
26
- <%= render "config" %>
@@ -1,26 +0,0 @@
1
- namespace :monologue do
2
- namespace :cache do
3
- desc "Completely wipe Monologue's cache"
4
- task wipe: :environment do
5
- puts "********************************************************************************"
6
- puts "********** Monologue, your blogging engine: rake edition ************"
7
- puts "********************************************************************************"
8
- puts " Starting to run 'rake monologue:cache:wipe'... "
9
- if ActionController::Base.perform_caching && Monologue::PageCache.enabled && Monologue::PageCache.wipe_enabled && (ActionController::Base.page_cache_directory != Rails.public_path)
10
- puts " Starting to wipe cache...hold tight..."
11
- Monologue::TotalSweeper.wipe_all
12
- puts " \e[#{32}mDone!\e[0m"
13
- else
14
- msg = " Monologue's cache configuration isn't set correctly to use this wipe task. Doc here: https://github.com/jipiboily/monologue/wiki/Configure-Monologue's-cache"
15
- puts "\e[#{31}m#{msg}\e[0m"
16
- puts " Current configuration: "
17
- puts " ActionController::Base.perform_caching == #{ActionController::Base.perform_caching}"
18
- puts " Monologue::PageCache.enabled == #{Monologue::PageCache.enabled}"
19
- puts " Monologue::PageCache.wipe_enabled == #{Monologue::PageCache.wipe_enabled}"
20
- puts " ActionController::Base.page_cache_directory == #{ActionController::Base.page_cache_directory}"
21
- puts " Rails.public_path == #{Rails.public_path}"
22
- end
23
- puts "********************************************************************************"
24
- end
25
- end
26
- end