-
-
Save seyhunak/2651530 to your computer and use it in GitHub Desktop.
Simple page inject for JQuery Mobile and Rails Partials
This file contains 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
# Used to dynamically add a rails page view when using Jquery Mobile | |
# Author Nick Treadway @nicktea | |
@insert_page = (id, content) -> | |
page = $("<article id="+id+" data-role='page' data-url="+id+" data-add-back-btn='true'>" + content + "</article>") | |
page.appendTo('body') | |
$('a' + '#' + id).click -> | |
$.mobile.changePage(page, {transition: "slide"}) | |
# Use (your-view.haml) | |
:javascript | |
var content = "#{escape_javascript(render :partial => 'content')}" | |
insert_page("your-id", content); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment