blogit 0.4.8 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. data/README.md +11 -3
  2. data/app/assets/javascripts/blogit/archive.js +8 -0
  3. data/app/assets/javascripts/blogit/index.js +1 -1
  4. data/app/assets/stylesheets/blogit/index.css +10 -1
  5. data/app/controllers/blogit/comments_controller.rb +7 -7
  6. data/app/controllers/blogit/posts_controller.rb +12 -10
  7. data/app/helpers/blogit/application_helper.rb +23 -4
  8. data/app/helpers/blogit/posts_helper.rb +47 -3
  9. data/app/models/blogit/comment.rb +2 -0
  10. data/app/models/blogit/post.rb +26 -8
  11. data/app/views/blogit/comments/_admin_links.html.erb +2 -2
  12. data/app/views/blogit/comments/_comment.html.erb +8 -8
  13. data/app/views/blogit/comments/_form.html.erb +17 -18
  14. data/app/views/blogit/posts/_active_record_comments.html.erb +4 -0
  15. data/app/views/blogit/posts/_blogger_information.html.erb +1 -1
  16. data/app/views/blogit/posts/_comments_count.html.erb +2 -2
  17. data/app/views/blogit/posts/_disqus_comments.html.erb +14 -0
  18. data/app/views/blogit/posts/_empty.html.erb +2 -2
  19. data/app/views/blogit/posts/_form.html.erb +9 -9
  20. data/app/views/blogit/posts/_no_comments.html.erb +0 -0
  21. data/app/views/blogit/posts/_post.html.erb +6 -6
  22. data/app/views/blogit/posts/_post_links.html.erb +1 -1
  23. data/app/views/blogit/posts/_share_bar.html.erb +45 -0
  24. data/app/views/blogit/posts/edit.html.erb +2 -2
  25. data/app/views/blogit/posts/index.html.erb +7 -7
  26. data/app/views/blogit/posts/new.html.erb +1 -1
  27. data/app/views/blogit/posts/show.html.erb +2 -6
  28. data/config/locales/en.yml +48 -0
  29. data/config/locales/fr.yml +61 -0
  30. data/lib/blogit/configuration.rb +69 -30
  31. data/lib/blogit/version.rb +1 -1
  32. data/lib/generators/templates/blogit.rb +34 -18
  33. data/spec/controllers/blogit/posts_controller_spec.rb +75 -75
  34. data/spec/dummy/app/helpers/application_helper.rb +1 -0
  35. data/spec/dummy/app/views/layouts/application.html.erb +8 -4
  36. data/spec/dummy/config/application.rb +1 -1
  37. data/spec/dummy/config/initializers/blogit.rb +21 -12
  38. data/spec/dummy/db/development.sqlite3 +0 -0
  39. data/spec/dummy/db/test.sqlite3 +0 -0
  40. data/spec/dummy/log/development.log +155 -0
  41. data/spec/dummy/log/test.log +7310 -0
  42. data/spec/helpers/blogit/application_helper_spec.rb +63 -8
  43. data/spec/helpers/blogit/posts_helper_spec.rb +114 -6
  44. data/spec/lib/blogit/parsers/markdown_parser_spec.rb +7 -3
  45. data/spec/lib/configuration_spec.rb +43 -19
  46. data/spec/models/blogit/post_spec.rb +51 -53
  47. data/spec/spec_helper.rb +1 -1
  48. metadata +158 -36
@@ -0,0 +1,4 @@
1
+ <div id="comments">
2
+ <%= render post.comments %>
3
+ </div>
4
+ <%= render partial: "blogit/comments/form", locals: { post: post, comment: comment } %>
@@ -1,4 +1,4 @@
1
1
  <%= blog_post_tag :footer do %>
2
- Written by <%= post.blogger_display_name %> on
2
+ <%=t :written_by, scope: 'blogit.posts', author: post.blogger_display_name %>
3
3
  <%= time_tag(post.created_at, blogit_conf.datetime_format) %>
4
4
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <%= content_tag(:div, class: "blog_post_comments_count", id: "blog_post_#{post.id}_comments_count") do %>
2
2
  <%= link_to(post_path(post, anchor: "comments")) do %>
3
- <%= pluralize post.comments_count, "comment" %>
4
- <% end %>
3
+ <%=t :comment, scope: 'blogit.posts', count: post.comments_count %>
4
+ <% end %>
5
5
  <% end %>
@@ -0,0 +1,14 @@
1
+ <div id="disqus_thread"></div>
2
+ <script type="text/javascript">
3
+ /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
4
+ var disqus_shortname = '<%= Blogit.configuration.disqus_shortname %>'; // required: replace example with your forum shortname
5
+
6
+ /* * * DON'T EDIT BELOW THIS LINE * * */
7
+ (function() {
8
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
9
+ dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
10
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
11
+ })();
12
+ </script>
13
+ <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
14
+ <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
@@ -1,3 +1,3 @@
1
1
  <div class="blogit_empty_message">
2
- Sorry, there are no posts about "<%= params[:tag] %>".
3
- </div>
2
+ <%=t :there_are_no_posts_about, scope: 'blogit.posts', tag: params[:tag] %>
3
+ </div>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <% if @post.errors.any? %>
4
4
  <div id="error_explanation">
5
- <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
5
+ <h2><%=t :prohibited_this_post_from_being_saved, scope: 'blogit.posts', count: @post.errors.count%></h2>
6
6
 
7
7
  <ul>
8
8
  <% @post.errors.full_messages.each do |msg| %>
@@ -14,30 +14,30 @@
14
14
 
15
15
  <fieldset>
16
16
  <%= field do %>
17
- <%= f.text_field :title, placeholder: "Give your post a title" %>
17
+ <%= f.text_field :title, placeholder: t(:give_your_post_a_title, scope: 'blogit.posts') %>
18
18
  <% end %>
19
19
 
20
20
  <%= field do %>
21
- <%= f.text_area :body, placeholder: "Write something here..." %>
21
+ <%= f.text_area :body, placeholder: t(:write_something_here, scope: 'blogit.posts') %>
22
22
  <% end %>
23
23
  </fieldset>
24
24
 
25
25
  <fieldset>
26
26
 
27
27
  <%= field id: "new_blog_post_tag_field" do %>
28
- <%= f.label :tag_list, "Tags" %>
29
- <%= f.text_field :tag_list, placeholder: "tag one, tag two, etc..." %>
28
+ <%= f.label :tag_list, t(:tags, scope: 'blogit.posts') %>
29
+ <%= f.text_field :tag_list, placeholder: t(:tag_placeholder, scope: 'blogit.posts') %>
30
30
  <% end %>
31
-
31
+
32
32
  <p class="blog_post_tip">
33
- Tip: you can style your post using <%= blogit_conf.default_parser %>
33
+ <%=t :tip_you_can_style_your_post_using, scope: 'blogit.posts', parser: blogit_conf.default_parser %>
34
34
  </p>
35
35
 
36
36
  </fieldset>
37
37
 
38
38
  <%= actions do %>
39
- <%= f.submit %> or
40
- <%= link_to("cancel", @post.new_record? ? root_path : post_path(@post)) %>
39
+ <%= f.submit %> <%=t :or, scope: 'blogit.posts'%>
40
+ <%= link_to(t(:cancel, scope: 'blogit.posts'), @post.new_record? ? root_path : post_path(@post)) %>
41
41
  <% end %>
42
42
 
43
43
  <% end %>
File without changes
@@ -5,15 +5,15 @@
5
5
 
6
6
  <%# Render the body of this blog post (as Markdown) %>
7
7
  <%= render "blogit/posts/post_body", post: post %>
8
-
8
+
9
9
  <%# Render admin links to edit/delete this post %>
10
10
  <%= render "blogit/posts/post_links", post: post %>
11
-
11
+
12
12
  <%# Render info about the person who wrote this post %>
13
13
  <%= render "blogit/posts/blogger_information", post: post %>
14
-
14
+
15
15
  <%# Render the no. of comments %>
16
- <%= render "blogit/posts/comments_count",
16
+ <%= render "blogit/posts/comments_count",
17
17
  post: post if defined?(show_comments_count) and show_comments_count %>
18
-
19
- <% end %>
18
+
19
+ <% end %>
@@ -1,5 +1,5 @@
1
1
  <%= login_required do %>
2
2
  <%= actions do %>
3
- <%= link_to("edit", edit_post_path(post)) %> | <%= link_to("delete", post, method: :destroy, confirm: "Are you sure you want to remove this post?") %>
3
+ <%= link_to(t(:edit, scope: 'blogit.posts'), edit_post_path(post)) %> | <%= link_to(t(:delete, scope: 'blogit.posts'), post, method: :delete, confirm: t(:are_you_sure_you_want_to_remove_this_post, scope: 'blogit.posts')) %>
4
4
  <% end %>
5
5
  <% end unless blogit_conf.author_edits_only and not this_blogger?(post) %>
@@ -0,0 +1,45 @@
1
+ <div id="blog_share_bar">
2
+
3
+ <div id="google-plus" class="social_button">
4
+ <!-- GOOGLE +1 -->
5
+ <g:plusone size="medium"></g:plusone>
6
+ <script type="text/javascript">
7
+ window.___gcfg = {lang: '<%= I18n.default_locale %>'};
8
+
9
+ (function() {
10
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
11
+ po.src = 'https://apis.google.com/js/plusone.js';
12
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
13
+ })();
14
+ </script>
15
+ <!-- /GOOGLE +1 -->
16
+ </div>
17
+
18
+ <div id="twitter" class="social_button">
19
+ <!-- TWITTER -->
20
+ <a href="https://twitter.com/share" class="twitter-share-button"
21
+ data-lang="<%= I18n.default_locale %>"
22
+ data-url="http://<%= request.host_with_port %><%= request.path.gsub("//","/") %>"
23
+ data-via="<%= Blogit.configuration.twitter_username %>"
24
+ data-text="<%= post.title%>"
25
+ data-count="horizontal">Tweet</a>
26
+
27
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
28
+ <!-- /TWITTER -->
29
+ </div>
30
+
31
+ <div id="facebook" class="social_button">
32
+ <!-- FACEBOOK LIKE -->
33
+ <div id="fb-root"></div>
34
+ <script>(function(d, s, id) {
35
+ var js, fjs = d.getElementsByTagName(s)[0];
36
+ if (d.getElementById(id)) return;
37
+ js = d.createElement(s); js.id = id;
38
+ js.src = "//connect.facebook.net/<%= t "blogit.share_bar.facebook" %>/all.js#xfbml=1";
39
+ fjs.parentNode.insertBefore(js, fjs);
40
+ }(document, 'script', 'facebook-jssdk'));</script>
41
+ <div class="fb-like" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false"></div>
42
+ <!-- /FACEBOOK LIKE -->
43
+ </div>
44
+
45
+ </div>
@@ -1,3 +1,3 @@
1
- <h2>Edit Blog Post #<%= @post.id %></h2>
1
+ <h2><%=t :edit_blog_post, scope: 'blogit.posts', id: @post.id %></h2>
2
2
 
3
- <%= render 'form' %>
3
+ <%= render 'form' %>
@@ -1,17 +1,17 @@
1
1
  <%= login_required class: "actions", id: "new_blog_post_link" do %>
2
- <%= link_to 'New Blog post', new_post_path %>
2
+ <%= link_to t(:new_blog_post, scope: 'blogit.posts'), new_post_path %>
3
3
  <% end %>
4
4
 
5
5
  <% if @posts.any? %>
6
6
 
7
- <%= render partial: "blogit/posts/post",
8
- collection: @posts,
9
- spacer_template: "blog_post_spacer",
7
+ <%= render partial: "blogit/posts/post",
8
+ collection: @posts,
9
+ spacer_template: "blog_post_spacer",
10
10
  locals: {show_comments_count: true} %>
11
11
  <% else %>
12
-
12
+
13
13
  <%= render partial: "blogit/posts/empty" %>
14
-
14
+
15
15
  <% end %>
16
16
 
17
- <%= render "pagination" %>
17
+ <%= render "pagination" %>
@@ -1,3 +1,3 @@
1
- <h2>Write a new blog post</h2>
1
+ <h2><%=t :write_a_new_blog_post, scope: 'blogit.posts'%></h2>
2
2
 
3
3
  <%= render 'form' %>
@@ -1,7 +1,3 @@
1
1
  <%= render @post %>
2
- <% if blogit_conf.include_comments %>
3
- <div id="comments">
4
- <%= render @post.comments %>
5
- </div>
6
- <%= render "blogit/comments/form" %>
7
- <% end %>
2
+ <%= share_bar_for @post %>
3
+ <%= comments_for @post %>
@@ -0,0 +1,48 @@
1
+ en:
2
+ blogit:
3
+ comments:
4
+ leave_a_comment: "Leave a comment"
5
+ name: "Name *"
6
+ email_never_displayed: "Email * (Never displayed)"
7
+ your_website: "Your Website"
8
+ your_comment: "Your comment *"
9
+ add_comment: "Add Comment"
10
+ adding_comment: "Adding Comment..."
11
+ wrote: "%{author} wrote:"
12
+ posted_on: "Posted on"
13
+ delete: "delete"
14
+ are_you_sure_you_want_to_remove_this_comment: "Are you sure you want to remove this comment?"
15
+ successfully_added_comment: "Successfully added comment!"
16
+ successfully_removed_comment: "Successfully removed comment."
17
+ posts:
18
+ written_by: "Written by %{author} on"
19
+ there_are_no_posts_about: "Sorry, there are no posts about \"%{tag}\"."
20
+ prohibited_this_post_from_being_saved:
21
+ one: "One error prohibited this post form being saved:"
22
+ other: "%{count} errors prohibited this post form being saved:"
23
+ give_your_post_a_title: "Give your post a title"
24
+ write_something_here: "Write something here..."
25
+ tags: "Tags"
26
+ tag_placeholder: "tag one, tag two, etc..."
27
+ tip_you_can_style_your_post_using: "Tip: you can style your post using %{parser}"
28
+ or: "or"
29
+ cancel: "cancel"
30
+ edit: "edit"
31
+ delete: "delete"
32
+ are_you_sure_you_want_to_remove_this_post: "Are you sure you want to remove this post?"
33
+ comment:
34
+ one: "1 comment"
35
+ other: "%{count} comments"
36
+ edit_blog_post: "Edit Blog Post #%{id}"
37
+ new_blog_post: "New Blog post"
38
+ write_a_new_blog_post: "Write a new blog post"
39
+ blog_post_was_successfully_created: "Blog post was successfully created."
40
+ blog_post_was_successfully_updated: "Blog post was successfully updated."
41
+ blog_post_was_successfully_destroyed: "Blog post was successfully destroyed."
42
+ share_bar:
43
+ facebook: "en_US"
44
+
45
+ time:
46
+ formats:
47
+ plain_month_only: "%B"
48
+
@@ -0,0 +1,61 @@
1
+ fr:
2
+ blogit:
3
+ comments:
4
+ leave_a_comment: "Laissez un commentaire"
5
+ name: "Nom *"
6
+ email_never_displayed: "Email * (Jamais affiché)"
7
+ your_website: "Votre site web"
8
+ your_comment: "Votre commentaire *"
9
+ add_comment: "Ajouter un commentaire"
10
+ adding_comment: "Ajout de commentaire ..."
11
+ wrote: "%{author} a écrit:"
12
+ posted_on: "Publié le "
13
+ delete: "effacer"
14
+ are_you_sure_you_want_to_remove_this_comment: "Etes vous certain de vouloir supprimer ce commentaire?"
15
+ successfully_added_comment: "Commentaire ajouté avec succès."
16
+ successfully_removed_comment: "Commentaire supprimé avec succès."
17
+ posts:
18
+ written_by: "Ecrit par %{author} le"
19
+ there_are_no_posts_about: "Désolé, il n'y a pas d'article à propos de \"%{tag}\"."
20
+ prohibited_this_post_from_being_saved:
21
+ one: "Une erreur a empêché cet article d'être enregistré :"
22
+ other: "%{count} erreurs ont empêché cet article d'être enregistré :"
23
+ give_your_post_a_title: "Donnez un nom à votre article"
24
+ write_something_here: "Ecrivez quelque chose ici ..."
25
+ tags: "Libellés"
26
+ tag_placeholder: "Libellé 1, Libellé 2 ..."
27
+ tip_you_can_style_your_post_using: "Astuce : vous pouvez styler votre article en utilisant %{parser}"
28
+ or: "ou"
29
+ cancel: "annuler"
30
+ edit: "editer"
31
+ delete: "supprimer"
32
+ are_you_sure_you_want_to_remove_this_post: "Etes vous certain de vouloir supprimer cet article?"
33
+ comment:
34
+ zero: "Aucun commentaire"
35
+ one: "1 commentaire"
36
+ other: "%{count} commentaires"
37
+ edit_blog_post: "Editez l'article #%{id}"
38
+ new_blog_post: "Nouvel article"
39
+ write_a_new_blog_post: "Ecrivez un nouvel article"
40
+ blog_post_was_successfully_created: "Article ajouté avec succès."
41
+ blog_post_was_successfully_updated: "Article modifié avec succès."
42
+ blog_post_was_successfully_destroyed: "Article supprimé avec succès."
43
+ share_bar:
44
+ facebook: "fr_FR"
45
+
46
+ time:
47
+ formats:
48
+ plain_month_only: "%B"
49
+
50
+ activerecord:
51
+ models:
52
+ blogit/post: "article"
53
+ blogit/comment: "commentaire"
54
+ attributes:
55
+ blogit/post:
56
+ title: "titre"
57
+ body: "corps"
58
+ blogit/comment:
59
+ name: "nom"
60
+ body: "corps"
61
+
@@ -1,71 +1,80 @@
1
1
  module Blogit
2
2
  class Configuration
3
-
4
- # Should we include comments for blog posts?
3
+
4
+ # What kind of comments do you want to add to your blog ? (:active_record, :disqus or :no)
5
5
  attr_accessor :include_comments
6
6
 
7
+ # When using disqus comments, what is the shortname of your forum ?
8
+ attr_reader :disqus_shortname
9
+
10
+ # Should there be a share bar on every post ?
11
+ attr_accessor :include_share_bar
12
+
13
+ # Twitter username used in the share bar
14
+ attr_reader :twitter_username
15
+
7
16
  # The name of the controller method we'll call to return the current blogger.
8
17
  attr_accessor :current_blogger_method
9
-
18
+
10
19
  # what method do we call on blogger to return their display name?
11
20
  # Defaults to :username
12
21
  attr_accessor :blogger_display_name_method
13
-
14
- # Which DateTime::FORMATS format do we use to display
22
+
23
+ # Which DateTime::FORMATS format do we use to display
15
24
  # blog and comment publish time
16
25
  # Defaults to :short
17
26
  attr_accessor :datetime_format
18
-
27
+
19
28
  # Number of posts to show per page
20
29
  # @see https://github.com/amatsuda/kaminari
21
30
  # @see Blogit::Post
22
31
  attr_accessor :posts_per_page
23
-
32
+
24
33
  # Should text within "```" or "`" be highlighted as code?
25
34
  # Defaults to true
26
35
  # @note - At the moment this only works when default_parser
27
36
  # is :markdown
28
37
  attr_accessor :highlight_code_syntax
29
-
38
+
30
39
  # The name of the before filter we'll call to authenticate the current user.
31
40
  # Defaults to :login_required
32
41
  attr_accessor :authentication_method
33
-
42
+
34
43
  # If set to true, only the user who authored the post may, edit or destroy.
35
44
  # Defaults to false
36
45
  attr_accessor :author_edits_only
37
-
38
- # If set to true, the comments form will POST and DELETE to the comments
46
+
47
+ # If set to true, the comments form will POST and DELETE to the comments
39
48
  # controller using AJAX calls.
40
49
  # Defaults to true
41
50
  attr_accessor :ajax_comments
42
-
51
+
43
52
  # If set to true, the create, edit, update and destroy actions
44
- # will be included. If set to false, you'll have to set these
53
+ # will be included. If set to false, you'll have to set these
45
54
  # yourself elsewhere in the app
46
55
  attr_accessor :include_admin_actions
47
-
56
+
48
57
  # If set to true, links for new posts, editing posts and deleting comments
49
- # will be available. If set to false, you'll have to set these
58
+ # will be available. If set to false, you'll have to set these
50
59
  # yourself in the templates.
51
60
  attr_accessor :include_admin_links
52
-
61
+
53
62
  # The default format for parsing the blog content.
54
63
  # Defaults to :markdown
55
64
  attr_accessor :default_parser
56
-
65
+
57
66
  # When using redcarpet as content parser, pass these options as defaults
58
67
  # Defaults to REDCARPET_OPTIONS
59
- attr_accessor :redcarpet_options
60
-
68
+ attr_accessor :redcarpet_options
69
+
61
70
  # Should the controllers cache the blog pages as HTML?
62
71
  # Defaults to false
63
72
  attr_accessor :cache_pages
64
-
73
+
65
74
  # The title of the RSS feed for the blog posts
66
- # Defaults to "[Application Name] Blog Posts"
75
+ # Defaults to "[Application Name] Blog Posts"
67
76
  attr_accessor :rss_feed_title
68
-
77
+
69
78
  # The description of the RSS feed for the blog posts
70
79
  # Defaults to "[Application Name] Blog Posts"
71
80
  attr_accessor :rss_feed_description
@@ -74,18 +83,24 @@ module Blogit
74
83
  # Defaults to 'en'
75
84
  attr_accessor :rss_feed_language
76
85
 
77
-
86
+ # Should the routes of the main app be accessible without
87
+ # the "main_app." prefix ?
88
+ attr_accessor :inline_main_app_named_routes
89
+
78
90
  REDCARPET_OPTIONS = {
79
- hard_wrap: true,
80
- filter_html: true,
91
+ hard_wrap: true,
92
+ filter_html: true,
81
93
  autolink: true,
82
94
  no_intra_emphasis: true,
83
95
  fenced_code_blocks: true,
84
96
  gh_blockcode: true,
85
97
  }
86
-
98
+
87
99
  def initialize
88
- @include_comments = true
100
+ @include_comments = :active_record
101
+ @disqus_shortname = ""
102
+ @include_share_bar = false
103
+ @twitter_username = ""
89
104
  @current_blogger_method = :current_user
90
105
  @blogger_display_name_method = :username
91
106
  @datetime_format = :short
@@ -94,7 +109,7 @@ module Blogit
94
109
  @author_edits_only = false
95
110
  @ajax_comments = true
96
111
  @include_admin_actions = true
97
- @include_admin_links = true
112
+ @include_admin_links = true
98
113
  @cache_pages = false
99
114
  @default_parser = :markdown
100
115
  @highlight_code_syntax = true
@@ -103,10 +118,34 @@ module Blogit
103
118
  @rss_feed_language = "en"
104
119
  @redcarpet_options = REDCARPET_OPTIONS
105
120
  end
106
-
121
+
107
122
  def default_parser_class
108
123
  "Blogit::Parsers::#{@default_parser.to_s.classify}Parser".constantize
109
124
  end
125
+
126
+ # If the user has defined a disqus shortname but hasn't set include_comments to
127
+ # disqus, print a warning to the console.
128
+ def disqus_shortname=(shortname)
129
+ if @include_comments && @include_comments != :disqus
130
+ blogit_warn "You've set config.disqus_shortname in your blogit config file but config.include_comments is not set to :disqus"
131
+ end
132
+ @disqus_shortname = shortname
133
+ end
134
+
135
+ # If the user has defined a disqus shortname but hasn't set include_comments to
136
+ # disqus, print a warning to the console.
137
+ def twitter_username=(username)
138
+ if @twitter_username.present? and not @include_share_bar
139
+ blogit_warn "You've set config.twitter_username in your blogit config file but config.include_share_bar is set to false"
140
+ end
141
+ @twitter_username = username
142
+ end
143
+
144
+ private
145
+
146
+ def blogit_warn(message)
147
+ warn "[Blogit]: #{message}"
148
+ end
110
149
 
111
150
  end
112
- end
151
+ end