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
// NB: This is a proof of concept and needs work before using in production. | |
// https://github.com/turbolinks/turbolinks/issues/196#issuecomment-320610483 | |
// Copy paste the javascript below to somewhere that loads after turbolinks.js. | |
// Source: Converted coffee to JS with: https://awsm-tools.com/code/coffee2js | |
// https://github.com/turbolinks/turbolinks/blob/master/src/turbolinks/snapshot.coffee | |
Turbolinks.Snapshot.fromHTMLElement = function (htmlElement) { | |
var bodyElement, headDetails, headElement, _ref; |
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 ApplicationController < ActionController::Base | |
before_filter :set_variant | |
def set_variant | |
if request.format == :mobile | |
if request.xhr? | |
request.format = :js | |
else | |
request.format = :html | |
end |