Created
August 18, 2010 21:42
-
-
Save mdeering/536277 to your computer and use it in GitHub Desktop.
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
class SchoolManagerHooks < Spree::ThemeSupport::HookListener | |
# Hook is getting called as expected in the user form. | |
# http://github.com/railsdog/spree/blob/0-11-stable/vendor/extensions/theme_default/app/views/shared/_user_form.html.erb | |
# But both give 'undefined local variable or method `f' | |
# Partial Rendering Hook. | |
insert_after :signup_below_password_fields, 'form_fields' | |
# Also tried a block rendering hook. | |
insert_after :signup_below_password_fields do | |
"<%= f.label :school %><br />" | |
"<%= f.select School.all %>" | |
end | |
end |
submitted a patch for 0-11-stable to allow for access to the form builder for the hooks inside of the user form.
http://railsdog.lighthouseapp.com/projects/31096/tickets/1606-011-give-hooks-inside-the-user-form-access-to-the-form-builder-theme_default
http://github.com/mdeering/spree/commit/d9666f1a2bce16c85d2ad1d1902e1aa9acd8c0f3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works for me
insert_before :admin_user_form_fields do
%{
<% f.field_container :first_name do %>
<%= f.label :first_name, t("first_name") %>
<%= f.text_field :first_name, :class => 'title' %>
<%= f.error_message_on :first_name %>
<% end %>
<% f.field_container :last_name do %>
<%= f.label :last_name, t("last_name") %>
<%= f.text_field :last_name, :class => 'title' %>
<%= f.error_message_on :last_name %>
<% end %>
}
end
Works for me