social_stream 2.0.4 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.rdoc +2 -1
  4. data/base/README.rdoc +2 -0
  5. data/base/app/assets/javascripts/social_stream/relation_customs.js +8 -3
  6. data/base/app/assets/javascripts/social_stream/timeline.js +1 -2
  7. data/base/app/assets/javascripts/social_stream/wall.js +11 -0
  8. data/base/app/assets/stylesheets/social_stream/base/contacts/_contacts.css.sass +1 -0
  9. data/base/app/assets/stylesheets/social_stream/base/contacts/layouts/_contacts.css.sass +1 -42
  10. data/base/app/assets/stylesheets/social_stream/base/footer/layout/_footer.css.sass +3 -2
  11. data/base/app/assets/stylesheets/social_stream/base/layouts/_layout.css.sass +4 -1
  12. data/base/app/assets/stylesheets/social_stream/base/mixins/_layout.css.sass +48 -0
  13. data/base/app/assets/stylesheets/social_stream/base/profile/_profile.css.sass +21 -25
  14. data/base/app/assets/stylesheets/social_stream/base/sidebar/_sidebar.css.sass +1 -27
  15. data/base/app/assets/stylesheets/social_stream/base/sidebar/layout/_sidebar.css.sass +1 -24
  16. data/base/app/assets/stylesheets/social_stream/base/toolbar/_toolbar.css.sass +2 -11
  17. data/base/app/assets/stylesheets/social_stream/base/toolbar/layout/_toolbar.css.sass +18 -5
  18. data/base/app/controllers/contacts_controller.rb +17 -22
  19. data/base/app/controllers/permissions_controller.rb +3 -1
  20. data/base/app/helpers/contacts_helper.rb +9 -14
  21. data/base/app/models/actor.rb +28 -2
  22. data/base/app/models/contact.rb +18 -1
  23. data/base/app/models/permission.rb +21 -1
  24. data/base/app/models/relation.rb +14 -15
  25. data/base/app/models/relation/custom.rb +27 -24
  26. data/base/app/views/activities/_new.html.erb +1 -1
  27. data/base/app/views/contacts/{_link_custom.html.erb → _button.html.erb} +0 -0
  28. data/base/app/views/contacts/_contact.html.erb +1 -1
  29. data/base/app/views/contacts/index.html.erb +1 -1
  30. data/base/app/views/devise/passwords/new.html.erb +6 -8
  31. data/base/app/views/devise/registrations/new.html.erb +5 -7
  32. data/base/app/views/layouts/application.html.erb +7 -8
  33. data/base/app/views/permissions/_index.html.erb +12 -12
  34. data/base/app/views/permissions/_list.html.erb +10 -0
  35. data/base/app/views/permissions/index.js.erb +1 -15
  36. data/base/app/views/posts/create.js.erb +5 -4
  37. data/base/app/views/profiles/_personal.html.erb +2 -2
  38. data/base/app/views/relation/customs/_custom.html.erb +2 -27
  39. data/base/app/views/relation/customs/_form.html.erb +1 -1
  40. data/base/app/views/relation/customs/_index.html.erb +1 -1
  41. data/base/app/views/relation/customs/_list.html.erb +5 -4
  42. data/base/app/views/relation/customs/index.html.erb +1 -1
  43. data/base/app/views/relations/_relation.html.erb +33 -0
  44. data/base/config/locales/en.yml +10 -5
  45. data/base/config/locales/es.yml +20 -40
  46. data/base/config/locales/pt.yml +5 -1
  47. data/base/config/locales/zh.yml +17 -9
  48. data/base/lib/generators/social_stream/base/install_generator.rb +0 -4
  49. data/base/lib/generators/social_stream/base/templates/initializer.rb +24 -0
  50. data/base/lib/social_stream/base.rb +70 -0
  51. data/base/lib/social_stream/base/ability.rb +13 -1
  52. data/base/lib/social_stream/base/version.rb +1 -1
  53. data/base/lib/social_stream/test_helpers/controllers.rb +12 -6
  54. data/base/social_stream-base.gemspec +1 -1
  55. data/base/spec/controllers/permissions_controller_spec.rb +2 -6
  56. data/documents/app/assets/stylesheets/social_stream-documents.css.sass +2 -0
  57. data/documents/app/assets/stylesheets/social_stream/documents/explore/_explore-documents.css.sass +1 -2
  58. data/documents/app/assets/stylesheets/social_stream/documents/explore/layout/_explore-documents.css.sass +2 -13
  59. data/documents/app/assets/stylesheets/social_stream/documents/mixins/_mixins.css.sass +19 -0
  60. data/documents/lib/social_stream-documents.rb +0 -2
  61. data/documents/lib/social_stream/documents/version.rb +1 -1
  62. data/documents/social_stream-documents.gemspec +1 -1
  63. data/events/lib/social_stream/events/version.rb +1 -1
  64. data/events/social_stream-events.gemspec +1 -1
  65. data/lib/social_stream/version.rb +1 -1
  66. data/linkser/app/assets/javascripts/social_stream/linkser.wall.js +11 -14
  67. data/linkser/app/views/links/create.js.erb +3 -4
  68. data/linkser/lib/social_stream/linkser/version.rb +1 -1
  69. data/linkser/social_stream-linkser.gemspec +1 -1
  70. data/oauth2_server/app/assets/stylesheets/social_stream-oauth2_server.css.sass +1 -1
  71. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/applications/_applications-oauth2server.css.sass +1 -1
  72. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/applications/layout/_applications-oauth2server.css.sass +4 -0
  73. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/create/_create-oauth2server.css.sass +3 -7
  74. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/mixins/_mixin.css.sass +10 -0
  75. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/show/layout/_show-oauth2server.css.sass +15 -6
  76. data/oauth2_server/app/controllers/site/clients_controller.rb +14 -11
  77. data/oauth2_server/app/models/relation/manager.rb +19 -0
  78. data/oauth2_server/app/models/site/client.rb +10 -6
  79. data/oauth2_server/app/views/site/clients/_avatar.html.erb +15 -0
  80. data/oauth2_server/app/views/site/clients/_edit.html.erb +6 -0
  81. data/oauth2_server/app/views/site/clients/_edit_step_2.html.erb +11 -0
  82. data/oauth2_server/app/views/site/clients/_edit_step_3.html.erb +10 -0
  83. data/oauth2_server/app/views/site/clients/_list.html.erb +20 -17
  84. data/oauth2_server/app/views/site/clients/edit.html.erb +5 -6
  85. data/oauth2_server/app/views/site/clients/index.html.erb +1 -1
  86. data/oauth2_server/app/views/site/clients/new.html.erb +4 -2
  87. data/oauth2_server/app/views/site/clients/show.html.erb +49 -42
  88. data/oauth2_server/config/locales/en.yml +21 -3
  89. data/oauth2_server/config/locales/es.yml +26 -11
  90. data/oauth2_server/config/locales/zh.yml +25 -0
  91. data/oauth2_server/db/migrate/20130619134332_site_client_admin_to_manager.rb +24 -0
  92. data/oauth2_server/lib/social_stream-oauth2_server.rb +1 -19
  93. data/oauth2_server/lib/social_stream/oauth2_server.rb +33 -5
  94. data/oauth2_server/lib/social_stream/oauth2_server/ability.rb +23 -0
  95. data/oauth2_server/lib/social_stream/oauth2_server/engine.rb +6 -0
  96. data/oauth2_server/lib/social_stream/oauth2_server/models/actor.rb +2 -2
  97. data/oauth2_server/lib/social_stream/oauth2_server/version.rb +1 -1
  98. data/oauth2_server/social_stream-oauth2_server.gemspec +1 -1
  99. data/oauth2_server/spec/controllers/site_clients_controller_authorization_spec.rb +112 -0
  100. data/oauth2_server/spec/factories/site_client.rb +2 -2
  101. data/oauth2_server/spec/models/site/client_authorization_spec.rb +20 -0
  102. data/ostatus/lib/social_stream-ostatus.rb +0 -4
  103. data/ostatus/lib/social_stream/ostatus/engine.rb +11 -0
  104. data/ostatus/lib/social_stream/ostatus/version.rb +1 -1
  105. data/ostatus/social_stream-ostatus.gemspec +1 -1
  106. data/places/config/locales/en.yml +0 -1
  107. data/places/config/locales/es.yml +1 -2
  108. data/presence/lib/social_stream/presence/version.rb +1 -1
  109. data/presence/social_stream-presence.gemspec +1 -1
  110. data/social_stream.gemspec +7 -7
  111. metadata +30 -26
  112. data/base/app/helpers/permissions_helper.rb +0 -21
  113. data/base/lib/generators/social_stream/base/templates/relations.yml +0 -39
  114. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/mixins/_mixins.css.sass +0 -5
  115. data/oauth2_server/app/models/relation/admin.rb +0 -9
  116. data/oauth2_server/app/views/site/clients/_form_step1.html.erb +0 -7
  117. data/oauth2_server/app/views/site/clients/_form_step2.html.erb +0 -20
  118. data/ostatus/app/decorators/social_stream/base/relation/custom_decorator.rb +0 -3
  119. data/ostatus/lib/social_stream/ostatus/models/relation/custom.rb +0 -22
  120. data/spec/dummy/config/relations.yml +0 -39
@@ -1,4 +1,4 @@
1
- @import "social_stream/oauth2_server/mixins/mixins/"
1
+ @import "social_stream/oauth2_server/mixins/mixin"
2
2
 
3
3
  @import "social_stream/oauth2_server/applications/applications-oauth2server"
4
4
  @import "social_stream/oauth2_server/applications/layout/applications-oauth2server"
@@ -4,7 +4,7 @@
4
4
  @include colorfont-big-size
5
5
  float: left
6
6
  a
7
- @include btn-primary
7
+ @include btn-secundary
8
8
  @include border-radius(5px)
9
9
  margin: 12px 0
10
10
  .soften
@@ -1,10 +1,6 @@
1
- #content
2
- .box
3
- @include border-radius (5px)
4
- background-color: whitesmoke
5
- .image
6
- @include border-radius (5px)
7
- background-color: $white
1
+ form.new_site_client
2
+ @include principal-box
3
+
8
4
 
9
5
 
10
6
 
@@ -0,0 +1,10 @@
1
+ // menu horizontal
2
+ // ----------------------------------
3
+
4
+ @mixin principal-box
5
+ @include border-radius(5px)
6
+ @include box-shadow (1px 1px 15px 0px rgba(50, 50, 50, 0.1))
7
+ border: 1px solid
8
+ border-color: rgba(0,0,0, 0.1)
9
+ background-color: $auxiliarColor
10
+ border-color: rgba(0,0,0, 0.1)
@@ -34,8 +34,8 @@
34
34
  margin-left: 2.85%
35
35
  .site_client
36
36
  width: 95%
37
- padding-left: 2.5%
38
- padding-right: 2.5%
37
+ padding: 0 2.5%
38
+ margin-bottom: 30px
39
39
  display: inline-block
40
40
  h1
41
41
  @include clearfix
@@ -56,6 +56,9 @@
56
56
  margin-top: -50px
57
57
  h4
58
58
  margin-bottom: 0px
59
+ font-size: 18px
60
+ color: $principalColor
61
+ font-family: $serifFontFamily
59
62
  .name,
60
63
  .url,
61
64
  .users
@@ -69,21 +72,27 @@
69
72
  margin-left: 20px
70
73
  padding-top: 5px
71
74
  border-top: 1px solid #C1C1C1
75
+ color: #929292
76
+ font-size: 17px
72
77
  .btn-group
73
78
  @include btn-primary
74
79
  @include border-radius(5px)
75
80
  @include btn-add
81
+ float: right
76
82
  .dropdown-menu
77
83
  width: 300px
78
84
  margin-left: -196px
85
+ padding: 10px 14px
86
+ color: $gray
79
87
  li
80
- word-break: break-all
81
- overflow-y: hidden
82
- overflow-x: scroll
83
88
  h6
84
89
  border-bottom: 1px solid #CCC
85
90
  a
86
- color: principalColor
91
+ color: $principalColor !important
92
+ li.client-secret
93
+ p
94
+ word-break: break-all
95
+ overflow-x: scroll
87
96
 
88
97
 
89
98
 
@@ -1,18 +1,12 @@
1
1
  class Site::ClientsController < ApplicationController
2
2
  before_filter :authenticate_user!
3
3
 
4
- before_filter :set_author_ids, only: [ :create, :update ]
4
+ before_filter :set_author_ids, only: [ :new, :create, :update ]
5
5
 
6
- def index
7
- @developer_clients = current_subject.developer_site_clients
8
- end
9
-
10
- def show
11
- @client = Site::Client.find params[:id]
12
- end
6
+ load_and_authorize_resource
13
7
 
14
- def new
15
- @client = Site::Client.new
8
+ def index
9
+ @clients = current_subject.managed_site_clients
16
10
  end
17
11
 
18
12
  def create
@@ -20,7 +14,9 @@ class Site::ClientsController < ApplicationController
20
14
 
21
15
  if @client.save
22
16
  respond_to do |format|
23
- format.html { redirect_to @client }
17
+ format.html {
18
+ redirect_to edit_site_client_path(@client, step: 2)
19
+ }
24
20
  end
25
21
  else
26
22
  respond_to do |format|
@@ -47,9 +43,16 @@ class Site::ClientsController < ApplicationController
47
43
  end
48
44
  end
49
45
 
46
+ def destroy
47
+ @client.destroy
48
+
49
+ redirect_to home_path
50
+ end
51
+
50
52
  private
51
53
 
52
54
  def set_author_ids
55
+ params[:site_client] ||= HashWithIndifferentAccess.new
53
56
  params[:site_client][:author_id] = current_subject.actor_id
54
57
  params[:site_client][:user_author_id] = current_user.actor_id
55
58
  params[:site_client][:owner_id] = current_subject.actor_id
@@ -0,0 +1,19 @@
1
+ # Owner of client sites
2
+ class Relation::Manager < Relation::Single
3
+ PERMISSIONS =
4
+ [
5
+ [ 'manage', nil ],
6
+ [ 'manage', 'relation/custom' ],
7
+ [ 'manage', 'contact' ]
8
+ ]
9
+
10
+ class << self
11
+ def create_activity?
12
+ false
13
+ end
14
+ end
15
+
16
+ def available_permissions
17
+ Permission.instances PERMISSIONS
18
+ end
19
+ end
@@ -4,12 +4,13 @@ class Site::Client < Site
4
4
  before_validation :set_secret,
5
5
  on: :create
6
6
 
7
- after_create :set_admin
7
+ after_create :set_manager
8
8
 
9
- scope :administered_by, lambda { |actor|
10
- joins(actor: :sent_ties).
9
+ scope :managed_by, lambda { |actor|
10
+ select("DISTINCT sites.*").
11
+ joins(actor: :sent_permissions).
11
12
  merge(Contact.received_by(actor)).
12
- merge(Tie.related_by(Relation::Admin.instance))
13
+ merge(Permission.where(action: 'manage', object: nil))
13
14
  }
14
15
 
15
16
  %w{ url callback_url secret }.each do |m|
@@ -32,7 +33,10 @@ class Site::Client < Site
32
33
  self.secret = SecureRandom.hex(64)
33
34
  end
34
35
 
35
- def set_admin
36
- contact_to!(author).relation_ids = [ Relation::Admin.instance.id ]
36
+ def set_manager
37
+ c = sent_contacts.create! receiver_id: author.id,
38
+ user_author: author
39
+
40
+ c.relation_ids = [ ::Relation::Manager.instance.id ]
37
41
  end
38
42
  end
@@ -0,0 +1,15 @@
1
+ <section class="avatar">
2
+ <% if can? :update, @profile %>
3
+ <header>
4
+ <%= render partial: 'edit_icon' %>
5
+ <h4>
6
+ <%= t('avatar.profile_change') %>
7
+ </h4>
8
+ </header>
9
+ <div class="update">
10
+ <%= render partial: 'avatars/form',
11
+ object: @profile.actor,
12
+ as: :avatarable %>
13
+ </div>
14
+ <% end %>
15
+ </section>
@@ -0,0 +1,6 @@
1
+ <%= render partial: 'form' %>
2
+
3
+ <section class="site_client_roles">
4
+ <%= render partial: 'relation/customs/index',
5
+ locals: { subject: @client } %>
6
+ </section>
@@ -0,0 +1,11 @@
1
+ <%= image_tag 'step_2.png' %>
2
+
3
+ <section class="new_app">
4
+ <h1>Set the application's logo</h1>
5
+
6
+ <%= render partial: 'avatars/form',
7
+ object: @client,
8
+ as: :avatarable %>
9
+
10
+ <%= link_to "Next", edit_site_client_path(@client, step: 3) %>
11
+ </section>
@@ -0,0 +1,10 @@
1
+ <%= image_tag 'step_3.png' %>
2
+
3
+ <h1>Manage roles and permissions</h1>
4
+
5
+ <section class="site_client_roles">
6
+ <%= render partial: 'relation/customs/index',
7
+ locals: { subject: @client } %>
8
+ </section>
9
+
10
+ <%= link_to 'Finish', @client %>
@@ -1,24 +1,27 @@
1
1
  <section class="site_clients_list">
2
- <% list.each do |client| %>
2
+ <ul>
3
+ <% list.each do |client| %>
4
+ <li>
5
+ <%= image_tag client.logo.url(:small), style: "width: 40px; height: 40px;" %>
3
6
 
4
- <%= image_tag client.logo.url(:small), style: "width: 40px; height: 40px;" %>
5
-
6
- <div class="name">
7
- <%= link_to client.name, client %>
8
- </div>
9
- <div class="url">
10
- <%= link_to client.url, client.url, target: '_blank' %>
11
- </div>
12
- <div class="users">
13
- <span>
14
- 5
15
- </span>
16
- users
17
- </div>
18
- <hr class="soften">
19
- <% end %>
7
+ <div class="name">
8
+ <%= link_to client.name, client %>
9
+ </div>
10
+ <div class="url">
11
+ <%= link_to client.url, client.url, target: '_blank' %>
12
+ </div>
13
+ <div class="users">
14
+ <span>
15
+ 5
16
+ </span>
17
+ users
18
+ </div>
19
+ <hr class="soften">
20
+ </li>
21
+ <% end %>
20
22
 
21
23
  <%= javascript_tag do %>
22
24
  SocialStream.SiteClient.index();
23
25
  <% end %>
26
+ </ul>
24
27
  </section>
@@ -3,12 +3,11 @@
3
3
  <%= render partial: 'toolbar/home' %>
4
4
 
5
5
  <section class="edit_site_client" id="edit_<%= dom_id @client %>">
6
- <%= render partial: 'form' %>
7
-
8
- <section class="site_client_roles">
9
- <%= render partial: 'relation/customs/index',
10
- locals: { list: @client.relations } %>
11
- </section>
6
+ <% if params[:step].present? %>
7
+ <%= render partial: "edit_step_#{ params[:step] }" %>
8
+ <% else %>
9
+ <%= render partial: 'edit' %>
10
+ <% end %>
12
11
  </section>
13
12
  </section>
14
13
 
@@ -44,7 +44,7 @@
44
44
  <div class="tab-content">
45
45
  <div class="tab-pane active" id="tab1">
46
46
  <%= render partial: 'list',
47
- object: @developer_clients %>
47
+ object: @clients %>
48
48
  </div>
49
49
 
50
50
  <div class="tab-pane" id="tab2">
@@ -2,9 +2,11 @@
2
2
  <%= render partial: 'toolbar/home' %>
3
3
 
4
4
  <section class="new_site_client">
5
+ <%= image_tag 'step_1.png' %>
5
6
 
6
-
7
- <%= render partial: 'form_step1' %>
7
+ <article class="new_app">
8
+ <%= render partial: 'form' %>
9
+ </article>
8
10
  </section>
9
11
  </section>
10
12
 
@@ -20,7 +20,7 @@
20
20
  <%= Site::Client.human_attribute_name :description %>
21
21
  </h4>
22
22
  <div class="result">
23
- <%= link_to @client.description, @client.description%>
23
+ <%= @client.description%>
24
24
  </div>
25
25
 
26
26
  <h4>
@@ -30,45 +30,52 @@
30
30
  <%= link_to @client.url, @client.url%>
31
31
  </div>
32
32
 
33
- <h4>
34
- <%= Site::Client.human_attribute_name :callback_url %>
35
- </h4>
36
- <div class="result">
37
- <%= @client.callback_url %>
38
- </div>
33
+ <% if can? :update, @client %>
34
+ <h4>
35
+ <%= Site::Client.human_attribute_name :callback_url %>
36
+ </h4>
37
+ <div class="result">
38
+ <%= @client.callback_url %>
39
+ </div>
40
+ <% end %>
39
41
  </div>
40
42
 
41
- <div class="btn-group">
42
- <a class="dropdown-toggle" data-toggle="dropdown" href="#">
43
- Credentials
44
- <span class="caret"></span>
45
- </a>
46
- <ul class="dropdown-menu">
47
- <li>
48
- <h6>
49
- <%= Site::Client.human_attribute_name :id %>
50
- <a href="#" class="pull-right">refresh</a>
51
- </h6>
52
- <%= @client.id %>
53
- </li>
54
-
55
- <li>
56
- <h6>
57
- <%= Site::Client.human_attribute_name :secret %>
58
- <a href="#" class="pull-right">refresh</a>
59
- </h6>
60
- <%= @client.secret %>
61
- </li>
62
- </ul>
63
- </div>
43
+ <% if can? :update, @client %>
44
+ <div class="btn-group">
45
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
46
+ Credentials
47
+ <span class="caret"></span>
48
+ </a>
49
+ <ul class="dropdown-menu">
50
+ <li>
51
+ <h6>
52
+ <%= Site::Client.human_attribute_name :id %>
53
+ </h6>
54
+ <p>
55
+ <%= @client.id %>
56
+ </p>
57
+ </li>
58
+
59
+ <li class="client-secret">
60
+ <h6>
61
+ <%= Site::Client.human_attribute_name :secret %>
62
+ <a href="#" class="pull-right">refresh</a>
63
+ </h6>
64
+ <p>
65
+ <%= @client.secret %>
66
+ </p>
67
+ </li>
68
+ </ul>
69
+ </div>
70
+ <% end %>
64
71
  </div>
65
72
  </section>
66
73
 
67
74
  <div class="tabbable"> <!-- Only required for left/right tabs -->
68
75
  <ul class="nav nav-tabs">
69
- <li class="active"><a href="#tab1" data-toggle="tab">Users</a></li>
70
- <li><a href="#tab2" data-toggle="tab">Organizations</a></li>
71
- <li><a href="#tab3" data-toggle="tab">Stats</a></li>
76
+ <li class="active"><a href="#authorized" data-toggle="tab">Authorized</a></li>
77
+ <li><a href="#registered" data-toggle="tab">Registered</a></li>
78
+ <li><a href="#stats" data-toggle="tab">Stats</a></li>
72
79
  </ul>
73
80
  <div class="search-nav hidden-phone">
74
81
  <%= form_tag search_path, method: 'get', class: "navbar-search pull-left" do %>
@@ -79,6 +86,7 @@
79
86
  SocialStream.SearchHeader.show();
80
87
  });
81
88
  <% end %>
89
+
82
90
  <div class="mat">
83
91
  <%= render partial: 'layouts/loading' %>
84
92
 
@@ -97,18 +105,17 @@
97
105
 
98
106
 
99
107
  <div class="tab-content">
100
- <div class="tab-pane active" id="tab1">
101
- <ul class="nav nav-pills">
102
- <li class="active">
103
- <a href="#">added</a>
104
- </li>
105
- <li><a href="#">registered</a></li>
106
- </ul>
108
+ <div class="tab-pane active" id="authorized">
109
+ <%= render partial: 'contacts/contact',
110
+ collection: @client.sent_contacts.first(12) %>
111
+ </div>
112
+
113
+ <div class="tab-pane" id="registered">
107
114
  </div>
108
115
 
109
- <div class="tab-pane" id="tab2">
116
+ <div class="tab-pane" id="stats">
110
117
  </div>
111
118
  </div>
112
119
  </div>
113
120
 
114
- </section>
121
+ </section>