jsmenubuilder 0.3.0 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/jsmenubuilder.rb +243 -13
- metadata +28 -27
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 390f2055daa29b9c5b8af617ef19102a9d06e5b2a688bc5cf5c17df27a5c7cf7
|
4
|
+
data.tar.gz: 83f06038310c93648c578c4635d31da97b515d1e3dca1f3625f739257b7111ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49c3173c496d39ac8f5be2652892bba3ed418f9bf1ddc85df27cafe9283a51efa690828343f7679aad1febea03ee261d85733a0cc2d0400f164583e978698767
|
7
|
+
data.tar.gz: 2a0ac728386fc75241f7776cf044bb521255c731b8e9f834347a34c154fa20d0b93733423d9f81b806da5d4c22bd626f2b62607b640ec4962dbe107ccbf72b53
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/jsmenubuilder.rb
CHANGED
@@ -6,6 +6,7 @@ require 'rexle'
|
|
6
6
|
require 'rxfhelper'
|
7
7
|
require 'rexle-builder'
|
8
8
|
|
9
|
+
|
9
10
|
class JsMenuBuilder
|
10
11
|
using ColouredText
|
11
12
|
|
@@ -189,7 +190,109 @@ STICKY_NAVBAR_CSS =<<EOF
|
|
189
190
|
.sticky + .content {
|
190
191
|
padding-top: 60px;
|
191
192
|
}
|
193
|
+
/* see https://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header */
|
194
|
+
.anchor {
|
195
|
+
background-color: transparent;
|
196
|
+
padding-top: 70px;
|
197
|
+
margin-top: -70px;
|
198
|
+
display: block;
|
199
|
+
}
|
200
|
+
|
201
|
+
h2.anchor {
|
202
|
+
background-color: transparent;
|
203
|
+
padding-top: 60px;
|
204
|
+
margin-top: 0px;
|
205
|
+
}
|
206
|
+
|
207
|
+
EOF
|
208
|
+
|
209
|
+
VERTICAL_MENU_CSS =<<EOF
|
210
|
+
.vertical-menu {
|
211
|
+
width: 200px; /* Set a width if you like */
|
212
|
+
}
|
213
|
+
|
214
|
+
.vertical-menu a {
|
215
|
+
background-color: #eee; /* Grey background color */
|
216
|
+
color: black; /* Black text color */
|
217
|
+
display: block; /* Make the links appear below each other */
|
218
|
+
padding: 12px; /* Add some padding */
|
219
|
+
text-decoration: none; /* Remove underline from links */
|
220
|
+
}
|
221
|
+
|
222
|
+
.vertical-menu a:hover {
|
223
|
+
background-color: #ccc; /* Dark grey background on mouse-over */
|
224
|
+
}
|
225
|
+
|
226
|
+
.vertical-menu a.active {
|
227
|
+
background-color: #4CAF50; /* Add a green color to the "active/current" link */
|
228
|
+
color: white;
|
229
|
+
}
|
230
|
+
EOF
|
231
|
+
|
232
|
+
FIXED_MENU_CSS =<<EOF
|
233
|
+
/* The navigation bar */
|
234
|
+
.navbar {
|
235
|
+
overflow: hidden;
|
236
|
+
background-color: #333;
|
237
|
+
position: fixed; /* Set the navbar to fixed position */
|
238
|
+
top: 0; /* Position the navbar at the top of the page */
|
239
|
+
width: 100%; /* Full width */
|
240
|
+
}
|
241
|
+
|
242
|
+
/* Links inside the navbar */
|
243
|
+
.navbar a {
|
244
|
+
float: left;
|
245
|
+
display: block;
|
246
|
+
color: #f2f2f2;
|
247
|
+
text-align: center;
|
248
|
+
padding: 14px 16px;
|
249
|
+
text-decoration: none;
|
250
|
+
}
|
251
|
+
|
252
|
+
/* Change background on mouse-over */
|
253
|
+
.navbar a:hover {
|
254
|
+
background: #ddd;
|
255
|
+
color: black;
|
256
|
+
}
|
192
257
|
|
258
|
+
/* Main content */
|
259
|
+
.main {
|
260
|
+
margin-top: 30px; /* Add a top margin to avoid content overlay */
|
261
|
+
}
|
262
|
+
EOF
|
263
|
+
|
264
|
+
BREADCRUMB_CSS =<<EOF
|
265
|
+
/* Style the list */
|
266
|
+
ul.breadcrumb {
|
267
|
+
padding: 10px 16px;
|
268
|
+
list-style: none;
|
269
|
+
background-color: #eee;
|
270
|
+
}
|
271
|
+
|
272
|
+
/* Display list items side by side */
|
273
|
+
ul.breadcrumb li {
|
274
|
+
display: inline;
|
275
|
+
font-size: 18px;
|
276
|
+
}
|
277
|
+
|
278
|
+
/* Add a slash symbol (/) before/behind each list item */
|
279
|
+
ul.breadcrumb li+li:before {
|
280
|
+
padding: 8px;
|
281
|
+
color: black;
|
282
|
+
content: "/\\00a0";
|
283
|
+
}
|
284
|
+
|
285
|
+
/* Add a color to all links inside the list */
|
286
|
+
ul.breadcrumb li a {
|
287
|
+
color: #0275d8;
|
288
|
+
text-decoration: none;
|
289
|
+
}
|
290
|
+
|
291
|
+
/* Add a color on mouse-over */
|
292
|
+
ul.breadcrumb li a:hover {
|
293
|
+
color: #01447e;
|
294
|
+
text-decoration: underline;
|
295
|
+
}
|
193
296
|
EOF
|
194
297
|
|
195
298
|
FULL_PAGE_TABS_JS =<<EOF
|
@@ -266,6 +369,11 @@ function myFunction() {
|
|
266
369
|
}
|
267
370
|
EOF
|
268
371
|
|
372
|
+
VERTICAL_MENU_JS = ''
|
373
|
+
FIXED_MENU_JS = ''
|
374
|
+
BREADCRUMB_JS = ''
|
375
|
+
|
376
|
+
|
269
377
|
attr_reader :html, :css, :js
|
270
378
|
|
271
379
|
def initialize(unknown=nil, options={})
|
@@ -290,7 +398,8 @@ EOF
|
|
290
398
|
options = unknown
|
291
399
|
end
|
292
400
|
|
293
|
-
@types = %i(tabs full_page_tabs accordion sticky_navbar
|
401
|
+
@types = %i(tabs full_page_tabs accordion sticky_navbar
|
402
|
+
vertical_menu fixed_menu breadcrumb)
|
294
403
|
|
295
404
|
build(type, options) if type
|
296
405
|
|
@@ -409,7 +518,7 @@ EOF
|
|
409
518
|
puts 'inside build_h'.info if @debug
|
410
519
|
|
411
520
|
h = doc.root.xpath('tag').inject({}) do |r,e|
|
412
|
-
r.merge(e.attributes[:title] => e.children.join.strip)
|
521
|
+
r.merge(e.attributes[:title] => [e.children.join.strip, e.attributes[:class].join(' ')])
|
413
522
|
end
|
414
523
|
|
415
524
|
puts ('build_h: ' + h.inspect).debug if @debug
|
@@ -441,8 +550,9 @@ EOF
|
|
441
550
|
|
442
551
|
a = RexleBuilder.build do |xml|
|
443
552
|
xml.tags({mode: type}) do
|
444
|
-
entries.each do |heading,
|
445
|
-
|
553
|
+
entries.each do |heading, value|
|
554
|
+
content, klass = value
|
555
|
+
xml.tag({title: heading, class: klass}, content )
|
446
556
|
end
|
447
557
|
end
|
448
558
|
end
|
@@ -545,7 +655,7 @@ EOF
|
|
545
655
|
|
546
656
|
panels = opt[:accordion]
|
547
657
|
|
548
|
-
@h = h = panels.group_by {|key, value| key.upcase[0]}
|
658
|
+
@h = h = panels.group_by {|key, value| key.upcase[0]}
|
549
659
|
|
550
660
|
debug = @debug
|
551
661
|
|
@@ -555,16 +665,23 @@ EOF
|
|
555
665
|
|
556
666
|
xml.html do
|
557
667
|
|
558
|
-
h.each do |char, rows|
|
668
|
+
h.sort.each do |char, rows|
|
559
669
|
|
560
|
-
xml.h2({id: char.downcase}, char)
|
670
|
+
xml.h2({class: 'anchor', id: char.downcase}, char)
|
561
671
|
|
562
|
-
rows.each do |heading,
|
672
|
+
rows.each do |heading, value|
|
673
|
+
|
674
|
+
puts 'value: ' + value.inspect if @debug
|
675
|
+
inner_html, attrclass = value
|
676
|
+
|
563
677
|
puts 'inner_html: ' + inner_html.inspect if debug
|
564
|
-
xml.a({name: heading.downcase.gsub(/\W/,'-')
|
565
|
-
|
678
|
+
xml.a({class: 'anchor', name: heading.downcase.gsub(/\W/,'-')\
|
679
|
+
.gsub(/-{2,}/,'-').gsub(/^-|-$/,'')})
|
566
680
|
xml.button({class:'accordion'}, heading.to_s)
|
567
|
-
|
681
|
+
|
682
|
+
s = 'panel'
|
683
|
+
s += ' ' + attrclass if attrclass
|
684
|
+
xml.div({class: s}, inner_html)
|
568
685
|
|
569
686
|
end
|
570
687
|
end
|
@@ -586,7 +703,7 @@ EOF
|
|
586
703
|
|
587
704
|
opt[:html]
|
588
705
|
|
589
|
-
elsif opt[:
|
706
|
+
elsif opt[:items]
|
590
707
|
|
591
708
|
RexleBuilder.build do |xml|
|
592
709
|
|
@@ -594,7 +711,7 @@ EOF
|
|
594
711
|
|
595
712
|
xml.div(id: 'navbar') do
|
596
713
|
|
597
|
-
opt[:
|
714
|
+
opt[:items].each do |title, href|
|
598
715
|
xml.a({href: href}, title)
|
599
716
|
end
|
600
717
|
|
@@ -610,6 +727,119 @@ EOF
|
|
610
727
|
return doc
|
611
728
|
|
612
729
|
|
730
|
+
end
|
731
|
+
|
732
|
+
def vertical_menu(opt={})
|
733
|
+
|
734
|
+
puts 'inside vertical_navbar' if @debug
|
735
|
+
|
736
|
+
navhtml = if opt[:html] then
|
737
|
+
|
738
|
+
opt[:html]
|
739
|
+
|
740
|
+
elsif opt[:items]
|
741
|
+
|
742
|
+
RexleBuilder.build do |xml|
|
743
|
+
|
744
|
+
xml.html do
|
745
|
+
|
746
|
+
xml.div(class: 'vertical-menu') do
|
747
|
+
|
748
|
+
opt[:items].each do |title, href|
|
749
|
+
xml.a({href: href}, title)
|
750
|
+
end
|
751
|
+
|
752
|
+
end
|
753
|
+
|
754
|
+
end
|
755
|
+
end
|
756
|
+
end
|
757
|
+
|
758
|
+
doc = Rexle.new(navhtml)
|
759
|
+
puts 'doc: ' + doc.xml.inspect if @debug
|
760
|
+
|
761
|
+
return doc
|
762
|
+
|
763
|
+
|
764
|
+
end
|
765
|
+
|
766
|
+
def fixed_menu(opt={})
|
767
|
+
|
768
|
+
puts 'inside fixed_menu' if @debug
|
769
|
+
|
770
|
+
navhtml = if opt[:html] then
|
771
|
+
|
772
|
+
opt[:html]
|
773
|
+
|
774
|
+
elsif opt[:items]
|
775
|
+
|
776
|
+
RexleBuilder.build do |xml|
|
777
|
+
|
778
|
+
xml.html do
|
779
|
+
|
780
|
+
xml.div(class: 'navbar') do
|
781
|
+
|
782
|
+
opt[:items].each do |title, href|
|
783
|
+
xml.a({href: href}, title)
|
784
|
+
end
|
785
|
+
|
786
|
+
end
|
787
|
+
|
788
|
+
xml.div(class: 'main') do
|
789
|
+
|
790
|
+
end
|
791
|
+
|
792
|
+
end
|
793
|
+
end
|
794
|
+
end
|
795
|
+
|
796
|
+
doc = Rexle.new(navhtml)
|
797
|
+
puts 'doc: ' + doc.xml.inspect if @debug
|
798
|
+
|
799
|
+
return doc
|
800
|
+
|
801
|
+
|
613
802
|
end
|
803
|
+
|
804
|
+
def breadcrumb(opt={})
|
805
|
+
|
806
|
+
puts 'inside breadcrumb' if @debug
|
807
|
+
|
808
|
+
navhtml = if opt[:html] then
|
809
|
+
|
810
|
+
opt[:html]
|
811
|
+
|
812
|
+
elsif opt[:items]
|
813
|
+
|
814
|
+
RexleBuilder.build do |xml|
|
815
|
+
|
816
|
+
xml.html do
|
817
|
+
|
818
|
+
xml.ul(class: 'breadcrumb') do
|
819
|
+
|
820
|
+
opt[:items][0..-2].each do |title, href|
|
821
|
+
xml.li do
|
822
|
+
xml.a({href: href}, title)
|
823
|
+
end
|
824
|
+
end
|
825
|
+
|
826
|
+
title = opt[:items][-1].first
|
827
|
+
xml.li title
|
828
|
+
|
829
|
+
end
|
830
|
+
|
831
|
+
|
832
|
+
|
833
|
+
end
|
834
|
+
end
|
835
|
+
end
|
836
|
+
|
837
|
+
doc = Rexle.new(navhtml)
|
838
|
+
puts 'doc: ' + doc.xml.inspect if @debug
|
839
|
+
|
840
|
+
return doc
|
841
|
+
|
842
|
+
|
843
|
+
end
|
614
844
|
|
615
845
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsmenubuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,31 +11,31 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjEwMTE3MjAxMDI3WhcN
|
15
|
+
MjIwMTE3MjAxMDI3WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC2UBXg
|
17
|
+
dSeJqcBwxeYBSbb4Juz+zVFhmlo/usgbmk+Y8bbO/hI+AlPyH5UnWhNDSWh23AXa
|
18
|
+
pP1do4VSJ7ne25KRB7Qdb843fndoLtowgb1vmpoovKAj0/aNMjXl1OqbWxp4tisU
|
19
|
+
TTrzOiihBReECZLnRhUtcnODAK1lCyrtQpLFQXPH+hAK02QZhIqPt8r+/4Ou1ZR2
|
20
|
+
KDpxOaaueNxiD2LmCbYnp4LAbQYbQCY3V+gnSkEnogIwaIQ/Z1OZp58b2nv3Fl8+
|
21
|
+
lQZdEBj0Q7MhFeeM41hzAgypwAty6WBCVKo8BnUGyF46+Z9dCa9l3maQ/yBARqGh
|
22
|
+
8CjvQPrtOndZfZ8IuvA8MGOrB9keFHccpetHnPUrcZThr1yfATudu/bHNFNJ9Vgz
|
23
|
+
Sk6iQaFZ7zGCUnMc7BstDb9nx0B+mTdAjDHAhNIkHleqXH7iQ/+tNevbC7gqS7E5
|
24
|
+
nfsSWJJk7GonsT0P5Vxq2dypljI229fvbiB+vWUEoIgBj7+/2bQORt4UUT0CAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUzHu1LvAL
|
26
|
+
lMU8BO9RyzXJexVkI/UwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
27
|
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAB3veD2cecAEwrICnXn9pYFc+eC9fIMwyyboP1jgf
|
29
|
+
uoxV7buwI6jKolHBuGanDQdqFMUib2JrX0mKZ/9KZw4cCen8grmFRIRRGSooZZEt
|
30
|
+
F5wMy0Mte8+nVnhi8tBU5+0bwqR2USL9LKVoeDCyd6sxOlkffVqYZFRGQB3/K3o9
|
31
|
+
XaAfiwiXOcq1hYBPh76N/rcNUvjlON4WpoJbwGiREKsLgFXpExXloeUUo8EhCVs5
|
32
|
+
g5n20V75pNW/1y8jOxbrKq/M4uaJkyvFMc96ms/NO5Av1OO/GfFJmecuupUvi80E
|
33
|
+
yD+/vvvKT8C6A+7Luv70eCEqNC2kmI5k2FKlfkkfaHacRtDz4Ntzw+W216u2ewBB
|
34
|
+
4DzeVtqMQq2g7T4xVjQRRwdBJkdERbyx4TD/2HNa6VNC/V8R5aVlKNyjjglPSC3P
|
35
|
+
stR9WM2Qrn9oxHHjgt05mQb9lgp7uGqcCvQoP82U8lJawp7oLLsO25kTe4Hj28T1
|
36
|
+
+BcAGJd5hR/dFCHvJ6rtQss3
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2021-01-20 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rexle
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
version: '1.5'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.5.
|
49
|
+
version: 1.5.9
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version: '1.5'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.5.
|
59
|
+
version: 1.5.9
|
60
60
|
description:
|
61
61
|
email: james@jamesrobertson.eu
|
62
62
|
executables: []
|
@@ -83,7 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.7.10
|
87
88
|
signing_key:
|
88
89
|
specification_version: 4
|
89
90
|
summary: Generates HTML based tabs using HTML, CSS, and JavaScript.
|
metadata.gz.sig
CHANGED
Binary file
|