monologue 0.1.3 → 0.2.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/README.md +29 -21
  2. data/app/assets/javascripts/monologue/blog/twitter.js.coffee +32 -0
  3. data/app/assets/stylesheets/monologue/blog/application.css +3 -3
  4. data/app/assets/stylesheets/monologue/blog/monologue.css +150 -7
  5. data/app/controllers/monologue/admin/cache_controller.rb +27 -0
  6. data/app/controllers/monologue/admin/posts_controller.rb +28 -12
  7. data/app/controllers/monologue/admin/sessions_controller.rb +2 -2
  8. data/app/controllers/monologue/admin/users_controller.rb +13 -0
  9. data/app/controllers/monologue/application_controller.rb +22 -6
  10. data/app/controllers/monologue/posts_controller.rb +7 -7
  11. data/app/controllers/monologue/tags_controller.rb +12 -0
  12. data/app/helpers/monologue/application_helper.rb +76 -0
  13. data/app/helpers/monologue/tags_helper.rb +5 -0
  14. data/app/models/monologue/post.rb +43 -29
  15. data/app/models/monologue/posts_revision.rb +50 -52
  16. data/app/models/monologue/tag.rb +16 -0
  17. data/app/models/monologue/tagging.rb +4 -0
  18. data/app/models/monologue/user.rb +1 -0
  19. data/app/sweepers/monologue/posts_sweeper.rb +20 -4
  20. data/app/sweepers/monologue/total_sweeper.rb +5 -0
  21. data/app/views/layouts/monologue/admin/_nav_bar.html.erb +17 -6
  22. data/app/views/layouts/monologue/application.html.erb +15 -20
  23. data/app/views/layouts/monologue/application/_disqus.html.erb +18 -0
  24. data/app/views/layouts/monologue/application/_disqus_embed.html.erb +17 -0
  25. data/app/views/layouts/monologue/application/_fb_open_graph.html.erb +4 -1
  26. data/app/views/layouts/monologue/application/_gauge_analytics.html.erb +15 -0
  27. data/app/views/layouts/monologue/application/_google_analytics.html.erb +1 -1
  28. data/app/views/layouts/monologue/application/_head.html.erb +3 -2
  29. data/app/views/layouts/monologue/application/_sidebar.html.erb +5 -0
  30. data/app/views/layouts/monologue/application/_social_icons.html.erb +5 -0
  31. data/app/views/layouts/monologue/application/_twitter_cards.html.erb +7 -0
  32. data/app/views/monologue/admin/cache/_config.html.erb +18 -0
  33. data/app/views/monologue/admin/cache/how_to_enable.html.erb +6 -0
  34. data/app/views/monologue/admin/cache/show.html.erb +26 -0
  35. data/app/views/monologue/admin/posts/_form.html.erb +3 -2
  36. data/app/views/monologue/admin/posts/edit.html.erb +1 -1
  37. data/app/views/monologue/admin/posts/index.html.erb +1 -1
  38. data/app/views/monologue/admin/users/edit.html.erb +9 -0
  39. data/app/views/monologue/posts/_post.html.erb +14 -0
  40. data/app/views/monologue/posts/_revision_header.html.erb +9 -0
  41. data/app/views/monologue/posts/_social_sharing.html.erb +45 -36
  42. data/app/views/monologue/posts/index.html.erb +4 -17
  43. data/app/views/monologue/posts/show.html.erb +11 -24
  44. data/app/views/monologue/sidebar/_categories.html.erb +7 -0
  45. data/app/views/monologue/sidebar/_latest_posts.html.erb +7 -0
  46. data/app/views/monologue/sidebar/_latest_tweets.html.erb +8 -0
  47. data/app/views/monologue/sidebar/_tag_cloud.html.erb +5 -0
  48. data/app/views/monologue/tags/_tag.html.erb +1 -0
  49. data/app/views/monologue/tags/show.html.erb +4 -0
  50. data/config/locales/en.yml +54 -10
  51. data/config/locales/fr.yml +55 -11
  52. data/config/routes.rb +8 -2
  53. data/db/migrate/20120514164158_create_monologue_tags.rb +8 -0
  54. data/db/migrate/20120514194459_join_posts_and_tags.rb +7 -0
  55. data/db/migrate/20120604010152_rename_post_tags_table.rb +5 -0
  56. data/db/migrate/20120612013442_create_taggings.rb +11 -0
  57. data/db/migrate/20120612015727_delete_join_posts_tags.rb +11 -0
  58. data/db/migrate/20120612020023_add_index_to_tag_name.rb +5 -0
  59. data/deprecations.rb +10 -0
  60. data/lib/monologue.rb +20 -1
  61. data/lib/monologue/engine.rb +12 -1
  62. data/lib/monologue/version.rb +1 -1
  63. data/lib/tasks/monologue_cache.rake +26 -0
  64. data/vendor/assets/fonts/monologue/foundation_icons/social_foundicons.eot +0 -0
  65. data/vendor/assets/fonts/monologue/foundation_icons/social_foundicons.svg +15 -0
  66. data/vendor/assets/fonts/monologue/foundation_icons/social_foundicons.ttf +0 -0
  67. data/vendor/assets/fonts/monologue/foundation_icons/social_foundicons.woff +0 -0
  68. data/vendor/assets/javascripts/monologue/bootstrap/bootstrap.min.js +6 -1
  69. data/vendor/assets/stylesheets/monologue/bootstrap/bootstrap-responsive.min.css +9 -3
  70. data/vendor/assets/stylesheets/monologue/bootstrap/bootstrap.min.css +9 -610
  71. data/vendor/assets/stylesheets/monologue/foundation_icons/social_foundicons.css.erb +148 -0
  72. metadata +109 -10
  73. data/app/helpers/monologue/admin/admin_helper.rb +0 -4
  74. data/app/helpers/monologue/posts_helper.rb +0 -4
  75. data/app/helpers/monologue/sessions_helper.rb +0 -6
  76. data/lib/tasks/monologue_tasks.rake +0 -4
@@ -1,4 +1,3 @@
1
-
2
1
  <% content_for :title do %>
3
2
  <%= @revision.title %>
4
3
  <% end %>
@@ -8,31 +7,19 @@
8
7
  <% end %>
9
8
 
10
9
  <article>
11
- <header><h1><%= link_to @revision.title, @revision.full_url %></h1></header>
12
- <div class="posted">
13
- <time datetime="<%= @revision.published_at %>">
14
- <%= @revision.published_at.to_date.to_formatted_s(:long_ordinal) %>
15
- </time>&nbsp;&nbsp;|&nbsp;&nbsp;<%= @revision.user.name %>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<%= @revision.full_url + "#disqus_thread" %>"></a>
16
- </div>
17
- <p><%= raw @revision.content %></p>
10
+ <%= render :partial => 'monologue/posts/revision_header', :locals => {:revision=>@revision}%>
11
+ <div id="content" data-monologue="content">
12
+ <%= raw @revision.content %>
13
+ </div>
14
+
15
+ <div id="tags" data-monologue="tags">
16
+ <%= render @revision.post.tags %>
17
+ </div>
18
18
 
19
19
  <%= render "social_sharing" %>
20
20
 
21
21
  <div id="disqus_thread"></div>
22
- <script type="text/javascript">
23
- /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
24
- var disqus_shortname = '<%= Monologue.disqus_shortname%>'; // required: replace example with your forum shortname
25
-
26
- <% if Rails.env.development? %>
27
- var disqus_developer = 1; // developer mode is on
28
- <% end %>
22
+ <%= render 'layouts/monologue/application/disqus_embed' %>
23
+ <noscript>Please enable JavaScript to view the comments.</noscript>
24
+ </article>
29
25
 
30
- /* * * DON'T EDIT BELOW THIS LINE * * */
31
- (function() {
32
- var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
33
- dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
34
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
35
- })();
36
- </script>
37
- <noscript>Please enable JavaScript to view the comments.</a></noscript>
38
- </article>
@@ -0,0 +1,7 @@
1
+ <%= sidebar_section_for(t(".title")) do %>
2
+ <ul>
3
+ <% @tags.each do |tag| %>
4
+ <li id="tag"><%=link_to "#{tag.name} (#{tag.frequency})", tag_url(tag) %> </li>
5
+ <% end %>
6
+ </ul>
7
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%= sidebar_section_for(t(".title")) do %>
2
+ <ul>
3
+ <% @recent_posts.each do |post| %>
4
+ <li><%= link_to post.active_revision.title, post.active_revision.full_url %></li>
5
+ <% end %>
6
+ </ul>
7
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <% unless Monologue.twitter_username.nil? %>
2
+ <%= sidebar_section_for(t(".title")) do %>
3
+ <ul id="latest_tweets">
4
+ <li id="tweet_template" style="display:none;">{{text}}</li>
5
+ </ul>
6
+ <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/<%= Monologue.twitter_username %>.json?callback=TwitterWidget.callback&amp;count=5"></script>
7
+ <% end %>
8
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= sidebar_section_for(t(".title")) do %>
2
+ <% @tags.each do |tag| %>
3
+ <%=link_to tag.name, tag_url(tag), :class =>label_for_tag(tag,@tags_frequency_min,@tags_frequency_max) %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1 @@
1
+ <span class='tag'><%=link_to tag.name, tag_url(tag) %></span>
@@ -0,0 +1,4 @@
1
+ <div class="tag-search">
2
+ <%= t(".showing_post_with_tag")%> <strong>'<%= @tag.name %>'</strong>. <%=link_to t(".show_all_posts"),:root %>
3
+ </div>
4
+ <%= render @posts %>
@@ -9,7 +9,7 @@ en:
9
9
  social_sharing:
10
10
  tagline:
11
11
  "Loved what you just read? Share it!"
12
- index:
12
+ post:
13
13
  readmore:
14
14
  "Read more"
15
15
  "404":
@@ -17,10 +17,37 @@ en:
17
17
  "The page you were looking for doesn't exist."
18
18
  message:
19
19
  "You may have mistyped the address or the page may have moved."
20
+ sidebar:
21
+ categories:
22
+ title:
23
+ "Categories"
24
+ latest_posts:
25
+ title:
26
+ "Latest posts"
27
+ latest_tweets:
28
+ title:
29
+ "Latest tweets"
30
+ tag_cloud:
31
+ title:
32
+ "Tags"
33
+ tags:
34
+ show:
35
+ showing_post_with_tag:
36
+ "Showing posts with label"
37
+ show_all_posts:
38
+ "Show all posts"
20
39
  admin:
21
40
  login:
22
41
  need_auth:
23
42
  "You must first log in to access admin section."
43
+ users:
44
+ edit:
45
+ header: "Edit your account"
46
+ email: "Email"
47
+ name: "Name"
48
+ password: "Password"
49
+ confirmation: "Password confirmation"
50
+ save: "Save"
24
51
  posts:
25
52
  index:
26
53
  title:
@@ -62,12 +89,8 @@ en:
62
89
  content:
63
90
  "Content"
64
91
  url:
65
- before_generated_url:
66
- "URL <br /><i> This will be filled by default with "
67
- after_generated_url:
68
- ". You can choose your own URL. </i>"
69
- do_not_add_mount_point:
70
- "Do not add at the beginning of your URL :"
92
+ caption:
93
+ "URL<br/><i> This will be filled by default with '%s'. You can choose your own URL. Do not add '%s' at the beginning of your URL.</i>"
71
94
  generated_title:
72
95
  "your-post-title"
73
96
  published_at:
@@ -78,10 +101,24 @@ en:
78
101
  "Save"
79
102
  preview:
80
103
  "Preview"
104
+ tags:
105
+ "Tags <br/><i>Separate tags by commas</i>"
81
106
  comments:
82
107
  show:
83
108
  recent_comments:
84
109
  "Recent comments"
110
+ cache:
111
+ show:
112
+ title: "Manage cache"
113
+ description: "You can completely wipe cache here."
114
+ files_in_cache: "Here are the files actually cached:"
115
+ no_files_are_cached: "There are actually no file in cache."
116
+ delete: "Completely wipe cache?"
117
+ confirm: 'Are you sure you want to competely clear cache?'
118
+ cache_wiped: "Cache was wiped!"
119
+ how_to_enable:
120
+ warning: "You can't manage cache!"
121
+ explanations: "There are certain settings that are not set correctly to be able to use Monologue's basic cache. Please review configuration documentation."
85
122
  sessions:
86
123
  new:
87
124
  title:
@@ -109,8 +146,9 @@ en:
109
146
  "List of monologues"
110
147
  comments:
111
148
  "Comments"
112
- logged_in_as:
113
- "Logged in as"
149
+ cache: "Manage cache"
150
+ edit_user_info: "My account"
151
+ settings: "Settings"
114
152
  log_out:
115
153
  "Log out"
116
154
  activerecord:
@@ -132,4 +170,10 @@ en:
132
170
  start_with_slash:
133
171
  "URL can't start with a slash ('/')"
134
172
  unique:
135
- "URL is already used by another post"
173
+ "URL is already used by another post"
174
+ monologue/user:
175
+ blank:
176
+ "%{attribute} is required"
177
+ attributes:
178
+ password:
179
+ confirmation: "Password and confirmation doesn't match."
@@ -8,8 +8,8 @@ fr:
8
8
  "Articles plus récents"
9
9
  social_sharing:
10
10
  tagline:
11
- "Vous avez ce que vous avez lu? Partagez le!"
12
- index:
11
+ "Vous avez aimé ce que vous avez lu? Partagez le!"
12
+ post:
13
13
  readmore:
14
14
  "Lire"
15
15
  "404":
@@ -17,10 +17,37 @@ fr:
17
17
  "La page que vous cherchiez n'existe pas."
18
18
  message:
19
19
  "You pourriez avoir mal tappé l'adresse ou la page pourrait avoir été déplacée."
20
+ sidebar:
21
+ categories:
22
+ title:
23
+ "Catégories"
24
+ latest_posts:
25
+ title:
26
+ "Derniers articles"
27
+ latest_tweets:
28
+ title:
29
+ "Derniers tweets"
30
+ tag_cloud:
31
+ title:
32
+ "Labels"
33
+ tags:
34
+ show:
35
+ showing_post_with_tag:
36
+ "Articles ayant le label"
37
+ show_all_posts:
38
+ "Voir tous les articles"
20
39
  admin:
21
40
  login:
22
41
  need_auth:
23
42
  "Vous devez d'abord vous connectez à la section d'administration."
43
+ users:
44
+ edit:
45
+ header: "Modifier mon compte"
46
+ email: "Courriel"
47
+ name: "Nom"
48
+ password: "Mot de passe"
49
+ confirmation: "Confirmation du mot de passe"
50
+ save: "Sauvegarder"
24
51
  posts:
25
52
  index:
26
53
  title:
@@ -62,12 +89,8 @@ fr:
62
89
  content:
63
90
  "Contenu"
64
91
  url:
65
- before_generated_url:
66
- "Adresse URL <br /><i> Ce sera rempli par défaut avec "
67
- after_generated_url:
68
- ". Vous pouvez aussi choisir votre propre adresse URL. </i>"
69
- do_not_add_mount_point:
70
- "N'ajoutez pas au début de l'adresse URL:"
92
+ caption:
93
+ "Adresse URL<br/><i> Ce sera rempli par défaut avec '%s'. Vous pouvez aussi choisir votre propre adresse URL. N'ajoutez pas '%s' au début de l'adresse URL.</i>"
71
94
  generated_title:
72
95
  "nom-de-votre-article"
73
96
  published_at:
@@ -78,6 +101,20 @@ fr:
78
101
  "Sauvegarder"
79
102
  preview:
80
103
  "Aperçu"
104
+ tags:
105
+ "Catégories<br/><i>Séparer les catégories par des virgules</i>"
106
+ cache:
107
+ show:
108
+ title: "Gérer la cache"
109
+ description: "Vous pouvez complètement effacer la cache ici."
110
+ files_in_cache: "Voici les fichiers en cache:"
111
+ no_files_are_cached: "Il n'y a aucun fichier en cache."
112
+ delete: "Effacer complètement la cache?"
113
+ confirm: 'Voulez-vous vraiment effacer la cache?'
114
+ cache_wiped: "La cache a été effacée!"
115
+ how_to_enable:
116
+ warning: "Vous ne pouvez gérer la cache!"
117
+ explanations: "Il y a certaines configurations à effectuer pour utiliser la gestion de cache de base de Monologue. SVP voir la documentation ci-dessous (anglais seulement)."
81
118
  comments:
82
119
  show:
83
120
  recent_comments:
@@ -109,8 +146,9 @@ fr:
109
146
  "Liste des monologues"
110
147
  comments:
111
148
  "Commentaires"
112
- logged_in_as:
113
- "Connecté en tant que"
149
+ cache: "Gérer la cache"
150
+ edit_user_info: "Mon compte"
151
+ settings: "Paramètres"
114
152
  log_out:
115
153
  "Déconnexion"
116
154
  activerecord:
@@ -132,4 +170,10 @@ fr:
132
170
  start_with_slash:
133
171
  "L'adresse URL ne peut débuter par un slash ('/')"
134
172
  unique:
135
- "L'adresse URL est déjà utilisée par un autre article"
173
+ "L'adresse URL est déjà utilisée par un autre article"
174
+ monologue/user:
175
+ blank:
176
+ "%{attribute} est requis"
177
+ attributes:
178
+ password:
179
+ confirmation: "Le mot de passe et sa confirmation doivent concorder."
data/config/routes.rb CHANGED
@@ -2,15 +2,21 @@ Monologue::Engine.routes.draw do
2
2
  root :to => "posts#index"
3
3
  match "/page/:page", :to => "posts#index", :as => "posts_page"
4
4
  match "/feed" => "posts#feed", :as => "feed", :defaults => {:format => :rss}
5
-
5
+
6
+ match "/tags/:tag" =>"tags#show", :as => "tags_page"
7
+
6
8
  namespace :admin, :path => "monologue" do
7
9
  get "/" => "posts#index", :as => "" # responds to admin_url and admin_path
8
10
  get "logout" => "sessions#destroy"
9
11
  get "login" => "sessions#new"
10
12
  resources :sessions
11
13
  resources :posts
14
+ resources :users
12
15
  get "comments" => "comments#show", :as => "comments"
16
+
17
+ get "cache" => "cache#show", :as => "cache"
18
+ delete "cache" => "cache#destroy"
13
19
  end
14
-
20
+
15
21
  match "*post_url" => "posts#show", :as => "post"
16
22
  end
@@ -0,0 +1,8 @@
1
+ class CreateMonologueTags < ActiveRecord::Migration
2
+ def change
3
+ create_table :monologue_tags do |t|
4
+ t.string :name
5
+
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ class JoinPostsAndTags < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts_tags, :id=>false do |t|
4
+ t.integer :post_id,:tag_id
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class RenamePostTagsTable < ActiveRecord::Migration
2
+ def change
3
+ rename_table :posts_tags, :monologue_posts_tags
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class CreateTaggings < ActiveRecord::Migration
2
+ def change
3
+ create_table :monologue_taggings do |t|
4
+ t.integer :post_id, :tag_id
5
+ end
6
+
7
+ add_index :monologue_taggings, :post_id
8
+ add_index :monologue_taggings, :tag_id
9
+
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class DeleteJoinPostsTags < ActiveRecord::Migration
2
+ def up
3
+ drop_table :monologue_posts_tags
4
+ end
5
+
6
+ def down
7
+ create_table :monologue_posts_tags, :id=>false do |t|
8
+ t.integer :post_id,:tag_id
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexToTagName < ActiveRecord::Migration
2
+ def change
3
+ add_index :monologue_tags, :name
4
+ end
5
+ end
data/deprecations.rb ADDED
@@ -0,0 +1,10 @@
1
+ def deprecate msg
2
+ puts "\e[#{31}m#{msg}\e[0m"
3
+ end
4
+
5
+ if RUBY_VERSION.include?("1.8.")
6
+ deprecate "#############################################"
7
+ deprecate "# NOTE FOR RUBY 1.8.X USERS #"
8
+ deprecate "#############################################"
9
+ deprecate "Please note that Monologue 0.2 is the last version to support Ruby 1.8."
10
+ end
data/lib/monologue.rb CHANGED
@@ -7,12 +7,31 @@ module Monologue
7
7
  :site_url,
8
8
  :meta_description,
9
9
  :meta_keyword,
10
+
11
+ :show_rss_icon,
12
+
10
13
  :twitter_username,
11
14
  :twitter_locale,
15
+
12
16
  :facebook_like_locale,
17
+ :facebook_url,
18
+ :facebook_logo, #used in the open graph protocol to display an image when a post is liked
19
+
20
+ :google_plus_account_url,
13
21
  :google_plusone_locale,
22
+
23
+ :linkedin_url,
24
+
25
+ :github_username,
26
+
14
27
  :admin_force_ssl,
15
28
  :posts_per_page,
16
29
  :google_analytics_id,
17
- :layout
30
+ :gauge_analytics_site_id,
31
+ :layout,
32
+ :sidebar
33
+ end
34
+
35
+ module Monologue::PageCache
36
+ mattr_accessor :enabled, :wipe_enabled, :wipe_after_save
18
37
  end
@@ -1,11 +1,22 @@
1
1
  require "tinymce-rails"
2
+ require "truncate_html"
2
3
  module Monologue
3
4
  class Engine < Rails::Engine
4
5
  isolate_namespace Monologue
5
-
6
+
7
+
8
+
6
9
  config.generators.test_framework :rspec, :view_specs => false, :fixture => false
7
10
  config.generators.stylesheets false
8
11
  config.generators.fixture_replacement :factory_girl
9
12
  config.generators.integration_tool :rspec
13
+
14
+ initializer :assets do |config|
15
+ Rails.application.config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
16
+ end
17
+
18
+
19
+ ENGINE_ROOT = File.join(File.dirname(__FILE__), '../..')
20
+ require "#{ENGINE_ROOT}/deprecations"
10
21
  end
11
22
  end