jstreebuilder 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a34efda76d17c49fe344f4cbdf3ac4e1e12f0ea04015838f51fdba695fe8c6fb
4
- data.tar.gz: 7d7748ad8a279fe205c0832b610463b26d7f5223235da94e5ed8d0a0c264fd92
3
+ metadata.gz: d776f9c33266197c777807bd162beb3c2415b82686fe2fa8c1a8a2ba4d33dfab
4
+ data.tar.gz: b2df7d91ba2d3365089f952ec7817183e194c2c62ed9b706acbc1ca2fa1fcea2
5
5
  SHA512:
6
- metadata.gz: e93d1ed1bfb1d5607f2a7b41dea63503fbdf6bfc45a4d1a6c7b45922ebfefeb36b52346af29eda10d600f286ab578ef1653150447dcc79164c8fecb737156505
7
- data.tar.gz: 1851f88fd3da5fde59ec8d91ff9e6815b3037cc6562167644f7be0fef9407d57c6079d221113a60512e0181906b1a5edb3029004195f709130d87d3fc781a010
6
+ metadata.gz: 45ee0172a25404b048847b43a6c61ecb2ed8f568c7c79ca2949864c68a80a34a1b3b45b487467b2537f4c4b3ee5cb2dd6dcba6aa6bafddcb86bd74e891e1ac32
7
+ data.tar.gz: 7e64e35b0fbfdbc91769b45698f305adbea9acd115f0e09ecc53543f728d740b81a51618c6bc4ce172d2f953ff9e2f5a03ac159658a329c2c8a18abb121118e2
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/jstreebuilder.rb CHANGED
@@ -116,6 +116,47 @@ ul, #myUL {
116
116
  }
117
117
  ]
118
118
 
119
+ SIDEBAR_CSS = TREE_CSS + %q[
120
+
121
+ body {
122
+ font-family: "Lato", sans-serif;
123
+ }
124
+
125
+ .sidenav {
126
+ width: 25%;
127
+ position: fixed;
128
+ z-index: 1;
129
+ top: 20px;
130
+ left: 10px;
131
+ background: #eee;
132
+ overflow-x: hidden;
133
+ padding: 12px 0;
134
+ }
135
+
136
+ .sidenav a {
137
+ padding: 2px 8px 2px 6px;
138
+ text-decoration: none;
139
+ font-size: 23px;
140
+ color: #2166F3;
141
+
142
+ }
143
+
144
+ .sidenav a:hover {
145
+ color: #064579;
146
+ }
147
+
148
+ .main {
149
+ margin-left: 25%; /* Same width as the sidebar + left position in px */
150
+ font-size: 26px; /* Increased text to enable scrolling */
151
+ padding: 0px 10px;
152
+ }
153
+
154
+ @media screen and (max-height: 450px) {
155
+ .sidenav {padding-top: 15px;}
156
+ .sidenav a {font-size: 19 px;}
157
+ }
158
+ ]
159
+
119
160
  TREE_JS =<<EOF
120
161
  var toggler = document.getElementsByClassName("caret");
121
162
  var i;
@@ -128,6 +169,8 @@ for (i = 0; i < toggler.length; i++) {
128
169
  }
129
170
  EOF
130
171
 
172
+ SIDEBAR_JS = TREE_JS
173
+
131
174
  class TreeBuilder
132
175
  using ColouredText
133
176
 
@@ -208,7 +251,7 @@ EOF
208
251
  def initialize(unknown=nil, options={})
209
252
 
210
253
  if unknown.is_a? String or unknown.is_a? Symbol then
211
- type = unkown.to_sym
254
+ type = unknown.to_sym
212
255
  elsif unknown.is_a? Hash
213
256
  options = {type: :tree}.merge(unknown)
214
257
  type = options[:type]
@@ -216,7 +259,7 @@ EOF
216
259
 
217
260
  @debug = options[:debug]
218
261
 
219
- @types = %i(tree)
262
+ @types = %i(tree sidebar)
220
263
 
221
264
  build(type, options) if type
222
265
 
@@ -326,5 +369,11 @@ EOF
326
369
  @ul = xslt.transform(doc).to_s.lines[1..-1].join
327
370
 
328
371
  end
372
+
373
+ def sidebar(opt={})
374
+ doc = Rexle.new(tree(opt))
375
+ doc.root.attributes[:class] = 'sidenav'
376
+ @ul = doc.xml(declaration: false)
377
+ end
329
378
 
330
379
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jstreebuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file