sinatra-disqus 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +5 -0
- data/README.md +5 -1
- data/lib/sinatra/disqus/version.rb +1 -1
- data/lib/sinatra/disqus.rb +21 -17
- data/sinatra-disqus.gemspec +0 -1
- metadata +1 -17
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -61,7 +61,7 @@ or via Bundler:
|
|
61
61
|
|
62
62
|
# Disqus settings
|
63
63
|
set :disqus_shortname, "example.org"
|
64
|
-
|
64
|
+
# Put disqus into developer mode unless in production.
|
65
65
|
set :disqus_developer, !production?
|
66
66
|
end
|
67
67
|
|
@@ -87,6 +87,10 @@ or via Bundler:
|
|
87
87
|
#comments
|
88
88
|
inject_disqus # you'd probably do this at the bottom of a view instead.
|
89
89
|
|
90
|
+
### Version numbering ###
|
91
|
+
|
92
|
+
This project attempts to follow the [semver](http://semver.org/) standard of numbering.
|
93
|
+
|
90
94
|
### Licence ###
|
91
95
|
|
92
96
|
Look in the LICENCE file.
|
data/lib/sinatra/disqus.rb
CHANGED
@@ -1,26 +1,30 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
require 'sinatra/base'
|
4
|
-
require 'haml'
|
5
4
|
|
6
5
|
module Sinatra
|
7
6
|
module Disqus
|
8
7
|
|
9
8
|
Disqus_output_top = <<TOP
|
10
|
-
|
11
|
-
|
9
|
+
<div id='disqus_thread'>
|
10
|
+
<script type='text/javascript'>
|
11
|
+
//<![CDATA[
|
12
12
|
TOP
|
13
13
|
Disqus_output_bottom = <<BOTTOM
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
(function() {
|
15
|
+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
16
|
+
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
|
17
|
+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
18
|
+
})();
|
19
|
+
//]]>
|
20
|
+
</script>
|
21
|
+
<noscript>
|
21
22
|
Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>
|
22
|
-
|
23
|
+
</noscript>
|
24
|
+
<p>
|
23
25
|
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
|
26
|
+
</p>
|
27
|
+
</div>
|
24
28
|
BOTTOM
|
25
29
|
|
26
30
|
# @private
|
@@ -43,11 +47,11 @@ BOTTOM
|
|
43
47
|
# @return [String] The portion of the disqus javascript with the vars.
|
44
48
|
def self.build_vars( opts )
|
45
49
|
<<STR
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
var disqus_title = "#{opts[:title].gsub(/'/, "\\\\'")}";
|
51
|
+
var disqus_developer = #{opts[:disqus_developer]}; // developer mode
|
52
|
+
var disqus_shortname = '#{opts[:disqus_shortname]}';
|
53
|
+
var disqus_identifier = '#{opts[:disqus_identifier]}'; // is on if 1
|
54
|
+
var disqus_url = '#{opts[:request_url]}';
|
51
55
|
STR
|
52
56
|
end
|
53
57
|
end
|
@@ -57,7 +61,7 @@ STR
|
|
57
61
|
|
58
62
|
# @return [String] Returns the bit of HTML/javascript to stick in the page.
|
59
63
|
def inject_disqus
|
60
|
-
|
64
|
+
"#{Disqus_output_top}#{Private.build_vars(request_url: uri(request.path_info), disqus_shortname: settings.disqus_shortname, disqus_developer: settings.disqus_developer, title: @title, disqus_identifier: Private.disqus_identifier(request.path))}#{Disqus_output_bottom}"
|
61
65
|
end
|
62
66
|
|
63
67
|
end
|
data/sinatra-disqus.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-disqus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,22 +27,6 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: haml
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
30
|
description: Drop in disqus to any Sinatra view via a handy helper.
|
47
31
|
email:
|
48
32
|
- iainspeed@gmail.com
|