social_stream 0.4.2 → 0.4.3

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.
Files changed (78) hide show
  1. data/app/controllers/activities_controller.rb +1 -0
  2. data/app/controllers/avatars_controller.rb +17 -10
  3. data/app/controllers/comments_controller.rb +2 -0
  4. data/app/controllers/conversations_controller.rb +98 -103
  5. data/app/controllers/groups_controller.rb +3 -1
  6. data/app/controllers/likes_controller.rb +2 -0
  7. data/app/controllers/messages_controller.rb +4 -0
  8. data/app/controllers/posts_controller.rb +2 -2
  9. data/app/controllers/ties_controller.rb +6 -0
  10. data/app/helpers/subjects_helper.rb +32 -7
  11. data/app/helpers/ties_helper.rb +7 -2
  12. data/app/models/activity.rb +1 -1
  13. data/app/models/actor.rb +5 -8
  14. data/app/models/relation.rb +65 -0
  15. data/app/models/tie.rb +27 -7
  16. data/app/views/activities/_child.html.erb +1 -5
  17. data/app/views/activities/_root.html.erb +2 -4
  18. data/app/views/avatars/_form.html.erb +5 -16
  19. data/app/views/avatars/_precrop.html.erb +24 -17
  20. data/app/views/avatars/index.html.erb +47 -36
  21. data/app/views/avatars/new.html.erb +19 -3
  22. data/app/views/contacts/index.html.erb +1 -1
  23. data/app/views/contacts/index.js.erb +2 -0
  24. data/app/views/conversations/_conversation_full.html.erb +2 -1
  25. data/app/views/conversations/_index.html.erb +0 -7
  26. data/app/views/conversations/_show.html.erb +0 -7
  27. data/app/views/conversations/index.html.erb +9 -1
  28. data/app/views/conversations/index.js.erb +1 -0
  29. data/app/views/conversations/show.html.erb +1 -1
  30. data/app/views/conversations/show.js.erb +2 -0
  31. data/app/views/groups/_new.html.erb +9 -2
  32. data/app/views/groups/new.html.erb +5 -1
  33. data/app/views/layouts/_header.erb +23 -1
  34. data/app/views/layouts/_representation.html.erb +1 -1
  35. data/app/views/messages/new.html.erb +1 -1
  36. data/app/views/messages/new.js.erb +3 -0
  37. data/app/views/profiles/_profile.html.erb +18 -13
  38. data/app/views/profiles/edit.html.erb +29 -4
  39. data/app/views/profiles/update.js.erb +3 -3
  40. data/app/views/subjects/_toolbar_home_menu_options.html.erb +1 -1
  41. data/app/views/subjects/_toolbar_home_menu_options_subjects.html.erb +2 -2
  42. data/app/views/subjects/_toolbar_logo.html.erb +14 -2
  43. data/app/views/subjects/_toolbar_message_menu.html.erb +1 -1
  44. data/app/views/subjects/_toolbar_profile_menu_tie_options.html.erb +18 -7
  45. data/app/views/ties/_edit.html.erb +102 -0
  46. data/app/views/ties/_new.html.erb +48 -19
  47. data/app/views/ties/edit.html.erb +1 -0
  48. data/config/locales/en.yml +42 -27
  49. data/config/routes.rb +0 -6
  50. data/lib/generators/social_stream/templates/public/images/btn/arrowBlue.png +0 -0
  51. data/lib/generators/social_stream/templates/public/images/btn/shadow.png +0 -0
  52. data/lib/generators/social_stream/templates/public/javascripts/addContact.js +100 -0
  53. data/lib/generators/social_stream/templates/public/javascripts/avatars.js +8 -0
  54. data/lib/generators/social_stream/templates/public/javascripts/hoverIntent.js +84 -0
  55. data/lib/generators/social_stream/templates/public/javascripts/main.js +10 -1
  56. data/lib/generators/social_stream/templates/public/javascripts/menu.js +22 -6
  57. data/lib/generators/social_stream/templates/public/stylesheets/default/activities.css +2 -2
  58. data/lib/generators/social_stream/templates/public/stylesheets/default/addContact.css +29 -0
  59. data/lib/generators/social_stream/templates/public/stylesheets/default/avatars.css +79 -0
  60. data/lib/generators/social_stream/templates/public/stylesheets/default/base.css +44 -5
  61. data/lib/generators/social_stream/templates/public/stylesheets/default/header.css +151 -1
  62. data/lib/generators/social_stream/templates/public/stylesheets/default/home.css +1 -1
  63. data/lib/generators/social_stream/templates/public/stylesheets/default/jquery-ui.css +1 -1
  64. data/lib/generators/social_stream/templates/public/stylesheets/default/messages.css +6 -4
  65. data/lib/social_stream.rb +1 -1
  66. data/lib/social_stream/ability.rb +20 -0
  67. data/lib/social_stream/models/subject.rb +5 -1
  68. data/lib/social_stream/test_helpers/controllers.rb +55 -0
  69. data/lib/social_stream/version.rb +1 -1
  70. data/social_stream.gemspec +1 -1
  71. data/spec/controllers/comments_controller_spec.rb +38 -0
  72. data/spec/controllers/groups_controller_spec.rb +75 -5
  73. data/spec/factories/comment.rb +4 -0
  74. data/spec/models/tie_spec.rb +25 -15
  75. metadata +18 -10
  76. data/app/controllers/pshb_controller.rb +0 -55
  77. data/app/views/ties/new.js.erb +0 -12
  78. data/lib/social_stream/relations.rb +0 -46
@@ -1,27 +1,56 @@
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
+
1
8
  <div class="dialog_add_tie" id="new_tie">
2
- <div class="content_add_user" >
3
- <div class="activity_add_ties">
4
-
9
+ <div class="content_add_user" >
10
+ <div class="activity_add_ties">
11
+
12
+ <%= location(
13
+ link_to(image_tag("btn/btn_friend.png", :class => "menu_icon")+t('tie.new.title'), new_tie_path("tie[sender_id]" => @tie.sender.id, "tie[receiver_id]" => @tie.receiver.id),:remote => true)
14
+ ) %>
15
+
5
16
  <%= form_for @tie do |f| %>
6
- <%= f.hidden_field :receiver_id %>
7
- <%= f.hidden_field :sender_id %>
17
+ <%= f.hidden_field :receiver_id %>
18
+ <%= f.hidden_field :sender_id %>
19
+ <%= f.hidden_field :relation_name %>
8
20
 
9
21
  <div class="block">
10
- <div class="close_add_contact">
11
- <%=link_to('X','#', :id => "close_add_contact")%>
22
+
23
+ <div class="form_row center">
24
+ <h2> <%= t('tie.new.title') %> </h2>
25
+ </div>
26
+ <div class="two_columns_container">
27
+ <div class="form_column_left">
28
+ <p class="colum_field_title"><%= t('message.one') %></p>
29
+ <%= f.text_area :message, :class =>"new_tie_text_area" %>
12
30
  </div>
13
- <div class="form_row center">
14
- <h2> <%= t('tie.new.title') %> </h2>
15
- </div>
16
- <div class="two_columns_container">
17
- <div class="form_column_left">
18
- <p class="colum_field_title"><%= t('message.one') %></p>
19
- <%= f.text_area :message, :class =>"new_tie_text_area" %>
20
- </div>
21
-
22
- <div class="form_column_right">
23
- <div class="select_relations">
24
- <%= f.select :relation_name, @tie.sender.relations.sort.map{ |r| [ r.name, r.name ] } %>
31
+
32
+ <div class="form_column_right">
33
+ <div class="select_relations">
34
+ <div id="relationsSelect" class="dropdown">
35
+ <dt><a href="#"><span><%= t('tie.relation.one') %></span></a></dt>
36
+ <dd>
37
+ <ul>
38
+ <% (@tie.sender.relations.sort.map{ |r| [ r.name] }).each do |relationArray| %>
39
+ <li><a href="#" class="option"><%=relationArray[0]%><span class="value"><%=relationArray[0]%></span></a></li>
40
+ <% end %>
41
+ <li><a href="#" class="input_link">
42
+ <span class="value"></span>
43
+ <input type="text" class="input_select"/>
44
+ </a></li>
45
+ </ul>
46
+ </dd>
47
+ </div>
48
+ </div>
49
+
50
+ <div id="relationPermissions">
51
+ <p class="relationPermision"><input type="checkbox" class="checkbox_permission" name="tie[relation_permissions][]" value="<%= Permission.find_by_action_and_function_and_object("read","star_ties","activity").id%>"> <%= t('permissions.read.activity.star_ties', :user=> @tie.receiver.name) %></p>
52
+ <p class="relationPermision"><input type="checkbox" class="checkbox_permission" name="tie[relation_permissions][]" value="<%= Permission.find_by_action("follow").id%>" checked="true"> <%= t('permissions.follow', :user=> @tie.receiver.name) %></p>
53
+ <p class="relationPermision"><input type="checkbox" class="checkbox_permission" name="tie[relation_permissions][]" value="<%= Permission.find_by_action_and_function_and_object("create","tie","activity").id%>"> <%= t('permissions.create.activity.tie', :user=> @tie.receiver.name) %></p>
25
54
  </div>
26
55
  </div>
27
56
  </div>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'ties/edit' %>
@@ -18,14 +18,22 @@ en:
18
18
  unlike: "Already I do not like"
19
19
  verb:
20
20
  follow:
21
- title: "%{subject} added %{contact} as contact."
22
- message: "%{name} added you as contact."
21
+ User:
22
+ title: "%{subject} added %{contact} as contact."
23
+ message: "%{name} added you as contact."
24
+ Group:
25
+ title: "%{subject} added %{contact} as contact."
26
+ message: "%{name} added you as contact."
23
27
  make-friend:
24
- title: "%{subject} and %{contact} are now connected."
25
- message: "%{name} also added you as contact."
28
+ User:
29
+ title: "%{subject} and %{contact} are now connected."
30
+ message: "%{name} also added you as contact."
31
+ Group:
32
+ title: "%{subject} added %{contact} as contact."
33
+ message: "%{name} added you as contact."
26
34
  avatar:
27
35
  crop_image: "Crop the uploaded image"
28
- crop_submit: "Crop"
36
+ crop_submit: "Crop image"
29
37
  destroy: "Delete"
30
38
  destroy_sure: "Are you sure you wan't to delete the selected avatar?"
31
39
  error:
@@ -35,23 +43,31 @@ en:
35
43
  new: "Create a new avatar"
36
44
  new_short: "New avatar"
37
45
  no_avatars: "You haven't any avatar, plesase create a new one."
46
+ one: "Avatar"
47
+ other: "Avatars"
48
+ original: "Original image"
38
49
  preview: "Preview"
39
50
  profile_change: "Change your avatar"
40
51
  set_default: "Set as default"
41
52
  set_default_sure: "Are you sure you wan't to set this avatar as default?"
42
53
  upload: "Upload"
43
54
  browse: "Browse"
55
+ button:
56
+ cancel: "Cancel"
57
+ update: "Update"
44
58
  comment:
45
59
  input: "Write a comment..."
46
60
  confirm_delete: "Delete comment?"
47
61
  contact:
48
- one: "Contact"
49
- other: "Contacts"
50
62
  all_n: "All contacts (%{count})"
63
+ edit:
64
+ submit: "Edit Contact"
51
65
  new:
52
66
  link: "+ Add contact"
53
67
  title: "Add %{name} as contact"
54
- submit: "+ Add contact"
68
+ submit: "Add Contact"
69
+ one: "Contact"
70
+ other: "Contacts"
55
71
  copyright: "2010 Copyright - All rights reserved"
56
72
  days: Days
57
73
  delete:
@@ -89,22 +105,6 @@ en:
89
105
  unlocks:
90
106
  send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
91
107
  unlocked: 'Your account was successfully unlocked. You are now signed in.'
92
- edit:
93
- aboutme: "About me --NOTE: use profile.<class>.about"
94
- actualcity: "Actual City --NOTE: use profile.actualcity"
95
- address: "Address --NOTE: use profile.address"
96
- birthday: "BirthDay --NOTE: use profile.<class>.birthday"
97
- contact: "Contact information --NOTE: use profile.contact"
98
- email: "E-mail --NOTE: use profile.email"
99
- experience: "Experience --NOTE: use profile.experience"
100
- fax: "Fax --NOTE: use profile.fax"
101
- group_info: "Group information --NOTE: use profile.<class>.info"
102
- mobile: "Mobile --NOTE: use profile.mobile"
103
- organization: "Organization --NOTE: use profile.organization"
104
- personal_info: "Personal information --NOTE: use profile.<class>.info"
105
- phone: "Phone --NOTE: use profile.phone"
106
- profile: "Edit profile"
107
- website: "Website --NOTE: use profile.website"
108
108
  forgot_password: "Forgot you password?"
109
109
  frontpage:
110
110
  collaborate:
@@ -158,10 +158,12 @@ en:
158
158
  information: "Information"
159
159
  wall: "Wall"
160
160
  message:
161
+ answer: "Write your answer"
161
162
  inbox: "Inbox"
162
163
  new: "New Message"
163
164
  one: "Message"
164
165
  other: "Messages"
166
+ participants: "Participants"
165
167
  sentbox: "Sentbox"
166
168
  trash: "Trash"
167
169
  send: "Send a message"
@@ -201,6 +203,17 @@ en:
201
203
  service:
202
204
  one: "Service"
203
205
  other: "Services"
206
+ permissions:
207
+ read:
208
+ activity:
209
+ star_ties: "Allow %{user} to read my wall"
210
+ tie:
211
+ weak_star_ties: "Not defined"
212
+ follow: "Follow %{user}"
213
+ create:
214
+ activity:
215
+ tie: "Allow %{user} to write in my wall"
216
+ weak_ties: "Not defined"
204
217
  products:
205
218
  one: "Product"
206
219
  other: "Products"
@@ -212,14 +225,16 @@ en:
212
225
  tie:
213
226
  add:
214
227
  bookmark: "Bookmark"
215
- contact: "Add contact as"
228
+ contact: "Add contact as..."
216
229
  follow: "Follow"
217
230
  like: "Like"
218
231
  partner: "Add Partner"
219
- category:
220
- new: "New category"
232
+ relation:
233
+ one: "Contact type"
234
+ new: "New type"
221
235
  edit:
222
236
  contact: "Contact: %{type}"
237
+ title: "Edit Contact"
223
238
  new:
224
239
  title: "Add New Contact"
225
240
  pending:
data/config/routes.rb CHANGED
@@ -12,12 +12,6 @@ Rails.application.routes.draw do
12
12
  match 'api/user/:id/home' => 'api#activity_atom_feed', :format => 'atom'
13
13
  ##/API##
14
14
 
15
- # PubSubHubBub
16
- match 'pshb/callback' => 'pshb#callback', :as => :pshb_callback
17
- # Test
18
- match 'pshb/test_s' => 'pshb#pshb_subscription_request'
19
- match 'pshb/test_p' => 'pshb#pshb_publish'
20
-
21
15
  # Webfinger
22
16
  match '.well-known/host-meta',:to => 'frontpage#host_meta'
23
17
 
@@ -0,0 +1,100 @@
1
+ $(document).ready(function() {
2
+
3
+ $("#relationPermissions").hide();
4
+
5
+ $(".dropdown dt a").click(function() {
6
+ $(".dropdown dd ul").toggle();
7
+ });
8
+
9
+ $(".dropdown dd ul li a.option").click(function() {
10
+ var text = $(this).html();
11
+ $(".dropdown dt a span").html(text);
12
+ $(".dropdown dd ul").hide();
13
+ $('input[name$="tie[relation_name]"]').val(getSelectedValue("relationsSelect"));
14
+ });
15
+
16
+
17
+ $('input.input_select').click(function() {
18
+ return false;
19
+ });
20
+
21
+ $(".dropdown dd ul li a.input_link").click(function() {
22
+ var text = $('input.input_select').val();
23
+ setSelectedValue(text);
24
+
25
+ });
26
+
27
+ function getSelectedValue(id) {
28
+ $("#relationPermissions").hide();
29
+ return $("#" + id).find("dt a span.value").html();
30
+ }
31
+
32
+ function setSelectedValue(text){
33
+ if(validate_value_for_input(text)){
34
+ $('input[name$="tie[relation_name]"]').val(text);
35
+ $(".dropdown dt a span").html(text);
36
+ $("#relationPermissions").show();
37
+ }
38
+ $(".dropdown dd ul").hide();
39
+ }
40
+
41
+ function validate_value_for_input(value){
42
+ var result = true;
43
+
44
+ if (value.trim()=="") {
45
+ result = false;
46
+ }
47
+
48
+ var constantOptions = $(".dropdown dd ul li a.option");
49
+ $.each(constantOptions, function(index, item) {
50
+ if(item.text==value){
51
+ result = false;
52
+ }
53
+ if(item.text==value.trim()){
54
+ result = false;
55
+ }
56
+ });
57
+
58
+ return result;
59
+ }
60
+
61
+ function isConstantOptionSelected(){
62
+ var selected = $(".dropdown dt a span.value").text();
63
+ var constantOptions = $(".dropdown dd ul li a.option");
64
+ var result = false;
65
+
66
+ $.each(constantOptions, function(index, item) {
67
+ if(item.text==selected){
68
+ result = true;
69
+ }
70
+ });
71
+
72
+ return result;
73
+ }
74
+
75
+
76
+ $(document).bind('click', function(e) {
77
+ var $clicked = $(e.target);
78
+ if (! $clicked.parents().hasClass("dropdown")){
79
+ //If any previous option selected...
80
+ if(!isConstantOptionSelected()){
81
+ var text = $('input.input_select').val();
82
+ setSelectedValue(text);
83
+ }else{
84
+ $(".dropdown dd ul").hide();
85
+ }
86
+ }
87
+ });
88
+
89
+
90
+ $('input.input_select').bind('keypress', function(e) {
91
+
92
+ if (e.which == '13') {
93
+ //Case: Intro key
94
+ setSelectedValue($(this).val());
95
+ return false;
96
+ }
97
+
98
+ });
99
+
100
+ });
@@ -0,0 +1,8 @@
1
+ $(document).ready( function() {
2
+ //Full Caption Sliding (Hidden to Visible)
3
+ $('.boxgrid.captionfull').hover( function() {
4
+ $(".cover", this).stop().animate({top:'61px'},{queue:false,duration:160});
5
+ }, function() {
6
+ $(".cover", this).stop().animate({top:'104px'},{queue:false,duration:160});
7
+ });
8
+ });
@@ -0,0 +1,84 @@
1
+ (function($){
2
+ /* hoverIntent by Brian Cherne */
3
+ $.fn.hoverIntent = function(f,g) {
4
+ // default configuration options
5
+ var cfg = {
6
+ sensitivity: 7,
7
+ interval: 100,
8
+ timeout: 0
9
+ };
10
+ // override configuration options with user supplied object
11
+ cfg = $.extend(cfg, g ? { over: f, out: g } : f );
12
+
13
+ // instantiate variables
14
+ // cX, cY = current X and Y position of mouse, updated by mousemove event
15
+ // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
16
+ var cX, cY, pX, pY;
17
+
18
+ // A private function for getting mouse position
19
+ var track = function(ev) {
20
+ cX = ev.pageX;
21
+ cY = ev.pageY;
22
+ };
23
+
24
+ // A private function for comparing current and previous mouse position
25
+ var compare = function(ev,ob) {
26
+ ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
27
+ // compare mouse positions to see if they've crossed the threshold
28
+ if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
29
+ $(ob).unbind("mousemove",track);
30
+ // set hoverIntent state to true (so mouseOut can be called)
31
+ ob.hoverIntent_s = 1;
32
+ return cfg.over.apply(ob,[ev]);
33
+ } else {
34
+ // set previous coordinates for next time
35
+ pX = cX; pY = cY;
36
+ // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
37
+ ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
38
+ }
39
+ };
40
+
41
+ // A private function for delaying the mouseOut function
42
+ var delay = function(ev,ob) {
43
+ ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
44
+ ob.hoverIntent_s = 0;
45
+ return cfg.out.apply(ob,[ev]);
46
+ };
47
+
48
+ // A private function for handling mouse 'hovering'
49
+ var handleHover = function(e) {
50
+ // next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
51
+ var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
52
+ while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
53
+ if ( p == this ) { return false; }
54
+
55
+ // copy objects to be passed into t (required for event object to be passed in IE)
56
+ var ev = jQuery.extend({},e);
57
+ var ob = this;
58
+
59
+ // cancel hoverIntent timer if it exists
60
+ if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
61
+
62
+ // else e.type == "onmouseover"
63
+ if (e.type == "mouseover") {
64
+ // set "previous" X and Y position based on initial entry point
65
+ pX = ev.pageX; pY = ev.pageY;
66
+ // update "current" X and Y position based on mousemove
67
+ $(ob).bind("mousemove",track);
68
+ // start polling interval (self-calling timeout) to compare mouse coordinates over time
69
+ if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
70
+
71
+ // else e.type == "onmouseout"
72
+ } else {
73
+ // unbind expensive mousemove event
74
+ $(ob).unbind("mousemove",track);
75
+ // if hoverIntent state is true, then call the mouseOut function after the specified delay
76
+ if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
77
+ }
78
+ };
79
+
80
+ // bind the function to the two event listeners
81
+ return this.mouseover(handleHover).mouseout(handleHover);
82
+ };
83
+
84
+ })(jQuery);
@@ -1,8 +1,17 @@
1
1
  // initialise plugins
2
2
  jQuery(function(){
3
- jQuery('ul.sf-menu').superfish();
3
+ jQuery('ul.sf-menu').superfish({
4
+ delay: 1000, // one second delay on mouseout
5
+ animation: {height:'show'}, // fade-in and slide-down animation
6
+ speed: 'fast', // faster animation speed
7
+ autoArrows: false,
8
+ dropShadows: false // disable drop shadows
4
9
  });
5
10
 
11
+ });
12
+
13
+
14
+
6
15
  $(document).ready(function() {
7
16
  $('#tabright> ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
8
17
  });