social_stream-linkser 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,25 +1,30 @@
1
- var SocialStream = SocialStream || {};
2
- SocialStream.Linkser = SocialStream.Linkser || {};
3
- SocialStream.Linkser.initiate = function() {
4
- $.preloadImages("<%= asset_path('loading.gif') %>");
1
+ //= require social_stream.wall
2
+
3
+ SocialStream.Linkser.Wall = (function(SS, $) {
4
+ var regexp = /^(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&;:\/~+#-]*[\w@?^=%&;\/~+#-])?$/
5
+
5
6
  var urlDetect = function() {
6
7
  this.currentValue = $("#input_activities").val();
8
+
7
9
  if(this.lastValue == null)
8
10
  this.lastValue = "";
9
11
 
10
- var regexp = /^(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&;:\/~+#-]*[\w@?^=%&;\/~+#-])?$/
11
12
  if(regexp.test($("#input_activities").val())) {
12
13
  $("#link_url").val($("#input_activities").val());
13
14
  $("#link_loaded").val(false);
14
15
  $("#new_post").attr("action", "/links");
16
+
15
17
  if(this.currentValue != this.lastValue) {
16
18
  $("#link_preview").html($('<img>').attr('src', '<%= asset_path('loading.gif') %>').addClass('loading'));
19
+
17
20
  this.lastValue = this.currentValue;
18
21
  var url = this.currentValue;
19
22
  var urlDetect = this;
23
+
20
24
  $.ajax({
21
25
  type : "GET",
22
26
  url : "/linkser_parse?url=" + url,
27
+ dataType: 'html',
23
28
  success : function(html) {
24
29
  if($("#input_activities").val() == url) {//Only show if input value is still the same
25
30
  $("#link_preview").html(html);
@@ -33,6 +38,7 @@ SocialStream.Linkser.initiate = function() {
33
38
  }
34
39
  });
35
40
  }
41
+
36
42
  $("#link_preview").show();
37
43
  } else {
38
44
  $("#new_post").attr("action", "/posts");
@@ -41,23 +47,36 @@ SocialStream.Linkser.initiate = function() {
41
47
  $("#link_url").val("");
42
48
  }
43
49
  }
44
- if($("#new_post").length) {
45
- $("#input_activities").change(urlDetect).keyup(urlDetect);
46
- $("#new_post").append($('<input>').attr('type', 'hidden').attr('name', 'link[owner_id]').attr('id', 'link_owner_id').val($("#post_owner_id").val()));
47
- $("#new_post").append($('<input>').attr('type', 'hidden').attr('name', 'link[url]').attr('id', 'link_url'));
48
- $("#new_post").append($('<input>').attr('type', 'hidden').attr('name', 'link[loaded]').attr('id', 'link_loaded').val(false));
49
- $("#new_post").append($('<div>').attr('id', 'link_preview').css('display', 'none'));
50
+
51
+ var init = function(){
52
+ $.preloadImages("<%= asset_path('loading.gif') %>");
53
+
54
+ if($("#new_post").length) {
55
+ $("#input_activities").change(urlDetect).keyup(urlDetect);
56
+
57
+ $("#new_post").append($('<input>').attr('type', 'hidden').attr('name', 'link[owner_id]').attr('id', 'link_owner_id').val($("#post_owner_id").val()));
58
+ $("#new_post").append($('<input>').attr('type', 'hidden').attr('name', 'link[url]').attr('id', 'link_url'));
59
+ $("#new_post").append($('<input>').attr('type', 'hidden').attr('name', 'link[loaded]').attr('id', 'link_loaded').val(false));
60
+ $("#new_post").append($('<div>').attr('id', 'link_preview').css('display', 'none'));
61
+ }
50
62
  }
51
- }
52
63
 
53
- SocialStream.Linkser.openCallback = function(id,url,w,h){
64
+ var openCallback = function(id,url,w,h){
54
65
  var height='353';
66
+
55
67
  if(w>0 && h>0) {
56
68
  height=470*h/w;
57
69
  }
70
+
58
71
  $("#" + id).html($('<iframe>').attr('src',url).attr('width','470').attr('height',height));
59
- }
72
+ }
73
+
74
+ SocialStream.Wall.addInitCallback(init);
75
+
76
+ return {
77
+ openCallback: openCallback
78
+ }
79
+
80
+ })(SocialStream, jQuery);
81
+
60
82
 
61
- $(function(){
62
- SocialStream.Linkser.initiate();
63
- });
@@ -1,2 +1,6 @@
1
+ //= require social_stream-base
2
+ //
3
+ //= require_self
1
4
  //= require_tree .
2
5
 
6
+ SocialStream.Linkser = SocialStream.Linkser || {};
@@ -47,7 +47,7 @@
47
47
  }
48
48
  .link .info{
49
49
  float: left;
50
- width: 360px;
50
+ width: 350px;
51
51
  text-align: left;
52
52
  }
53
53
  .activity_objects .link .info{
@@ -61,7 +61,8 @@
61
61
  text-decoration: underline;
62
62
  margin-bottom: 5px;
63
63
  }
64
- .link .info .description{
64
+ .link .info .description textarea {
65
+ height: 60px;
65
66
  }
66
67
  .link iframe{
67
68
  border: 0;
@@ -7,7 +7,7 @@
7
7
  <%= javascript_tag do %>
8
8
  $("#link_<%= link.id.to_s %> img").each(function(){
9
9
  $(this).click(function(){
10
- SocialStream.Linkser.openCallback("link_<%= link.id.to_s %>", "<%= link.callback_url %>", "<%= link.width %>", "<%= link.height %>");
10
+ SocialStream.Linkser.Wall.openCallback("link_<%= link.id.to_s %>", "<%= link.callback_url %>", "<%= link.width %>", "<%= link.height %>");
11
11
  });
12
12
  });
13
13
 
@@ -6,21 +6,14 @@
6
6
  </div>
7
7
  <% end %>
8
8
  <div class="info">
9
- <% if link.title %>
10
- <div class="title">
11
- <%= link.title %>
12
- <%= hidden_field_tag "link[title]", link.title %>
13
- </div>
14
- <% end %>
15
- <div class="url">
16
- <%= auto_link(link.url) %>
9
+ <div class="title">
10
+ <%= text_field_tag "link[title]", link.title %>
17
11
  </div>
18
- <% if link.description %>
19
- <div class="description">
20
- <%= auto_link(link.description) %>
21
- <%= hidden_field_tag "link[description]", link.description %>
22
- </div>
23
- <% end %>
12
+
13
+ <div class="description">
14
+ <%= text_area_tag "link[description]", link.description %>
15
+ </div>
16
+
24
17
  <% if link.callback_url %>
25
18
  <%= hidden_field_tag "link[callback_url]", link.callback_url %>
26
19
  <% end %>
@@ -1,10 +1,4 @@
1
- <% content_for :javascript do %>
2
- var message_hash = window.location.hash.match(/^.*activity_(\d+).*$/);
3
- if (message_hash && message_hash > 0){
4
- $.scrollTo('#activity_' + message_hash[1] ,1500,{axis:'y'});
5
- }
6
- <% end %>
7
-
8
1
  <%= render :partial => 'objects/show',
9
2
  :locals => { :object => @link } %>
10
3
 
4
+ <%= render @link.post_activity %>
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Linkser
3
- VERSION = "0.7.0".freeze
3
+ VERSION = "0.7.1".freeze
4
4
  end
5
5
  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.17.0')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.17.1')
16
16
  s.add_runtime_dependency('linkser', '~> 0.0.10')
17
17
  # Development Gem dependencies
18
18
  s.add_development_dependency('sqlite3-ruby')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-linkser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,18 +14,18 @@ date: 2012-03-07 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: social_stream-base
17
- requirement: &86006300 !ruby/object:Gem::Requirement
17
+ requirement: &76541690 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 0.17.0
22
+ version: 0.17.1
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *86006300
25
+ version_requirements: *76541690
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: linkser
28
- requirement: &86005920 !ruby/object:Gem::Requirement
28
+ requirement: &76541250 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.0.10
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *86005920
36
+ version_requirements: *76541250
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: sqlite3-ruby
39
- requirement: &86005720 !ruby/object:Gem::Requirement
39
+ requirement: &76540900 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *86005720
47
+ version_requirements: *76540900
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec-rails
50
- requirement: &86005410 !ruby/object:Gem::Requirement
50
+ requirement: &76540230 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 2.6.0
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *86005410
58
+ version_requirements: *76540230
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: factory_girl
61
- requirement: &86005150 !ruby/object:Gem::Requirement
61
+ requirement: &76539430 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.3.2
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *86005150
69
+ version_requirements: *76539430
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: forgery
72
- requirement: &86004900 !ruby/object:Gem::Requirement
72
+ requirement: &76538560 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 0.3.6
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *86004900
80
+ version_requirements: *76538560
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: capybara
83
- requirement: &86004660 !ruby/object:Gem::Requirement
83
+ requirement: &76536370 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,7 +88,7 @@ dependencies:
88
88
  version: 0.3.9
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *86004660
91
+ version_requirements: *76536370
92
92
  description: Social Stream Linkser provides Linkser support in Social Stream, the
93
93
  core for building social network websites.
94
94
  email: ecasanovac@gmail.com