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
def display_submit_tag(label)
content_tag('p', submit_tag( label, :class => 'submit'), :class => 'submitline')
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 = nil, options = {})
filter_type =
if filter_type_method.blank?
''
else
instance_variable_get("@#{object}").send(filter_type_method)
end
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, { :size => '72x12' }.merge(options).merge({:class => html_class}))
else
text_area(object, method, { :size => '72x12' }.merge(options))
end
end
def file_manager(&block)
concat(content_tag('div', capture(&block), :class => 'file-manager') + "
", block.binding)
end
def file_manager_button(title, icon, url)
content_tag('div', link_to(image_tag(icon, :alt => title, :title => title) + content_tag('div', title), url), :class => 'file-manager-button')
end
end