social_stream-base 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/api_controller.rb +5 -7
- data/app/views/api/activity_atom_feed.atom.builder +3 -3
- data/app/views/contacts/_contact.html.erb +1 -1
- data/app/views/contacts/_suggestions.html.erb +6 -4
- data/app/views/{ties → contacts}/suggestion.html.erb +0 -0
- data/app/views/{ties → contacts}/suggestion.js.erb +0 -0
- data/app/views/permissions/_index.html.erb +4 -1
- data/config/locales/en.yml +1 -0
- data/config/routes.rb +1 -1
- data/lib/generators/social_stream/base/templates/public/stylesheets/default/images/add-policy.png +0 -0
- data/lib/generators/social_stream/base/templates/public/stylesheets/default/spheres.css +16 -4
- data/lib/generators/social_stream/base/templates/relations.yml +6 -0
- data/lib/social_stream/base/version.rb +1 -1
- data/lib/tasks/db/populate.rake +1 -1
- data/social_stream-base.gemspec +3 -1
- data/spec/dummy/config/relations.yml +6 -0
- data/spec/integration/navigation_spec.rb +24 -0
- data/spec/models/tie_spec.rb +7 -1
- data/spec/support/migrations.rb +18 -19
- metadata +9 -12
- data/app/views/ties/_edit.html.erb +0 -70
- data/app/views/ties/_form.html.erb +0 -6
- data/app/views/ties/create.js.erb +0 -26
- data/app/views/ties/edit.html.erb +0 -1
@@ -20,13 +20,11 @@ class ApiController < ApplicationController
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def activity_atom_feed
|
23
|
-
@
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@page = params[:page]
|
29
|
-
@activities = @user.wall(:home).paginate(:page => params[:page], :per_page => 10)
|
23
|
+
@subject = Actor.find_by_slug!(params[:id])
|
24
|
+
# FIXME: why? check with Victor
|
25
|
+
@subject ||= current_user
|
26
|
+
|
27
|
+
@activities = @subject.wall(:home).paginate(:page => params[:page], :per_page => 10)
|
30
28
|
|
31
29
|
respond_to do |format|
|
32
30
|
format.atom
|
@@ -1,8 +1,8 @@
|
|
1
1
|
atom_feed({'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/'}) do |feed|
|
2
|
-
feed.title(@
|
2
|
+
feed.title(@subject.name + ' public stream')
|
3
3
|
feed.updated(@activities.first.updated_at)
|
4
4
|
feed.author do
|
5
|
-
feed.name(@
|
5
|
+
feed.name(@subject.name)
|
6
6
|
end
|
7
7
|
|
8
8
|
for activity in @activities
|
@@ -37,4 +37,4 @@ atom_feed({'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/'}) do |feed|
|
|
37
37
|
if params[:page].to_i != 1
|
38
38
|
feed.link :rel => 'previous', :href=>api_my_home_url+'?page='+(params[:page].to_i-1).to_s
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if current_subject.suggestion.present? %>
|
2
2
|
<% content_for :javascript do %>
|
3
3
|
|
4
|
-
$(".suggestions .
|
4
|
+
$(".suggestions .close").livequery("click",function(){
|
5
5
|
temp = $(this);
|
6
6
|
$.get("<%=suggestion_contacts_path%>", function(data) {
|
7
7
|
temp.parents(".contact").replaceWith(data);
|
@@ -19,9 +19,11 @@
|
|
19
19
|
</div>
|
20
20
|
</div>
|
21
21
|
<div class="content">
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
<div class="suggestions">
|
23
|
+
<% if (sgs = current_subject.suggestions(2)).present? %>
|
24
|
+
<%= render :partial => 'contacts/contact', :collection => sgs %>
|
25
|
+
<%end%>
|
26
|
+
</div>
|
25
27
|
</div>
|
26
28
|
</div>
|
27
29
|
<%end%>
|
File without changes
|
File without changes
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<div class="privacy_add_element"></div>
|
8
8
|
|
9
9
|
<table class="tableCheckBoxOptions">
|
10
|
-
<% default_permissions.
|
10
|
+
<% default_permissions.each_with_index do |p, i| %>
|
11
11
|
<tr>
|
12
12
|
<td>
|
13
13
|
<div contain=<%= dom_id p %> class="checkboxPermissionOptionLeft">
|
@@ -15,6 +15,9 @@
|
|
15
15
|
<label for=<%= dom_id p %>><%= p.description(:brief) %></label>
|
16
16
|
</div>
|
17
17
|
</td>
|
18
|
+
<% if i == 0 %>
|
19
|
+
<td rowspan="<%= default_permissions.size %>" id="privacy-rule-arrow"><%= t 'privacy.rule.add' %></td>
|
20
|
+
<% end %>
|
18
21
|
</tr>
|
19
22
|
<% end %>
|
20
23
|
</table>
|
data/config/locales/en.yml
CHANGED
data/config/routes.rb
CHANGED
@@ -9,7 +9,7 @@ Rails.application.routes.draw do
|
|
9
9
|
match 'api/user/:id' => 'api#users'
|
10
10
|
match 'api/me' => 'api#users'
|
11
11
|
match 'api/me/home/' => 'api#activity_atom_feed', :format => 'atom', :as => :api_my_home
|
12
|
-
match 'api/user/:id/
|
12
|
+
match 'api/user/:id/public' => 'api#activity_atom_feed', :format => 'atom'
|
13
13
|
##/API##
|
14
14
|
|
15
15
|
# Webfinger
|
data/lib/generators/social_stream/base/templates/public/stylesheets/default/images/add-policy.png
ADDED
Binary file
|
@@ -191,18 +191,25 @@ span.privacy_span_new {
|
|
191
191
|
margin:0 auto;
|
192
192
|
}
|
193
193
|
|
194
|
-
|
194
|
+
#relation_custom_permissions_input {
|
195
|
+
list-style-type: none;
|
196
|
+
}
|
197
|
+
|
198
|
+
#relation_custom_permissions_input ol{
|
195
199
|
text-decoration: none;
|
196
|
-
margin:
|
200
|
+
margin: 0 10px 0 30px;
|
197
201
|
text-align: left;
|
198
|
-
list-style-type: square;
|
199
202
|
}
|
200
203
|
|
201
|
-
|
204
|
+
#relation_custom_permissions_input ol li{
|
202
205
|
font-family: sans-serif;
|
203
206
|
padding: 5px 0px 5px 0px;
|
204
207
|
}
|
205
208
|
|
209
|
+
#relation_custom_permissions_input label {
|
210
|
+
margin-left: 0px;
|
211
|
+
}
|
212
|
+
|
206
213
|
#relation_custom_permissions_input fieldset{
|
207
214
|
border: 0px;
|
208
215
|
text-align: left;
|
@@ -224,3 +231,8 @@ span.privacy_span_new {
|
|
224
231
|
cursor: wait;
|
225
232
|
}
|
226
233
|
|
234
|
+
#privacy-rule-arrow {
|
235
|
+
background: url('images/add-policy.png') no-repeat center center;
|
236
|
+
color: #FFFFFF;
|
237
|
+
}
|
238
|
+
|
@@ -23,6 +23,11 @@ user:
|
|
23
23
|
permissions:
|
24
24
|
- [ read, activity, weak_star_ties ]
|
25
25
|
sphere: personal
|
26
|
+
partner:
|
27
|
+
name: partner
|
28
|
+
permissions:
|
29
|
+
- [ read, activity, weak_star_ties ]
|
30
|
+
sphere: work
|
26
31
|
|
27
32
|
group:
|
28
33
|
member:
|
@@ -41,3 +46,4 @@ group:
|
|
41
46
|
permissions:
|
42
47
|
- [ read, activity, weak_star_ties ]
|
43
48
|
sphere: external_relations
|
49
|
+
|
data/lib/tasks/db/populate.rake
CHANGED
@@ -97,7 +97,7 @@ namespace :db do
|
|
97
97
|
# = Ties
|
98
98
|
available_actors.each do |a|
|
99
99
|
actors = available_actors.dup - Array(a)
|
100
|
-
relations = a.
|
100
|
+
relations = a.relations
|
101
101
|
|
102
102
|
Forgery::Basic.number(:at_most => actors.size).times do
|
103
103
|
actor = actors.delete_at((rand * actors.size).to_i)
|
data/social_stream-base.gemspec
CHANGED
@@ -46,8 +46,10 @@ Gem::Specification.new do |s|
|
|
46
46
|
# HTML Forms
|
47
47
|
s.add_runtime_dependency('formtastic','~> 1.2.3')
|
48
48
|
|
49
|
+
# Freeze Rails to 3.0.7 until Mailboxer bug is fixed
|
50
|
+
s.add_runtime_dependency('rails', '3.0.7')
|
51
|
+
|
49
52
|
# Development Gem dependencies
|
50
|
-
s.add_development_dependency('rails', '~> 3.0.7')
|
51
53
|
# Integration testing
|
52
54
|
s.add_development_dependency('capybara', '~> 0.3.9')
|
53
55
|
# Testing database
|
@@ -23,6 +23,11 @@ user:
|
|
23
23
|
permissions:
|
24
24
|
- [ read, activity, weak_star_ties ]
|
25
25
|
sphere: personal
|
26
|
+
partner:
|
27
|
+
name: partner
|
28
|
+
permissions:
|
29
|
+
- [ read, activity, weak_star_ties ]
|
30
|
+
sphere: work
|
26
31
|
|
27
32
|
group:
|
28
33
|
member:
|
@@ -41,3 +46,4 @@ group:
|
|
41
46
|
permissions:
|
42
47
|
- [ read, activity, weak_star_ties ]
|
43
48
|
sphere: external_relations
|
49
|
+
|
@@ -6,4 +6,28 @@ describe "Navigation" do
|
|
6
6
|
it "should be a valid app" do
|
7
7
|
::Rails.application.should be_a(Dummy::Application)
|
8
8
|
end
|
9
|
+
|
10
|
+
context "logged in" do
|
11
|
+
before(:all) do
|
12
|
+
@user = Factory(:user)
|
13
|
+
|
14
|
+
visit root_path
|
15
|
+
fill_in 'user_email', :with => @user.email
|
16
|
+
fill_in 'user_password', :with => 'testing'
|
17
|
+
|
18
|
+
click 'user_submit'
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with other user" do
|
22
|
+
before do
|
23
|
+
Factory(:user)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should close tab" do
|
27
|
+
visit home_path
|
28
|
+
click_link "X"
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
9
33
|
end
|
data/spec/models/tie_spec.rb
CHANGED
@@ -23,9 +23,15 @@ describe Tie do
|
|
23
23
|
|
24
24
|
count = receiver.follower_count
|
25
25
|
|
26
|
+
follower_relation = sender.
|
27
|
+
relation_customs.
|
28
|
+
joins(:permissions).
|
29
|
+
merge(Permission.follow).
|
30
|
+
first
|
31
|
+
|
26
32
|
Tie.create :sender_id => sender.actor_id,
|
27
33
|
:receiver_id => receiver.actor_id,
|
28
|
-
:relation_id =>
|
34
|
+
:relation_id => follower_relation.id
|
29
35
|
|
30
36
|
receiver.reload.follower_count.should eq(count + 1)
|
31
37
|
end
|
data/spec/support/migrations.rb
CHANGED
@@ -1,24 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
class MigrationFinder
|
2
|
+
def initialize gem, path
|
3
|
+
finder = Gem::GemPathSearcher.new
|
4
|
+
taggable_spec = finder.find(gem)
|
5
|
+
taggable_migration = finder.matching_files(taggable_spec,
|
6
|
+
File.join(*path)).first
|
4
7
|
|
5
|
-
require
|
8
|
+
require taggable_migration
|
9
|
+
end
|
10
|
+
end
|
6
11
|
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
taggable_migration = finder.matching_files(taggable_spec,
|
11
|
-
File.join("generators","acts_as_taggable_on","migration","templates","active_record","migration")).first
|
12
|
+
# Social Stream Base
|
13
|
+
MigrationFinder.new 'social_stream-base',
|
14
|
+
['generators', 'social_stream', 'base', 'templates', 'migration']
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
finder = Gem::GemPathSearcher.new
|
17
|
-
mailboxer_spec = finder.find('mailboxer')
|
18
|
-
mailboxer_migration =
|
19
|
-
finder.matching_files(mailboxer_spec,
|
20
|
-
File.join('generators', 'mailboxer', 'templates', 'migration')).first
|
21
|
-
|
22
|
-
require mailboxer_migration
|
16
|
+
# acts-as-taggable-on
|
17
|
+
MigrationFinder.new 'acts-as-taggable-on',
|
18
|
+
["generators", "acts_as_taggable_on", "migration", "templates", "active_record", "migration"]
|
23
19
|
|
20
|
+
# Mailboxer
|
21
|
+
MigrationFinder.new 'mailboxer',
|
22
|
+
['generators', 'mailboxer', 'templates', 'migration']
|
24
23
|
|
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:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 2
|
10
|
+
version: 0.5.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- GING - DIT - UPM
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-06-
|
19
|
+
date: 2011-06-08 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -300,7 +300,7 @@ dependencies:
|
|
300
300
|
requirement: &id018 !ruby/object:Gem::Requirement
|
301
301
|
none: false
|
302
302
|
requirements:
|
303
|
-
- -
|
303
|
+
- - "="
|
304
304
|
- !ruby/object:Gem::Version
|
305
305
|
hash: 9
|
306
306
|
segments:
|
@@ -308,7 +308,7 @@ dependencies:
|
|
308
308
|
- 0
|
309
309
|
- 7
|
310
310
|
version: 3.0.7
|
311
|
-
type: :
|
311
|
+
type: :runtime
|
312
312
|
version_requirements: *id018
|
313
313
|
- !ruby/object:Gem::Dependency
|
314
314
|
name: capybara
|
@@ -537,6 +537,8 @@ files:
|
|
537
537
|
- app/views/contacts/index.html.erb
|
538
538
|
- app/views/contacts/index.js.erb
|
539
539
|
- app/views/contacts/new.html.erb
|
540
|
+
- app/views/contacts/suggestion.html.erb
|
541
|
+
- app/views/contacts/suggestion.js.erb
|
540
542
|
- app/views/conversations/_conversation.html.erb
|
541
543
|
- app/views/conversations/_conversation_full.html.erb
|
542
544
|
- app/views/conversations/_conversations.html.erb
|
@@ -634,12 +636,6 @@ files:
|
|
634
636
|
- app/views/spheres/index.html.erb
|
635
637
|
- app/views/subjects/_contacts.html.erb
|
636
638
|
- app/views/subjects/_tabs.html.erb
|
637
|
-
- app/views/ties/_edit.html.erb
|
638
|
-
- app/views/ties/_form.html.erb
|
639
|
-
- app/views/ties/create.js.erb
|
640
|
-
- app/views/ties/edit.html.erb
|
641
|
-
- app/views/ties/suggestion.html.erb
|
642
|
-
- app/views/ties/suggestion.js.erb
|
643
639
|
- app/views/toolbar/_home.html.erb
|
644
640
|
- app/views/toolbar/_home_menu.html.erb
|
645
641
|
- app/views/toolbar/_home_menu_options.html.erb
|
@@ -1054,6 +1050,7 @@ files:
|
|
1054
1050
|
- lib/generators/social_stream/base/templates/public/stylesheets/default/frontpage.css
|
1055
1051
|
- lib/generators/social_stream/base/templates/public/stylesheets/default/header.css
|
1056
1052
|
- lib/generators/social_stream/base/templates/public/stylesheets/default/home.css
|
1053
|
+
- lib/generators/social_stream/base/templates/public/stylesheets/default/images/add-policy.png
|
1057
1054
|
- lib/generators/social_stream/base/templates/public/stylesheets/default/images/fcbkcomplete/close.gif
|
1058
1055
|
- lib/generators/social_stream/base/templates/public/stylesheets/default/images/loading.gif
|
1059
1056
|
- lib/generators/social_stream/base/templates/public/stylesheets/default/images/ui-bg_flat_0_aaaaaa_40x100.png
|
@@ -1,70 +0,0 @@
|
|
1
|
-
<% content_for :headers do %>
|
2
|
-
<%= stylesheet_link_tag "addContact.css", :media => "screen, projection" %>
|
3
|
-
<%= javascript_include_tag 'addContact'%>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<% toolbar :profile => @tie.receiver_subject, :option => 'contacts' %>
|
7
|
-
|
8
|
-
<% content_for :javascript do %>
|
9
|
-
$(document).ready(function() {
|
10
|
-
defaultRelations = ["friend","acquaintance","public"]
|
11
|
-
|
12
|
-
relation_name = "<%=@tie.relation.name%>";
|
13
|
-
$(".dropdown dt a span").html(relation_name);
|
14
|
-
$('input[name$="tie[relation_name]"]').val(relation_name);
|
15
|
-
|
16
|
-
});
|
17
|
-
<% end %>
|
18
|
-
|
19
|
-
<div class="dialog_add_tie" id="new_tie">
|
20
|
-
<div class="content_add_user" >
|
21
|
-
<div class="activity_add_ties">
|
22
|
-
|
23
|
-
|
24
|
-
<%= location(
|
25
|
-
link_to(image_tag("btn/btn_friend.png", :class => "menu_icon")+t('tie.edit.title'), edit_tie_path,:remote => true)
|
26
|
-
) %>
|
27
|
-
|
28
|
-
<%= form_for @tie do |f| %>
|
29
|
-
<%= f.hidden_field :receiver_id %>
|
30
|
-
<%= f.hidden_field :sender_id %>
|
31
|
-
<%= f.hidden_field :relation_name %>
|
32
|
-
|
33
|
-
<div class="block">
|
34
|
-
|
35
|
-
<div class="form_row center">
|
36
|
-
<h2> <%= t('tie.edit.title') %> </h2>
|
37
|
-
</div>
|
38
|
-
<div class="two_columns_container">
|
39
|
-
<div class="form_column_left">
|
40
|
-
<p class="colum_field_title"><%= t('message.one') %></p>
|
41
|
-
<%= f.text_area :message, :class =>"new_tie_text_area" %>
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<div class="form_column_right">
|
45
|
-
<div class="select_relations">
|
46
|
-
<div id="relationsSelect" class="dropdown">
|
47
|
-
<dt><a href="#"><span><%= t('tie.relation.one') %></span></a></dt>
|
48
|
-
<dd>
|
49
|
-
<ul>
|
50
|
-
<% (@tie.sender.relations.sort.map{ |r| [ r.name] }).each do |relationArray| %>
|
51
|
-
<li><a href="#" class="option"><%=relationArray[0]%><span class="value"><%=relationArray[0]%></span></a></li>
|
52
|
-
<% end %>
|
53
|
-
<li><a href="#" class="input_link">
|
54
|
-
<span class="value"></span>
|
55
|
-
<input type="text" class="input_select"/>
|
56
|
-
</a></li>
|
57
|
-
</ul>
|
58
|
-
</dd>
|
59
|
-
</div>
|
60
|
-
</div>
|
61
|
-
</div>
|
62
|
-
</div>
|
63
|
-
<div class="form_bottom">
|
64
|
-
<%= submit_tag t('contact.edit.submit'), :class => "button" %>
|
65
|
-
</div>
|
66
|
-
</div>
|
67
|
-
<% end %>
|
68
|
-
</div>
|
69
|
-
</div>
|
70
|
-
</div>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<% if @tie.new_record? %>
|
2
|
-
$("#tie_<%=dom_id(@tie.receiver_subject)%>").html(<%= @tie.errors.to_xml %>);
|
3
|
-
<% else %>
|
4
|
-
var old_tie = $("#tie_<%= dom_id(@tie.receiver_subject) %>");
|
5
|
-
var link_tie = $("#tie_link<%= dom_id(@tie.receiver_subject) %>");
|
6
|
-
<% if @tie.receiver_subject.is_a?(Group) #group tie %>
|
7
|
-
// add to group list
|
8
|
-
if ($('#carousel_ul').length) { // element found
|
9
|
-
$("#carousel_ul").prepend("<%= escape_javascript(render @tie.receiver_subject) %>");
|
10
|
-
}else{ // no element found
|
11
|
-
$("#my_groups").html("<%= escape_javascript(render(:partial => 'users/groups', :locals => { :user => current_subject } ))%>");
|
12
|
-
}
|
13
|
-
$("#group_count").html("<%=current_subject.recent_groups.count%>");
|
14
|
-
link_tie.replaceWith("<%= escape_javascript(link_follow_state) %>");
|
15
|
-
link_tie.slideUp(300).delay(800).fadeIn(400);
|
16
|
-
<% else %>
|
17
|
-
if (old_tie.parent().hasClass('suggestions')) {
|
18
|
-
//replace with new suggestion
|
19
|
-
old_tie.replaceWith("<%= escape_javascript(render(@tie.sender.suggestion))%>");
|
20
|
-
} else {
|
21
|
-
old_tie.hide();
|
22
|
-
}
|
23
|
-
<% end %>
|
24
|
-
|
25
|
-
$(".boxy-inner .close").click();
|
26
|
-
<% end %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render :partial => 'ties/edit' %>
|