Class: Objectified::HtmlTags::Div
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
#+, #add_css_rules, #add_this_to_javascript, #add_to_pre_content, #append_css_manager, #append_onto_the_css_class, #append_onto_the_result, #append_the_content, #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
#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 = Div.css_class?, optional_id = nil, optional_css_style = nil, &block) ⇒ Div
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 68
def initialize(
use_this_text = '',
optional_css_class = Div.css_class?,
optional_id = nil,
optional_css_style = nil,
&block
)
try_to_register_this_tag(self)
reset
use_this_text = use_this_text.join(' ').strip if use_this_text.is_a? Array
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
if block_given?
evaluate_this_block(&block)
end
end
|
Class Method Details
33
34
35
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 33
def self.clear
Div.set_css_class('')
end
|
.css_class? ⇒ Boolean
56
57
58
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 56
def self.css_class?
@css_class
end
|
.reset_css_class ⇒ Object
26
27
28
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 26
def self.reset_css_class
@css_class = nil
end
|
.set_css_class(i = DEFAULT_CSS_CLASS) ⇒ Object
#
Usage example for setting to a default CSS class to use in <div> tags goes like so:
Cyberweb::Objectified::HtmlTags::Div.set_css_class 'red'
Cyberweb::Div.set_css_class 'red'
This will then have set a new default for all <div> tags, as they will be red from this point on.
#
49
50
51
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 49
def self.set_css_class(i = DEFAULT_CSS_CLASS)
@css_class = i
end
|
Instance Method Details
#horizontal_separator ⇒ Object
Also known as:
hsep
116
117
118
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 116
def horizontal_separator
"<hr>\n"
end
|
#minimal(i = content?,
, padding_to_use = 0) ⇒ Object
#
minimal (minimal tag)
This was originally inspired by ruby-gtk, which allows us to use .minimal() on a widget. For HTML, we simply assume this to use a div-HTML tag.
The method here must be able to support API calls such as:
hbox.minimal(button1?, 2)
The second argument is inner-padding.
#
133
134
135
136
137
138
139
140
141
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 133
def minimal(
i = content?,
padding_to_use = 0
)
padding_to_use = "pad#{padding_to_use}px"
"<div class=\"hbox #{padding_to_use}\">\n"+
i.to_s+
"\n</div>"
end
|
#onchange=(i) ⇒ Object
#
onchange=
This assumes that a javascript function is called. If the last character is not ‘)’ then we will append ‘()’.
Usage example:
combobox.onchange = 'foobar()'
#
105
106
107
108
109
110
111
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 105
def onchange=(i)
i = i.to_s.dup
unless i.end_with? ')'
i << '()'
end
@internal_hash[:onchange] = i
end
|
#rebuild_the_result ⇒ Object
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 182
def rebuild_the_result
reset_the_result
consider_adding_the_script_entry_from_the_internal_hash
consider_adding_the_pre_content
append_onto_the_result '<div'
if @internal_hash.has_key?(:onclick) and @internal_hash[:onclick]
append_onto_the_result ' onclick="'+@internal_hash[:onclick].to_s+'"'
end
batch_append_css_class_then_the_ID_and_then_the_css_style
if @internal_hash.has_key? :name
append_onto_the_result ' name="'+@internal_hash[:name].to_s+'"'
end
if @internal_hash[:in_tag_script] and !@internal_hash[:in_tag_script].empty?
append_onto_the_result " #{@internal_hash[:in_tag_script]}"
end
append_onto_the_result ">\n"
content = content?
if content and !content.empty?
append_onto_the_result "#{content}\n"
end
append_onto_the_result "</div>\n"
return raw_result?
end
|
90
91
92
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 90
def reset
super()
end
|
#set_border_size(i = 0) ⇒ Object
153
154
155
156
157
158
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 153
def set_border_size(i = 0)
i = i.to_i
if i and i > 0
append_onto_the_CSS_class 'mar'+i.to_s+'px'
end
end
|
#set_padding(i = 0) ⇒ Object
146
147
148
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 146
def set_padding(i = 0)
append_onto_the_CSS_class 'pad'+i.to_s+'px'
end
|
#set_size_request(width = 1024, height = 820) ⇒ Object
172
173
174
175
176
177
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 172
def set_size_request(
width = 1024,
height = 820
)
append_to_the_CSS_style 'width: '+width.to_s+'px; height: '+height.to_s+'px;'
end
|
#
show_all
This method currently does not do anything. In the future we may change this behaviour, such as toggling the CSS visibility property.
#
166
167
|
# File 'lib/cyberweb/objectified/html_tags/div.rb', line 166
def show_all
end
|