Module: Ziya::Helpers::BaseHelper
- Includes:
- Ziya::Helper, Utils::Text
- Included in:
- Charts::Base, Gauges::Base, Gauges::Support::Base
- Defined in:
- lib/ziya/helpers/base_helper.rb
Instance Method Summary collapse
-
#chart(class_name) ⇒ Object
————————————————————————- YAML Convenience for chart class.
-
#chart_url(url, swf_chart_dir = "/charts") ⇒ Object
————————————————————————- generates a swf chart path from the given url.
-
#clazz(class_name, module_name = nil) ⇒ Object
YAML Convenience for chart name setting.
-
#component(component_name) ⇒ Object
(also: #comp)
————————————————————————- YAML Convenience for component declaration.
-
#dial(comp_class, comp_name = nil) ⇒ Object
————————————————————————- YAML Convenience for gauge component declaration.
-
#dials ⇒ Object
————————————————————————- YAML dials declaration.
-
#drawing(class_name) ⇒ Object
(also: #filter_type, #area)
————————————————————————- YAML Convenience for draw component class.
-
#gauge(class_name) ⇒ Object
————————————————————————- YAML Convenience for gauge class.
-
#indent(multiple = 1) ⇒ Object
————————————————————————- indent yaml content vy multiples of 2 spaces.
Methods included from Utils::Text
#camelize, #classify, #demodulize, #underscore
Methods included from Ziya::Helper
#block_is_within_action_view?, #capture_block, #chart_path, #charts_swf, #class_id, #codebase, #composite_url, #content_tag, #content_tag_string, #escape_chars, #escape_once, #escape_url, #gauge_path, #gauges_swf, #gen_composite_path, #gen_swf_path, #generate_flash_tag, #generate_old_style_flash_tag, #mime, #plugin_url, #setup_movie_size, #setup_wmode, #tag, #tag_options, #ziya_chart, #ziya_chart_js, #ziya_gauge, #ziya_javascript_include_tag
Instance Method Details
#chart(class_name) ⇒ Object
YAML Convenience for chart class
57 58 59 |
# File 'lib/ziya/helpers/base_helper.rb', line 57 def chart( class_name ) "--- #{clazz( class_name, :Charts )}" end |
#chart_url(url, swf_chart_dir = "/charts") ⇒ Object
generates a swf chart path from the given url. Used as helper to embed chart
11 12 13 |
# File 'lib/ziya/helpers/base_helper.rb', line 11 def chart_url( url, swf_chart_dir="/charts" ) gen_composite_path( swf_chart_dir, url ) end |
#clazz(class_name, module_name = nil) ⇒ Object
YAML Convenience for chart name setting
63 64 65 66 67 68 |
# File 'lib/ziya/helpers/base_helper.rb', line 63 def clazz( class_name, module_name=nil ) buff = "!ruby/object:Ziya::" buff << "#{module_name}::" unless module_name.nil? buff << "#{camelize(class_name.to_s)}" buff end |
#component(component_name) ⇒ Object Also known as: comp
YAML Convenience for component declaration
42 43 44 |
# File 'lib/ziya/helpers/base_helper.rb', line 42 def component( component_name ) "#{component_name}: #{clazz component_name, :Components}" end |
#dial(comp_class, comp_name = nil) ⇒ Object
YAML Convenience for gauge component declaration
29 30 31 32 |
# File 'lib/ziya/helpers/base_helper.rb', line 29 def dial( comp_class, comp_name=nil ) clazz = clazz( comp_class, "Gauges::Support" ) comp_name ? "- :#{comp_name}: #{clazz}" : "- #{clazz}" end |
#dials ⇒ Object
YAML dials declaration
36 37 38 |
# File 'lib/ziya/helpers/base_helper.rb', line 36 def dials "components: !omap" end |
#drawing(class_name) ⇒ Object Also known as: filter_type, area
YAML Convenience for draw component class
49 50 51 |
# File 'lib/ziya/helpers/base_helper.rb', line 49 def drawing( class_name ) clazz( class_name, :Components ) end |
#gauge(class_name) ⇒ Object
YAML Convenience for gauge class
23 24 25 |
# File 'lib/ziya/helpers/base_helper.rb', line 23 def gauge( class_name ) "--- #{clazz( class_name, 'Gauges' )}\n#{dials}" end |
#indent(multiple = 1) ⇒ Object
indent yaml content vy multiples of 2 spaces
17 18 19 |
# File 'lib/ziya/helpers/base_helper.rb', line 17 def indent( multiple= 1 ) " " * multiple end |