# File lib/erubis/helpers/rails_form_helper.rb, line 106 106: def _pp_check_box_checked?(value, checked_value) 107: return ActionView::Helpers::InstanceTag::check_box_checked?(value, checked_value) 108: end
# File lib/erubis/helpers/rails_form_helper.rb, line 50 50: def _pp_remove_error_div(s) 51: s.sub!(/\A<div class="fieldWithErrors">(.*)<\/div>\z/, '\1') 52: return s 53: end
# File lib/erubis/helpers/rails_form_helper.rb, line 121 121: def _pp_select(object, method, collection, priority_collection, options={}, html_options={}) 122: return pp_error_on(object, method) do 123: s = "" 124: ## start tag 125: s << "<select id=\"#{object}_#{method}\" name=\"#{object}[#{method}]\"" 126: for key, val in html_options: 127: s << " #{key}=\"#{val}\"" 128: end 129: s << ">\n" 130: ## selected table 131: key = options.key?(:value) ? :value : (options.key?('value') ? 'value' : nil) 132: if key.nil? ; selected = "@#{object}.#{method}" 133: elsif (val=options[key]).nil? ; selected = nil 134: elsif val =~ /\A<%=(.*)%>\z/ ; selected = $1 135: else ; selected = val.inspect 136: end 137: s << "<% _table = {#{selected}=>' selected=\"selected\"'} %>\n" if selected 138: ## <option> tags 139: if options[:include_blank] || options['include_blank'] 140: s << "<option value=\"\"></option>\n" 141: end 142: unless priority_collection.blank? 143: _pp_select_options(s, priority_collection, selected, 'delete') 144: s << "<option value=\"\">-------------</option>\n" 145: end 146: _pp_select_options(s, collection, selected, '[]') 147: ## end tag 148: s << "</select>" 149: s 150: end 151: end
# File lib/erubis/helpers/rails_form_helper.rb, line 153 153: def _pp_select_options(s, collection, selected, operator) 154: for item in collection 155: value, text = item.is_a?(Array) ? item : [item, item] 156: if !selected 157: t = '' 158: elsif operator == 'delete' 159: t = "<%= _table.delete(#{value.inspect}) %>" 160: else 161: t = "<%= _table[#{value.inspect}] %>" 162: end 163: s << "<option value=\"#{h value}\"#{t}>#{h text}</option>\n" 164: end 165: end
# File lib/erubis/helpers/rails_form_helper.rb, line 99 99: def pp_check_box(object_name, method, options={}, checked_value="1", unchecked_value="0") 100: s = check_box(object_name, method, options, checked_value, unchecked_value) 101: s.sub!(/\schecked=\"checked\"/, '') 102: s.sub!(/type="checkbox"/, "\\&<%= _pp_check_box_checked?(@#{object_name}.#{method}, #{checked_value.inspect}) ? ' checked=\"checked\"' : '' %>") 103: return pp_error_on(object_name, method) { _pp_remove_error_div(s) } 104: end
# File lib/erubis/helpers/rails_form_helper.rb, line 171 171: def pp_collection_select(object, method, collection, value_method, text_method, options={}, html_options={}) 172: collection2 = collection.collect { |e| 173: [e.__send__(value_method), e.__send__(text_method)] 174: } 175: return _pp_select(object, method, collection2, nil, options, html_options) 176: end
# File lib/erubis/helpers/rails_form_helper.rb, line 178 178: def pp_country_select(object, method, priority_countries=nil, options={}, html_options={}) 179: collection = ActionView::Helpers::FormOptionsHelper::COUNTRIES 180: return _pp_select(object, method, collection, priority_countries, options, html_options) 181: end
# File lib/erubis/helpers/rails_form_helper.rb, line 37 37: def pp_error_on(object_name, method) 38: s = '' 39: s << "<% _stag, _etag = _pp_error_tags(@#{object_name}.errors.on('#{method}')) %>" 40: s << "<%= _stag %>" 41: s << yield(object_name, method) 42: s << "<%= _etag %>" 43: return s 44: end
# File lib/erubis/helpers/rails_form_helper.rb, line 91 91: def pp_file_field(object_name, method, options={}) 92: return pp_tag_helper(:file_field, object_name, method, options) 93: end
# File lib/erubis/helpers/rails_form_helper.rb, line 69 69: def pp_form_tag(url_for_options={}, options={}, *parameters_for_url, &block) 70: return form_tag(url_for_options, options, *parameters_for_url, &block) 71: end
# File lib/erubis/helpers/rails_form_helper.rb, line 193 193: def pp_image_submit_tag(source, options={}) 194: return image_submit_tag(source, options) 195: end
# File lib/erubis/helpers/rails_form_helper.rb, line 83 83: def pp_password_field(object_name, method, options={}) 84: return pp_tag_helper(:password_field, object_name, method, options) 85: end
# File lib/erubis/helpers/rails_form_helper.rb, line 30 30: def pp_render_partial(basename) 31: basename = "_#{basename}" unless basename[0] == __ 32: filename = pp_template_filename(basename) 33: preprocessor = _create_preprocessor(File.read(filename)) 34: return preprocessor.evaluate(_preprocessing_context_object()) 35: end
# File lib/erubis/helpers/rails_form_helper.rb, line 167 167: def pp_select(object, method, collection, options={}, html_options={}) 168: return _pp_select(object, method, collection, nil, options, html_options) 169: end
# File lib/erubis/helpers/rails_form_helper.rb, line 189 189: def pp_submit_tag(value="Save changes", options={}) 190: return submit_tag(value, options) 191: end
# File lib/erubis/helpers/rails_form_helper.rb, line 55 55: def pp_tag_helper(helper, object_name, method, options={}) 56: if object_name.is_a?(ActionView::Helpers::FormHelper) 57: object_name = object_name.object_name 58: end 59: unless options.key?(:value) || options.key?('value') 60: options['value'] = _?("h @#{object_name}.#{method}") 61: end 62: #$stderr.puts "*** debug: pp_tag_helper(): options=#{options.inspect}" 63: return pp_error_on(object_name, method) { 64: s = __send__(helper, object_name, method, options) 65: _pp_remove_error_div(s) 66: } 67: end
# File lib/erubis/helpers/rails_form_helper.rb, line 23 23: def pp_template_filename(basename) 24: fname = "#{RAILS_ROOT}/app/views/#{controller.controller_name}/#{basename}.html.erb" 25: return fname if test(ff, fname) 26: return "#{RAILS_ROOT}/app/views/#{controller.controller_name}/#{basename}.rhtml" 27: end
# File lib/erubis/helpers/rails_form_helper.rb, line 19 19: def pp_template_filename(basename) 20: return "#{RAILS_ROOT}/app/views/#{controller.controller_name}/#{basename}.rhtml" 21: end
# File lib/erubis/helpers/rails_form_helper.rb, line 95 95: def pp_text_area(object_name, method, options={}) 96: return pp_tag_helper(:text_area, object_name, method, options) 97: end
# File lib/erubis/helpers/rails_form_helper.rb, line 79 79: def pp_text_field(object_name, method, options={}) 80: return pp_tag_helper(:text_field, object_name, method, options) 81: end
# File lib/erubis/helpers/rails_form_helper.rb, line 183 183: def pp_time_zone_select(object, method, priority_zones=nil, options={}, html_options={}) 184: model = options[:model] || options['model'] || TimeZone 185: collection = model.all.collect { |e| [e.name, e.to_s] } 186: return _pp_select(object, method, collection, priority_zones, options, html_options) 187: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.