Skip to content

Instantly share code, notes, and snippets.

@craigmcnamara
Created April 7, 2011 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigmcnamara/908544 to your computer and use it in GitHub Desktop.
Save craigmcnamara/908544 to your computer and use it in GitHub Desktop.
This is a Liquid template with access to a Page object and fb_page and fb_user information
<div id="fb-root">
<div style="background-color:#FFFFFF; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;min-height:750px;">
<link rel="stylesheet" type="text/css" href="{{page.host_path}}/screen.css" />
<div id="cny-home-expo-01">
<img src="{{page.host_path}}/cny-home-expo_01.gif" width="520" height="109" alt="">
</div>
<div id="cny-home-expo-02">
<img src="{{page.host_path}}/cny-home-expo_02.gif" width="253" height="362" alt="">
</div>
<div id="cny-home-expo-03">
<p id='ajaxMessage'></p>
<form action='http://pagelander.net/contacts' class='contact_form' id='contact_form' method='post' style="display:none;">
<input id='authenticity_token' name='authenticity_token' type='hidden' value='auASX61O/2GGUBJR5maalky7YeQ1QF7vQHR2jo3zeMA=' />
<input id='page_slug' name='page_slug' type='hidden' value='{{page.landing_page_name}}' />
<div class='input'>
<label class='string' for='name'>
Name
</label>
<input name='contact[name]' />
</div>
<div class='input'>
<label class='string' for='email'>
Email
</label>
<input name='contact[email]' />
</div>
<div class='input'>
<label class='string' for='phone'>
Phone
</label>
<input name='contact[phone]' />
</div>
<div class='input'>
<label class='string' for='address'>
Address
</label>
<input name='contact[address]' />
</div>
<div class='input'>
<label class='string' for='city'>
City
</label>
<input name='contact[city]' />
</div>
<div class='input'>
<label class='string' for='state'>
State
</label>
<input name='contact[state]' />
</div>
<div class='input'>
<label class='string' for='zip'>
Zip
</label>
<input name='contact[zip]' />
</div>
<input type='submit' value='Submit' id='submit' />
</form>
<img src="{{page.host_path}}/home-expo_03-fixed.gif" width="267" height="362" alt="" id="unliked_form" style="display:block;">
</div>
<div id="cny-home-expo-04">
<img src="{{page.host_path}}/cny-home-expo_04.gif" width="520" height="229" alt="">
</div>
</div>
</div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type='text/javascript'></script>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: '194661473905020', status: true, cookie: true, xfbml: true, channelUrl: 'http://pagelander.net/facebook/expo'});
FB.getLoginStatus(function(response) {
$('#ajaxMessage').html("<p>Connected to Application</p>").show();
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
$(document).ready(function(){
if({{fb_page.liked}}){
$('#unliked_form').hide();
$('#contact_form').show();
}
$('#ajaxMessage').hide();
$('#submit').click(function(){
$('#ajaxMessage').html("<p>Submitting your information, please wait...</p>").show();
$.ajax({
type: "POST",
url: "http://pagelander.net/contacts",
data: $('#contact_form').serialize(),
success: function(msg){
$('#ajaxMessage').hide();
$('#contact_form').html("<div id='thank_you' class='thank_you'>"+msg+"</div>")
}
});
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment