social_stream 0.12.13 → 0.12.14

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.
@@ -0,0 +1,9 @@
1
+ module SettingsHelper
2
+ include SocialStream::Views::Settings
3
+
4
+ def render_settings
5
+ settings_items.inject(ActiveSupport::SafeBuffer.new) do |result, item|
6
+ result + item[:html]
7
+ end
8
+ end
9
+ end
@@ -4,18 +4,5 @@
4
4
  <h2><%= t('settings.for')%> <%= current_subject.name %></h2>
5
5
  <div class="space_center">
6
6
  </div>
7
- <% if current_subject==current_user %>
8
- <%= render :partial => "devise/registrations/edit_user", :locals => { :resource => current_user, :resource_name => :user }%>
9
- <% end %>
10
- <%= render :partial => "notifications" %>
11
- <% if current_subject.respond_to? :authentication_token%>
12
- <%= render :partial => "api_key" %>
13
- <% end %>
14
- <% if current_subject==current_user %>
15
- <%= render :partial => "devise/registrations/delete_account", :locals => { :resource => current_user, :resource_name => :user }%>
16
- <% else %>
17
- <%= render :partial => 'destroy' %>
18
- <% end %>
19
- <% if defined?(SocialStream::Presence) and SocialStream::Presence.enable %>
20
- <%= render :partial => 'chat/settings' %>
21
- <% end %>
7
+
8
+ <%= render_settings %>
@@ -190,7 +190,7 @@ en:
190
190
  destroy:
191
191
  one: "Destroy group"
192
192
  explanation: "All the activities, information and contacts of this group will be destroyed!"
193
- go_ahead: "Yes, I am sure. Go ahead"
193
+ go_ahead: "Yes, I am sure. Destroy all!"
194
194
  last_confirm: "This is your last chance. Are you really sure?"
195
195
  form:
196
196
  title: "Group"
@@ -190,7 +190,7 @@ es:
190
190
  destroy:
191
191
  one: "Destruir grupo"
192
192
  explanation: "¡Todas las actividades, información y contactos de este grupo serán destruídos!"
193
- go_ahead: "Sí, estoy seguro/a. ¡Adelante!"
193
+ go_ahead: "Sí, estoy seguro/a. ¡Destruirlo todo!"
194
194
  last_confirm: "Es tu última oportunidad. ¿Realmente estás seguro/a?"
195
195
  form:
196
196
  title: "Grupo"
@@ -61,6 +61,13 @@ module SocialStream
61
61
  autoload :Object, 'social_stream/models/object'
62
62
  end
63
63
 
64
+ module Views
65
+ module Settings
66
+ autoload :Base, 'social_stream/views/settings/base'
67
+ autoload :ItemList, 'social_stream/views/settings/item_list'
68
+ end
69
+ end
70
+
64
71
  module TestHelpers
65
72
  autoload :Controllers, 'social_stream/test_helpers/controllers'
66
73
  end
@@ -129,8 +136,4 @@ module SocialStream
129
136
  end
130
137
  end
131
138
 
132
- module Mailboxer
133
- autoload :NotificationDecoder, 'mailboxer/notification_decoder'
134
- end
135
-
136
- require 'social_stream/base'
139
+ require 'social_stream/base/engine'
@@ -1,99 +1,7 @@
1
+ require 'social_stream/ability/base'
2
+
1
3
  module SocialStream
2
4
  class Ability
3
- include CanCan::Ability
4
-
5
- # Create a new ability for this user, who is currently representing subject
6
- def initialize(subject)
7
-
8
- #Download alias action
9
- alias_action :download, :to => :show
10
-
11
- # Activity Objects
12
- (SocialStream.objects - [ :actor, :comment ]).map{ |obj|
13
- obj.to_s.classify.constantize
14
- }.each do |klass|
15
- can :create, klass do |k| # can :create, Post do |post|
16
- k.build_post_activity.allow?(subject, 'create')
17
- end
18
-
19
- can :read, klass do |k| # can :read, Post do |post|
20
- k.post_activity.allow?(subject, 'read')
21
- end
22
-
23
- can :update, klass do |k| # can :update, Post do |post|
24
- k.post_activity.allow?(subject, 'update')
25
- end
26
-
27
- can :destroy, klass do |k| # can :destroy, Post do |post|
28
- k.post_activity.allow?(subject, 'destroy')
29
- end
30
- end
31
-
32
- can :create, Comment do |c|
33
- c._activity_parent.allow?(subject, 'read')
34
- end
35
-
36
- can :read, Comment do |c|
37
- c.post_activity.allow?(subject, 'read')
38
- end
39
-
40
- can :update, Comment do |c|
41
- c.post_activity.allow?(subject, 'update')
42
- end
43
-
44
- can :destroy, Comment do |c|
45
- c.post_activity.allow?(subject, 'destroy')
46
- end
47
-
48
- # Activities
49
- can :create, Activity do |a|
50
- a.allow?(subject, 'create')
51
- end
52
-
53
- can :read, Activity do |a|
54
- a.allow?(subject, 'read')
55
- end
56
-
57
- can :update, Activity do |a|
58
- a.allow?(subject, 'update')
59
- end
60
-
61
- can :destroy, Activity do |a|
62
- a.allow?(subject, 'destroy')
63
- end
64
-
65
- # Users
66
- can :read, User
67
-
68
- can :update, User do |u|
69
- u.represented_by?(subject)
70
- end
71
-
72
- # Groups
73
- can :read, Group
74
-
75
- can :create, Group do |g|
76
- subject.present? &&
77
- g._contact.sender_id == Actor.normalize_id(subject)
78
- end
79
-
80
- can :update, Group do |g|
81
- g.represented_by?(subject)
82
- end
83
-
84
- can :destroy, Group do |g|
85
- g.represented_by?(subject)
86
- end
87
-
88
- can :read, Profile
89
-
90
- # Profile
91
- can :update, Profile do |p|
92
- p.subject.represented_by?(subject)
93
- end
94
-
95
- # Privacy
96
- can [:create, :read, :update, :destroy], Relation::Custom, :actor_id => subject.try(:actor_id)
97
- end
5
+ include SocialStream::Ability::Base
98
6
  end
99
7
  end
@@ -0,0 +1,101 @@
1
+ module SocialStream
2
+ class Ability
3
+ module Base
4
+ include CanCan::Ability
5
+
6
+ # Create a new ability for this user, who is currently representing subject
7
+ def initialize(subject)
8
+
9
+ #Download alias action
10
+ alias_action :download, :to => :show
11
+
12
+ # Activity Objects
13
+ (SocialStream.objects - [ :actor, :comment ]).map{ |obj|
14
+ obj.to_s.classify.constantize
15
+ }.each do |klass|
16
+ can :create, klass do |k| # can :create, Post do |post|
17
+ k.build_post_activity.allow?(subject, 'create')
18
+ end
19
+
20
+ can :read, klass do |k| # can :read, Post do |post|
21
+ k.post_activity.allow?(subject, 'read')
22
+ end
23
+
24
+ can :update, klass do |k| # can :update, Post do |post|
25
+ k.post_activity.allow?(subject, 'update')
26
+ end
27
+
28
+ can :destroy, klass do |k| # can :destroy, Post do |post|
29
+ k.post_activity.allow?(subject, 'destroy')
30
+ end
31
+ end
32
+
33
+ can :create, Comment do |c|
34
+ c._activity_parent.allow?(subject, 'read')
35
+ end
36
+
37
+ can :read, Comment do |c|
38
+ c.post_activity.allow?(subject, 'read')
39
+ end
40
+
41
+ can :update, Comment do |c|
42
+ c.post_activity.allow?(subject, 'update')
43
+ end
44
+
45
+ can :destroy, Comment do |c|
46
+ c.post_activity.allow?(subject, 'destroy')
47
+ end
48
+
49
+ # Activities
50
+ can :create, Activity do |a|
51
+ a.allow?(subject, 'create')
52
+ end
53
+
54
+ can :read, Activity do |a|
55
+ a.allow?(subject, 'read')
56
+ end
57
+
58
+ can :update, Activity do |a|
59
+ a.allow?(subject, 'update')
60
+ end
61
+
62
+ can :destroy, Activity do |a|
63
+ a.allow?(subject, 'destroy')
64
+ end
65
+
66
+ # Users
67
+ can :read, User
68
+
69
+ can :update, User do |u|
70
+ u.represented_by?(subject)
71
+ end
72
+
73
+ # Groups
74
+ can :read, Group
75
+
76
+ can :create, Group do |g|
77
+ subject.present? &&
78
+ g._contact.sender_id == Actor.normalize_id(subject)
79
+ end
80
+
81
+ can :update, Group do |g|
82
+ g.represented_by?(subject)
83
+ end
84
+
85
+ can :destroy, Group do |g|
86
+ g.represented_by?(subject)
87
+ end
88
+
89
+ can :read, Profile
90
+
91
+ # Profile
92
+ can :update, Profile do |p|
93
+ p.subject.represented_by?(subject)
94
+ end
95
+
96
+ # Privacy
97
+ can [:create, :read, :update, :destroy], Relation::Custom, :actor_id => subject.try(:actor_id)
98
+ end
99
+ end
100
+ end
101
+ end
@@ -31,6 +31,12 @@ module SocialStream
31
31
  end
32
32
  end
33
33
 
34
+ initializer "social_stream-base.views.settings" do
35
+ SocialStream::Views::Settings.module_eval do
36
+ include SocialStream::Views::Settings::Base
37
+ end
38
+ end
39
+
34
40
  initializer "social_stream-base.avatars_for_rails" do
35
41
  AvatarsForRails.setup do |config|
36
42
  config.avatarable_model = :actor
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.9.35".freeze
3
+ VERSION = "0.9.36".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,43 @@
1
+ module SocialStream
2
+ module Views
3
+ module Settings
4
+ module Base
5
+ def settings_items
6
+ SocialStream::Views::Settings::ItemList.new.tap do |items|
7
+ if current_subject == current_user
8
+ items << {
9
+ :key => 'user.edit',
10
+ :html => render(:partial => "devise/registrations/edit_user",
11
+ :locals => {
12
+ :resource => current_user,
13
+ :resource_name => :user
14
+ })
15
+ }
16
+ end
17
+
18
+ items << {
19
+ :key => 'notifications',
20
+ :html => render(:partial => "notifications")
21
+ }
22
+
23
+ if current_subject.respond_to? :authentication_token
24
+ items << {
25
+ :key => 'api_key',
26
+ :html => render(:partial => "api_key")
27
+ }
28
+ end
29
+
30
+ items << {
31
+ :key => 'destroy',
32
+ :html =>
33
+ current_subject == current_user ?
34
+ render(:partial => "devise/registrations/delete_account",
35
+ :locals => { :resource => current_user, :resource_name => :user }) :
36
+ render(:partial => 'destroy')
37
+ }
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,13 @@
1
+ module SocialStream
2
+ module Views
3
+ module Settings
4
+ class ItemList < Array
5
+ def insert_before key, obj
6
+ position = index{ |i| i[:key] == 'notifications' } + 1
7
+
8
+ insert position, obj
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -31,10 +31,10 @@ en:
31
31
  mine: "My files"
32
32
  msg: "Uploaded a file:"
33
33
  name: "file"
34
- not_mine: "Documents"
34
+ not_mine: "Files"
35
35
  one: "a file"
36
36
  simple_all: "All"
37
- title: "Documents"
37
+ title: "Files"
38
38
  picture:
39
39
  confirm_delete: "Delete picture?"
40
40
  title: "Pictures"
@@ -31,10 +31,10 @@ es:
31
31
  mine: "Mis ficheros"
32
32
  msg: "Subió un fichero:"
33
33
  name: "fichero"
34
- not_mine: "Documentos"
34
+ not_mine: "Ficheros"
35
35
  one: "un fichero"
36
36
  simple_all: "Todos"
37
- title: "Documentos"
37
+ title: "Ficheros"
38
38
  picture:
39
39
  confirm_delete: "¿Borrar imagen?"
40
40
  title: "Imágenes"
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Documents
3
- VERSION = "0.4.7".freeze
3
+ VERSION = "0.4.8".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.9.35')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.9.36')
16
16
  s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
17
17
  s.add_runtime_dependency('paperclip','2.3.11')
18
18
  s.add_runtime_dependency('delayed_paperclip','>= 0.7.2')
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "0.12.13".freeze
2
+ VERSION = "0.12.14".freeze
3
3
  end
@@ -1,5 +1,3 @@
1
- <% if current_user and current_subject and current_user==current_subject %>
2
-
3
1
  <div class="block" id="chat_settings">
4
2
  <div class="header">
5
3
  <div class="header_text">
@@ -34,5 +32,3 @@
34
32
  <% end %>
35
33
  </div>
36
34
  </div>
37
-
38
- <% end %>
@@ -1,6 +1,12 @@
1
1
  require 'social_stream-base'
2
2
 
3
3
  module SocialStream
4
+ module Views
5
+ module Settings
6
+ autoload :Presence, 'social_stream/views/settings/presence'
7
+ end
8
+ end
9
+
4
10
  module Presence
5
11
 
6
12
  autoload :XmppServerOrder, 'social_stream/presence/xmpp_server_order'
@@ -9,6 +15,7 @@ module SocialStream
9
15
  autoload :BuddyManager, 'social_stream/presence/models/buddy_manager'
10
16
  end
11
17
 
18
+
12
19
  mattr_accessor :domain
13
20
  mattr_accessor :bosh_service
14
21
  mattr_accessor :auth_method
@@ -37,4 +44,4 @@ module SocialStream
37
44
  end
38
45
  end
39
46
 
40
- require 'social_stream/presence/engine'
47
+ require 'social_stream/presence/engine'
@@ -6,6 +6,12 @@ module SocialStream
6
6
  include SocialStream::Presence::Models::BuddyManager
7
7
  end
8
8
  end
9
+
10
+ initializer "social_stream-presence.views.settings" do
11
+ SocialStream::Views::Settings.module_eval do
12
+ include SocialStream::Views::Settings::Presence
13
+ end
14
+ end
9
15
  end
10
16
  end
11
17
  end
@@ -0,0 +1,20 @@
1
+ module SocialStream
2
+ module Views
3
+ module Settings
4
+ module Presence
5
+ def settings_items
6
+ super.tap do |items|
7
+ if SocialStream::Presence.enable
8
+ if current_subject == current_user
9
+ items.insert_before 'notifications', {
10
+ :key => 'chat',
11
+ :html => render(:partial => "chat/settings")
12
+ }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
11
11
  s.files = `git ls-files`.split("\n")
12
12
 
13
13
  # Gem dependencies
14
- s.add_runtime_dependency('social_stream-base', '~> 0.9.35')
15
- s.add_runtime_dependency('social_stream-documents', '~> 0.4.7')
14
+ s.add_runtime_dependency('social_stream-base', '~> 0.9.36')
15
+ s.add_runtime_dependency('social_stream-documents', '~> 0.4.8')
16
16
  s.add_runtime_dependency('social_stream-events', '~> 0.0.20')
17
17
 
18
18
  # Development Gem dependencies
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream
3
3
  version: !ruby/object:Gem::Version
4
- hash: 53
4
+ hash: 51
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 12
9
- - 13
10
- version: 0.12.13
9
+ - 14
10
+ version: 0.12.14
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-11-20 00:00:00 +01:00
19
+ date: 2011-11-21 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: 125
30
+ hash: 115
31
31
  segments:
32
32
  - 0
33
33
  - 9
34
- - 35
35
- version: 0.9.35
34
+ - 36
35
+ version: 0.9.36
36
36
  type: :runtime
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency
@@ -43,12 +43,12 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- hash: 1
46
+ hash: 31
47
47
  segments:
48
48
  - 0
49
49
  - 4
50
- - 7
51
- version: 0.4.7
50
+ - 8
51
+ version: 0.4.8
52
52
  type: :runtime
53
53
  version_requirements: *id002
54
54
  - !ruby/object:Gem::Dependency
@@ -440,6 +440,7 @@ files:
440
440
  - base/app/helpers/permissions_helper.rb
441
441
  - base/app/helpers/profiles_helper.rb
442
442
  - base/app/helpers/search_helper.rb
443
+ - base/app/helpers/settings_helper.rb
443
444
  - base/app/helpers/subjects_helper.rb
444
445
  - base/app/helpers/toolbar_helper.rb
445
446
  - base/app/helpers/users_helper.rb
@@ -670,7 +671,8 @@ files:
670
671
  - base/lib/paperclip/social_stream.rb
671
672
  - base/lib/social_stream-base.rb
672
673
  - base/lib/social_stream/ability.rb
673
- - base/lib/social_stream/base.rb
674
+ - base/lib/social_stream/ability/base.rb
675
+ - base/lib/social_stream/base/engine.rb
674
676
  - base/lib/social_stream/base/version.rb
675
677
  - base/lib/social_stream/controllers/cancan_devise_integration.rb
676
678
  - base/lib/social_stream/controllers/helpers.rb
@@ -684,6 +686,8 @@ files:
684
686
  - base/lib/social_stream/test_helpers.rb
685
687
  - base/lib/social_stream/test_helpers/controllers.rb
686
688
  - base/lib/social_stream/toolbar_config/base.rb
689
+ - base/lib/social_stream/views/settings/base.rb
690
+ - base/lib/social_stream/views/settings/item_list.rb
687
691
  - base/lib/tasks/db/populate.rake
688
692
  - base/lib/tasks/workers.rake
689
693
  - base/social_stream-base.gemspec
@@ -1188,6 +1192,7 @@ files:
1188
1192
  - presence/lib/social_stream/presence/models/buddy_manager.rb
1189
1193
  - presence/lib/social_stream/presence/version.rb
1190
1194
  - presence/lib/social_stream/presence/xmpp_server_order.rb
1195
+ - presence/lib/social_stream/views/settings/presence.rb
1191
1196
  - presence/lib/tasks/presence/synchronize.rake
1192
1197
  - presence/social_stream-presence.gemspec
1193
1198
  - presence/spec/demo/.gitignore