social_stream-linkser 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,14 +2,19 @@ class LinkserController < ApplicationController
|
|
2
2
|
def index
|
3
3
|
if params[:url].present?
|
4
4
|
url = params[:url]
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
begin
|
6
|
+
o = Linkser.parse url, {:max_images => 1}
|
7
|
+
if o.is_a? Linkser::Objects::HTML
|
8
|
+
link = Link.new
|
9
|
+
link.fill o
|
10
|
+
render :partial => "links/link_preview", :locals => {:link => link}
|
11
|
+
return
|
12
|
+
end
|
13
|
+
rescue
|
14
|
+
render :partial => "links/error", :locals => {:message => I18n.t("link.errors.loading") + " " + url.to_s}
|
15
|
+
return
|
11
16
|
end
|
12
17
|
end
|
13
|
-
|
18
|
+
render :partial => "links/error", :locals => {:message => I18n.t("link.errors.only_webs")}
|
14
19
|
end
|
15
20
|
end
|
data/app/models/link.rb
CHANGED
@@ -32,9 +32,12 @@ class Link < ActiveRecord::Base
|
|
32
32
|
|
33
33
|
def check_loaded
|
34
34
|
if !self.loaded.eql? "true" and self.title.nil? and self.description.nil? and self.image.nil?
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
begin
|
36
|
+
o = Linkser.parse self.url, {:max_images => 1}
|
37
|
+
if o.is_a? Linkser::Objects::HTML
|
38
|
+
self.fill o
|
39
|
+
end
|
40
|
+
rescue
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
|
14
14
|
# Gem dependencies
|
15
|
-
s.add_runtime_dependency('social_stream-base', '~> 0.10.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.10.8')
|
16
16
|
s.add_runtime_dependency('linkser', '~> 0.0.7')
|
17
17
|
# Development Gem dependencies
|
18
18
|
s.add_development_dependency('sqlite3-ruby')
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_stream-linkser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Eduardo Casanova Cuesta
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-12-
|
19
|
+
date: 2011-12-13 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -27,12 +27,12 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 39
|
31
31
|
segments:
|
32
32
|
- 0
|
33
33
|
- 10
|
34
|
-
-
|
35
|
-
version: 0.10.
|
34
|
+
- 8
|
35
|
+
version: 0.10.8
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id001
|
38
38
|
- !ruby/object:Gem::Dependency
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- app/controllers/links_controller.rb
|
168
168
|
- app/controllers/linkser_controller.rb
|
169
169
|
- app/models/link.rb
|
170
|
+
- app/views/links/_error.html.erb
|
170
171
|
- app/views/links/_link.html.erb
|
171
172
|
- app/views/links/_link_preview.html.erb
|
172
173
|
- app/views/links/create.js.erb
|