Created
September 26, 2014 21:57
-
-
Save jfridye/4a99e2315af6e2065cdd 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
<%block name="fb_js"> | |
<script> | |
function mapped_route() { | |
var fb_url = '/me/${tl.facebook_app_namespace}:map?route=${request.build_absolute_uri()}'; | |
FB.api(fb_url, 'post', function (response) { | |
if (!response || response.error) { | |
var msg = 'Error occured'; | |
if (response.error) { | |
msg += "\n\nType: " + response.error.type + "\n\nMessage: " + response.error.message; | |
log(msg); | |
} | |
} | |
}); | |
} | |
fb_deferred.done( function () { | |
mapped_route(); | |
}); | |
function view_route() { | |
var fb_url = '/me/${tl.facebook_app_namespace}:view?route=${request.build_absolute_uri()}'; | |
FB.api(fb_url, 'post', function (response) { | |
if (!response || response.error) { | |
var msg = 'Error occured'; | |
if (response.error) { | |
msg += "\n\nType: " + response.error.type + "\n\nMessage: " + response.error.message; | |
log(msg); | |
} | |
} | |
}); | |
} | |
function goTop5() { | |
$('.error').dialog('destroy'); | |
$('.ui-dialog-titlebar-close').click(); | |
window.location.href = '/routes/my_routes/#top5'; | |
} | |
$.extend(true, _MMF_GLOBAL.text, { | |
top5_error_title: ${_(u'Cannot Add to Top 5') | n, jscript}, | |
top5_error_msg: ${_(u'You already have five routes designated as <i>Top 5</i>. You must remove one before adding another. <input type=\'button\' class=\'mmf_small_button\' value=\'View your Top 5\' onClick=\'goTop5();\' />') | n, jscript}, | |
top5_unset: 'Click to remove from Top 5', | |
top5_set: 'Click to add to Top 5', | |
}); | |
</script> | |
</%block> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment