#24 ✓resolved
Colin Jones

image_submit_tag?

Reported by Colin Jones | July 17th, 2008 @ 02:55 AM

image_submit_tag is something I use relatively frequently; not sure if this could be helpful to others for use in an Engines plugin with syntax like we have for image_tag:

image_submit_tag("test.gif", :plugin => 'test_plugin')

I've kind of gone back and forth between 2 solutions: typing out the full path to the image asset (kind of ugly):

image_submit_tag("/plugin_assets/test_plugin/images/test.gif")

and adding the functionality to Rails in the same pattern as Engines' image_tag:

module Engines::RailsExtensions::FormTagHelpers

def self.included(base)

base.class_eval do

alias_method_chain :image_submit_tag, :engine_additions

end

end

def image_submit_tag_with_engine_additions(source, options={})

options.stringify_keys!

if options["plugin"]

source = Engines::RailsExtensions::PublicAssetHelpers.plugin_asset_path(options["plugin"], "images", source)

options.delete("plugin")

end

image_submit_tag_without_engine_additions(source, options)

end

end

::ActionView::Helpers::FormTagHelper.send(:include, Engines::RailsExtensions::FormTagHelpers)

Does this sound something that would be helpful to have in Engines by default, or is it best added on a project-by-project basis?

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The rails engines plugin itself

Shared Ticket Bins

People watching this ticket

Attachments

Pages