tag with class 'formfield'
def display_form_field(label, html_for_field)
content_tag('div', content_tag('div', content_tag('label', label)) + html_for_field, :class => 'formfield')
end
alias_method :labelled_form_field, :display_form_field
def labelled_form_for(name, object = nil, options = {}, &proc)
object ||= instance_variable_get("@#{name}")
form_for(name, object, { :builder => NoosferoFormBuilder }.merge(options), &proc)
end
class NoosferoFormBuilder < ActionView::Helpers::FormBuilder
include GetText
(field_helpers - %w(hidden_field)).each do |selector|
src = <<-END_SRC
def #{selector}(field, *args, &proc)
column = object.class.columns_hash[field.to_s]
"
"
end
END_SRC
class_eval src, __FILE__, __LINE__
end
end
def category_color
if @category.nil?
""
else
@category.top_ancestor.display_color
end
end
def text_editor(object, method, filter_type_method, options = {})
filter_type = instance_variable_get("@#{object}").send(filter_type_method)
if filter_type == '[No Filter]' || filter_type.blank?
html_class = "tiny_mce_editor"
if options[:class]
html_class << " #{options[:class]}"
end
text_area(object, method, { :rows => 12, :columns => 72 }.merge(options).merge({:class => html_class}))
else
text_area(object, method, { :rows => 12, :columns => 72 }.merge(options))
end
end
def select_filter_type(object, method, html_options)
options = [
[ _('No Filter at all'), '[No Filter]' ],
[ _('RDoc filter'), 'RDoc' ],
[ _('Simple'), 'Simple' ],
[ _('Textile'), 'Textile' ]
]
select_tag "#{object}[#{method}]", options_for_select(options, @page.filter_type || Comatose.config.default_filter), { :id=> "#{object}_#{method}" }.merge(html_options)
end
end