Module: MasterView::Info
- Defined in:
- lib/masterview/masterview_info.rb
Overview
:nodoc:
Constant Summary collapse
- PROP_CATEGORY_ROOTS =
'MasterView Roots'
- PROP_CATEGORY_GENERAL_OPTIONS =
'General Options'
- PROP_CATEGORY_TEMPLATE_SRC_OPTIONS =
'Template Source Options'
- PROP_CATEGORY_TEMPLATE_GEN_OPTIONS =
'Template Generation Options'
- PROP_CATEGORY_TEMPLATE_PARSE_OPTIONS =
'Template Parsing Options'
- PROP_CATEGORY_RAILS_APP_OPTIONS =
'Rails Application Options'
- CATEGORIZED_PROPERTY_SPECS =
[ # [ <section-name>, [prop-name [, prop-name]... ] ] [ PROP_CATEGORY_ROOTS, [ :mv_installation_dir, :rails_app?, :on_rails? ] ], [ PROP_CATEGORY_GENERAL_OPTIONS, [ :root_path, :config_dir_path, :environment ] ], #:directive_load_path [ PROP_CATEGORY_TEMPLATE_SRC_OPTIONS, [ :template_src_dir_path, :template_filename_pattern ] ], [ PROP_CATEGORY_TEMPLATE_GEN_OPTIONS, [ :template_dst_dir_path, :output_filename_extension, :generated_file_default_extension, :include_generated_file_comment ] ], [ PROP_CATEGORY_TEMPLATE_PARSE_OPTIONS, [ :default_parser_options, :namespace_prefix, :namespace_prefix_extensions ] ], [ PROP_CATEGORY_RAILS_APP_OPTIONS, [ :parse_masterview_templates_at_startup, :reparse_changed_masterview_templates, :generate_rhtml_files ] ] ]
- PROPERTY_CATEGORIES =
CATEGORIZED_PROPERTY_SPECS.collect { | catEntry | catEntry[0] }
Class Method Summary collapse
- .getHtmlTemplate(element_option_name, params) ⇒ Object
-
.to_html(params = {}) ⇒ Object
Answer an html rendering of the Configuration Optionally provide HTML fragment templates and class/style attributes to customize rendering.
Class Method Details
.getHtmlTemplate(element_option_name, params) ⇒ Object
108 109 110 |
# File 'lib/masterview/masterview_info.rb', line 108 def self.getHtmlTemplate(element_option_name, params) ConfigInfoHelpers.getHtmlTemplate( element_option_name, params )#, defaults=ConfigInfoHelpers.::DEFAULT_RENDERING_OPTIONS end |
.to_html(params = {}) ⇒ Object
Answer an html rendering of the Configuration Optionally provide HTML fragment templates and class/style attributes to customize rendering
114 115 116 117 118 119 120 121 122 123 124 125 126 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 159 160 161 |
# File 'lib/masterview/masterview_info.rb', line 114 def self.to_html( params={} ) config = MasterView::ConfigSettings # unpack the supported keyword args title_html_template = getHtmlTemplate( :title, params ) #parms: config settings title preamble_html_template = getHtmlTemplate( :preamble, params ) #parms: MasterView version config_settings_html_template = getHtmlTemplate( :container, params ) #parms: section/option entries section_entry_html_template = getHtmlTemplate( :section_entry, params ) #parms: :section_attrs, section_name option_entry_html_template = getHtmlTemplate( :option_entry, params ) #parms: :option_name_attrs, option_name, :option_value_attrs, option_value postscript_html = getHtmlTemplate( :postscript, params ) # prepare our templates for convenient use during the generation loop below config_settings_html_start, config_settings_html_end = config_settings_html_template.split('%s') # and off we go at last html = [] unless title_html_template == :none # allow client to suppress html << title_html_template % [ 'MasterView Configuration' ] end unless preamble_html_template == :none # allow client to suppress html << preamble_html_template % [ MasterView::VERSION::STRING ] end html << config_settings_html_start CATEGORIZED_PROPERTY_SPECS.each { | section_name, | html << section_entry_html_template % section_name .each { | option | option_name = CGI.escapeHTML(option.to_s) option_value = config.send(option) #tbd: option_value.kind_of?(Hash) then make it pretty? option_value = option_value.nil? ? '(nil)' : CGI.escapeHTML(option_value.inspect) html << option_entry_html_template % [ option_name, option_value ] } # hack in options which aren't direct properties of the MasterView::Configuration if section_name == PROP_CATEGORY_GENERAL_OPTIONS option_name = 'logger' option_value = MasterView::Log.class.name html << option_entry_html_template % [ option_name, option_value ] option_name = 'log_level' option_value = MasterView.log_level html << option_entry_html_template % [ option_name, option_value ] end } html << config_settings_html_end html << postscript_html if postscript_html html.join("\n") end |