comfy_blog 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -59,6 +59,10 @@ Posted comments will be sitting in the queue waiting to be published. You can au
59
59
  by setting this to `true`:
60
60
 
61
61
  config.auto_publish_comments = true
62
+
63
+ You can use Disqus to manage comments by setting the following config:
64
+
65
+ config.disqus_shortname = 'forum_shortname'
62
66
 
63
67
 
64
68
  ComfyBlog is released under the [MIT license](https://github.com/comfy/comfy-blog/raw/master/LICENSE)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -1,7 +1,9 @@
1
1
  <li>
2
2
  <div class='item'>
3
3
  <div class='action_links'>
4
- <%= link_to pluralize(post.comments.count, 'comment'), admin_blog_post_comments_path(post) %>
4
+ <% unless ComfyBlog.disqus_enabled? %>
5
+ <%= link_to pluralize(post.comments.count, 'comment'), admin_blog_post_comments_path(post) %>
6
+ <% end %>
5
7
  <%= link_to 'Edit', edit_admin_blog_post_path(post) %>
6
8
  <%= link_to 'Delete', admin_blog_post_path(post), :method => :delete, :confirm => 'Are you sure?' %>
7
9
  </div>
@@ -14,8 +16,7 @@
14
16
  <% post.tags.each do |tag| %>
15
17
  <span class="tag"><%= tag.name %></span>
16
18
  <% end %>
17
-
18
- </div>
19
+ </div>
19
20
  </div>
20
21
  </div>
21
22
  </li>
@@ -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 = '<%= ComfyBlog.config.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">blog comments powered by <span class="logo-disqus">Disqus</span></a>
@@ -1,9 +1,13 @@
1
1
  <%= render :partial => 'blog/posts/post', :object => @post %>
2
2
 
3
- <div id='comments'>
4
- <% @post.comments.each do |comment| %>
5
- <%= render :partial => 'blog/comments/comment', :object => comment %>
6
- <% end %>
7
- </div>
8
-
9
- <%= render :partial => 'blog/comments/form' %>
3
+ <% if ComfyBlog.disqus_enabled? %>
4
+ <%= render :partial => 'blog/comments/disqus' %>
5
+
6
+ <% else %>
7
+ <div id='comments'>
8
+ <% @post.comments.each do |comment| %>
9
+ <%= render :partial => 'blog/comments/comment', :object => comment %>
10
+ <% end %>
11
+ </div>
12
+ <%= render :partial => 'blog/comments/form' %>
13
+ <% end %>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "comfy_blog"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oleg Khabarov", "The Working Group Inc."]
12
- s.date = "2012-01-30"
12
+ s.date = "2012-01-31"
13
13
  s.description = ""
14
14
  s.email = "oleg@twg.ca"
15
15
  s.extra_rdoc_files = [
@@ -57,6 +57,7 @@ Gem::Specification.new do |s|
57
57
  "app/views/admin/blog/tags/index.html.erb",
58
58
  "app/views/admin/blog/tags/new.html.erb",
59
59
  "app/views/blog/comments/_comment.html.erb",
60
+ "app/views/blog/comments/_disqus.html.erb",
60
61
  "app/views/blog/comments/_form.html.erb",
61
62
  "app/views/blog/comments/create.js.erb",
62
63
  "app/views/blog/posts/_post.html.erb",
@@ -3,10 +3,14 @@ Rails.application.routes.draw do
3
3
  namespace :admin, :path => ComfyBlog.config.admin_route_prefix do
4
4
  namespace :blog do
5
5
  resources :posts, :except => [:show] do
6
- resources :comments, :only => [:index]
6
+ unless ComfyBlog.disqus_enabled?
7
+ resources :comments, :only => [:index]
8
+ end
7
9
  end
8
- resources :comments, :only => [:index, :destroy] do
9
- put :publish, :on => :member
10
+ unless ComfyBlog.disqus_enabled?
11
+ resources :comments, :only => [:index, :destroy] do
12
+ put :publish, :on => :member
13
+ end
10
14
  end
11
15
  resources :tags, :except => [:show]
12
16
  end
@@ -23,7 +27,9 @@ Rails.application.routes.draw do
23
27
  o.get ':year/:month/:slug' => 'posts#show', :as => :dated_blog_post
24
28
  end
25
29
 
26
- post ':post_id/comments' => 'comments#create', :as => :blog_post_comments
30
+ unless ComfyBlog.disqus_enabled?
31
+ post ':post_id/comments' => 'comments#create', :as => :blog_post_comments
32
+ end
27
33
 
28
34
  get ':id' => 'posts#show', :as => :blog_post
29
35
  end
@@ -22,5 +22,9 @@ module ComfyBlog
22
22
  end
23
23
  alias :config :configuration
24
24
 
25
+ def disqus_enabled?
26
+ self.config.disqus_shortname.present?
27
+ end
28
+
25
29
  end
26
30
  end
@@ -31,6 +31,9 @@ module ComfyBlog
31
31
  # Default is false.
32
32
  attr_accessor :auto_publish_comments
33
33
 
34
+ # Comments can be fully handled by Disqus. Set this config to use it.
35
+ attr_accessor :disqus_shortname
36
+
34
37
  # Configuration defaults
35
38
  def initialize
36
39
  @title = 'ComfyBlog'
@@ -42,6 +45,8 @@ module ComfyBlog
42
45
  @public_layout = 'application'
43
46
  @posts_per_page = 10
44
47
  @auto_publish_comments = false
48
+ @disqus_shortname = nil
45
49
  end
50
+
46
51
  end
47
52
  end
@@ -100,4 +100,11 @@ class Blog::PostsControllerTest < ActionController::TestCase
100
100
  assert_response 404
101
101
  end
102
102
 
103
+ def test_get_show_with_disqus
104
+ ComfyBlog.config.disqus_shortname = 'test'
105
+ post = blog_posts(:default)
106
+ get :show, :year => post.year, :month => post.month, :slug => blog_posts(:default).slug
107
+ assert_response :success
108
+ end
109
+
103
110
  end
@@ -22,7 +22,8 @@ class ActiveSupport::TestCase
22
22
  config.form_builder = 'ComfyBlog::FormBuilder'
23
23
  config.public_layout = 'application'
24
24
  config.posts_per_page = 10
25
- config.auto_publish_comments = false
25
+ config.auto_publish_comments = false
26
+ config.disqus_shortname = nil
26
27
  end
27
28
  end
28
29
 
@@ -12,6 +12,7 @@ class ConfigurationTest < ActiveSupport::TestCase
12
12
  assert_equal 'ComfyBlog::FormBuilder', config.form_builder
13
13
  assert_equal 10, config.posts_per_page
14
14
  assert_equal false, config.auto_publish_comments
15
+ assert_equal nil, config.disqus_shortname
15
16
  end
16
17
 
17
18
  def test_initialization_overrides
@@ -19,4 +20,10 @@ class ConfigurationTest < ActiveSupport::TestCase
19
20
  assert_equal 'new-admin', ComfyBlog.config.admin_route_prefix
20
21
  end
21
22
 
23
+ def test_disqus_enabled?
24
+ assert !ComfyBlog.disqus_enabled?
25
+ ComfyBlog.config.disqus_shortname = 'test'
26
+ assert ComfyBlog.disqus_enabled?
27
+ end
28
+
22
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfy_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-30 00:00:00.000000000Z
13
+ date: 2012-01-31 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &70142022204480 !ruby/object:Gem::Requirement
17
+ requirement: &70337561190460 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70142022204480
25
+ version_requirements: *70337561190460
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rails_autolink
28
- requirement: &70142022203220 !ruby/object:Gem::Requirement
28
+ requirement: &70337561188860 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.0.4
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70142022203220
36
+ version_requirements: *70337561188860
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: jquery-rails
39
- requirement: &70142022201680 !ruby/object:Gem::Requirement
39
+ requirement: &70337561187720 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70142022201680
47
+ version_requirements: *70337561187720
48
48
  description: ''
49
49
  email: oleg@twg.ca
50
50
  executables: []
@@ -93,6 +93,7 @@ files:
93
93
  - app/views/admin/blog/tags/index.html.erb
94
94
  - app/views/admin/blog/tags/new.html.erb
95
95
  - app/views/blog/comments/_comment.html.erb
96
+ - app/views/blog/comments/_disqus.html.erb
96
97
  - app/views/blog/comments/_form.html.erb
97
98
  - app/views/blog/comments/create.js.erb
98
99
  - app/views/blog/posts/_post.html.erb
@@ -160,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
161
  version: '0'
161
162
  segments:
162
163
  - 0
163
- hash: -3227396926195768290
164
+ hash: 4147721177865210323
164
165
  required_rubygems_version: !ruby/object:Gem::Requirement
165
166
  none: false
166
167
  requirements: