origen_doc_helpers 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/application.rb +1 -0
- data/config/version.rb +1 -1
- data/lib/helpers.rb +44 -0
- data/templates/web/examples.md.erb +2 -1
- data/templates/web/examples/disqus.md.erb +54 -0
- data/templates/web/examples/yammer.md.erb +1 -1
- data/templates/web/layouts/_basic.html.erb +1 -0
- data/templates/web/layouts/_doc.html.erb +3 -0
- data/templates/web/layouts/_examples.html.erb +2 -0
- metadata +12 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d464f725c392838e29ed436e67b9f774fcbf609
|
4
|
+
data.tar.gz: 71856ff7ab2a8a1541b5ec888782570528955a67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8d4a476b525cd30887bfcf84b8c250ee09d4eb7df1cfbf4b9a8d2aa968ac15c23405af4e495e0662e489130b6bd0a1929a1f0bd5dd6c8eda91b1b2bbd739e1d
|
7
|
+
data.tar.gz: 14fe243108aade7cb9aa3353e510f4f13f3f7242cd58e86574fdeb992c0c067858c843a7c9ec03fbd1919d5cc7cb5443af76029ca809aad34857b2fda6dbe87e
|
data/config/application.rb
CHANGED
@@ -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
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
|
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,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
|
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.
|
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-
|
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.
|
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.
|
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.
|
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
|