Skip to content

Commit

Permalink
First draft of the README is done
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Robertson committed Jan 31, 2013
1 parent 9ea00a3 commit 335c4d4
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions README.md
Expand Up @@ -83,28 +83,32 @@ Run the generator:


## Usage ## Usage


### Version override ### Adding Alternate Versions

Alternate versions of an application are registered using the `#add_alternate` method in the
`ress.rb` initializer that is generated by the `ress:install` generator. The configurabe options
available are all documented in the [comments of that file](https://github.com/matthewrobertson/ress/blob/master/lib/generators/ress/templates/ress.rb).


You can manually override the detector and load a particular version of ### Version override
the site by passing in the `device` GET parameter with the ID of the
version you'd like to load. This will look up the `link` tag based on
the specified ID and load that version. For example, if you are on
desktop but want the tablet version, visiting
`http://foo.com/?version=tablet` will redirect to the tablet version at
`http://tablet.foo.com`.


Relatedly, you can prevent redirection completely, by specifying the You can manually override the version detector javascript and allow mobile
`force=1` GET parameter. For example, if you are on desktop and know the clients to visit the canonical version of the app by passing in a the GET
URL of the tablet site, you can load `http://tablet.foo.com/?force=1`. url parameter `force_canonical=1`. This sets a session cookie in a `before_filter`
that stops the version detection scipt from redirecting users so it only has to be
done once per session. Ress includes a helper / controller method `force_canonical` that returns
a link back to the canonical version of the current page with this query param appended.
For, example you may include something like this in your `<footer>` to let mobile users
access the canonical site.


```html ```html
<!-- Include a way to manually switch between device types --> <!-- Let mobile devices access the canonical site -->
<footer> <footer>
<ul> <% unless canonical_request? %>
<li><a href="?device=desktop">Desktop</a></li> <div>
<li><a href="?device=tablet">Tablet</a></li> You are currently viewing the mobile version of this site.
<li><a href="?device=phone">Phone</a></li> <%= link_to 'View the desktop version', force_canonical_url %>
</ul> </div>
<% end %>
</footer> </footer>
``` ```


Expand Down

0 comments on commit 335c4d4

Please sign in to comment.