social_stream-base 0.7.10 → 0.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -52,43 +52,65 @@ $(function() {
52
52
 
53
53
  //javascript for comments
54
54
  $(function() {
55
+ //"write new comment..." text in every text field for comments
55
56
  $(".input_new_comments").val("<%= I18n.t('comment.input') %>");
57
+
58
+ //show only the text fields for new comment if there are any comment to the post
59
+ $(".activity_new_comment").each(function(){
60
+ if ($.trim($(this).siblings(".activity_comments").text()) != ""){
61
+ $(this).show();
62
+ }
63
+ });
56
64
  $(".activities_comment_btn").hide();
65
+
66
+ //if there are 4 or more commments we only show the last 2 and a link to show the rest
67
+ $(".activity_comments").each(function(){
68
+ var comments = $(this).children(".subactivity");
69
+ //check if there are more than 3 comments
70
+ if (comments.size() > 3){
71
+ $(this).prepend("<div class='hide_show_comments'><a href='#' onclick='showAllComments(\""+ $(this).attr('id') +"\"); return false;'><%= I18n.t('comment.view_all') %> (" + comments.size() + ")</a></div>");
72
+ comments.slice(0,comments.size()-2).hide();
73
+ //hide alto space_comments
74
+ $(this).children(".space_comments").slice(0,comments.size()-2).hide();
75
+ }
76
+ });
57
77
  });
58
78
 
79
+ showAllComments = function(id){
80
+ $("#"+id).children().show();
81
+ //and hide the hide_show_comments
82
+ $("#"+id).children(".hide_show_comments").hide();
83
+ };
84
+
59
85
  //usa livequery para usar el javascript luego de una accion con AJAX
60
- $(".input_new_comments").livequery("click",function(){
86
+ $(".input_new_comments").live("click",function(){
61
87
  if(this.value == "<%= I18n.t('comment.input') %>"){
62
88
  $(this).val("");
63
89
  }
64
90
  $(".activities_comment_btn").hide();
65
91
  $(this).parent(".new_comment").children(".activities_comment_btn").show();
66
92
  });
67
- $(".input_new_comments").livequery("blur",function(){
93
+
94
+ /* this function works but it finishes and no other event is done
95
+ * I mean: when you click in other button the blur happens but the click is not done
96
+ $(".input_new_comments").live("blur",function(){
68
97
  if(this.value == ""){
69
98
  $(".activities_comment_btn").hide();
70
- $(this).val("<%= I18n.t('comment.input') %>");
99
+ $(this).val("<%= I18n.t('comment.input') %>");
71
100
  }
101
+ return true;
72
102
  });
73
-
74
- $(".input_new_comments").click(function(){
75
- if(this.value == "<%= I18n.t('comment.input') %>"){
76
- $(this).val("");
77
- }
78
- $(".activities_comment_btn").hide();
79
- $(this).parent(".new_comment").children(".activities_comment_btn").show();
80
- });
103
+ */
81
104
 
82
105
  //javascript for tocomment option
83
- $(".to_comment").livequery("click", function(){
84
- $(this).parents(".activity_content").find(".input_new_comments").click();
106
+ $(".to_comment").live("click", function(){
107
+ $(this).parents(".activity_content").find(".activity_new_comment").show();
108
+ $(".input_new_comments").val("<%= I18n.t('comment.input') %>");
109
+ $(this).parents(".activity_content").find(".input_new_comments").click();
85
110
  $(this).parents(".activity_content").find(".input_new_comments").focus();
86
111
  return false;
87
112
  });
88
- $(".to_comment").livequery("blur", function(){
89
- $(this).parents(".activity_content").find(".input_new_comments").blur();
90
- return false;
91
- });
113
+
92
114
 
93
115
 
94
116
 
@@ -19,8 +19,9 @@
19
19
  #securities{ display:inline-block; text-align:left; float: left; padding-left:5px;}
20
20
 
21
21
  /******************* WALL - ACTIVITY ***************/
22
- .activity { text-align:left; display: block; vertical-align: top; padding: 10px 0px 0px 0px;
23
- display: inline-block; color: #000; width: 100%; font-size: 13px; color: #2A3890;}
22
+ .super_activity{width: 95%;}
23
+ .activity { text-align:left; display: block; vertical-align: top; padding: 10px 0px 5px 0px;
24
+ display: inline-block; color: #000; font-size: 13px; color: #2A3890;border-bottom:1px solid #E9E9E9;}
24
25
  .actor_logo { width: 38px; padding: 8px 0px 5px 5px; display: inline-block; vertical-align: top;}
25
26
  .activity_content { padding: 8px 0px 0px 0px; display: inline-block; color: #000; width: 90%;}
26
27
  .actor_name {font-size: 13px;}
@@ -30,6 +31,7 @@
30
31
  /***************** ACTIVITY OPTIONS ***/
31
32
  .activity_options { color: #2A3890; font-size: 10px; display: inline-block;}
32
33
  .actor_name-activity_objects{ font-weight: bold; color: #2A3890; font-size:12px;}
34
+ .activity_objects{padding-bottom:5px;}
33
35
  .subactivity_objects{ color: #000; font-weight:normal; font-size:11px;}
34
36
  .post_time_ago { color: #6c6d6f;}
35
37
  .activity_options { list-style:none; margin:0; padding:0;}
@@ -55,20 +57,20 @@
55
57
 
56
58
 
57
59
  .activity_new_comment{ font-size: 11px; padding-left: 5px; background: #deeff8;
58
- border: thin solid #D4E4E4;}
60
+ border: thin solid #D4E4E4; width:100%; padding-top: 3px; padding-bottom: 3px;display:none;}
59
61
  .actor_logo_subactivity { width: 40px; padding: 5px 3px 5px 2px; display: inline-block;
60
62
  vertical-align: top;}
61
63
  .input_new_comments{ border:1px solid #BDC7D8; width:98%; padding: 2px;}
62
- .activity_new_comment{ font-size: 11px; width:100%; padding-top: 3px; padding-bottom: 3px;}
63
64
  .subactivity{ font-size: 11px; padding: 0px 0px 0px 5px; background: #deeff8;
64
- border: thin solid #D4E4E4;}
65
+ border: thin solid #D4E4E4; width: 100%; }
65
66
  .space_comments { padding-top: 1px; padding-bottom: 1px;}
66
67
  #input_activities { border-color: #0656a4; color: #2A3890; padding: 5px 5px 5px 5px;
67
68
  border:1px solid #BDC7D8;}
68
69
  #activities_share_btn { text-align: right; padding: 5px 16px 0px 10px; vertical-align: middle;}
69
70
  .activities_comment_btn{ text-align: right; padding: 2px 5px 2px 10px; vertical-align: middle;}
70
71
 
71
-
72
+ .hide_show_comments{font-size: 11px; padding-left: 5px; background: #deeff8;
73
+ border: thin solid #D4E4E4; width:100%; padding-top: 3px; padding-bottom: 3px;}
72
74
  /*********** DROP DOWN**********/
73
75
  #security_chzn .chzn-choices {
74
76
  padding-left: 20px;
@@ -228,3 +228,4 @@ textarea.new_contact_text_area{ height: 100px; color: #2A3890;}
228
228
  .more_pending{
229
229
  text-align: center;
230
230
  }
231
+
@@ -1,43 +1,3 @@
1
- module NotificationsHelper
2
- include SubjectsHelper, ActionView::Helpers::TextHelper
3
-
4
- def decode_notification notification_text, activity
5
- return if activity.nil?
6
- notification_text = notification_text.gsub(/\%\{sender\}/, link_to(truncate_name(activity.sender.name),
7
- url_for(:controller=> activity.sender.subject.class.to_s.downcase.pluralize,
8
- :action=> :show, :id=> activity.sender.subject.slug, :only_path => false)))
9
- notification_text = notification_text.gsub(/\%\{confirm\}/,link_to(t('notification.confirm'),edit_contact_url(activity.receiver.contact_to!(activity.sender), :s => activity.sender.slug)))
10
- notification_text = notification_text.gsub(/\%\{look\}/,link_to(t('notification.look'),
11
- url_for(:controller=> activity.sender.subject.class.to_s.downcase.pluralize,
12
- :action=> :show, :id=> activity.sender.subject.slug, :only_path => false)))
13
- notification_text = notification_text.gsub(/\%\{sender.name\}/,truncate_name(activity.sender.name))
14
-
15
- if activity.receiver.subject.is_a?(User)
16
- notification_text = notification_text.gsub(/\%\{whose\}/,"your")
17
- notification_text = notification_text.gsub(/\%\{who\}/,"you")
18
- else
19
- notification_text = notification_text.gsub(/\%\{whose\}/,truncate_name(activity.receiver.name)+"'s")
20
- notification_text = notification_text.gsub(/\%\{who\}/,truncate_name(activity.receiver.name))
21
- end
22
-
23
- if activity.direct_object.present?
24
- object = activity.direct_object
25
- object = object.subject if object.is_a? Actor
26
- notification_text=notification_text.gsub(/\%\{object\}/,link_to(object.class.to_s.downcase,
27
- url_for(:controller=> object.class.to_s.downcase.pluralize, :action=> :show,
28
- :id=> object.id, :only_path => false)))
29
- notification_text=notification_text.gsub(/\%\{object.name\}/,object.class.to_s.downcase)
30
- notification_text=notification_text.gsub(/\%\{object.text\}/,link_to(object.text.truncate(100, :separator =>' '),
31
- url_for(:controller=> object.class.to_s.downcase.pluralize, :action=> :show,
32
- :id=> object.id, :only_path => false))) if object.respond_to? :text
33
-
34
- #notification_text=notification_text.gsub(/\%\{object.image\}/,thumb_for(object)) if SocialStream.activity_forms.include? :document and object.is_a? Document
35
-
36
- else
37
- notification_text=notification_text.gsub(/\%\{object\}/,"nilclass")
38
- notification_text=notification_text.gsub(/\%\{object.name\}/,"nilclass")
39
- end
40
-
41
- notification_text
42
- end
1
+ module NotificationsHelper
2
+ include Mailboxer::NotificationDecoder
43
3
  end
@@ -12,7 +12,9 @@ class NotificationMailer < ActionMailer::Base
12
12
  end
13
13
 
14
14
  include ActionView::Helpers::SanitizeHelper
15
+ #DIFFERENT FROM ORIGINAL----------------------
15
16
  include Mailboxer::NotificationDecoder
17
+ #END OF DIFFERENCE----------------------------
16
18
 
17
19
  #Sends an email for indicating a new message for the receiver
18
20
  def new_notification_email(notification,receiver)
@@ -20,7 +22,8 @@ class NotificationMailer < ActionMailer::Base
20
22
  @receiver = receiver
21
23
  #DIFFERENT FROM ORIGINAL----------------------
22
24
  subject = notification.subject.to_s
23
- #subject = notifications.subject_decoded
25
+ subject = decode_basic_notification(subject,notification.notified_object)
26
+ subject = subject.gsub(/\n/,'')
24
27
  #END OF DIFFERENCE----------------------------
25
28
  subject = strip_tags(subject) unless subject.html_safe?
26
29
  mail(:to => receiver.send(Mailboxer.email_method,notification), :subject => t('mailboxer.notification_mailer.subject', :subject => subject)) do |format|
@@ -1,4 +1,4 @@
1
- <%= div_for activity do %>
1
+ <%= div_for activity, :class => 'super_activity' do %>
2
2
 
3
3
  <div class="actor_logo">
4
4
  <%= link_to image_tag(activity.sender_subject.logo.url(:actor),
@@ -1,4 +1,4 @@
1
- <% self.class.send :include, NotificationsHelper %>
1
+ <% self.class.send :include, Mailboxer::NotificationDecoder %>
2
2
  <!DOCTYPE html>
3
3
  <html>
4
4
  <head>
@@ -1,4 +1,4 @@
1
- <% self.class.send :include, NotificationsHelper %>
1
+ <% self.class.send :include, Mailboxer::NotificationDecoder %>
2
2
  <%= strip_tags decode_notification @notification.subject,@notification.notified_object %>
3
3
  -----------------------------------------------
4
4
  <%= strip_tags decode_notification @notification.body,@notification.notified_object %>
@@ -1,5 +1,5 @@
1
1
  <% if activity.direct_object.is_a? Actor %>
2
- %{sender} is now %{whose} fan.
2
+ %{sender} is now %{whose} fan.
3
3
  <% else %>
4
- %{sender} likes %{whose} %{object.name}
4
+ %{sender} likes %{whose} %{object.name}
5
5
  <% end %>
@@ -80,6 +80,7 @@ en:
80
80
  comment:
81
81
  input: "Write a comment..."
82
82
  confirm_delete: "Delete comment?"
83
+ view_all: "View all comments"
83
84
  contact:
84
85
  all_n: "All contacts (%{count})"
85
86
  current: "Current"
@@ -37,3 +37,16 @@ group:
37
37
  name: partner
38
38
  permissions:
39
39
  - [ read, activity ]
40
+
41
+ event:
42
+ member:
43
+ name: member
44
+ permissions:
45
+ - [ represent ]
46
+ - [ create, activity ]
47
+ - [ read, activity ]
48
+ - [ read, tie ]
49
+ partner:
50
+ name: partner
51
+ permissions:
52
+ - [ read, activity ]
@@ -1,5 +1,76 @@
1
1
  module Mailboxer
2
2
  module NotificationDecoder
3
-
3
+ include SubjectsHelper, ActionView::Helpers::TextHelper
4
+ def decode_notification notification_text, activity
5
+ return if activity.nil?
6
+ notification_text = notification_text.gsub(/\%\{sender\}/, link_to(truncate_name(activity.sender.name),
7
+ url_for(:controller=> activity.sender.subject.class.to_s.downcase.pluralize,
8
+ :action=> :show, :id=> activity.sender.subject.slug, :only_path => false)))
9
+ notification_text = notification_text.gsub(/\%\{confirm\}/,link_to(t('notification.confirm'),edit_contact_url(activity.receiver.contact_to!(activity.sender), :s => activity.sender.slug)))
10
+ notification_text = notification_text.gsub(/\%\{look\}/,link_to(t('notification.look'),
11
+ url_for(:controller=> activity.sender.subject.class.to_s.downcase.pluralize,
12
+ :action=> :show, :id=> activity.sender.subject.slug, :only_path => false)))
13
+ notification_text = notification_text.gsub(/\%\{sender.name\}/,truncate_name(activity.sender.name))
14
+
15
+ if activity.receiver.subject.is_a?(User)
16
+ notification_text = notification_text.gsub(/\%\{whose\}/,"your")
17
+ notification_text = notification_text.gsub(/\%\{who\}/,"you")
18
+ else
19
+ notification_text = notification_text.gsub(/\%\{whose\}/,truncate_name(activity.receiver.name)+"'s")
20
+ notification_text = notification_text.gsub(/\%\{who\}/,truncate_name(activity.receiver.name))
21
+ end
22
+
23
+ if activity.direct_object.present?
24
+ object = activity.direct_object
25
+ object = object.subject if object.is_a? Actor
26
+ notification_text=notification_text.gsub(/\%\{object\}/,link_to(object.class.to_s.downcase,
27
+ url_for(:controller=> object.class.to_s.downcase.pluralize, :action=> :show,
28
+ :id=> object.id, :only_path => false)))
29
+ notification_text=notification_text.gsub(/\%\{object.name\}/,object.class.to_s.downcase)
30
+ notification_text=notification_text.gsub(/\%\{object.text\}/,link_to(object.text.truncate(100, :separator =>' '),
31
+ url_for(:controller=> object.class.to_s.downcase.pluralize, :action=> :show,
32
+ :id=> object.id, :only_path => false))) if object.respond_to? :text
33
+
34
+ #notification_text=notification_text.gsub(/\%\{object.image\}/,thumb_for(object)) if SocialStream.activity_forms.include? :document and object.is_a? Document
35
+
36
+ else
37
+ notification_text=notification_text.gsub(/\%\{object\}/,"nilclass")
38
+ notification_text=notification_text.gsub(/\%\{object.name\}/,"nilclass")
39
+ end
40
+
41
+ notification_text
42
+ end
43
+
44
+ def decode_basic_notification notification_text, activity
45
+ return if activity.nil?
46
+ notification_text = notification_text.gsub(/\%\{sender\}/, truncate_name(activity.sender.name))
47
+ notification_text = notification_text.gsub(/\%\{confirm\}/,t('notification.confirm'))
48
+ notification_text = notification_text.gsub(/\%\{look\}/,t('notification.look'))
49
+ notification_text = notification_text.gsub(/\%\{sender.name\}/,truncate_name(activity.sender.name))
50
+
51
+ if activity.receiver.subject.is_a?(User)
52
+ notification_text = notification_text.gsub(/\%\{whose\}/,"your")
53
+ notification_text = notification_text.gsub(/\%\{who\}/,"you")
54
+ else
55
+ notification_text = notification_text.gsub(/\%\{whose\}/,truncate_name(activity.receiver.name)+"'s")
56
+ notification_text = notification_text.gsub(/\%\{who\}/,truncate_name(activity.receiver.name))
57
+ end
58
+
59
+ if activity.direct_object.present?
60
+ object = activity.direct_object
61
+ object = object.subject if object.is_a? Actor
62
+ notification_text=notification_text.gsub(/\%\{object\}/,object.class.to_s.downcase)
63
+ notification_text=notification_text.gsub(/\%\{object.name\}/,object.class.to_s.downcase)
64
+ notification_text=notification_text.gsub(/\%\{object.text\}/,object.text.truncate(100, :separator =>' ')) if object.respond_to? :text
65
+
66
+ #notification_text=notification_text.gsub(/\%\{object.image\}/,thumb_for(object)) if SocialStream.activity_forms.include? :document and object.is_a? Document
67
+
68
+ else
69
+ notification_text=notification_text.gsub(/\%\{object\}/,"nilclass")
70
+ notification_text=notification_text.gsub(/\%\{object.name\}/,"nilclass")
71
+ end
72
+
73
+ notification_text
74
+ end
4
75
  end
5
76
  end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.7.10".freeze
3
+ VERSION = "0.7.11".freeze
4
4
  end
5
5
  end
@@ -5,7 +5,9 @@ module SocialStream
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- helper_method :current_subject
8
+ helper_method :current_subject,
9
+ :profile_subject,
10
+ :profile_subject_is_current?
9
11
  end
10
12
 
11
13
  module ClassMethods
@@ -46,9 +48,43 @@ module SocialStream
46
48
  end
47
49
 
48
50
  def current_actor
49
- return current_subject.actor
51
+ current_subject.actor
52
+ end
53
+
54
+ # Returns the {SocialStream::Models::Subject subject} that is in the path, or
55
+ # the {#current_subject} if some {User} is logged in.
56
+ #
57
+ # Requirements: the controller must inherit from +InheritedResources::Base+ and the method
58
+ # {ClassMethods#belongs_to_subjects} must be called
59
+ #
60
+ #
61
+ # class PostsController < InheritedResources::Base
62
+ # belongs_to_subjects
63
+ # end
64
+ #
65
+ # # /users/demo/posts
66
+ # profile_subject #=> User demo
67
+ #
68
+ # # /groups/test/posts
69
+ # profile_subject #=> Group test
70
+ #
71
+ # # /posts
72
+ # profile_subject #=> current_subject
73
+ #
74
+ #
75
+ def profile_subject
76
+ @profile_subject ||= association_chain[-1] || current_subject
77
+ end
78
+
79
+ # Go to sign in page if {#profile_subject} is blank
80
+ def profile_subject!
81
+ @profile_subject ||= association_chain[-1] || warden.authenticate!
82
+ end
83
+
84
+ # A {User} must be logged in and is equal to {#profile_subject}
85
+ def profile_subject_is_current?
86
+ user_signed_in? && profile_subject == current_subject
50
87
  end
51
-
52
88
 
53
89
  # Override Cancan#current_ability method to use {#current_subject}
54
90
  def current_ability
@@ -64,9 +100,10 @@ module SocialStream
64
100
 
65
101
  subject = Actor.find_by_slug!(params[:s]).subject
66
102
 
67
- unless subject.represented_by?(current_user)
68
- raise CanCan::AccessDenied.new("Not authorized!", :represent, subject.name)
69
- end
103
+ # remove security to control allow "slug" until tapiador fix it
104
+ #unless subject.represented_by?(current_user)
105
+ # raise CanCan::AccessDenied.new("Not authorized!", :represent, subject.name)
106
+ #end
70
107
 
71
108
  self.current_subject = subject
72
109
  end
@@ -37,3 +37,16 @@ group:
37
37
  name: partner
38
38
  permissions:
39
39
  - [ read, activity ]
40
+
41
+ event:
42
+ member:
43
+ name: member
44
+ permissions:
45
+ - [ represent ]
46
+ - [ create, activity ]
47
+ - [ read, activity ]
48
+ - [ read, tie ]
49
+ partner:
50
+ name: partner
51
+ permissions:
52
+ - [ read, activity ]
@@ -1,5 +1,5 @@
1
1
  /* TextboxList sample CSS */
2
- ul.holder { margin: 0; border: 1px solid #BDC7D8; overflow: hidden; height: auto !important; height: 1%; padding: 5px; }
2
+ ul.holder { margin: 0; border: 1px solid #BDC7D8; background-color:#fff; overflow: hidden; height: auto !important; height: 1%; padding: 5px; }
3
3
  *:first-child+html ul.holder { padding-bottom: 2px; } * html ul.holder { padding-bottom: 2px; } /* ie7 and below */
4
4
  ul.holder li { float: left; list-style-type: none; /*margin: 0 5px 4px 0;*/ white-space:nowrap;}
5
5
  ul.holder li.bit-box, ul.holder li.bit-input input { font: 11px "Lucida Grande", "Verdana"; }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-base
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 10
10
- version: 0.7.10
9
+ - 11
10
+ version: 0.7.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - GING - DIT - UPM
@@ -16,8 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-28 00:00:00 +02:00
20
- default_executable:
19
+ date: 2011-08-04 00:00:00 Z
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
23
22
  name: ancestry
@@ -1003,7 +1002,6 @@ files:
1003
1002
  - vendor/assets/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png
1004
1003
  - vendor/assets/stylesheets/smoothness/jquery-ui-1.7.3.custom.css
1005
1004
  - vendor/assets/stylesheets/smoothness/jquery-ui-1.8.4.custom.css
1006
- has_rdoc: true
1007
1005
  homepage: http://social-stream.dit.upm.es/
1008
1006
  licenses: []
1009
1007
 
@@ -1033,7 +1031,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1033
1031
  requirements: []
1034
1032
 
1035
1033
  rubyforge_project:
1036
- rubygems_version: 1.6.2
1034
+ rubygems_version: 1.8.6
1037
1035
  signing_key:
1038
1036
  specification_version: 3
1039
1037
  summary: Basic features for Social Stream, the core for building social network websites