Windows 8.1 Tile Helpers Build Status Dependency Status

Adds easy defaults for writing Windows 8.1 tile functionality on top of Rails.

Installation

Add this line to your application's Gemfile:

gem 'tiles-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tiles-rails

Usage

Creating a notification feed

Create a controller to handle your requests, e.g. app/controllers/feeds_controller.rb:

class FeedsController < ApplicationController
  respond_to :tile

  def show
    @posts = Post.limit(3)
    respond_with @posts
  end

end

Now create a view to render the feed, e.g. app/views/feeds/show.tile.builder:

tile_feed do |feed|
  feed.binding(branding: 'logo', template: 'TileSquare150x150Text04', fallback: 'TileSquareImage') do
    feed.text(@posts.first.title, id: '1')
  end

  feed.binding(branding: 'logo', template: 'TileWide310x150Text03', fallback: 'TileWideImage') do
    feed.text(@posts.first.title, id: '1')
  end

  feed.binding(branding: 'logo', template: 'TileSquare310x310TextList02', contentId: @posts.first.id) do
    @posts.each_with_index do |post, index|
      feed.text(post.title, id: "#{index + 1}")
    end
  end
end

Update your config/routes.rb with the new route:

Blog::Application.routes.draw do
  ...

  resource :feed, only: [:show]
end

Now you can access your notification feed at http://localhost:3000/feed.tile.