RubyGems Navigation menu

sinatra-effigy 0.0.3

Sinatra Effigy ============== An Effigy extension for Sinatra. Why? ---- * HTML should be in .html files. Ruby should be in .rb files. * Effigy follows the jQuery API - just replace $() with f(). * Effigy has 100% test coverage and 0 Reek smells. Usage ----- Install the gem: sudo gem install sinatra-effigy Create your Sinatra app: require 'rubygems' require 'sinatra' require 'sinatra/effigy' get '/jobs/:id' do |id| effigy :job, Job.find(id) end Create your template (fresh from a designer?) at /templates/job.html: Web Designer at thoughtbot <h1>Web Designer</h1> <h2><a href="http://example.com">thoughtbot</a></h2> <h3>Boston or New York</h3> <div> <p>Graphic design, typography, CSS, HTML.</p> </div> <h3>Apply</h3> <p>Please contact <span>jobs@example.com</span>.</p> Create a view at /views/job.rb that responds to #transform: class JobView < Effigy::View attr_reader :job def initialize(*locals) @job = locals.first end def transform f('title').text("#{job.position} at #{job.company}") f('h1').text(job.position) f('h2 a').attr(:href => job.company_url). text(job.company) f('#description').html(job.description) f('#apply-at').text(job.apply_at) end end Conventions ----------- Assumes matching Ruby files at views/ and HTML files at templates/. Use a string if you need directories: get '/jobs/edit/:id' do |id| effigy 'jobs/edit', Job.find(id) end Resources --------- * [Effigy](http://github.com/jferris/effigy) * [Sinatra](http://sinatrarb.com)

Gemfile:
=

instalar:
=

Versões:

  1. 0.0.9 March 20, 2010 (7 KB)
  2. 0.0.8 March 11, 2010 (6 KB)
  3. 0.0.7 January 15, 2010 (6 KB)
  4. 0.0.6 January 14, 2010 (6 KB)
  5. 0.0.5 January 14, 2010 (6 KB)
  6. 0.0.3 January 12, 2010 (6,5 KB)
Mostrar todas as versões (9)

Runtime Dependencies (1):

sinatra >= 0

Donos:

Autores:

  • Dan Croak

SHA 256 checksum:

=

Total de downloads 32.016

Desta versão 3.372

Versão lançada:

Licenças:

N/A

Versão Requerida do Ruby: Nenhum

Links: