Changeset 6817 for lang/ruby/pritter

Show
Ignore:
Timestamp:
02/17/08 16:49:44 (5 years ago)
Author:
nakamud
Message:

fixed datetimetype
link to toppage
lang/ruby/pritter: auto link for URL string

Location:
lang/ruby/pritter
Files:
2 added
4 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/pritter/app/models/messenger.rb

    r5638 r6817  
    2525        profile = Profile.find_or_create_by_jid( msg.from.node ) 
    2626 
    27         tweet = Tweet.create!( :name => msg.from.node, :content => msg.body, :profile => profile ) 
     27        tweet = Tweet.create!( :name => msg.from.node, :content => Tweet.url2link_of_body(msg.body), :profile => profile ) 
    2828        profile.tweetcount += 1 
    2929 
  • lang/ruby/pritter/app/models/tweet.rb

    r5120 r6817  
    11class Tweet < ActiveRecord::Base 
    22  belongs_to :profile 
     3 
     4  require 'uri' 
     5 
     6  def self.url2link_of_body( body ) 
     7    html_string = CGI::escapeHTML(body) 
     8    URI.extract(html_string).each{|url| 
     9      html_string.gsub!(url,"<a href='#{url}' target='_blank'>#{url}</a>") 
     10    } 
     11    html_string 
     12  end 
     13 
    314end 
  • lang/ruby/pritter/app/views/timeline/anybody.rhtml

    r6567 r6817  
    99</head> 
    1010<body> 
    11   <h1>Pritter</h1> 
     11  <h1><%= link_to( "Pritter", {:action=>:anybody}, :style=>'color:white;' ) %></h1> 
    1212  <div id="about_pritter"><%= about_pritter %></div> 
    1313 
  • lang/ruby/pritter/db/schema.rb

    r5120 r6817  
    33# then regenerate this schema definition. 
    44 
    5 ActiveRecord::Schema.define(:version => 2) do 
     5ActiveRecord::Schema.define(:version => 4) do 
    66 
    77  create_table "profiles", :force => true do |t|