twisplay 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -15,20 +15,10 @@ And then execute:
15
15
 
16
16
  Add the Twisplay CSS file 'application.css.scss':
17
17
 
18
- @import "twisplay";
19
-
18
+ @import "twisplay"
20
19
 
21
20
  ## Usage
22
21
 
23
- Render a tweet in a view using the status id from the URL (E.g. "https://twitter.com/#!/rails/status/185856371667894273"):
22
+ Render a tweet in a view using the status id from the URL (E.g. https://twitter.com/#!/rails/status/185856371667894273 ):
24
23
 
25
24
  tweet("185856371667894273")
26
-
27
-
28
- ## Contributing
29
-
30
- 1. Fork it
31
- 2. Create your feature branch (`git checkout -b my-new-feature`)
32
- 3. Commit your changes (`git commit -am 'Added some feature'`)
33
- 4. Push to the branch (`git push origin my-new-feature`)
34
- 5. Create new Pull Request
@@ -42,7 +42,8 @@ div.twisplay {
42
42
  }
43
43
 
44
44
  &.tweet {
45
- font-size: 16px;
45
+ font-size: 14px;
46
+ line-height: 24px;
46
47
  margin-bottom: 0;
47
48
  height: 53px;
48
49
 
@@ -1,4 +1,5 @@
1
1
  module TwisplayHelper
2
+
2
3
  def tweet(tweet)
3
4
  @tweet = Tweet.find_by_tweet_id(tweet)
4
5
  render :template => "twisplay/tweet"
data/app/models/tweet.rb CHANGED
@@ -1,10 +1,22 @@
1
1
  require "twitter"
2
+ require "twitter-text"
2
3
 
3
- class Tweet < ActiveRecord::Base
4
-
4
+ class Tweet < ActiveRecord::Base
5
+ include Twitter::Autolink
6
+
5
7
  validates_presence_of :text, :tweet_created_at, :tweet_id, :user_name, :user_screen_name
6
8
 
7
- # attr_accessible :text, :tweet_created_at, :tweet_id, :user_name, :user_screen_name, :user_profile_image_url
9
+ attr_accessible :text, :tweet_created_at, :tweet_id, :user_name, :user_screen_name, :user_profile_image_url
10
+
11
+ default_scope :order => "tweet_created_at DESC"
12
+
13
+ def text
14
+ auto_link(self[:text])
15
+ end
16
+
17
+ def user_profile_image_url=(url)
18
+ self[:user_profile_image_url] = url.sub("_normal", "_reasonably_small")
19
+ end
8
20
 
9
21
  def self.find_by_tweet_id(tweet_id)
10
22
  if Tweet.exists?(:tweet_id => tweet_id.to_s)
@@ -17,23 +29,9 @@ class Tweet < ActiveRecord::Base
17
29
  tweet.tweet_id = status.id
18
30
  tweet.user_name = status.user.name
19
31
  tweet.user_screen_name = status.user.screen_name
20
- tweet.user_profile_image_url = status.user.profile_image_url.sub("_normal", "_reasonably_small")
32
+ tweet.user_profile_image_url = status.user.profile_image_url
21
33
  tweet.save!
22
34
  tweet
23
35
  end
24
36
  end
25
-
26
- def client
27
- self.class.client
28
- end
29
-
30
- def self.client
31
- Twitter.configure do |config|
32
- config.consumer_key = TWITTER_CONSUMER_KEY
33
- config.consumer_secret = TWITTER_CONSUMER_SECRET
34
- config.oauth_token = TWITTER_ACCESS_TOKEN
35
- config.oauth_token_secret = TWITTER_ACCESS_TOKEN_SECRET
36
- end
37
- end
38
-
39
37
  end
@@ -8,7 +8,7 @@
8
8
  <%= link_to @tweet.user_name, "https://twitter.com/intent/user?screen_name=#{@tweet.user_screen_name}" %>
9
9
  </p>
10
10
  <p class="tweet">
11
- <%= @tweet.text %>
11
+ <%= @tweet.text.html_safe %>
12
12
  </p>
13
13
  <div class="twitter_links">
14
14
  <div class="date">
@@ -1,3 +1,3 @@
1
1
  module Twisplay
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/twisplay.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["j.diepenmaat@bluetools.nl"]
7
7
  gem.description = "Display tweets on your website using Twitter's Design Guidelines."
8
8
  gem.summary = "Display tweets on your website using Twitter's Design Guidelines."
9
- gem.homepage = ""
9
+ gem.homepage = "https://github.com/bluetools/twisplay"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -15,4 +15,5 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Twisplay::VERSION
17
17
  gem.add_dependency "twitter", "~> 2.2.5"
18
+ gem.add_dependency "twitter-text", "~> 1.4.17"
18
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twisplay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-30 00:00:00.000000000 Z
12
+ date: 2012-05-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: twitter
16
- requirement: &70219364829000 !ruby/object:Gem::Requirement
16
+ requirement: &70244614077520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,18 @@ dependencies:
21
21
  version: 2.2.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70219364829000
24
+ version_requirements: *70244614077520
25
+ - !ruby/object:Gem::Dependency
26
+ name: twitter-text
27
+ requirement: &70244614076980 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.4.17
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70244614076980
25
36
  description: Display tweets on your website using Twitter's Design Guidelines.
26
37
  email:
27
38
  - j.diepenmaat@bluetools.nl
@@ -51,7 +62,7 @@ files:
51
62
  - lib/twisplay.rb
52
63
  - lib/twisplay/version.rb
53
64
  - twisplay.gemspec
54
- homepage: ''
65
+ homepage: https://github.com/bluetools/twisplay
55
66
  licenses: []
56
67
  post_install_message:
57
68
  rdoc_options: []