Sha256: ee4b8051d2a70be7ec3844823f401ddefad21fe5cc76d21a6a5f6ade8d942586
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
# Windows 8 Tile Helpers [![Build Status](https://secure.travis-ci.org/unindented/tiles-rails.png)](http://travis-ci.org/unindented/tiles-rails) [![Dependency Status](https://gemnasium.com/unindented/tiles-rails.png)](https://gemnasium.com/unindented/tiles-rails) Adds easy defaults for writing Windows 8 tile functionality on top of Rails. ## Installation Add this line to your application's `Gemfile`: ```rb gem 'tiles-rails' ``` And then execute: ```sh $ bundle ``` Or install it yourself as: ```sh $ gem install tiles-rails ``` ## Usage ### Creating a notification feed Create a controller to handle your requests, e.g. `app/controllers/feeds_controller.rb`: ```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`: ```rb 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: ```rb Blog::Application.routes.draw do ... resource :feed, only: [:show] end ``` Now you can access your notification feed at <http://localhost:3000/feed.tile>.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tiles-rails-0.0.1 | README.md |