Class Index [+]

Quicksearch

Erubis::Helpers::RailsFormHelper

Public Instance Methods

_pp_check_box_checked?(value, checked_value) click to toggle source
     # 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
_pp_error_tags(value) click to toggle source
    # File lib/erubis/helpers/rails_form_helper.rb, line 46
46:   def _pp_error_tags(value)
47:     return value ? ['<div class="fieldWithErrors">', '</div>'] : ['', '']
48:   end
_pp_radio_button_checked?(value, tag_value) click to toggle source
     # File lib/erubis/helpers/rails_form_helper.rb, line 117
117:   def _pp_radio_button_checked?(value, tag_value)
118:     return ActionView::Helpers::InstanceTag::radio_button_checked?(value, tag_value)
119:   end
_pp_remove_error_div(s) click to toggle source
    # 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
_pp_select(object, method, collection, priority_collection, options={}, html_options={}) click to toggle source
     # 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
_pp_select_options(s, collection, selected, operator) click to toggle source
     # 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
pp_check_box(object_name, method, options={}, checked_value="1", unchecked_value="0") click to toggle source
     # 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
pp_collection_select(object, method, collection, value_method, text_method, options={}, html_options={}) click to toggle source
     # 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
pp_country_select(object, method, priority_countries=nil, options={}, html_options={}) click to toggle source
     # 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
pp_error_on(object_name, method) click to toggle source
    # 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
pp_file_field(object_name, method, options={}) click to toggle source
    # 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
pp_form_tag(url_for_options={}, options={}, *parameters_for_url, &block) click to toggle source
    # 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
pp_hidden_field(object_name, method, options={}) click to toggle source
    # File lib/erubis/helpers/rails_form_helper.rb, line 87
87:   def pp_hidden_field(object_name, method, options={})
88:     return pp_tag_helper(:hidden_field, object_name, method, options)
89:   end
pp_image_submit_tag(source, options={}) click to toggle source
     # 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
pp_password_field(object_name, method, options={}) click to toggle source
    # 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
pp_radio_button(object_name, method, tag_value, options={}) click to toggle source
     # File lib/erubis/helpers/rails_form_helper.rb, line 110
110:   def pp_radio_button(object_name, method, tag_value, options={})
111:     s = radio_button(object_name, method, tag_value, options)
112:     s.sub!(/\schecked=\"checked\"/, '')
113:     s.sub!(/type="radio"/, "\\&<%= _pp_radio_button_checked?(@#{object_name}.#{method}, #{tag_value.inspect}) ? ' checked=\"checked\"' : '' %>")
114:     return pp_error_on(object_name, method) { _pp_remove_error_div(s) }
115:   end
pp_render_partial(basename) click to toggle source
    # 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
pp_select(object, method, collection, options={}, html_options={}) click to toggle source
     # 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
pp_submit_tag(value="Save changes", options={}) click to toggle source
     # 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
pp_tag_helper(helper, object_name, method, options={}) click to toggle source
    # 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
pp_template_filename(basename) click to toggle source
    # 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
pp_template_filename(basename) click to toggle source
    # 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
pp_text_area(object_name, method, options={}) click to toggle source
    # 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
pp_text_field(object_name, method, options={}) click to toggle source
    # 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
pp_time_zone_select(object, method, priority_zones=nil, options={}, html_options={}) click to toggle source
     # 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.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.