Class: Cyberweb::Objectified::HtmlTags::Table
- Inherits:
-
Base
- Object
- Base
- Cyberweb::Objectified::HtmlTags::Table
show all
- Defined in:
- lib/cyberweb/objectified/html_tags/table.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#+, #add_css_rules, #add_this_to_javascript, #add_to_pre_content, #append_css_manager, #append_onto_the_css_class, #append_onto_the_result, #append_this_to_the_css_style, #attach, #batch_append_css_class_then_the_ID_and_then_the_css_style, #bblack1, #bblack2, #bblack3, #bblack4, #bblack5, #bblack6, #center, #consider_adding_the_pre_content, #consider_adding_the_script_entry_from_the_internal_hash, #content?, #content_as_string, #css_class?, #css_manager, #css_style?, #display, #do_not_load_lazily, #ee, #enable_lazy_loading, #evaluate_this_block, #font=, #id?, #is_an_objectified_html_tag?, #is_draggable?, #lazy_loading?, #make_bold, #modify_the_css_style_based_on_the_alignment, #name=, #name?, #on_click_select, #on_clicked, #on_hover_colour, #on_hover_pulse_increase, #on_mouse_hover, #pad, #pad10px, #pad1px, #pad2px, #pad3px, #pad4px, #pad5px, #pad6px, #pad7px, #pad8px, #pad9px, #path_to_internal_javascript_file, #pre_content?, #raw_result?, #report, report, #report?, #reset_the_content, #reset_the_result, #return_appendable_content, #return_css_class, #return_css_style, #return_javascript, #script?, #set_content, #set_css_class, #set_css_style, #set_id, #set_is_draggable, #set_title, #set_width, #title?, #to_str, #try_to_register_this_tag, #use_this_on_click_function=, #very_light_yellowish_background, #width_height, #yellow_background
Methods included from BaseModule
#attach_these_constants, #base_dir?, #beautiful_url, #cd, #create_the_internal_hash, #doctype?, #ee, #ensure_main_encoding, #esystem, #html_templates, #initialize_the_config_if_the_config_hash_is_empty, #internal_hash?, #log_dir?, #no_http, #random_alphabet_characters, #rarrow?, #rds, #remove_comments_from_this_string, #remove_numbers, #require_the_html_templates, #require_these, #return_file_size_in_kb_of, #return_html_comment, #ruby_sitelib_dir?, #sanitize_this_id, #server_base_directory?, #string_remote_image, #today?, #try_to_require_rack, #try_to_require_the_open_gem, #write_what_into
#content_type_is_html, #content_type_is_jpeg, #content_type_is_json, #content_type_is_plain_text
#append_to_the_commandline_arguments, #commandline_arguments?, #first_argument?, #parse_these_commandline_arguments, #second_argument?, #set_commandline_arguments
#all_html_colours, #lightgreen, #rev, #sdir, #sfancy, #sfile, #simp, #steelblue, #tomato
Constructor Details
#initialize(use_this_text = '', optional_css_class = Table.css_class?, optional_id = nil, optional_css_style = nil) ⇒ Table
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 62
def initialize(
use_this_text = '',
optional_css_class = Table.css_class?,
optional_id = nil,
optional_css_style = nil
)
try_to_register_this_tag(self)
reset
set_content(use_this_text) set_CSS_class(optional_css_class) if optional_css_class
set_id(optional_id) if optional_id
set_CSS_style(optional_css_style) if optional_css_style
end
|
Class Method Details
.alternate_backgrounds(array, optional_css_class = '') ⇒ Object
#
Cyberweb::Table.alternate_backgrounds
Next, define the method Table.alternate_backgrounds().
The first argument to this method must be an Array.
Usage examples:
Cyberweb::Table.alternate_backgrounds(%w( one two three four ), 'bblack1 pad0_5em')
Table.alternate_backgrounds(%w( one two three four ), 'bblack1 pad0_5em')
#
320
321
322
323
324
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 320
def Table.alternate_backgrounds(
array, optional_css_class = ''
)
ee ::Cyberweb::Table.return_alternate_backgrounds(array, optional_css_class)
end
|
.css_class? ⇒ Boolean
50
51
52
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 50
def self.css_class?
@css_class
end
|
.enable_padding ⇒ Object
#
Cyberweb::Table.enable_padding
#
303
304
305
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 303
def Table.enable_padding Table.set_css_class 'pad15px'
end
|
.padding=(i) ⇒ Object
#
Cyberweb::Table.padding=
This is an alias towards “bspace”, aka the “border-spacing” property.
#
245
246
247
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 245
def Table.padding=(i)
Table.set_css_class('bspace'+i.to_s)
end
|
.reset_css_class ⇒ Object
29
30
31
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 29
def self.reset_css_class
@css_class = nil
end
|
.return_alternate_backgrounds(array = [], optional_css_class = '', &block) ⇒ Object
#
Cyberweb::Table.return_alternate_backgrounds
This table will use alternative backgrounds.
#
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 254
def Table.return_alternate_backgrounds(
array = [],
optional_css_class = '',
&block
)
_use_this_class_for_even_rows = 'dark_background'
_use_this_class_for_odd_rows = 'light_background'
if block_given?
yielded = yield
if array.empty? and !yielded.empty?
array = yielded
end
end
table = Cyberweb::Objectified::HtmlTags::Table.new(optional_css_class)
table.alternate_backgrounds(
array,
optional_css_class
)
return table.to_s
end
|
.set_css_class(i = DEFAULT_CSS_CLASS) ⇒ Object
43
44
45
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 43
def self.set_css_class(i = DEFAULT_CSS_CLASS)
@css_class = i
end
|
Instance Method Details
#alternate_backgrounds(array = [], optional_css_class = 'bblack3 pad0_5em', &block) ⇒ Object
#
alternate_backgrounds
#
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 127
def alternate_backgrounds(
array = [],
optional_css_class = 'bblack3 pad0_5em',
&block
)
use_this_class_for_even_rows = 'dark_background'
use_this_class_for_odd_rows = 'light_background'
if optional_css_class
set_css_class(optional_css_class)
end
reset_the_content
array.each_with_index {|entry, index|
append_onto_content "<tr>#{N}"
case index % 2
when 0
append_onto_content '<td class="'+use_this_class_for_even_rows+'">'+N
when 1
append_onto_content '<td class="'+use_this_class_for_odd_rows+'">'+N
end
append_onto_content entry+N
append_onto_content '</td>'+N
case index % 2
when 1
append_onto_content '</tr>'+N
end
}
@internal_hash[:shall_we_modify_the_content] = false
end
|
#append_the_content(content = content?
) ⇒ Object
#
append_the_content
This will append the content onto the :result variable.
In this context, content refers to <tr><td> entries,
#
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 167
def append_the_content(
content = content?
)
if @internal_hash[:shall_we_modify_the_content]
content.each {|entry|
append_onto_the_result ' <tr>' if entry.is_a? Array
entry.each {|inner_entry|
append_onto_the_result '<td>'+inner_entry.to_s+'</td>'
}
else
append_onto_the_result '<td>'+entry.to_s+'</td>'
end
append_onto_the_result '</tr>'
append_onto_the_result N
}
else
append_onto_the_result "#{content}#{N}"
end
end
|
#fill_with_this_array(i) ⇒ Object
120
121
122
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 120
def fill_with_this_array(i)
set_content(i)
end
|
106
107
108
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 106
def (array)
@internal_hash[:headers] = array
end
|
99
100
101
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 99
def
@internal_hash[:headers]
end
|
#rebuild_the_result ⇒ Object
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 194
def rebuild_the_result
reset_the_result
consider_adding_the_pre_content
append_onto_the_result '<table'
batch_append_css_class_then_the_ID_and_then_the_css_style
if is_draggable?
append_onto_the_result ' draggable="true"'
end
append_onto_the_result ">\n"
=
if
array =
if !array.empty?
append_onto_the_result " <tr>\n"
array.each {||
append_onto_the_result " <th>#{}</th>\n"
}
append_onto_the_result " </tr>\n"
end
end
append_the_content
append_onto_the_result "</table>\n"
return raw_result?
end
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 79
def reset
super()
@internal_hash[:headers] = nil
@internal_hash[:shall_we_modify_the_content] = true
end
|
#shall_we_modify_the_content? ⇒ Boolean
#
shall_we_modify_the_content?
#
113
114
115
|
# File 'lib/cyberweb/objectified/html_tags/table.rb', line 113
def shall_we_modify_the_content?
@internal_hash[:shall_we_modify_the_content]
end
|