~michaelforrest/use-case-mapper/trunk

« back to all changes in this revision

Viewing changes to vendor/rails/railties/guides/rails_guides/helpers.rb

  • Committer: Michael Forrest
  • Date: 2010-10-15 16:28:50 UTC
  • Revision ID: michael.forrest@canonical.com-20101015162850-tj2vchanv0kr0dun
refrozeĀ gems

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
module RailsGuides
 
2
  module Helpers
 
3
    def guide(name, url, options = {}, &block)
 
4
      link = content_tag(:a, :href => url) { name }
 
5
      result = content_tag(:dt, link)
 
6
 
 
7
      if ticket = options[:ticket]
 
8
        result << content_tag(:dd, lh(ticket), :class => 'ticket')
 
9
      end
 
10
 
 
11
      result << content_tag(:dd, capture(&block))
 
12
      concat(result)
 
13
    end
 
14
 
 
15
    def lh(id, label = "Lighthouse Ticket")
 
16
      url = "http://rails.lighthouseapp.com/projects/16213/tickets/#{id}"
 
17
      content_tag(:a, label, :href => url)
 
18
    end
 
19
 
 
20
    def author(name, nick, image = 'credits_pic_blank.gif', &block)
 
21
      image = "images/#{image}"
 
22
 
 
23
      result = content_tag(:img, nil, :src => image, :class => 'left pic', :alt => name)
 
24
      result << content_tag(:h3, name)
 
25
      result << content_tag(:p, capture(&block))
 
26
      concat content_tag(:div, result, :class => 'clearfix', :id => nick)
 
27
    end
 
28
 
 
29
    def code(&block)
 
30
      c = capture(&block)
 
31
      content_tag(:code, c)
 
32
    end
 
33
  end
 
34
end