Created
June 26, 2012 07:25
-
-
Save geirarne/2994077 to your computer and use it in GitHub Desktop.
form builder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def image_upload(attribute, options={}) | |
control_group do | |
label(attribute, class: 'control-label')+ | |
controls do | |
if(defined?object[attribute] && !object[attribute].blank?) | |
# ::TODO:: make this into a real variable!!! (use attribute instead of the hard-coded 'background_image') | |
@template.image_tag(object.background_image.url(:thumb)) | |
end+ | |
tag('br')+ | |
file_field(attribute)+ | |
if options[:help] | |
help_block options[:help] | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 7.