htmlcom 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c76a876242c3b905316693f8d0f4593caa7e51f8e286c9fbb2c484e22da3f6a1
4
+ data.tar.gz: 71c34429b7a4283913b86c852a66d007096aaaca36e789ee0202e07f686a00e6
5
+ SHA512:
6
+ metadata.gz: 03e945cb3e35a5a18b9280da8d1dd3a880fccf8c547612e8ca5f0505e0965bb827a7a669582d5ad01bd8f1310bf498ac895d7f9ef240fe9bc1f3e2d1af449a2e
7
+ data.tar.gz: '09aab39f13a026cc31f002fed5e04638fe693bcb8c3bc7ef58573d6b6243d30d224d401970b92480b0cd2ceb24ae5890165b4d6754732c1daec641a816dd559d'
checksums.yaml.gz.sig ADDED
Binary file
data/lib/htmlcom.rb ADDED
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: htmlcom.rb
4
+
5
+ # description: Generates HTML components and is designed for rendering dynamic web pages from a web server.
6
+
7
+ require 'jsmenubuilder'
8
+
9
+
10
+ module HtmlCom
11
+
12
+ class Tabs
13
+
14
+ class Tab
15
+
16
+ attr_accessor :title, :content
17
+
18
+ def initialize(title, content: '', callback: nil)
19
+ @title, @content, @callback = title, content, callback
20
+ end
21
+
22
+ def content=(s)
23
+ @content = s
24
+ @callback.ping
25
+ end
26
+
27
+ def delete()
28
+ @title = nil
29
+ @callback.ping
30
+ end
31
+
32
+ def title=(s)
33
+ @title = s
34
+ @callback.ping
35
+ end
36
+
37
+ def to_a()
38
+ [@title, @content]
39
+ end
40
+
41
+ end
42
+
43
+ attr_reader :tab, :active
44
+
45
+ def initialize(headings: %w(tab1 tab2 tab3))
46
+
47
+ @build = JsMenuBuilder.new(:tabs, headings: headings)
48
+
49
+ @tab = headings.map do |heading|
50
+ Tab.new heading, content: "<h3>#{heading}</h3>", callback: self
51
+ end
52
+
53
+ end
54
+
55
+ def active=(tabnum)
56
+ @active_tab = tabnum
57
+ refresh()
58
+ end
59
+
60
+ def add_tab(title, content: '', index: nil)
61
+
62
+ tab = Tab.new(title, content: content)
63
+
64
+ if index then
65
+ @tab.insert index, tab
66
+ else
67
+ @tab << tab
68
+ end
69
+
70
+ refresh()
71
+
72
+ end
73
+
74
+ def delete_tab(i)
75
+ @tab.delete i
76
+ refresh()
77
+ end
78
+
79
+ def ping()
80
+
81
+ tabs = @tab.map do |tab|
82
+ tab.title ? tab.to_a : nil
83
+ end.compact.to_h
84
+
85
+ @build = JsMenuBuilder.new(:tabs, tabs: tabs, active: @active_tab)
86
+
87
+ end
88
+
89
+ alias refresh ping
90
+
91
+ def to_html()
92
+ @build.to_html
93
+ end
94
+
95
+ def to_webpage()
96
+ @build.to_webpage
97
+ end
98
+
99
+ end
100
+
101
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: htmlcom
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkwNzEyMTkwOTA2WhcN
15
+ MjAwNzExMTkwOTA2WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCzzWXZ
17
+ TL6xk999BKr4lVCAlobCVnxEotwgpmtPQPhhGGg7PsQPP/QUCt23JrmsSBfpPmIH
18
+ MpPjC1dfhwjGQgcmkjB5sNSprB6z0zFTJ8MdoxZAAioq7peDiKSkSeojhivGKKmG
19
+ XfL0NeMdLl3w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a9k5EnWLIYpdXkGCf0iULCn
35
+ WiRgzz3/21eCm7N/8s5UGa7uDJXDDxf/i/QsEUJn1VcorDbODN3DbcPYph26bgQm
36
+ vY6P53Z8DPcEft++oI9aZl1n
37
+ -----END CERTIFICATE-----
38
+ date: 2019-07-12 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: jsmenubuilder
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.1'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.1.1
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.1'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 0.1.1
60
+ description:
61
+ email: james@jamesrobertson.eu
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - lib/htmlcom.rb
67
+ homepage: https://github.com/jrobertson/htmlcom
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubygems_version: 3.0.1
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: Generates HTML components and is designed for rendering dynamic web pages
90
+ from a web server.
91
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ E6d�G쇷���݌XTa��4��Τ�����'tN�kk,�z]�u�﫾:�U@�a* &����X�/~�_:U/?fc;�A�
2
+ ֒j_� z4S�"l�]ygO�l�C�ymAB��gS�/"ѕ��8]�Xnh�Q+�ϰ�xP���q��{���˥�)�w���{�U�%�D�����6�;�`��*y��&ُ��Q=U��0d��ѕ����Z+h.3m�Z�J�匒�� �S���~S%�O�hw ��