social_stream-base 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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +2 -0
  3. data/app/assets/javascripts/social_stream/relation_customs.js +8 -3
  4. data/app/assets/javascripts/social_stream/timeline.js +1 -2
  5. data/app/assets/javascripts/social_stream/wall.js +11 -0
  6. data/app/assets/stylesheets/social_stream/base/contacts/_contacts.css.sass +1 -0
  7. data/app/assets/stylesheets/social_stream/base/contacts/layouts/_contacts.css.sass +1 -42
  8. data/app/assets/stylesheets/social_stream/base/footer/layout/_footer.css.sass +3 -2
  9. data/app/assets/stylesheets/social_stream/base/layouts/_layout.css.sass +4 -1
  10. data/app/assets/stylesheets/social_stream/base/mixins/_layout.css.sass +48 -0
  11. data/app/assets/stylesheets/social_stream/base/profile/_profile.css.sass +21 -25
  12. data/app/assets/stylesheets/social_stream/base/sidebar/_sidebar.css.sass +1 -27
  13. data/app/assets/stylesheets/social_stream/base/sidebar/layout/_sidebar.css.sass +1 -24
  14. data/app/assets/stylesheets/social_stream/base/toolbar/_toolbar.css.sass +2 -11
  15. data/app/assets/stylesheets/social_stream/base/toolbar/layout/_toolbar.css.sass +18 -5
  16. data/app/controllers/contacts_controller.rb +17 -22
  17. data/app/controllers/permissions_controller.rb +3 -1
  18. data/app/helpers/contacts_helper.rb +9 -14
  19. data/app/models/actor.rb +28 -2
  20. data/app/models/contact.rb +18 -1
  21. data/app/models/permission.rb +21 -1
  22. data/app/models/relation.rb +14 -15
  23. data/app/models/relation/custom.rb +27 -24
  24. data/app/views/activities/_new.html.erb +1 -1
  25. data/app/views/contacts/{_link_custom.html.erb → _button.html.erb} +0 -0
  26. data/app/views/contacts/_contact.html.erb +1 -1
  27. data/app/views/contacts/index.html.erb +1 -1
  28. data/app/views/devise/passwords/new.html.erb +6 -8
  29. data/app/views/devise/registrations/new.html.erb +5 -7
  30. data/app/views/layouts/application.html.erb +7 -8
  31. data/app/views/permissions/_index.html.erb +12 -12
  32. data/app/views/permissions/_list.html.erb +10 -0
  33. data/app/views/permissions/index.js.erb +1 -15
  34. data/app/views/posts/create.js.erb +5 -4
  35. data/app/views/profiles/_personal.html.erb +2 -2
  36. data/app/views/relation/customs/_custom.html.erb +2 -27
  37. data/app/views/relation/customs/_form.html.erb +1 -1
  38. data/app/views/relation/customs/_index.html.erb +1 -1
  39. data/app/views/relation/customs/_list.html.erb +5 -4
  40. data/app/views/relation/customs/index.html.erb +1 -1
  41. data/app/views/relations/_relation.html.erb +33 -0
  42. data/config/locales/en.yml +10 -5
  43. data/config/locales/es.yml +20 -40
  44. data/config/locales/pt.yml +5 -1
  45. data/config/locales/zh.yml +17 -9
  46. data/lib/generators/social_stream/base/install_generator.rb +0 -4
  47. data/lib/generators/social_stream/base/templates/initializer.rb +24 -0
  48. data/lib/social_stream/base.rb +70 -0
  49. data/lib/social_stream/base/ability.rb +13 -1
  50. data/lib/social_stream/base/version.rb +1 -1
  51. data/lib/social_stream/test_helpers/controllers.rb +12 -6
  52. data/social_stream-base.gemspec +1 -1
  53. data/spec/controllers/permissions_controller_spec.rb +2 -6
  54. metadata +7 -7
  55. data/app/helpers/permissions_helper.rb +0 -21
  56. data/lib/generators/social_stream/base/templates/relations.yml +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2119bb019a0c4d4c11bf902e194e29e5f1274576
4
- data.tar.gz: 76e260d1d53acbcf459fe95c1569b54ef9af4a3e
3
+ metadata.gz: 9edd12a3c4ab23a1a4e0d1a705b3b4845da4cea7
4
+ data.tar.gz: 97bd53d433ddfa35717d0042dcbf4e4675d05e5b
5
5
  SHA512:
6
- metadata.gz: 68ae64af17f88595cad7ce80f1bc657a9d3b75750e38a63a55780efb1c4ff41e866471dd1dbbe635a29bf581c0bac7860d35adc49d2d5a01f1c8e95986057bb3
7
- data.tar.gz: 9edc2c246fbc02b66f59926f878134d9da6900b97b1c13ec46d7c73db9a22dc3dd11323ce8835ff877e30b42cc9ebef916327ced09ed03d22e5066ef07fb5099
6
+ metadata.gz: 910cdbd7e6742a6f286da4670b7a3db5225c4a4966b4f4cec1bb04cba085d865e1c0afe5702eab6d3a56ae3cc12e92c61b3cfc109ec116d45f0a13335f99af84
7
+ data.tar.gz: 10309c56b8a9f96cd041c5fb2eb63b90c2c158660bed660796bda69c78dfac1e461efc0589a5b44335df6db6b086bb9fb6c417fd565a907a7fb52727383b6221
@@ -5,6 +5,8 @@ Social Stream Base provides the basic functionality for
5
5
  network websites. The features of this gem are limited, for a complete social
6
6
  network environment see https://github.com/ging/social_stream
7
7
 
8
+ {<img src="https://badge.fury.io/rb/social_stream-base.png" />}[http://rubygems.org/gems/social_stream-base]
9
+
8
10
  == Features
9
11
 
10
12
  * Social network infrastructure
@@ -120,8 +120,6 @@ SocialStream.RelationCustom = (function(SS, $, undefined){
120
120
  $('#new_relation').before(options.relation.html);
121
121
 
122
122
  initList($('#relation_custom_' + options.relation.id));
123
-
124
- resetNewForm();
125
123
  };
126
124
 
127
125
  var resetNameForm = function(options) {
@@ -153,6 +151,10 @@ SocialStream.RelationCustom = (function(SS, $, undefined){
153
151
  el.find('input[name="relation_custom[name]"]').val('');
154
152
  };
155
153
 
154
+ var selectNewItem = function(options) {
155
+ $('input[name^="relation"][value="' + options.relation.id + '"]').click();
156
+ };
157
+
156
158
  var hideElement = function(options) {
157
159
  $('#relation_custom_' + options.relation.id).hide();
158
160
  $('#relation_' + options.relation.id + '_permissions').hide();
@@ -162,7 +164,10 @@ SocialStream.RelationCustom = (function(SS, $, undefined){
162
164
  initList,
163
165
  initPermission);
164
166
 
165
- callback.register('create', addToList);
167
+ callback.register('create',
168
+ addToList,
169
+ resetNewForm,
170
+ selectNewItem);
166
171
 
167
172
  callback.register('update',
168
173
  resetNameForm,
@@ -60,8 +60,7 @@ SocialStream.Timeline = (function(SS, $, undefined){
60
60
 
61
61
  callback.register('create',
62
62
  SS.Audience.index,
63
- SS.Comment.index,
64
- SS.Wall.new_);
63
+ SS.Comment.index);
65
64
 
66
65
  callback.register('update',
67
66
  SS.Audience.index,
@@ -11,8 +11,18 @@ SocialStream.Wall = (function(SS, $, undefined){
11
11
  $('.wall_input [name="post[text]"]').autosize();
12
12
  };
13
13
 
14
+ // Prevent sending the same post several times
15
+ var initShareButton = function() {
16
+ $('.wall_input input[type="submit"]').on('click', loadingShareButton);
17
+ };
18
+
19
+ var loadingShareButton = function() {
20
+ $(this).button('loading');
21
+ };
22
+
14
23
  var resetWallInput = function(){
15
24
  $('#post_text').val('');
25
+ $('.wall_input input[type="submit"]').button('reset');
16
26
  };
17
27
 
18
28
  var changeAction = function(path) {
@@ -37,6 +47,7 @@ SocialStream.Wall = (function(SS, $, undefined){
37
47
 
38
48
  callback.register('show',
39
49
  initInputAutosize,
50
+ initShareButton,
40
51
  SS.Object.new_);
41
52
 
42
53
  callback.register('new_',
@@ -12,6 +12,7 @@
12
12
  float: right
13
13
  .contact-list
14
14
  .contact
15
+ @include contact-style
15
16
  .x
16
17
  font-size: 12px
17
18
  color: $black
@@ -30,48 +30,7 @@ input#group_name
30
30
  padding-bottom: 50px
31
31
 
32
32
  .contact
33
- width: 240px
34
- float: left
35
- margin-left: 19px
36
- min-height: 76px
37
- margin-bottom: 14px
38
-
39
- .avatar
40
- float: left
41
- margin-left: 0px
42
- width: 50px
43
- display: inline
44
- margin-top: 10px
45
- img
46
- width: 45px
47
- vertical-align: top
48
-
49
- .data
50
- float: left
51
- margin-left: 0px
52
- width: 175px
53
- display: inline-block
54
- margin-top: 11px
55
- .name
56
- @include ellipsis
57
- .info
58
- @include ellipsis
59
- z-index: 1
60
- padding-left: 2%
61
-
62
- .add
63
- z-index: 1
64
- float: left
65
- .edit_contact
66
- margin-bottom: 0px
67
- .dropdown-toggle
68
- margin-left: 0
69
- widht: 100%
70
- .x
71
- display: inline-block
72
- float: right
73
- margin-top: -40px
74
-
33
+ @include contact-layout
75
34
 
76
35
 
77
36
  #contact-form
@@ -1,6 +1,4 @@
1
1
  footer
2
- height: auto
3
- line-height: 32px
4
2
  text-align: center
5
3
  clear: both
6
4
  padding-top: 30px
@@ -8,5 +6,8 @@ footer
8
6
  margin-left: 0
9
7
  li
10
8
  display: inline-block
9
+ footer,
10
+ .push
11
+ height: 32px
11
12
 
12
13
 
@@ -1,3 +1,6 @@
1
+ html,
2
+ body
3
+ height: 100%
1
4
  body
2
5
  background-color: #f9f9f9
3
6
  color: #555
@@ -6,7 +9,7 @@ body
6
9
 
7
10
 
8
11
  .wrapper
9
- min-height: 100%
12
+ min-height: 95%
10
13
  height: auto !important
11
14
  margin: 0 auto -32px
12
15
 
@@ -33,3 +33,51 @@
33
33
  @mixin hidden-desktop
34
34
  @extend .hidden-desktop
35
35
 
36
+
37
+ @mixin contact-style
38
+ .avatar
39
+ img
40
+ @include border-radius(5px)
41
+ .data
42
+ .name
43
+ color: $black
44
+ .x
45
+ font-size: 12px
46
+ color: $black
47
+ a
48
+ text-decoration: none
49
+ .info
50
+ font-size: 11px
51
+ color: #777
52
+ font-family: $sansFontFamilyLight
53
+ .add
54
+ @include btn-add
55
+
56
+ @mixin contact-layout
57
+ margin: 4px 0 19px 14px
58
+ width: 240px
59
+ min-height: 76px
60
+ float: left
61
+ .avatar
62
+ width: 45px !important
63
+ float: left
64
+ .data
65
+ display: inline-block
66
+ margin: 2px 0 3px 3px
67
+ float: left
68
+ width: 65%
69
+ .info
70
+ z-index: 1
71
+ a
72
+ display: inline
73
+ .x
74
+ a
75
+ float: right
76
+ display: inline-block
77
+ margin-right: 16px
78
+ margin-top: -98px
79
+ .info
80
+ z-index: 1
81
+ .add
82
+ margin-top: 2px
83
+ width: auto
@@ -7,32 +7,28 @@
7
7
  margin-bottom: 10px
8
8
  .colorfont-overlay
9
9
  top: 20px !important
10
- .tags,
11
- .personal,
12
- .comunication-info,
13
- .experience,
14
- .avatar
15
- input,
16
- textarea
17
- background-color: $whiteSmoke
18
- .briefing
19
- background-color: $white
20
- color: $gray
21
- span
22
- @include border-radius(5px)
23
- background-color: #D9EDF7
24
- border: 1px solid #BCE8F1
25
- color: #3A87AD
26
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5)
27
- p
28
- border-top: 5px solid $whiteSmoke
29
- background-color: none
30
-
10
+ input,
11
+ textarea
12
+ background-color: $whiteSmoke
13
+ .briefing
14
+ background-color: $white
15
+ color: $gray
16
+ span
17
+ @include border-radius(5px)
18
+ background-color: #D9EDF7
19
+ border: 1px solid #BCE8F1
20
+ color: #3A87AD
21
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5)
22
+ p
23
+ border-top: 5px solid $whiteSmoke
24
+ background-color: none
25
+
31
26
 
32
- form.edit_profile
33
- input
34
- &[type="submit"]
35
- @include btn-secundary
27
+ form.edit_profile
28
+ input
29
+ &[type="submit"]
30
+ @include btn-secundary
31
+
36
32
  .personal
37
33
  form.edit_profile
38
34
  h6
@@ -3,31 +3,5 @@
3
3
  #pendings
4
4
  h4
5
5
  font-size: 33.5px
6
-
7
6
  .contact
8
- .avatar
9
- img
10
- @include border-radius(5px)
11
-
12
- .data
13
- .name
14
- color: $black
15
- .x
16
- font-size: 12px
17
- color: $black
18
- a
19
- text-decoration: none
20
- .info
21
- font-size: 11px
22
- color: #777
23
- font-family: $sansFontFamilyLight
24
-
25
- .add
26
- @include btn-add
27
-
28
- .see-more
29
- font-size: 12px
30
- line-height: 20px
31
- a
32
- text-decoration: none
33
- color: $grayLight
7
+ @include contact-style
@@ -4,30 +4,7 @@
4
4
  width: 22.85714%
5
5
  float: right
6
6
  .contact
7
- margin: 4px 0
8
- .avatar
9
- width: 45px !important
10
- float: left
11
- .data
12
- display: inline-block
13
- margin: 2px 0 3px 3px
14
- float: left
15
- width: 65%
16
- .info
17
- z-index: 1
18
- a
19
- display: inline
20
- .x
21
- a
22
- float: right
23
- display: inline-block
24
- margin-right: 16px
25
- margin-top: -98px
26
- .info
27
- z-index: 1
28
- .add
29
- margin-top: 2px
30
- width: auto
7
+ @include contact-layout
31
8
 
32
9
  #suggestions
33
10
  margin-top: 30px
@@ -5,8 +5,6 @@
5
5
  li
6
6
  @include btn-primary
7
7
  @include border-radius(5px)
8
- padding: 4px 7px
9
- margin-bottom: 5px
10
8
  a
11
9
  @include ellipsis
12
10
  .icon_tool16-info
@@ -63,9 +61,6 @@
63
61
 
64
62
  #toolbar
65
63
  h5
66
- position: relative
67
- margin-top: 7px
68
- margin-bottom: 16px
69
64
  font-size: 16px
70
65
  @include ellipsis
71
66
  a
@@ -80,11 +75,8 @@
80
75
 
81
76
  .contacts-toolbar,
82
77
  section.groups
83
- @extend .hidden-phone
84
78
  h4
85
- margin-bottom: 0px
86
79
  font-family: $sansFontFamilyLight
87
- border-bottom: 1px solid #ddd
88
80
  ul
89
81
  border-right: 1px solid #ddd
90
82
  img
@@ -103,10 +95,9 @@
103
95
  @include ellipsis
104
96
  img
105
97
  @include border-radius(5px)
98
+ .subject-name
99
+ @include ellipsis
106
100
  .subject-name-phone
107
- position: relative
108
- margin-top: 7px
109
- margin-bottom: 16px
110
101
  font-size: 16px
111
102
  @include ellipsis
112
103
  a
@@ -1,4 +1,9 @@
1
- #toolbar
1
+ #toolbar
2
+ h5
3
+ position: relative
4
+ margin-top: 7px
5
+ margin-bottom: 16px
6
+
2
7
  .contact-button
3
8
  .btn-group
4
9
  width: 100%
@@ -9,7 +14,7 @@
9
14
  .caret
10
15
  margin-left: 14px
11
16
 
12
-
17
+
13
18
  .icon_navbar-message-blue,
14
19
  .icon_tool16-info
15
20
  margin-right: 4px
@@ -61,11 +66,12 @@
61
66
  .logo_home
62
67
 
63
68
  .subject-name
64
- @include ellipsis
65
69
  @extend .hidden-phone
66
70
  .subject-name-phone
67
- @include ellipsis
68
71
  display: none
72
+ position: relative
73
+ margin-top: 7px
74
+ margin-bottom: 16px
69
75
  @extend .visible-phone
70
76
 
71
77
 
@@ -89,4 +95,11 @@
89
95
  img,
90
96
  .icon_navbar-message-blue,
91
97
  .icon_tool16-info
92
- margin-right: 4px
98
+ margin-right: 4px
99
+
100
+ .toolbar-profile
101
+ .toolbar_menu
102
+ ul
103
+ li
104
+ padding: 4px 7px
105
+ margin-bottom: 5px
@@ -1,32 +1,19 @@
1
1
  class ContactsController < ApplicationController
2
2
  before_filter :authenticate_user!, except: [ :index ]
3
- before_filter :exclude_reflexive, :except => [ :index, :suggestion, :pending ]
3
+ load_and_authorize_resource except: [ :index, :suggestion, :pending ]
4
+ before_filter :exclude_reflexive, except: [ :index, :suggestion, :pending ]
4
5
 
5
- def index
6
- subject = profile_or_current_subject!
6
+ helper_method :current_subject_contacts_to
7
7
 
8
+ def index
9
+ params[:subject] = subject = profile_or_current_subject!
8
10
  params[:d] ||= 'sent'
9
11
  params[:type] ||= subject.class.contact_index_models.first.to_s
10
12
 
11
- @contacts = Contact
12
-
13
- @contacts =
14
- if params[:d] == 'received'
15
- @contacts.received_by(subject).joins(:sender)
16
- else
17
- @contacts.sent_by(subject).joins(:receiver)
18
- end
19
-
20
- @contacts =
21
- @contacts.
22
- positive.
23
- merge(Actor.subject_type(params[:type])).
24
- merge(Actor.name_search(params[:q])).
25
- related_by_param(params[:relation]).
26
- page(params[:page])
13
+ @contacts = Contact.index(params)
27
14
 
28
15
  respond_to do |format|
29
- format.html { render @contacts if request.xhr? }
16
+ format.html { render current_subject_contacts_to(@contacts) if request.xhr? }
30
17
  format.json { render json: @contacts.map(&:receiver), helper: self }
31
18
  end
32
19
  end
@@ -87,11 +74,19 @@ class ContactsController < ApplicationController
87
74
  end
88
75
  end
89
76
 
77
+ protected
78
+
79
+ def current_subject_contacts_to(contacts)
80
+ contacts.map{ |c|
81
+ current_actor.blank? || c.sender == current_actor ?
82
+ c :
83
+ current_actor.contact_to!(c.receiver)
84
+ }
85
+ end
86
+
90
87
  private
91
88
 
92
89
  def exclude_reflexive
93
- @contact = current_subject.sent_contacts.find params[:id]
94
-
95
90
  if @contact.reflexive?
96
91
  redirect_to home_path
97
92
  end