publish_my_data 1.2.4 → 1.3.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.
@@ -100,4 +100,37 @@ code.scrolling{
100
100
  .uri{
101
101
  font-family: Monaco, Consolas, "Lucida Console", monospace;
102
102
  word-break: break-all;
103
+ }
104
+
105
+ /* 5100 - DOCUMENTATION
106
+ ========================================================================== */
107
+
108
+ .pmd.documentation{
109
+
110
+ header ul{
111
+ list-style-type: none;
112
+ padding:0;
113
+ }
114
+
115
+ section {
116
+ padding: 0 0 $pmdconfig_space_vertical 0;
117
+ }
118
+
119
+ section ul {
120
+ padding: 0 0 0 10px;
121
+ }
122
+
123
+ .subsubsection{
124
+ margin-left:2em;
125
+ }
126
+
127
+ h2{
128
+ width:100%;
129
+ border-bottom:2px solid black;
130
+ }
131
+
132
+ h4{
133
+ margin-top: 22px;
134
+ }
135
+
103
136
  }
@@ -1,6 +1,12 @@
1
1
  module PublishMyData
2
2
  module ApplicationHelper
3
3
 
4
+ def inside_layout(layout, &block)
5
+ layout = "layouts/#{layout}" unless layout =~ %r[\Alayouts/]
6
+ content_for :publish_my_data_content, capture(&block)
7
+ render template: layout
8
+ end
9
+
4
10
  def bodyclass(c)
5
11
  @bodyclass = c;
6
12
  end
@@ -0,0 +1,70 @@
1
+ module PublishMyData
2
+ module DocumentationHelper
3
+
4
+ def documentation_section(title, &block)
5
+ # update global data structure
6
+ if (@documentation_sections.nil?)
7
+ @documentation_sections = Array.new()
8
+ end
9
+ @documentation_sections.push({name:title,subsections:[]})
10
+ # output html
11
+ content_tag :section, id:section_title_to_id(title) do
12
+ concat content_tag :h2, title
13
+ concat capture &block
14
+ end
15
+ end
16
+
17
+ def documentation_subsection(title, &block)
18
+ # update global data structure
19
+ @documentation_sections.last[:subsections].push({name:title,subsubsections:[]})
20
+ # output html
21
+ content_tag :div, class:"subsection", id:section_title_to_id(title) do
22
+ concat content_tag :h3, title
23
+ concat capture &block
24
+ end
25
+ end
26
+
27
+ def documentation_subsubsection(title, &block)
28
+ # update global data structure
29
+ @documentation_sections.last[:subsections].last[:subsubsections].push({name:title,subsubsections:[]})
30
+ # output html
31
+ content_tag :div, class:"subsubsection", id:section_title_to_id(title) do
32
+ concat content_tag :h4, title
33
+ concat capture &block
34
+ end
35
+ end
36
+
37
+ # generate a block level code element - if you want inline code just do <code> whatever </code>
38
+ # note that language isn't used as yet
39
+ def codeblock(language, &block)
40
+ content_tag :code, class:"block #{language}" do
41
+ capture &block
42
+ end
43
+ end
44
+
45
+ # generate a *multiline* block of code with indentation.
46
+ # eg
47
+ #
48
+ # = codeblock_pre "c" do
49
+ # = preserve do
50
+ # :escaped
51
+ # void main(){
52
+ # ...indented code ...
53
+ # }
54
+ # use codeblock(language, &block) if you don't need to preserve whitespace
55
+ def codeblock_pre(language, &block)
56
+ content_tag :code, class:"block #{language} pre" do
57
+ capture &block
58
+ end
59
+ end
60
+
61
+ def section_title_to_id(title)
62
+ title.parameterize
63
+ end
64
+
65
+ def docs_inline_link(clickable,title)
66
+ link_to clickable, "##{section_title_to_id(title)}"
67
+ end
68
+
69
+ end
70
+ end
@@ -1,3 +1,12 @@
1
- You need to make an layouts/publish_my_data/application.html.haml (or erb) template in your app!
1
+ = inside_layout 'application' do
2
2
 
3
- = render template: 'layouts/publish_my_data/pmd_layout'
3
+ %main.pmd
4
+ = render 'publish_my_data/stripes/subnav'
5
+ = render 'publish_my_data/stripes/status'
6
+
7
+ %article
8
+ = yield
9
+ = render 'publish_my_data/stripes/formats'
10
+
11
+ = render 'publish_my_data/stripes/footer'
12
+ = render 'publish_my_data/shared/google_analytics'
@@ -0,0 +1,19 @@
1
+ = inside_layout 'application' do
2
+
3
+ %main.pmd.documentation
4
+ = render 'publish_my_data/stripes/subnav'
5
+ = render 'publish_my_data/stripes/status'
6
+
7
+ %article
8
+ %header
9
+ =fullwidth do
10
+ = yield :docs_intro
11
+ =fullwidth do
12
+ - # for now, inline - in future, perhaps in a sidebar or something...
13
+ = yield :docs_contents
14
+ .content
15
+ =fullwidth do
16
+ = yield
17
+
18
+ = render 'publish_my_data/stripes/footer'
19
+ = render 'publish_my_data/shared/google_analytics'