monologue 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/README.md +47 -32
  2. data/app/assets/stylesheets/monologue/blog/monologue.css +5 -0
  3. data/app/controllers/monologue/admin/base_controller.rb +1 -1
  4. data/app/controllers/monologue/admin/comments_controller.rb +4 -0
  5. data/app/controllers/monologue/admin/posts_controller.rb +15 -4
  6. data/app/controllers/monologue/application_controller.rb +2 -0
  7. data/app/controllers/monologue/posts_controller.rb +2 -2
  8. data/app/helpers/monologue/application_helper.rb +4 -0
  9. data/app/models/monologue/post.rb +1 -1
  10. data/app/models/monologue/posts_revision.rb +30 -1
  11. data/app/sweepers/monologue/posts_sweeper.rb +1 -0
  12. data/app/views/layouts/monologue/admin/_nav_bar.html.erb +4 -4
  13. data/app/views/layouts/monologue/application.html.erb +1 -19
  14. data/app/views/layouts/monologue/application/_fb_open_graph.html.erb +4 -0
  15. data/app/views/layouts/monologue/{_google_analytics.html.erb → application/_google_analytics.html.erb} +0 -0
  16. data/app/views/layouts/monologue/application/_head.html.erb +18 -0
  17. data/app/views/layouts/monologue/application/_meta_description.html.erb +1 -0
  18. data/app/views/layouts/monologue/application/_title.html.erb +3 -0
  19. data/app/views/monologue/admin/comments/show.html.erb +4 -0
  20. data/app/views/monologue/admin/posts/_form.html.erb +2 -2
  21. data/app/views/monologue/posts/_social_sharing.html.erb +1 -1
  22. data/app/views/monologue/posts/feed.rss.builder +2 -2
  23. data/app/views/monologue/posts/index.html.erb +1 -1
  24. data/app/views/monologue/posts/show.html.erb +2 -2
  25. data/config/locales/en.yml +30 -1
  26. data/config/locales/fr.yml +30 -1
  27. data/config/routes.rb +1 -0
  28. data/db/migrate/20120526131841_migrate_old_urls.rb +19 -0
  29. data/db/migrate/20120526195147_add_index_to_posts_revision_url.rb +5 -0
  30. data/lib/monologue.rb +2 -1
  31. data/lib/monologue/version.rb +1 -1
  32. metadata +11 -3
data/README.md CHANGED
@@ -1,12 +1,10 @@
1
1
  # MONOLOGUE
2
- ---
3
2
  Monologue is a basic mountable blogging engine in Rails built to be easily mounted in an already existing Rails app, but it can also be used alone.
4
3
 
5
4
  [![Build Status](https://secure.travis-ci.org/jipiboily/monologue.png)](http://travis-ci.org/jipiboily/monologue)
6
5
 
7
6
 
8
7
  ## Features
9
- ---
10
8
  - Rails mountable engine (fully named spaced)
11
9
  - tested
12
10
  - back to basics: few features
@@ -23,51 +21,68 @@ Monologue is a basic mountable blogging engine in Rails built to be easily mount
23
21
 
24
22
 
25
23
  ## Installation
26
- ---
27
- 1. add gem to your `Gemfile`
28
-
29
- gem "monologue"
30
- 2. run
31
-
32
- $ bundle install
33
- 3. add this to your route file (`config/route.rb`)
34
-
35
- mount Monologue::Engine, :at => '/' # or whatever path, be it "/blog" or "/monologue"
36
-
37
- 4. run
38
-
39
- bundle exec rake monologue:install:migrations
40
- bundle exec rake db:create # only if this is a new project
41
- bundle exec rake db:migrate
24
+ ### 1. Add the gem to your `Gemfile`
25
+ ```ruby
26
+ gem "monologue"
27
+ ```
28
+ And run `bundle install` to fetch the gem and update your 'Gemfile.lock'.
29
+
30
+ ### 2. Route to Monologue
31
+
32
+ Add this to your route file (`config/route.rb`)
33
+ ```ruby
34
+ # This line mounts Monologue's routes at the root of your application.
35
+ # This means, any requests to URLs such as /my-post, will go to Monologue::PostsController.
36
+ # If you would like to change where this engine is mounted, simply change the :at option to something different.
37
+ #
38
+ # We ask that you don't use the :as option here, as Monologue relies on it being the default of "monologue"
39
+ mount Monologue::Engine, :at => '/' # or whatever path, be it "/blog" or "/monologue"
40
+ ```
41
+
42
+ ### 3. Migrate Monologue's database tables
43
+ Run these commands:
44
+
45
+ 1. $`bundle exec rake monologue:install:migrations`
46
+ 2. $`bundle exec rake db:create` (only if this is a new project)
47
+ 3. $`bundle exec rake db:migrate`
48
+
42
49
 
43
- 5. Create a user
50
+ ### 4. Create a user
51
+ Open your development console with `rails c`, then:
52
+ ```ruby
53
+ Monologue::User.create(name: "monologue", email:"monologue@example.com", password:"my-password", password_confirmation: "my-password")
54
+ ```
55
+
56
+ ### 5. Configure Monologue.
57
+ This is all done in an initializer file, say `config/initializers/monologue.rb`. More on this in the [Wiki - Configuration](https://github.com/jipiboily/monologue/wiki/Configuration).
58
+
59
+ ### 6. Ready
60
+ Start your server and head on [http://localhost:3000/monologue](http://localhost:3000/monologue) to log in the admin section.
44
61
 
45
- rails c
46
- Monologue::User.create(name: "monologue", email:"monologue@example.com", password:"my-password", password_confirmation: "my-password")
47
-
48
- 6. Configure Monologue. This is all done in an initializer file, say `config/initializers/monologue.rb`. More on this in the [Wiki - Configuration](https://github.com/jipiboily/monologue/wiki/Configuration).
62
+ ### Note to Heroku users
63
+ Additionnal step: turn caching off in `config/environments/production.rb`:
64
+ ```ruby
65
+ config.action_controller.perform_caching = false
66
+ ```
49
67
 
50
68
  ## Enable caching
51
- ---
52
69
  Just turn perform_caching to true in your environment config file (`config/environment/{environment}.rb):
53
-
54
- config.action_controller.perform_caching = true
70
+ ```ruby
71
+ config.action_controller.perform_caching = true
72
+ ```
55
73
 
56
74
  **IMPORTANT**: if monologue is mounted at root ("/"), you must also add that in your `routes.rb` file, before the monologue mount:
57
75
 
58
- root :to => 'monologue/posts#index'
76
+ ```ruby
77
+ root to: 'monologue/posts#index'
78
+ ```
59
79
 
60
80
  ## Customization
61
- ---
62
-
63
81
  See the [Wiki - Customizations](https://github.com/jipiboily/monologue/wiki/Customizations).
64
82
 
65
83
  ## Requirements
66
- ---
67
84
  - Rails 3.1 +
68
85
  - Database: MySQL & Postgres are supported but other databases might work too.
69
86
 
70
87
  ## Contribute
71
- ---
72
-
73
88
  Fork it, then pull request. Please add tests for your feature or bug fix.
@@ -34,4 +34,9 @@ section header {
34
34
 
35
35
  section header h1 {
36
36
  margin: 0 0 0 0;
37
+ }
38
+
39
+ ul {
40
+ list-style: square;
41
+ margin-left: 30px;
37
42
  }
@@ -6,7 +6,7 @@ class Monologue::Admin::BaseController < Monologue::ApplicationController
6
6
 
7
7
  def authenticate_user!
8
8
  if current_user.nil?
9
- redirect_to admin_login_url, :alert => "You must first log in to access admin section."
9
+ redirect_to admin_login_url, :alert => I18n.t("monologue.admin.login.need_auth")
10
10
  end
11
11
  end
12
12
  end
@@ -0,0 +1,4 @@
1
+ class Monologue::Admin::CommentsController < Monologue::Admin::BaseController
2
+ def show
3
+ end
4
+ end
@@ -20,7 +20,13 @@ class Monologue::Admin::PostsController < Monologue::Admin::BaseController
20
20
  @revision.user_id = current_user.id
21
21
 
22
22
  if @post.save
23
- redirect_to edit_admin_post_path(@post), :notice => 'Monologue created'
23
+
24
+ if @revision.published_at > DateTime.now && @post.published && ActionController::Base.perform_caching
25
+ flash[:warning] = I18n.t("monologue.admin.posts.create.created_with_future_date_and_cache")
26
+ else
27
+ flash[:notice] = I18n.t("monologue.admin.posts.create.created")
28
+ end
29
+ redirect_to edit_admin_post_path(@post)
24
30
  else
25
31
  render :action => "new"
26
32
  end
@@ -37,7 +43,12 @@ class Monologue::Admin::PostsController < Monologue::Admin::BaseController
37
43
  @revision = @post.posts_revisions.build(params[:post][:posts_revision])
38
44
  @revision.user_id = current_user.id
39
45
  if @post.save
40
- redirect_to edit_admin_post_path(@post), :notice => 'Monologue saved'
46
+ if @revision.published_at > DateTime.now && @post.published && ActionController::Base.perform_caching
47
+ flash[:warning] = I18n.t("monologue.admin.posts.update.saved_with_future_date_and_cache")
48
+ else
49
+ flash[:notice] = I18n.t("monologue.admin.posts.update.saved")
50
+ end
51
+ redirect_to edit_admin_post_path(@post)
41
52
  else
42
53
  render :edit
43
54
  end
@@ -46,9 +57,9 @@ class Monologue::Admin::PostsController < Monologue::Admin::BaseController
46
57
  def destroy
47
58
  post = Monologue::Post.find(params[:id])
48
59
  if post.destroy
49
- redirect_to admin_posts_path, :notice => "Monologue removed"
60
+ redirect_to admin_posts_path, :notice => I18n.t("monologue.admin.posts.delete.removed")
50
61
  else
51
- redirect_to admin_posts_path, :alert => "Failed to remove monologue!"
62
+ redirect_to admin_posts_path, :alert => I18n.t("monologue.admin.posts.delete.failed")
52
63
  end
53
64
  end
54
65
  end
@@ -1,5 +1,7 @@
1
1
  class Monologue::ApplicationController < ApplicationController
2
2
 
3
+ layout Monologue.layout if Monologue.layout # TODO: find a way to test that. It was asked in issue #54 (https://github.com/jipiboily/monologue/issues/54)
4
+
3
5
  def not_found
4
6
  # fallback to the default 404.html page from main_app.
5
7
  file = Rails.root.join('public', '404.html')
@@ -8,9 +8,9 @@ class Monologue::PostsController < Monologue::ApplicationController
8
8
 
9
9
  def show
10
10
  unless current_user
11
- post = Monologue::Post.published.where("monologue_posts_revisions.url = :url", {:url => root_path + params[:post_url]}).first
11
+ post = Monologue::Post.published.where("monologue_posts_revisions.url = :url", {:url => params[:post_url]}).first
12
12
  else
13
- post = Monologue::Post.default.where("monologue_posts_revisions.url = :url", {:url => root_path + params[:post_url]}).first
13
+ post = Monologue::Post.default.where("monologue_posts_revisions.url = :url", {:url => params[:post_url]}).first
14
14
  end
15
15
  if post.nil?
16
16
  not_found
@@ -4,5 +4,9 @@ module Monologue
4
4
  options[:builder] = MonologueAdminFormBuilder
5
5
  form_for(object, options, &block)
6
6
  end
7
+
8
+ def monologue_accurate_title
9
+ content_for?(:title) ? ((content_for :title) + " | #{Monologue.site_name}") : Monologue.site_name
10
+ end
7
11
  end
8
12
  end
@@ -9,7 +9,7 @@ module Monologue
9
9
 
10
10
 
11
11
  scope :default, includes(:posts_revisions).where("posts_revision_id = monologue_posts_revisions.id").order("published_at DESC")
12
- scope :published, default.where(:published => true)
12
+ scope :published, default.where(:published => true).where("published_at <= ?", DateTime.now)
13
13
 
14
14
  validates :posts_revision_id, :uniqueness => true
15
15
 
@@ -13,6 +13,8 @@ module Monologue
13
13
  validates :title, :presence => true
14
14
  validates :content, :presence => true
15
15
  validates :url, :presence => true
16
+ validate :url_do_not_start_with_slash
17
+ validate :url_is_unique
16
18
  validates :user_id, :presence => true
17
19
  # validates :post_id, :presence => true # TODO: do something about this validation on the first creation of a POST
18
20
  validates :published_at, :presence => true
@@ -23,12 +25,39 @@ module Monologue
23
25
  post.save!
24
26
  end
25
27
 
28
+ def full_url
29
+ "#{Monologue::Engine.routes.url_helpers.root_path}#{self.url}"
30
+ end
31
+
32
+ def url_do_not_start_with_slash
33
+ errors.add(:url, I18n.t("activerecord.errors.models.monologue/posts_revision.attributes.url.start_with_slash")) if self.url.start_with?("/")
34
+ end
35
+
36
+ def url_is_unique
37
+ errors.add(:url, I18n.t("activerecord.errors.models.monologue/posts_revision.attributes.url.unique")) if self.url_exists?
38
+ end
39
+
40
+ def url_exists?
41
+ if self.post_id.nil?
42
+ return Monologue::PostsRevision.where("url = ?", self.url).count > 0
43
+ else
44
+ return Monologue::PostsRevision.where("url = ? and post_id <> ?", self.url, self.post_id).count > 0
45
+ end
46
+ end
47
+
26
48
  private
27
49
 
28
50
  def generate_url
29
51
  year = self.published_at.class == ActiveSupport::TimeWithZone ? self.published_at.year : DateTime.now.year
30
52
  self.title = "" if self.title.nil?
31
- self.url = "#{Monologue::Engine.routes.url_helpers.root_path}#{year}/#{self.title.parameterize}" if self.url.nil? || self.url.strip == ""
53
+ base_title = "#{year}/#{self.title.parameterize}"
54
+ url_empty = self.url.nil? || self.url.strip == ""
55
+ self.url = base_title if url_empty
56
+ while self.url_exists? && url_empty
57
+ i ||= 1
58
+ self.url = "#{base_title}-#{i}"
59
+ i += 1
60
+ end
32
61
  end
33
62
  end
34
63
  end
@@ -3,6 +3,7 @@ class Monologue::PostsSweeper < ActionController::Caching::Sweeper
3
3
 
4
4
 
5
5
  def sweep(post)
6
+ return unless post.published
6
7
  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
7
8
  page_cache_directory = Rails.public_path if page_cache_directory.nil? # TODO: we should not need this either...
8
9
  if post.posts_revisions.count > 0
@@ -5,13 +5,13 @@
5
5
  <ul class="nav pull-left">
6
6
 
7
7
  <li class="<%= request.fullpath === new_admin_post_path ? "active":"" %>">
8
- <a href="<%= new_admin_post_path %>"><%=t(".add_a_monologue")%></a>
8
+ <%= link_to t(".add_a_monologue"), new_admin_post_path%>
9
9
  </li>
10
10
  <li class="<%= request.fullpath === admin_posts_path || request.fullpath === admin_path ? "active":"" %>">
11
- <a href="<%= admin_posts_path %>"><%=t(".list_monologues")%></a>
11
+ <%= link_to t(".list_monologues"), admin_posts_path %>
12
12
  </li>
13
- <li>
14
- <a href="#"><%=t(".comments")%></a>
13
+ <li class="<%= request.fullpath === admin_comments_path ? "active":"" %>">
14
+ <%= link_to t(".comments"), admin_comments_path %></a>
15
15
  </li>
16
16
  </ul>
17
17
  <ul class="nav pull-right">
@@ -4,25 +4,7 @@
4
4
  <!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
5
5
  <!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
6
6
  <head>
7
- <title>
8
- <%= content_for?(:title) ? ((yield :title) + " | #{Monologue.site_name}") : Monologue.site_name %>
9
- </title>
10
- <meta charset="utf-8" />
11
- <meta name="description" content="<%= content_for?(:meta_description) ? yield(:meta_description) : Monologue.meta_description %>" />
12
- <meta name="keyword" content="<%=Monologue.meta_keyword%>">
13
-
14
- <meta http-equiv="content-type" content="text/html;charset=utf-8">
15
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
16
-
17
- <%= stylesheet_link_tag "monologue/blog/application" %>
18
- <%= javascript_include_tag "monologue/blog/application" %>
19
-
20
- <!-- Mobile Specific Metas
21
- ================================================== -->
22
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
23
-
24
- <link href="/feed" rel="alternate" title="RSS" type="application/rss+xml" >
25
- <%= render "layouts/monologue/google_analytics" %>
7
+ <%= render "layouts/monologue/application/head" %>
26
8
  </head>
27
9
  <body>
28
10
  <div class="container">
@@ -0,0 +1,4 @@
1
+ <meta property="og:title" content="<%= monologue_accurate_title %>"/>
2
+ <meta property="og:type" content="<%= controller.action_name == "show" ? "article" : "blog" %>"/>
3
+ <meta property="og:url" content="http://<%= request.host_with_port %><%= request.path.gsub("//","/") %>"/>
4
+ <meta property="og:site_name" content="<%= Monologue.site_name %>"/>
@@ -0,0 +1,18 @@
1
+ <%= render "layouts/monologue/application/title" %>
2
+ <meta charset="utf-8" />
3
+ <%= render "layouts/monologue/application/meta_description" %>
4
+ <%= render "layouts/monologue/application/fb_open_graph" %>
5
+ <meta name="keyword" content="<%=Monologue.meta_keyword%>">
6
+
7
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
9
+
10
+ <%= stylesheet_link_tag "monologue/blog/application" %>
11
+ <%= javascript_include_tag "monologue/blog/application" %>
12
+
13
+ <!-- Mobile Specific Metas
14
+ ================================================== -->
15
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
16
+
17
+ <link href="/feed" rel="alternate" title="RSS" type="application/rss+xml" >
18
+ <%= render "layouts/monologue/application/google_analytics" %>
@@ -0,0 +1 @@
1
+ <meta name="description" content="<%= content_for?(:meta_description) ? yield(:meta_description) : Monologue.meta_description %>" />
@@ -0,0 +1,3 @@
1
+ <title>
2
+ <%= monologue_accurate_title %>
3
+ </title>
@@ -0,0 +1,4 @@
1
+ <div id="recentcomments" class="dsq-widget">
2
+ <h1 class="dsq-widget-title"><%= t(".recent_comments") %></h1>
3
+ <script type="text/javascript" src="http://<%= Monologue.disqus_shortname%>.disqus.com/recent_comments_widget.js?num_items=20&hide_avatars=0&avatar_size=48&excerpt_length=500"></script>
4
+ </div>
@@ -2,12 +2,12 @@
2
2
  <%= post.fields_for @revision do |revision| %>
3
3
  <%= revision.text_field :title, :label => t(".title"), :class => "span6" %>
4
4
  <%= revision.text_area :content, :label => t(".content"), :class => "span12 ckeditor" %>
5
- <%= revision.text_field :url, :label => raw("#{t(".url.before_generated_url")} '#{monologue.root_path}#{DateTime.now.year}/#{t(".url.generated_title")}'#{t(".url.after_generated_url")}") %>
5
+ <%= revision.text_field :url, :label => raw("#{t(".url.before_generated_url")} '#{DateTime.now.year}/#{t(".url.generated_title")}'#{t(".url.after_generated_url")}. #{t(".url.do_not_add_mount_point")} <i>'#{monologue.root_path}'.</i>") %>
6
6
  <%= revision.text_field :published_at, :label => t(".published_at"), :data => {:datepicker => "datepicker"}, :value => revision.object.published_at.nil? ? "" : revision.object.published_at.strftime("%Y-%m-%d") %>
7
7
  <% end %>
8
8
  <%= post.check_box :published, :label => t(".published") %>
9
9
 
10
- <%= post.submit t(".save"), :class => "btn btn-large btn-primary" %> <a href="<%= @revision.url %>" target="_blank" class="btn btn-large"><%= t(".preview") %></a>
10
+ <%= post.submit t(".save"), :class => "btn btn-large btn-primary" %> <a href="<%= @revision.full_url %>" target="_blank" class="btn btn-large"><%= t(".preview") %></a>
11
11
 
12
12
  <script>
13
13
  if($.fn.datepicker.defaults_<%= I18n.locale %>){
@@ -16,7 +16,7 @@
16
16
  <!-- TWITTER -->
17
17
  <a href="https://twitter.com/share" class="twitter-share-button"
18
18
  data-lang="<%= Monologue.twitter_locale || "en" %>"
19
- data-url="<%= request.url %>"
19
+ data-url="http://<%= request.host_with_port %><%= request.path.gsub("//","/") %>"
20
20
  data-via="<%=Monologue.twitter_username%>"
21
21
  data-text="<%=@revision.title%>"
22
22
  data-count="vertical">Tweet</a>
@@ -11,8 +11,8 @@ xml.rss :version => "2.0" do
11
11
  xml.title revision.title
12
12
  xml.description raw(revision.content)
13
13
  xml.pubDate revision.published_at.to_s(:rfc822)
14
- xml.link Monologue.site_url + revision.url
15
- xml.guid Monologue.site_url + revision.url
14
+ xml.link Monologue.site_url + revision.full_url
15
+ xml.guid Monologue.site_url + revision.full_url
16
16
  end
17
17
  end
18
18
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  <section>
5
5
  <header>
6
- <h1><%= link_to revision.title, revision.url %></h1>
6
+ <h1><%= link_to revision.title, revision.full_url %></h1>
7
7
  <time datetime="<%= revision.published_at %>">
8
8
  <%= revision.published_at.to_date.to_formatted_s(:long_ordinal) %>
9
9
  </time>&nbsp;&nbsp;|&nbsp;&nbsp;<%= revision.user.name %>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<%= revision.url + "#disqus_thread" %>"></a>
@@ -8,11 +8,11 @@
8
8
  <% end %>
9
9
 
10
10
  <article>
11
- <header><h1><%= link_to @revision.title, @revision.url %></h1></header>
11
+ <header><h1><%= link_to @revision.title, @revision.full_url %></h1></header>
12
12
  <div class="posted">
13
13
  <time datetime="<%= @revision.published_at %>">
14
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.url + "#disqus_thread" %>"></a>
15
+ </time>&nbsp;&nbsp;|&nbsp;&nbsp;<%= @revision.user.name %>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<%= @revision.full_url + "#disqus_thread" %>"></a>
16
16
  </div>
17
17
  <p><%= raw @revision.content %></p>
18
18
 
@@ -18,6 +18,9 @@ en:
18
18
  message:
19
19
  "You may have mistyped the address or the page may have moved."
20
20
  admin:
21
+ login:
22
+ need_auth:
23
+ "You must first log in to access admin section."
21
24
  posts:
22
25
  index:
23
26
  title:
@@ -35,9 +38,24 @@ en:
35
38
  new:
36
39
  header:
37
40
  "New monologue"
41
+ create:
42
+ created:
43
+ "Monologue created"
44
+ created_with_future_date_and_cache:
45
+ "Monologue created: posts with a future publication date will not be shown unless cache is cleared on that same day. Cache will most probably be generated before that and won't be refreshed automatically."
38
46
  edit:
39
47
  header:
40
48
  "Edit"
49
+ update:
50
+ saved_with_future_date_and_cache:
51
+ "Monologue saved: posts with a future publication date will not be shown unless cache is cleared on that same day. Cache will most probably be generated before that and won't be refreshed automatically."
52
+ saved:
53
+ "Monologue saved"
54
+ delete:
55
+ removed:
56
+ "Monologue removed"
57
+ fail:
58
+ "Failed to remove monologue!"
41
59
  form:
42
60
  title:
43
61
  "Title"
@@ -48,6 +66,8 @@ en:
48
66
  "URL <br /><i> This will be filled by default with "
49
67
  after_generated_url:
50
68
  ". You can choose your own URL. </i>"
69
+ do_not_add_mount_point:
70
+ "Do not add at the beginning of your URL :"
51
71
  generated_title:
52
72
  "your-post-title"
53
73
  published_at:
@@ -58,6 +78,10 @@ en:
58
78
  "Save"
59
79
  preview:
60
80
  "Preview"
81
+ comments:
82
+ show:
83
+ recent_comments:
84
+ "Recent comments"
61
85
  sessions:
62
86
  new:
63
87
  title:
@@ -103,4 +127,9 @@ en:
103
127
  attributes:
104
128
  published_at:
105
129
  blank:
106
- "'Published at' is required"
130
+ "'Published at' is required"
131
+ url:
132
+ start_with_slash:
133
+ "URL can't start with a slash ('/')"
134
+ unique:
135
+ "URL is already used by another post"
@@ -18,6 +18,9 @@ fr:
18
18
  message:
19
19
  "You pourriez avoir mal tappé l'adresse ou la page pourrait avoir été déplacée."
20
20
  admin:
21
+ login:
22
+ need_auth:
23
+ "Vous devez d'abord vous connectez à la section d'administration."
21
24
  posts:
22
25
  index:
23
26
  title:
@@ -35,9 +38,24 @@ fr:
35
38
  new:
36
39
  header:
37
40
  "Nouveau monologue"
41
+ create:
42
+ created:
43
+ "Monologue créé: les articles avec une date de publication future ne seront pas affichés à moins que la cache soit vidée la même journée. La cache sera probablement générée avant ce moment et ne sera pas rafraichie automatiquement."
44
+ created_with_future_date_and_cache:
45
+ "Monologue créé avec succès."
38
46
  edit:
39
47
  header:
40
48
  "Modifier"
49
+ update:
50
+ saved_with_future_date_and_cache:
51
+ "Monologue sauvegardé: les articles avec une date de publication future ne seront pas affichés à moins que la cache soit vidée la même journée. La cache sera probablement générée avant ce moment et ne sera pas rafraichie automatiquement."
52
+ saved:
53
+ "Monologue sauvegardé"
54
+ delete:
55
+ removed:
56
+ "Monologue effacé"
57
+ fail:
58
+ "Le monologue n'as pas pu être effacé!"
41
59
  form:
42
60
  title:
43
61
  "Titre"
@@ -48,6 +66,8 @@ fr:
48
66
  "Adresse URL <br /><i> Ce sera rempli par défaut avec "
49
67
  after_generated_url:
50
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:"
51
71
  generated_title:
52
72
  "nom-de-votre-article"
53
73
  published_at:
@@ -58,6 +78,10 @@ fr:
58
78
  "Sauvegarder"
59
79
  preview:
60
80
  "Aperçu"
81
+ comments:
82
+ show:
83
+ recent_comments:
84
+ "Commentaires récents"
61
85
  sessions:
62
86
  new:
63
87
  title:
@@ -103,4 +127,9 @@ fr:
103
127
  attributes:
104
128
  published_at:
105
129
  blank:
106
- "'Publié le' est requis"
130
+ "'Publié le' est requis"
131
+ url:
132
+ start_with_slash:
133
+ "L'adresse URL ne peut débuter par un slash ('/')"
134
+ unique:
135
+ "L'adresse URL est déjà utilisée par un autre article"
data/config/routes.rb CHANGED
@@ -9,6 +9,7 @@ Monologue::Engine.routes.draw do
9
9
  get "login" => "sessions#new"
10
10
  resources :sessions
11
11
  resources :posts
12
+ get "comments" => "comments#show", :as => "comments"
12
13
  end
13
14
 
14
15
  match "*post_url" => "posts#show", :as => "post"
@@ -0,0 +1,19 @@
1
+ class MigrateOldUrls < ActiveRecord::Migration
2
+ def up
3
+ mount_point = Monologue::Engine.routes.url_helpers.root_path
4
+ Monologue::PostsRevision.all.each do |r|
5
+ next if r.url.nil?
6
+ r.url = r.url.sub(mount_point, "")
7
+ r.save!
8
+ end
9
+ end
10
+
11
+ def down
12
+ mount_point = Monologue::Engine.routes.url_helpers.root_path
13
+ Monologue::PostsRevision.all.each do |r|
14
+ next if r.url.nil?
15
+ r.url = mount_point + r.url
16
+ r.save!
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexToPostsRevisionUrl < ActiveRecord::Migration
2
+ def change
3
+ add_index :monologue_posts_revisions, :url
4
+ end
5
+ end
data/lib/monologue.rb CHANGED
@@ -13,5 +13,6 @@ module Monologue
13
13
  :google_plusone_locale,
14
14
  :admin_force_ssl,
15
15
  :posts_per_page,
16
- :google_analytics_id
16
+ :google_analytics_id,
17
+ :layout
17
18
  end
@@ -1,3 +1,3 @@
1
1
  module Monologue
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monologue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-05 00:00:00.000000000 Z
12
+ date: 2012-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -207,6 +207,7 @@ files:
207
207
  - app/assets/stylesheets/monologue/blog/skeleton/layout.css
208
208
  - app/assets/stylesheets/monologue/blog/skeleton/skeleton.css
209
209
  - app/controllers/monologue/admin/base_controller.rb
210
+ - app/controllers/monologue/admin/comments_controller.rb
210
211
  - app/controllers/monologue/admin/posts_controller.rb
211
212
  - app/controllers/monologue/admin/sessions_controller.rb
212
213
  - app/controllers/monologue/application_controller.rb
@@ -220,10 +221,15 @@ files:
220
221
  - app/models/monologue/posts_revision.rb
221
222
  - app/models/monologue/user.rb
222
223
  - app/sweepers/monologue/posts_sweeper.rb
223
- - app/views/layouts/monologue/_google_analytics.html.erb
224
224
  - app/views/layouts/monologue/admin/_nav_bar.html.erb
225
225
  - app/views/layouts/monologue/admin.html.erb
226
+ - app/views/layouts/monologue/application/_fb_open_graph.html.erb
227
+ - app/views/layouts/monologue/application/_google_analytics.html.erb
228
+ - app/views/layouts/monologue/application/_head.html.erb
229
+ - app/views/layouts/monologue/application/_meta_description.html.erb
230
+ - app/views/layouts/monologue/application/_title.html.erb
226
231
  - app/views/layouts/monologue/application.html.erb
232
+ - app/views/monologue/admin/comments/show.html.erb
227
233
  - app/views/monologue/admin/posts/_form.html.erb
228
234
  - app/views/monologue/admin/posts/edit.html.erb
229
235
  - app/views/monologue/admin/posts/index.html.erb
@@ -241,6 +247,8 @@ files:
241
247
  - db/migrate/20120114001001_create_monologue_users.rb
242
248
  - db/migrate/20120120193858_create_monologue_posts_revisions.rb
243
249
  - db/migrate/20120120193907_create_monologue_posts.rb
250
+ - db/migrate/20120526131841_migrate_old_urls.rb
251
+ - db/migrate/20120526195147_add_index_to_posts_revision_url.rb
244
252
  - db/seeds.rb
245
253
  - lib/monologue/engine.rb
246
254
  - lib/monologue/version.rb