Skip to content

Instantly share code, notes, and snippets.

@geirarne
Created June 26, 2012 07:25
Show Gist options
  • Save geirarne/2994077 to your computer and use it in GitHub Desktop.
Save geirarne/2994077 to your computer and use it in GitHub Desktop.
form builder
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
@geirarne
Copy link
Author

line 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment