social_stream 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/Gemfile.lock +48 -44
  2. data/app/controllers/ties_controller.rb +1 -0
  3. data/app/models/ability.rb +2 -0
  4. data/app/models/actor.rb +7 -8
  5. data/app/models/permission.rb +80 -0
  6. data/app/models/relation.rb +1 -6
  7. data/app/models/tie.rb +34 -42
  8. data/app/views/activities/_child.html.erb +1 -2
  9. data/app/views/activities/_jquery.html.erb +2 -3
  10. data/app/views/activities/_options.html.erb +1 -1
  11. data/app/views/activities/_root.html.erb +1 -2
  12. data/app/views/comments/_new.html.erb +18 -15
  13. data/app/views/groups/_followers.html.erb +16 -14
  14. data/app/views/groups/_group.html.erb +1 -1
  15. data/app/views/groups/_location.html.erb +3 -0
  16. data/app/views/groups/show.html.erb +2 -2
  17. data/app/views/home/_contacts.html.erb +2 -2
  18. data/app/views/home/_groups.html.erb +23 -0
  19. data/app/views/home/_options.html.erb +0 -6
  20. data/app/views/home/_right.html.erb +1 -6
  21. data/app/views/home/index.html.erb +3 -3
  22. data/app/views/posts/_post.html.erb +1 -1
  23. data/app/views/ties/_suggestions.html.erb +7 -1
  24. data/app/views/ties/_tie.html.erb +1 -1
  25. data/app/views/users/_contacts.html.erb +16 -18
  26. data/app/views/users/_groups.html.erb +1 -2
  27. data/app/views/users/_location.html.erb +3 -0
  28. data/app/views/users/_logo.html.erb +2 -4
  29. data/app/views/users/_menu.html.erb +3 -26
  30. data/app/views/users/_middle_show.html.erb +0 -1
  31. data/app/views/users/_options.html.erb +5 -0
  32. data/app/views/users/_right_show.html.erb +9 -0
  33. data/app/views/users/show.html.erb +2 -2
  34. data/config/locales/en.yml +3 -2
  35. data/lib/generators/social_stream/templates/public/images/btn/{btn_follower.png → btn_group.png} +0 -0
  36. data/lib/generators/social_stream/templates/public/images/logos/actor/group.png +0 -0
  37. data/lib/generators/social_stream/templates/public/images/logos/actor/user.png +0 -0
  38. data/lib/generators/social_stream/templates/public/images/logos/original/group.png +0 -0
  39. data/lib/generators/social_stream/templates/public/images/logos/original/user.png +0 -0
  40. data/lib/generators/social_stream/templates/public/images/logos/profile/group.png +0 -0
  41. data/lib/generators/social_stream/templates/public/images/logos/profile/user.png +0 -0
  42. data/lib/generators/social_stream/templates/public/images/logos/tie/group.png +0 -0
  43. data/lib/generators/social_stream/templates/public/images/logos/tie/user.png +0 -0
  44. data/lib/generators/social_stream/templates/public/images/{btn/title_background.png → title_background.png} +0 -0
  45. data/lib/generators/social_stream/templates/public/stylesheets/middle.css +1 -1
  46. data/lib/generators/social_stream/templates/public/stylesheets/right.css +1 -0
  47. data/lib/generators/social_stream/templates/seeds.yml +20 -20
  48. data/lib/social_stream/ability.rb +26 -0
  49. data/lib/social_stream/version.rb +1 -1
  50. data/lib/tasks/db/populate.rake +25 -6
  51. data/social_stream.gemspec +2 -1
  52. data/spec/dummy/db/seeds/social_stream.yml +43 -33
  53. data/spec/factories/tie.rb +15 -10
  54. data/spec/models/activity_spec.rb +83 -146
  55. data/spec/models/tie_spec.rb +113 -0
  56. metadata +52 -25
  57. data/spec/dummy/app/models/ability.rb +0 -23
@@ -1,5 +1,4 @@
1
1
  //javascript for main activities input
2
-
3
2
  title = "<%= t('activity.input') %>";
4
3
  $("#input_activities").click(function(){
5
4
  if(this.value == title){
@@ -9,8 +8,6 @@ $("#input_activities").click(function(){
9
8
  });
10
9
 
11
10
 
12
-
13
-
14
11
  //javascript for comments
15
12
  $(".input_new_comments").val("<%= t('comment.input') %>");
16
13
  $(".activities_comment_btn").hide();
@@ -41,6 +38,7 @@ $(".input_new_comments").click(function(){
41
38
  //javascript for tocomment option
42
39
  $(".to_comment").livequery("click", function(){
43
40
  $(this).parents(".activity_content").find(".input_new_comments").click();
41
+ $(this).parents(".activity_content").find(".input_new_comments").focus();
44
42
  return false;
45
43
  });
46
44
  $(".to_comment").livequery("blur", function(){
@@ -55,6 +53,7 @@ $(".to_comment").livequery("blur", function(){
55
53
 
56
54
 
57
55
 
56
+
58
57
  //move he last list item before the first item. The purpose of this is if the user clicks to slide left he will be able to see the last item.
59
58
  $('#carousel_ul li:first').before($('#carousel_ul li:last'));
60
59
 
@@ -1,7 +1,7 @@
1
1
  <div class="activity_options">
2
2
  <ul class="activity_options" >
3
3
  <li><div class="post_time_ago"><%= t('time.ago', :time => time_ago_in_words(activity.created_at)) %></div></li>
4
- <% if activity.is_root? %>
4
+ <% if activity.is_root? && current_user.active_ties_to(activity.receiver).any? %>
5
5
  <li><div class="verb_comment"> · <%= link_to t('activity.to_comment'), "#", :class => "to_comment" %> </div></li>
6
6
  <% end %>
7
7
  <li><div class="verb_like" id="like_<%= dom_id(activity) %>"> · <%= link_like(activity)%></div></li>
@@ -1,7 +1,6 @@
1
1
  <%= div_for activity do %>
2
2
  <div class="actor_logo">
3
- <%= link_to image_tag(activity.sender_subject.logo.url,
4
- :size => "35x35",
3
+ <%= link_to image_tag(activity.sender_subject.logo.url(:actor),
5
4
  :alt => activity.sender_subject.name),
6
5
  activity.sender_subject %>
7
6
  </div>
@@ -1,15 +1,18 @@
1
- <div class="activity_new_comment">
2
- <%= form_for Comment.new(:text => t('comment.input'),
3
- :_activity_tie_id =>
4
- current_user.active_ties_to(activity.receiver).first.id,
5
- :_activity_parent_id => activity.id),
6
- :remote => true do |f| %>
7
- <%= f.hidden_field :_activity_tie_id %>
8
- <%= f.hidden_field :_activity_parent_id %>
9
- <%= f.text_field :text, :class =>"input_new_comments" %>
10
- <div class="activities_comment_btn">
11
- <div class="activities_security"></div>
12
- <%= image_submit_tag "btn/btn_share.png" %>
13
- </div>
14
- <% end %>
15
- </div>
1
+ <% if current_user.active_ties_to(activity.receiver).any? %>
2
+ <div class="activity_new_comment">
3
+ <%= form_for Comment.new(:text => t('comment.input'),
4
+ :_activity_tie_id =>
5
+ current_user.active_ties_to(activity.receiver).first.id,
6
+ :_activity_parent_id => activity.id),
7
+ :remote => true do |f| %>
8
+ <%= f.hidden_field :_activity_tie_id %>
9
+ <%= f.hidden_field :_activity_parent_id %>
10
+ <%= f.text_field :text, :class =>"input_new_comments" %>
11
+ <div class="activities_comment_btn">
12
+ <div class="activities_security"></div>
13
+ <%= image_submit_tag "btn/btn_share.png" %>
14
+ </div>
15
+ <% end %>
16
+ </div>
17
+ <% end %>
18
+
@@ -1,14 +1,16 @@
1
- <div id="follower">
2
- <div id="title_follower">
3
- <%=image_tag("btn/btn_follower.png", :alt => "Follower")%><%=@group.followers.count%> <%=t('follower', :count => @group.followers.count)%>
4
- </div>
5
- <div class="follower_line">
6
- <% @group.followers.all.each do |follower| %>
7
- <%=link_to((image_tag(follower.logo.url, :alt => follower.name , :size => "40x40")) , follower)%>
8
- <%end%>
9
- </div>
10
- <div class="future_footer">
11
- <%=link_to((image_tag("btn/btn_next.png", :alt => "next")) , group_path)%>
12
- </div>
13
- </div>
14
-
1
+ <%if @group.followers.count > 0%>
2
+ <div id="follower">
3
+ <div id="title_follower">
4
+ <%=image_tag("btn/btn_group.png", :alt => "Follower")%><%=@group.followers.count%>
5
+ <%=t('follower', :count => @group.followers.count)%>
6
+ </div>
7
+ <div class="follower_line">
8
+ <% @group.followers.all.each do |follower| %>
9
+ <%=link_to((image_tag(follower.logo.url, :alt => follower.name , :size => "40x40")) , follower)%>
10
+ <%end%>
11
+ </div>
12
+ <div class="future_footer">
13
+ <%=link_to((image_tag("btn/btn_next.png", :alt => "next")) , group_path)%>
14
+ </div>
15
+ </div>
16
+ <%end%>
@@ -3,7 +3,7 @@
3
3
  <% end %>
4
4
  <%= div_for group do %>
5
5
  <div class="group_content">
6
- <%=link_to(image_tag(group.logo.url, :class => 'btn_group', :alt => group.name, :title => group.name), group) %>
6
+ <%=link_to(image_tag(group.logo.url(:actor), :class => 'btn_group', :alt => group.name, :title => group.name), group) %>
7
7
  </div>
8
8
  <div class="group_title">
9
9
  <%=link_to(group.name, group)%>
@@ -0,0 +1,3 @@
1
+ <div id="map_location" class="content_size">
2
+ <%= t('location.message', :location => "#{ image_tag('btn/btn_group.png' , :class => 'btn_config') } #{ t('group.one') }: <span class=\"name_group\">#{ sanitize @group.name }</span>").html_safe %>
3
+ </div>
@@ -7,7 +7,7 @@
7
7
  <% end %>
8
8
 
9
9
 
10
- <%= render :partial => 'home/location' %>
10
+ <%= render :partial => 'location' %>
11
11
 
12
12
  <br class="clearfloat" />
13
13
  <div class="space_center">
@@ -17,5 +17,5 @@
17
17
  </div>
18
18
 
19
19
  <%= render :partial => "activities/activities",
20
- :locals => { :activities => @group.wall_profile,
20
+ :locals => { :activities => @group.wall_profile(current_user).paginate,
21
21
  :owner => @group } %>
@@ -1,13 +1,13 @@
1
1
  <div class="contacts_header">
2
2
  <%=image_tag("btn/btn_friend.png", :class => "contacts_icon")%>
3
3
  <div class="contacts_text_header">
4
- <%= current_user.friends.count %> <%= t('friend', :count => current_user.friends.count) %>
4
+ <%= current_user.friends.count %> <%=t('friend', :count => current_user.friends.count) %>
5
5
  </div>
6
6
  </div>
7
7
  <div class ="contacts">
8
8
  <div class="contact">
9
9
  <%current_user.friends.all.each do |friend|%>
10
- <%=link_to((image_tag (friend.logo.url, :alt => friend.name , :size => "40x40")) , friend)%>
10
+ <%= link_to((image_tag(friend.logo.url, :title => friend.name , :size => "40x40")) , friend)%>
11
11
  <%end%>
12
12
  </div>
13
13
  </div>
@@ -0,0 +1,23 @@
1
+ <% if current_user.recent_groups.any? %>
2
+ <div id="groups_title" class="content_size">
3
+ <%=t('group.last') %> (<span id="group_count"><%=current_user.recent_groups.count%></span>)
4
+ </div>
5
+ <div id="groups_list" class="content_size">
6
+ <% if (current_user.recent_groups.count) > 10 %>
7
+ <div id='carousel_container'>
8
+ <div id='left_scroll'><%=image_tag("btn/group_left.png")%></div>
9
+ <div id='carousel_inner'>
10
+ <ul id='carousel_ul'>
11
+ <% else %>
12
+ <div class="space_center"></div>
13
+ <%end%>
14
+
15
+ <%= render current_user.recent_groups %>
16
+ <% if (current_user.recent_groups.count) > 10 %>
17
+ </ul>
18
+ </div>
19
+ <div id='right_scroll'><%=image_tag("btn/group_right.png")%></div>
20
+ </div>
21
+ <% end %>
22
+ </div>
23
+ <% end %>
@@ -1,10 +1,4 @@
1
1
  <ul class="menu noaccordion">
2
- <li>
3
- <%= link_to(image_tag("btn/btn_activities.png", :class => "menu_icon")+t('activity.last'),current_user) %>
4
- <ul class="acitem">
5
- <li><a href="http://www.pivotx.net/">PivotX</a></li>
6
- </ul>
7
- </li>
8
2
  <li>
9
3
  <%= link_to( image_tag("btn/btn_inbox.png", :class => "menu_icon")+t('inbox.one'), current_user) %>
10
4
  </li>
@@ -1,6 +1,6 @@
1
1
  <div id="logo">
2
2
  <b><%= link_to(current_user.name, current_user)%></b><br/>
3
- <%= link_to(image_tag(current_user.logo.url , :size => "94x65", :alt => current_user.name ), current_user ) %>
3
+ <%= link_to(image_tag(current_user.logo.url(:profile) , :alt => current_user.name ), current_user ) %>
4
4
  </div>
5
5
  <div class="space_center">
6
6
  </div>
@@ -13,10 +13,5 @@
13
13
  </div>
14
14
  <div class="space_center">
15
15
  </div>
16
- <% if current_user.friends.count>0 %>
17
- <%= render :partial => "contacts" %>
18
- <%end%>
19
- <div class="space_center">
20
- </div>
21
16
  <div class="space_center">
22
17
  </div>
@@ -6,14 +6,14 @@
6
6
  <%= render :partial => "right" %>
7
7
  <% end %>
8
8
 
9
- <%= render :partial => 'home/location' %>
9
+ <%= render :partial => 'location' %>
10
10
 
11
11
  <br class="clearfloat" />
12
12
  <div class="space_center">
13
13
  </div>
14
14
  <div id="my_groups">
15
- <%= render :partial => "users/groups" %>
15
+ <%= render :partial => "groups" %>
16
16
  </div>
17
17
  <%= render :partial => "activities/activities",
18
- :locals => { :activities => current_user.wall,
18
+ :locals => { :activities => current_user.wall.paginate,
19
19
  :owner => current_user } %>
@@ -1,3 +1,3 @@
1
1
  <%= div_for post, :class => 'content_size' do %>
2
- <%= post.text %>
2
+ <%= simple_format post.text %>
3
3
  <% end %>
@@ -1,11 +1,17 @@
1
1
  <% if current_user.suggestion.present? %>
2
2
  <% content_for :javascript do %>
3
+
3
4
  $(".suggestions .tie_close").livequery("click",function(){
4
- $(this).parents(".tie").replaceWith("<%= escape_javascript(render(current_user.suggestion))%>");
5
+ temp = $(this);
6
+ $.get("<%=suggestion_ties_path%>", function(data) {
7
+ temp.parents(".tie").replaceWith(data);
8
+ });
9
+
5
10
  });
6
11
  <% end %>
7
12
 
8
13
 
14
+
9
15
  <div class="tie_header">
10
16
  <%= image_tag('btn/notifications.png', :class => "tie_icon") %>
11
17
  <div class="tie_text_header">
@@ -1,6 +1,6 @@
1
1
  <div id="tie_<%=dom_id(tie.receiver_subject)%>" class="tie">
2
2
  <div class="tie_actor_logo">
3
- <%= link_to(image_tag(tie.receiver_subject.logo.url(:tie), :size =>"30x30"),
3
+ <%= link_to(image_tag(tie.receiver_subject.logo.url(:tie)),
4
4
  tie.receiver_subject) %>
5
5
  </div>
6
6
  <div class="tie_content">
@@ -1,19 +1,17 @@
1
- <div class="future_conference">
2
- <div class="future_header">
3
- <div class="future_text_header">
4
- <%= image_tag("btn/btn_follower.png", :alt =>"follower") %>2.520 Contacts
5
- </div>
6
- <div class="title_righ">
7
- <a href="#">Ver Todas</a>
8
- </div>
9
- </div>
10
- <div class="post_future_conference">
11
- <div class="future_content_center">
12
- <%=link_to ( (image_tag ( "albums/1.png", :alt => @user.name , :size => "40x40")) , @user) %>
13
- <%=link_to ( (image_tag ( "albums/2.png", :alt => @user.name , :size => "40x40")) , @user) %>
14
- <%=link_to ( (image_tag ( "albums/3.png", :alt => @user.name , :size => "40x40")) , @user) %>
15
- <%=link_to ( (image_tag ( "albums/4.png", :alt => @user.name , :size => "40x40")) , @user) %>
16
- </div>
17
- </div>
18
- </div>
1
+ <div class="contacts_header">
2
+ <%=image_tag("btn/btn_friend.png", :class => "contacts_icon")%>
3
+ <div class="contacts_text_header">
4
+ <%= @user.friends.count %> <%= t('friend', :count => @user.friends.count) %>
5
+ </div>
6
+ </div>
7
+ <div class ="contacts">
8
+ <div class="contact">
9
+ <%@user.friends.all.each do |friend|%>
10
+ <%=link_to((image_tag (friend.logo.url, :alt => friend.name , :size => "40x40")) , friend)%>
11
+ <%end%>
12
+ </div>
13
+ </div>
14
+ <div class="contacts_footer">
15
+ <%=link_to((image_tag("btn/btn_next.png", :alt => "next")) , users_path) %>
16
+ </div>
19
17
 
@@ -1,6 +1,6 @@
1
1
  <% if current_user.recent_groups.any? %>
2
2
  <div id="groups_title" class="content_size">
3
- <%=t('group.my') %> (<span id="group_count"><%=current_user.recent_groups.count%></span>)
3
+ <%=t('group.one', :count => current_user.recent_groups.count) %> (<span id="group_count"><%=current_user.recent_groups.count%></span>)
4
4
  </div>
5
5
  <div id="groups_list" class="content_size">
6
6
  <% if (current_user.recent_groups.count) > 10 %>
@@ -11,7 +11,6 @@
11
11
  <% else %>
12
12
  <div class="space_center"></div>
13
13
  <%end%>
14
-
15
14
  <%= render current_user.recent_groups %>
16
15
  <% if (current_user.recent_groups.count) > 10 %>
17
16
  </ul>
@@ -0,0 +1,3 @@
1
+ <div id="map_location" class="content_size">
2
+ <%= t('location.message', :location => "#{ image_tag('btn/btn_profile.png' , :class => 'btn_config') } #{ t('profile.one') }: <span class=\"name_group\">#{ sanitize @user.name }</span>").html_safe %>
3
+ </div>
@@ -1,6 +1,4 @@
1
1
  <div id="logo">
2
- <%=link_to(image_tag(@user.logo.url, :size => "120x196"), @user) %>
3
- <br/>
4
- <%= @user.name %>
5
- <br/>
2
+ <b><%= @user.name %></b><br/>
3
+ <%=image_tag(@user.logo.url(:profile)) %>
6
4
  </div>
@@ -1,30 +1,7 @@
1
- <div class="menu_lateral">
2
- <div class="option_menu">
3
- <div class="text_menu">
4
- &nbsp;&nbsp;<a href="#">Write a Message to <%=@user.name%></a>
5
- </div>
6
- </div>
1
+ <div class="menu_header"><b><%=t('menu.options')%></b>
7
2
  </div>
8
- <div class="space_center">
9
- </div>
10
- <div class="menu_lateral">
11
- <div class="option_menu">
12
- <%= image_tag("btn/btn_inbox.png") %>
13
- <div class="text_menu">
14
- <a href="#">Inbox(2)</a>
15
- </div>
16
- </div>
17
- </div>
18
- <div id="space_center_border">
3
+ <div id="menu_lateral">
4
+ <%= render :partial => "options" %>
19
5
  </div>
20
6
  <div class="space_center">
21
7
  </div>
22
- <div id="sub_menu_lateral">
23
- <div class="option_menu">
24
- <%= image_tag("btn/btn_video.png") %>
25
- <div class="text_menu">
26
- <a href="#">Groups</a>
27
- </div>
28
- </div>
29
- </div>
30
-
@@ -1,2 +1 @@
1
1
  <%= render :partial => 'profile' %>
2
- <%= render :partial => 'contacts' %>
@@ -0,0 +1,5 @@
1
+ <ul class="menu noaccordion">
2
+ <li>
3
+ <%= link_to( image_tag("btn/btn_inbox.png", :class => "menu_icon")+t('inbox.one'), current_user) %>
4
+ </li>
5
+ </ul>
@@ -2,4 +2,13 @@
2
2
  <div class="space_center">
3
3
  </div>
4
4
  <%= render :partial => 'menu' %>
5
+ <div class="space_center">
6
+ </div>
7
+ <% if @user.friends.count>0 %>
8
+ <%= render :partial => "contacts" %>
9
+ <%end%>
10
+ <div class="space_center">
11
+ </div>
12
+ <div class="space_center">
13
+ </div>
5
14
 
@@ -6,7 +6,7 @@
6
6
  <%= render :partial => 'right_show' %>
7
7
  <% end %>
8
8
 
9
- <%= render :partial => 'home/location' %>
9
+ <%= render :partial => 'location' %>
10
10
 
11
11
  <br class="clearfloat" />
12
12
  <div class="space_center">
@@ -14,5 +14,5 @@
14
14
 
15
15
  <%= render :partial => "users/groups" %>
16
16
  <%= render :partial => "activities/activities",
17
- :locals => { :activities => @user.wall_profile,
17
+ :locals => { :activities => @user.wall_profile(current_user).paginate,
18
18
  :owner => @user } %>
@@ -56,11 +56,12 @@ en:
56
56
  sentence2: "Posts, comments and activities"
57
57
  stats: "%{users} users and %{groups} groups registered"
58
58
  group:
59
+ one: "Group"
60
+ other: "Groups"
59
61
  all: "All Groups"
60
62
  by: "By Groups"
61
63
  my: "My Groups"
62
- one: "Group"
63
- other: "Groups"
64
+ last: "Last Groups"
64
65
  popular:
65
66
  most: "Most popular"
66
67
  voted: