object-view 0.4.9 → 0.5
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.
- checksums.yaml +4 -4
- data/lib/object-view.rb +8 -4
- data/lib/object_view/head.rb +1 -1
- data/lib/object_view/header.rb +15 -4
- data/lib/object_view/iframe.rb +18 -0
- data/lib/object_view/image.rb +22 -0
- data/lib/object_view/input.rb +242 -0
- data/lib/object_view/table.rb +3 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9c89d489d6e6dbddfdd75ff1bffccadf4c01406
|
4
|
+
data.tar.gz: 2ac3c3579352f620090b4a0c671e39dbc751afe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbc0fa828e1b053c98fc5cbc3b9bd5a0575a4546f7e68d08de87307f756db7a7407d980e451ab8a8b7c83568f670008dd51858f9f6cbd855f95414679366b114
|
7
|
+
data.tar.gz: 9e3b4a14ddcb5008bacf0c4152a9eb55530f0169036f5b5896e4a6fca961de40b0c6a57af13e65ff9c7797103911d248d0f1af8e491cbf8dd343298f3f272e33
|
data/lib/object-view.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
require 'stringio'
|
2
|
-
|
2
|
+
|
3
|
+
require_relative "object_view/chart_data"
|
3
4
|
require_relative 'object_view/element.rb'
|
4
5
|
require_relative 'object_view/body'
|
5
6
|
require_relative 'object_view/head'
|
7
|
+
require_relative "object_view/image"
|
6
8
|
require_relative 'object_view/header'
|
7
9
|
require_relative 'object_view/javascript_file'
|
8
10
|
require_relative 'object_view/div'
|
9
|
-
require_relative 'object_view/span'
|
10
11
|
require_relative 'object_view/javascript'
|
12
|
+
require_relative "object_view/nav"
|
13
|
+
require_relative 'object_view/page.rb'
|
11
14
|
require_relative 'object_view/table'
|
12
15
|
require_relative "object_view/link"
|
13
16
|
require_relative "object_view/ul"
|
14
|
-
require_relative "object_view/chart_data"
|
15
17
|
require_relative "object_view/paragraph"
|
16
|
-
require_relative
|
18
|
+
require_relative 'object_view/span'
|
19
|
+
require_relative 'object_view/input'
|
20
|
+
require_relative 'object_view/iframe'
|
17
21
|
|
18
22
|
|
19
23
|
module ObjectView
|
data/lib/object_view/head.rb
CHANGED
@@ -11,7 +11,7 @@ module ObjectView
|
|
11
11
|
def initialize
|
12
12
|
super
|
13
13
|
@tag = "head"
|
14
|
-
self.acceptable_children = [Javascript, JavascriptFile, Stylesheet, Title, String]
|
14
|
+
self.acceptable_children = [Javascript, JavascriptFile, Stylesheet, Title, String, Link]
|
15
15
|
end
|
16
16
|
|
17
17
|
def add_stylesheet(path, id = Time.new.to_i.to_s)
|
data/lib/object_view/header.rb
CHANGED
@@ -3,12 +3,23 @@ require_relative './element'
|
|
3
3
|
module ObjectView
|
4
4
|
|
5
5
|
class Header < Element
|
6
|
-
def initialize(n, text)
|
6
|
+
def initialize(n = nil, text = nil)
|
7
7
|
super()
|
8
8
|
@single_line = true
|
9
|
-
|
10
|
-
|
9
|
+
if (n)
|
10
|
+
@tag = "h#{n}"
|
11
|
+
else
|
12
|
+
@tag = 'header'
|
13
|
+
end
|
14
|
+
if (text)
|
15
|
+
add text
|
16
|
+
end
|
11
17
|
end
|
12
18
|
|
13
19
|
end
|
14
|
-
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative './element'
|
2
|
+
|
3
|
+
module ObjectView
|
4
|
+
|
5
|
+
class Image < Element
|
6
|
+
def initialize(content = nil)
|
7
|
+
super()
|
8
|
+
@tag = "img"
|
9
|
+
if (content)
|
10
|
+
self.add content
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def source=(value)
|
16
|
+
self[:src] = value
|
17
|
+
end
|
18
|
+
|
19
|
+
def source
|
20
|
+
return self[:src]
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,242 @@
|
|
1
|
+
require_relative "./element"
|
2
|
+
|
3
|
+
|
4
|
+
module ObjectView
|
5
|
+
|
6
|
+
class TextArea < ObjectView::Element
|
7
|
+
def initialize(value = "")
|
8
|
+
super()
|
9
|
+
@tag = "textarea"
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
def rows= row_count
|
14
|
+
self.attr('rows', row_count.to_s)
|
15
|
+
end
|
16
|
+
|
17
|
+
def columns= count
|
18
|
+
self.attr('cols', row_count.to_s)
|
19
|
+
end
|
20
|
+
|
21
|
+
def value= text
|
22
|
+
self.children.clear if (self.children)
|
23
|
+
self.add text
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class Input < ObjectView::Element
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
super()
|
31
|
+
@tag = "input"
|
32
|
+
end
|
33
|
+
|
34
|
+
def value= text
|
35
|
+
self.attr('value', text)
|
36
|
+
end
|
37
|
+
|
38
|
+
def value
|
39
|
+
return self.attr('value')
|
40
|
+
end
|
41
|
+
|
42
|
+
def type= text
|
43
|
+
self.attr('type', text)
|
44
|
+
end
|
45
|
+
|
46
|
+
def type
|
47
|
+
return self.attr('type')
|
48
|
+
end
|
49
|
+
|
50
|
+
def name= text
|
51
|
+
self.attr('name', text)
|
52
|
+
end
|
53
|
+
|
54
|
+
def name
|
55
|
+
self.attributes['name']
|
56
|
+
end
|
57
|
+
|
58
|
+
def read_only
|
59
|
+
self.attr('readonly')
|
60
|
+
end
|
61
|
+
|
62
|
+
def read_only= value
|
63
|
+
self.attr('readonly', value)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
class Radio < ObjectView::Input
|
69
|
+
def initialize
|
70
|
+
super
|
71
|
+
self.type = 'radio'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class Checkbox < ObjectView::Input
|
76
|
+
def initialize
|
77
|
+
super
|
78
|
+
self.type = 'checkbox'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class TextInput < ObjectView::Input
|
83
|
+
def place_holder= text
|
84
|
+
self.attr('value', text)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
class PasswordInput < ObjectView::Input
|
89
|
+
def initialize
|
90
|
+
super
|
91
|
+
self.type = 'password'
|
92
|
+
end
|
93
|
+
|
94
|
+
def place_holder= text
|
95
|
+
self.attr('value', text)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
class CheckInput < Input
|
100
|
+
def initialize
|
101
|
+
super
|
102
|
+
self.type = 'checkbox'
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
class SubmitInput < Input
|
107
|
+
def initialize
|
108
|
+
super
|
109
|
+
self.type = 'submit'
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
class Option < ObjectView::Element
|
115
|
+
def initialize(name, value)
|
116
|
+
super()
|
117
|
+
@tag = 'option'
|
118
|
+
self.attr('value', value)
|
119
|
+
self.add name
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
class HiddenInput < Input
|
124
|
+
def initialize
|
125
|
+
super
|
126
|
+
self.type = 'hidden'
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
class Combobox < ObjectView::Element
|
132
|
+
def initialize
|
133
|
+
super
|
134
|
+
@tag = 'select'
|
135
|
+
end
|
136
|
+
|
137
|
+
def option(name, value)
|
138
|
+
option = self.add Option.new(name, value)
|
139
|
+
return option
|
140
|
+
end
|
141
|
+
|
142
|
+
def name= text
|
143
|
+
self.attr('name', text)
|
144
|
+
end
|
145
|
+
|
146
|
+
def name
|
147
|
+
self.attributes['name']
|
148
|
+
end
|
149
|
+
|
150
|
+
def select(select_option)
|
151
|
+
self.children.each do |option|
|
152
|
+
if (selection_option == option)
|
153
|
+
option.attr('selected', 'selected')
|
154
|
+
else
|
155
|
+
if (option.attributes['selected'] != nil)
|
156
|
+
option.attributes.delete('selected')
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
class Form < ObjectView::Element
|
165
|
+
def initialize
|
166
|
+
super
|
167
|
+
@tag = 'form'
|
168
|
+
self.attr('method', "post")
|
169
|
+
end
|
170
|
+
|
171
|
+
def action= text
|
172
|
+
self.attr('action', text)
|
173
|
+
end
|
174
|
+
|
175
|
+
def accept_charset=(value)
|
176
|
+
self.attr('accept-charset', value)
|
177
|
+
end
|
178
|
+
|
179
|
+
def action=(value)
|
180
|
+
self.attr('action', value)
|
181
|
+
end
|
182
|
+
|
183
|
+
def method=(value)
|
184
|
+
self.attr('method', value)
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
class Button < ObjectView::Element
|
190
|
+
def initialize(text = nil, name = nil)
|
191
|
+
super(text)
|
192
|
+
@tag = 'button'
|
193
|
+
self.attr('type', 'submit')
|
194
|
+
if (name != nil)
|
195
|
+
self.attr('name', name)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
def label= text
|
200
|
+
self.add text
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
class Submit < ObjectView::Input
|
205
|
+
def initialize(text = nil, name = nil)
|
206
|
+
super()
|
207
|
+
@tag = 'input'
|
208
|
+
if (text != nil)
|
209
|
+
self.attr('value', text)
|
210
|
+
end
|
211
|
+
self.attr('type', 'submit')
|
212
|
+
if (name != nil)
|
213
|
+
self.attr('name', name)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
|
218
|
+
def label= text
|
219
|
+
self.add text
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
class Label < ObjectView::Element
|
225
|
+
def initialize(content = nil)
|
226
|
+
super(content)
|
227
|
+
@tag = 'label'
|
228
|
+
end
|
229
|
+
|
230
|
+
def for=(value)
|
231
|
+
attr('for', value)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
class FieldSet < ObjectView::Element
|
236
|
+
def initialize(content = nil)
|
237
|
+
super(content)
|
238
|
+
@tag = 'fieldset'
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
data/lib/object_view/table.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require_relative './header'
|
2
|
+
|
1
3
|
module ObjectView
|
2
4
|
|
3
5
|
class Table < Element
|
@@ -112,7 +114,7 @@ module ObjectView
|
|
112
114
|
super()
|
113
115
|
self.single_line = true
|
114
116
|
@tag = "td"
|
115
|
-
self.acceptable_children = [Table, Div, Span, Javascript, Link, String, Header, Paragraph]
|
117
|
+
self.acceptable_children = [Table, Div, Span, Javascript, Link, String, Header, Paragraph, Ul, Image]
|
116
118
|
end
|
117
119
|
end
|
118
120
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: object-view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -83,6 +83,9 @@ files:
|
|
83
83
|
- lib/object_view/errors/object_view_error.rb
|
84
84
|
- lib/object_view/head.rb
|
85
85
|
- lib/object_view/header.rb
|
86
|
+
- lib/object_view/iframe.rb
|
87
|
+
- lib/object_view/image.rb
|
88
|
+
- lib/object_view/input.rb
|
86
89
|
- lib/object_view/javascript.rb
|
87
90
|
- lib/object_view/javascript_file.rb
|
88
91
|
- lib/object_view/link.rb
|