jsmenubuilder 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/jsmenubuilder.rb +44 -5
- data.tar.gz.sig +0 -0
- metadata +3 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9015a21d6ec16f6a1f06b647bb7adb407699be900123a977b754997805f039a5
|
4
|
+
data.tar.gz: 4c6aa4d82b0ce977127ef82dbcc5c26408b32542f534db27f953e345bcc1054b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8af2787182d64270676455f8b7aeae116f75d38a24392a9e2018bb0b609be30b37e2e13fe488528f7729a1944914d1e50ed10f3ed02f732916880b39e539a96
|
7
|
+
data.tar.gz: 4b52b61bbe422c8f533801db7f635ac71d92740f71becf0d890e09344859c80b20d8b5309aa433c53f871940ba0848db1f3c42fc690fd9968848b1d03e9fed85
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/jsmenubuilder.rb
CHANGED
@@ -142,8 +142,8 @@ EOF
|
|
142
142
|
|
143
143
|
def initialize(unknown=nil, options={})
|
144
144
|
|
145
|
-
if unknown.is_a? String then
|
146
|
-
type = unknown
|
145
|
+
if unknown.is_a? String or unknown.is_a? Symbol then
|
146
|
+
type = unknown.to_sym
|
147
147
|
elsif unknown.is_a? Hash
|
148
148
|
options = unknown
|
149
149
|
end
|
@@ -226,6 +226,11 @@ EOF
|
|
226
226
|
|
227
227
|
end
|
228
228
|
|
229
|
+
def to_xml()
|
230
|
+
@xml
|
231
|
+
end
|
232
|
+
|
233
|
+
|
229
234
|
private
|
230
235
|
|
231
236
|
def build(type, options)
|
@@ -233,6 +238,8 @@ EOF
|
|
233
238
|
puts 'inside build'.info if @debug
|
234
239
|
puts "type: %s\noptions: %s".debug % [type, options] if @debug
|
235
240
|
|
241
|
+
type = :full_page_tabs if type.to_sym == :fullpage
|
242
|
+
|
236
243
|
return unless @types.include? type.to_sym
|
237
244
|
|
238
245
|
doc = method(type.to_sym).call(options)
|
@@ -244,7 +251,39 @@ EOF
|
|
244
251
|
@css = Object.const_get 'JsMenuBuilder::' + type.to_s.upcase + '_CSS'
|
245
252
|
@js = Object.const_get 'JsMenuBuilder::' + type.to_s.upcase + '_JS'
|
246
253
|
|
254
|
+
@xml = build_xml(type.to_sym, options)
|
255
|
+
|
247
256
|
end
|
257
|
+
|
258
|
+
def build_xml(type, opt={})
|
259
|
+
|
260
|
+
puts 'inside build_xml'.info if @debug
|
261
|
+
|
262
|
+
options = {active: '1'}.merge(opt)
|
263
|
+
|
264
|
+
tabs = if options[:headings] then
|
265
|
+
headings = options[:headings]
|
266
|
+
headings.zip(headings.map {|heading| ['h3', {}, heading]}).to_h
|
267
|
+
else
|
268
|
+
options[:tabs]
|
269
|
+
end
|
270
|
+
|
271
|
+
a = RexleBuilder.build do |xml|
|
272
|
+
xml.tags({mode: type}) do
|
273
|
+
tabs.each do |heading, content|
|
274
|
+
xml.tag({title: heading}, content )
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
doc = Rexle.new(a)
|
280
|
+
|
281
|
+
e = doc.root.element("tag[#{options[:active]}]")
|
282
|
+
e.attributes[:mode] = 'active' if e
|
283
|
+
|
284
|
+
return doc.xml(pretty: true)
|
285
|
+
|
286
|
+
end
|
248
287
|
|
249
288
|
def tabs(opt={})
|
250
289
|
|
@@ -264,7 +303,7 @@ EOF
|
|
264
303
|
xml.div(class: 'tab' ) do
|
265
304
|
tabs.keys.each do |heading|
|
266
305
|
xml.button({class:'tablinks',
|
267
|
-
onclick: %Q(openTab(event, "#{heading}"))}, heading)
|
306
|
+
onclick: %Q(openTab(event, "#{heading}"))}, heading.to_s)
|
268
307
|
end
|
269
308
|
end
|
270
309
|
|
@@ -302,7 +341,7 @@ EOF
|
|
302
341
|
|
303
342
|
tabs.keys.each do |heading|
|
304
343
|
xml.button({class:'tablink',
|
305
|
-
onclick: %Q(openPage("#{heading}", this))}, heading)
|
344
|
+
onclick: %Q(openPage("#{heading}", this))}, heading.to_s)
|
306
345
|
end
|
307
346
|
|
308
347
|
tabs.each do |heading, content|
|
@@ -321,6 +360,6 @@ EOF
|
|
321
360
|
|
322
361
|
|
323
362
|
end
|
324
|
-
|
363
|
+
|
325
364
|
|
326
365
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
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.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
haYJPATx3zs+9jtQoiFg+keM0CPYk/5LgCv9jxxzQcSS20C8O9MWRVvYfIr47ak7
|
36
36
|
yXrDPmRvbJLTNjDv6Tkg3vU6
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2019-07-
|
38
|
+
date: 2019-07-19 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rexle
|
@@ -83,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
|
87
|
-
rubygems_version: 2.5.2.1
|
86
|
+
rubygems_version: 3.0.1
|
88
87
|
signing_key:
|
89
88
|
specification_version: 4
|
90
89
|
summary: Generates HTML based tabs using HTML, CSS, and JavaScript.
|
metadata.gz.sig
CHANGED
Binary file
|