Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ajaxified inquiry form #98

Closed
wants to merge 1 commit into from
Closed

ajaxified inquiry form #98

wants to merge 1 commit into from

Conversation

keram
Copy link
Contributor

@keram keram commented Dec 18, 2012

hello guys,
improved inquiry form with ajax with properties:

  • in default configuration it behaves like before only is submitted through ajax
  • when javascript is not available it fallback to current old implementation
  • you can load form through ajax on other pages than contact.
    You just need put this snippet of code where you want:
<%= render :partial => 'refinery/inquiries/inquiries/javascripts' %>
  • customizable and configurable
    you can set form id, form holder,some callbacks etc.
    For example you want initialize inquiry form only after your custom event (maybe click on button)
    then you may put this snippet of code:
<%= render :partial => 'refinery/inquiries/inquiries/javascripts', :locals => {:initialize_onload => false} %>
<a id="frm-a" href="/contact">contact form</a>
<% content_for :javascripts do %>
<script>
$(function() {

    $('#frm-a').on('click', function () {
        new refinery.Inquiry({
            holder : { id : 'custom-holder-id', append_to: '#body_content_title' },
            onload : {
                fnc : window.alert,
                args : 'Inquiry Form loaded and binded'
            }});
    });
    return false;
});
</script>
<% end %>

and more..

In next step I would like write documentation and implement some polyfill for #77

sanitize passed form holder id prevent xss
refactoring & with bugfix on customized form holder
removing forgotted debug setting from inquiry model
:to => nil }.merge(hash)

render_options = {:json => json}
render(render_options)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could just be

render :json => json

@keram keram closed this Jun 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants