origen_doc_helpers 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d89354a4f13aed042c3fdbb0fb42ef325db4612f
4
- data.tar.gz: 19c9c7af0631ba313222d0d485b8e8707b7bdf0f
3
+ metadata.gz: 6d464f725c392838e29ed436e67b9f774fcbf609
4
+ data.tar.gz: 71856ff7ab2a8a1541b5ec888782570528955a67
5
5
  SHA512:
6
- metadata.gz: 278a9668b54e8a4bd8243be6e994bc168c23130d5b31025c3c26b28051ab521c6d843e6c52337895f80b2d98dce79725400c24dea783f368907e37a3d45b17bc
7
- data.tar.gz: 4ec1d7913206ac96248ebe5cc602d7c8c5d1be984dedf28f316c2ffa880c350833be4fb768830a82a442da689a5658a79b5f3ff5aa553abf58d6c89ace470c8e
6
+ metadata.gz: a8d4a476b525cd30887bfcf84b8c250ee09d4eb7df1cfbf4b9a8d2aa968ac15c23405af4e495e0662e489130b6bd0a1929a1f0bd5dd6c8eda91b1b2bbd739e1d
7
+ data.tar.gz: 14fe243108aade7cb9aa3353e510f4f13f3f7242cd58e86574fdeb992c0c067858c843a7c9ec03fbd1919d5cc7cb5443af76029ca809aad34857b2fda6dbe87e
@@ -9,6 +9,7 @@ class OrigenDocHelpersApplication < Origen::Application
9
9
  # command) fill in these attributes.
10
10
  config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/doc_helpers"
11
11
  config.web_domain = "http://origen-sdk.org/doc_helpers"
12
+ config.disqus_shortname = "origen-sdk"
12
13
 
13
14
  config.semantically_version = true
14
15
 
data/config/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module OrigenDocHelpers
2
2
  MAJOR = 0
3
- MINOR = 1
3
+ MINOR = 2
4
4
  BUGFIX = 0
5
5
  DEV = nil
6
6
 
data/lib/helpers.rb CHANGED
@@ -51,6 +51,50 @@ END
51
51
  end
52
52
  include Yammer
53
53
 
54
+ module Disqus
55
+ def disqus_comments(options = {})
56
+ options = {
57
+ disqus_shortname: Origen.app.config.disqus_shortname || 'origen-sdk'
58
+ }.merge(options)
59
+
60
+ <<END
61
+ <div style="position: relative">
62
+ <hr>
63
+ <h4>Comments</h4>
64
+ </div>
65
+ <div id="disqus_thread"></div>
66
+ <script type="text/javascript">
67
+ /* * * CONFIGURATION VARIABLES * * */
68
+ var disqus_shortname = '#{options[:disqus_shortname]}';
69
+ var disqus_title;
70
+ var disqus_url = 'http://' + window.location.hostname + window.location.pathname;
71
+
72
+ disqus_title = $("h1").text();
73
+ if (disqus_title.length == 0) {
74
+ disqus_title = $("h2").text();
75
+ }
76
+ if (disqus_title.length == 0) {
77
+ disqus_title = $("h3").text();
78
+ }
79
+ if (disqus_title.length == 0) {
80
+ disqus_title = $("title").text();
81
+ } else {
82
+ disqus_title = disqus_title + ' (' + $("title").text() + ')';
83
+ }
84
+
85
+ /* * * DON'T EDIT BELOW THIS LINE * * */
86
+ (function() {
87
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
88
+ dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
89
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
90
+ })();
91
+ </script>
92
+ <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
93
+ END
94
+ end
95
+ end
96
+ include Disqus
97
+
54
98
  # Helpers for the register diagrams
55
99
  module RegisterHelpers
56
100
  # Returns true if some portion of the given bits falls
@@ -10,7 +10,8 @@ that should be used to generate it.
10
10
 
11
11
  * [Searchable Documents](<%= path "/examples/searchable/intro" %>)
12
12
  * [Register Descriptions](<%= path "/examples/register" %>)
13
- * [Yammer Widgets](<%= path "/examples/yammer" %>)
13
+ * [Yammer Comments](<%= path "/examples/yammer" %>)
14
+ * [Disqus Comments](<%= path "/examples/disqus" %>)
14
15
 
15
16
  ### Test Engineering
16
17
 
@@ -0,0 +1,54 @@
1
+ % render "../layouts/examples.html" do
2
+
3
+ # Disqus Comments
4
+
5
+ These helpers make it easy to drop a [Disqus](https://disqus.com/) comments section at the
6
+ bottom of your pages, just like [the one below](<%= path "examples/disqus/#Comments" %>).
7
+
8
+ Note that such comments will be externally visible and therefore **this should not be used for
9
+ company internal applications/web pages**. For similar functionality within a company you
10
+ can use [Yammer comments](<%= path "examples/yammer" %>) instead if your company uses the
11
+ Office 365 suite.
12
+
13
+ ## Community Selection
14
+
15
+ Any comments made on a web page will be associated with a specific community on Disqus where
16
+ they can be collectively viewed and moderated, for example here is
17
+ [the Origen SDK Disqus community](https://disqus.com/home/forum/origen-sdk/).
18
+
19
+ If your web page is about a plugin/application that will be of general interest within the Origen
20
+ community, then you are welcome to use the Origen SDK Disqus community which will be selected
21
+ by default.
22
+
23
+ If your pages are more about your specific application domain, then you should
24
+ [create you own community channel](https://disqus.com/home/channels/new/) instead.
25
+
26
+ Your new community can be associated with your application by setting the following
27
+ app configuration attribute:
28
+
29
+ ~~~ruby
30
+ # config/application.rb
31
+ config.disqus_shortname = "my-community"
32
+ ~~~
33
+
34
+ Alternatively this parameter can be passed directly to the comments helper as shown
35
+ below.
36
+
37
+ ## Adding Comments
38
+
39
+ To include disqus comments simply add this to the bottom of any given page, or your
40
+ layout file to add comments to every page:
41
+
42
+ ~~~eruby
43
+ <%= "<" + "%= disqus_comments %" + ">" %>
44
+ ~~~
45
+
46
+ The following options are available:
47
+
48
+ ~~~text
49
+ :disqus_shortname - Specify the disqus forum to associate your comments with. This will fall back to the value returned by
50
+ RGen.app.config.disqus_shortname, and failing that will fall back to 'origen-sdk' to select the Origen
51
+ community channel.
52
+ ~~~
53
+
54
+ % end
@@ -1,6 +1,6 @@
1
1
  % render "../layouts/examples.html" do
2
2
 
3
- # Yammer Widgets
3
+ # Yammer Comments
4
4
 
5
5
  These helpers wrap the [Yammer Embed API](https://developer.yammer.com/connect/)
6
6
  which allows Yammer feeds to be embedded in any web page.
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: <%= options[:title] || Origen.config.name %>
3
+ analytics: UA-64455560-1
3
4
  ---
4
5
  <%= render "templates/web/partials/navbar.html", :tab => options[:tab] %>
5
6
 
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: <%= options[:title] || Origen.config.name %>
3
+ analytics: UA-64455560-1
3
4
  ---
4
5
  <%= render "partials/navbar.html", :tab => :examples %>
5
6
 
@@ -19,4 +20,6 @@ title: <%= options[:title] || Origen.config.name %>
19
20
 
20
21
  <%= yield %>
21
22
 
23
+ <%= disqus_comments %>
24
+
22
25
  % end
@@ -2,4 +2,6 @@
2
2
 
3
3
  <%= yield %>
4
4
 
5
+ <%= disqus_comments %>
6
+
5
7
  % end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_doc_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-26 00:00:00.000000000 Z
11
+ date: 2015-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
- version: 0.0.5
22
+ version: 0.2.1
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.2'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
- version: 0.0.5
32
+ version: 0.2.1
27
33
  description:
28
34
  email:
29
35
  - stephen.f.mcginty@gmail.com
@@ -52,6 +58,7 @@ files:
52
58
  - templates/shared/_spec.html.erb
53
59
  - templates/shared/test/_flow.md.erb
54
60
  - templates/web/examples.md.erb
61
+ - templates/web/examples/disqus.md.erb
55
62
  - templates/web/examples/register.md.erb
56
63
  - templates/web/examples/searchable/intro.md.erb
57
64
  - templates/web/examples/searchable/page2.md.erb
@@ -86,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
93
  version: 1.8.11
87
94
  requirements: []
88
95
  rubyforge_project:
89
- rubygems_version: 2.2.2
96
+ rubygems_version: 2.4.5
90
97
  signing_key:
91
98
  specification_version: 4
92
99
  summary: Snippets and helpers for creating Origen web documents