social_stream-base 0.9.21 → 0.9.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/app/assets/images/lightbox-blank.gif +0 -0
  2. data/app/assets/images/lightbox-btn-close.gif +0 -0
  3. data/app/assets/images/lightbox-btn-next.gif +0 -0
  4. data/app/assets/images/lightbox-btn-prev.gif +0 -0
  5. data/app/assets/images/lightbox-ico-loading.gif +0 -0
  6. data/app/assets/javascripts/activities.js.erb +40 -5
  7. data/app/assets/javascripts/activities_security_chosen-modified.jquery.js +767 -0
  8. data/app/assets/javascripts/messages.js +1 -0
  9. data/app/assets/javascripts/social_stream-base.js +1 -0
  10. data/app/assets/stylesheets/base.css.scss +1 -1
  11. data/app/assets/stylesheets/messages.css.scss +1 -0
  12. data/app/controllers/contacts_controller.rb +11 -7
  13. data/app/controllers/groups_controller.rb +11 -2
  14. data/app/views/activities/_new.html.erb +16 -2
  15. data/app/views/activities/index.js.erb +2 -0
  16. data/app/views/comments/create.js.erb +2 -0
  17. data/app/views/conversations/_conversation_full.html.erb +62 -44
  18. data/app/views/conversations/show.html.erb +1 -1
  19. data/app/views/conversations/show.js.erb +1 -1
  20. data/app/views/home/index.js.erb +3 -0
  21. data/app/views/layouts/_header_signed_in.erb +1 -0
  22. data/app/views/messages/new.js.erb +1 -1
  23. data/app/views/settings/_destroy.html.erb +17 -0
  24. data/app/views/settings/_index.html.erb +3 -2
  25. data/app/views/subjects/_show.js.erb +3 -0
  26. data/config/locales/en.yml +5 -0
  27. data/config/locales/es.yml +6 -1
  28. data/lib/social_stream/base/version.rb +1 -1
  29. data/spec/controllers/contacts_controller_spec.rb +8 -1
  30. data/spec/controllers/groups_controller_spec.rb +8 -11
  31. data/vendor/assets/javascripts/jquery.ae.image.resize.js +69 -0
  32. data/vendor/assets/javascripts/jquery.lightbox-with-resize-plugin.js +533 -0
  33. metadata +13 -6
  34. data/app/views/settings/_contacts.html.erb +0 -16
  35. data/vendor/assets/javascripts/chosen.jquery.js +0 -755
@@ -1,3 +1,4 @@
1
1
  //= require jquery.fcbkcomplete
2
2
  //= require jquery.validate
3
3
  //= require jquery.cleditor.min
4
+ //= require jquery.ae.image.resize
@@ -2,5 +2,6 @@
2
2
  //= require jquery_ujs
3
3
  //= require jquery-ui
4
4
  //= require modernizr
5
+ //= require jquery.lightbox-with-resize-plugin
5
6
  //
6
7
  //= require_tree .
@@ -122,7 +122,7 @@ button, input[type=submit]{margin: 10px 0 10px 0px;padding: 3px 20px 3px 20px;co
122
122
  .block .select_relations{ padding-top:20px; text-align: center; }
123
123
  #form_participants{vertical-align:60%;}
124
124
 
125
- div.chzn-container ul.chzn-choices li.search-field input.default{ cursor:pointer;}
125
+ div.chzn-container ul.chzn-choices li.search-field input{ cursor:pointer;}
126
126
 
127
127
  /********* Links SECTION **********/
128
128
  .contact_link a{ text-decoration:none;}
@@ -32,6 +32,7 @@
32
32
  .message .body{
33
33
  padding: 5px 5px 5px 5px;
34
34
  border: 1px solid $secondary-color;
35
+ word-wrap: break-word;
35
36
  }
36
37
  .message .content_left {
37
38
  float:left;
@@ -3,14 +3,8 @@ class ContactsController < ApplicationController
3
3
  before_filter :exclude_reflexive, :except => [ :index, :pending ]
4
4
 
5
5
  def index
6
- @total_contacts =
7
- Contact.sent_by(current_subject).
8
- joins(:receiver).merge(Actor.alphabetic).
9
- positive.
10
- select("actors.name")
11
-
12
6
  @contacts =
13
- @total_contacts.
7
+ total_contacts.
14
8
  merge(Actor.letter(params[:letter])).
15
9
  merge(Actor.name_search(params[:search])).
16
10
  related_by_param(params[:relation])
@@ -46,6 +40,8 @@ class ContactsController < ApplicationController
46
40
  end
47
41
 
48
42
  def pending
43
+ total_contacts
44
+
49
45
  @contacts = current_subject.pending_contacts
50
46
 
51
47
  respond_to do |format|
@@ -88,4 +84,12 @@ class ContactsController < ApplicationController
88
84
  end
89
85
  }.to_json
90
86
  end
87
+
88
+ def total_contacts
89
+ @total_contacts ||=
90
+ Contact.sent_by(current_subject).
91
+ joins(:receiver).merge(Actor.alphabetic).
92
+ positive.
93
+ select("actors.name")
94
+ end
91
95
  end
@@ -1,4 +1,6 @@
1
1
  class GroupsController < InheritedResources::Base
2
+ before_filter :authenticate_user!, :except => [ :index, :show ]
3
+
2
4
  # Set group founder to current_subject
3
5
  # Must do before authorization
4
6
  before_filter :set_founder, :only => :new
@@ -29,6 +31,15 @@ class GroupsController < InheritedResources::Base
29
31
  end
30
32
  end
31
33
 
34
+ def destroy
35
+ destroy! do |success, failure|
36
+ success.html {
37
+ self.current_subject = current_user
38
+ redirect_to :home
39
+ }
40
+ end
41
+ end
42
+
32
43
  protected
33
44
 
34
45
  # Overwrite resource method to support slug
@@ -40,8 +51,6 @@ class GroupsController < InheritedResources::Base
40
51
  private
41
52
 
42
53
  def set_founder
43
- return unless user_signed_in?
44
-
45
54
  params[:group] ||= {}
46
55
  params[:group][:_contact_id] ||= current_subject.ego_contact.id
47
56
  end
@@ -24,13 +24,27 @@
24
24
  </div>
25
25
 
26
26
  <div id="securities">
27
- <% if current_subject == receiver %>
27
+ <% if current_subject == receiver %>
28
+ <%= javascript_tag do %>
29
+ var relation_public = <%= receiver.relation_public.id %>;
30
+ var public_selected = false;
31
+ var relation_options = <%= escape_javascript(current_subject.activity_relations(receiver).sort.map{ |r| r.id }.to_json) %>;
32
+ var relation_public_pos = 0;
33
+ for(id in relation_options){
34
+ if(relation_options[id]==relation_public){
35
+ break;
36
+ }else{
37
+ relation_public_pos++;
38
+ }
39
+ }
40
+ //For security with check "var default_security_width = '100px';" in activities.js.erb
41
+ <% end %>
28
42
  <%= select_tag :_relation_ids, options_for_select(current_subject.activity_relations(receiver).sort.map{ |r| [ r.name, r.id ] }), :id => 'security', :multiple => true, :title => t("activity.privacy.myself.contacts.#{ receiver.class.to_s.underscore }") %>
29
43
  <% else %>
30
44
  <div id="security_chzn" class="chzn-container chzn-container-multi">
31
45
  <ul class="chzn-choices">
32
46
  <li class="search-field">
33
- <input type="text" value="<%= t "activity.privacy.outside.contacts.#{ receiver.class.to_s.underscore }", :receiver => truncate_name(receiver.name,:length => 15) %>" class="default" disabled="disabled">
47
+ <input type="text" value="<%= t "activity.privacy.outside.contacts.#{ receiver.class.to_s.underscore }", :receiver => truncate_name(receiver.name,:length => 15) %>" disabled="disabled">
34
48
  </li>
35
49
  </ul>
36
50
  </div>
@@ -1 +1,3 @@
1
1
  $('#wall-<%= params[:section] || "profile" %>').html("<%= escape_javascript render(:partial => 'index', :locals => { :owner => parent, :activities => @activities }) %>");
2
+
3
+ setActivityPrivacyTooltips();
@@ -2,4 +2,6 @@
2
2
  $("#comments_activity_<%= @comment.post_activity.parent.id %>").append("<%= escape_javascript(render @comment.post_activity) %>");
3
3
  $(".activities_comment_btn").hide();
4
4
 
5
+ setActivityPrivacyTooltips("<%= escape_javascript dom_id(@comment.post_activity) %>");
6
+
5
7
  unblock_all_forms();
@@ -1,53 +1,71 @@
1
1
  <div class="title">
2
- <h2><%= conversation.subject %></h2>
2
+ <h2><%= conversation.subject %></h2>
3
3
  </div>
4
4
  <div class="action">
5
- <% unless @box.eql?'trash' %><%= link_to(image_tag('btn/btn_delete.png', :atl => t('mailboxer.delete'), :title => t('mailboxer.delete')),
6
- conversation_path(conversation, :location => 'conversation', :box => @box),
7
- :confirm => t('mailboxer.delete_confirm', :object => conversation.subject),
8
- :method => :delete, :remote => true) %><% end %>
9
- </div>
10
- <div class="clearfloat">
5
+ <% unless @box.eql?'trash' %><%= link_to(image_tag('btn/btn_delete.png', :atl => t('mailboxer.delete'), :title => t('mailboxer.delete')),
6
+ conversation_path(conversation, :location => 'conversation', :box => @box),
7
+ :confirm => t('mailboxer.delete_confirm', :object => conversation.subject),
8
+ :method => :delete, :remote => true) %><% end %>
11
9
  </div>
10
+ <div class="clearfloat"></div>
12
11
  <div class="participants">
13
- <h3><%= t("message.participants") %>:</h3>
14
- <% conversation.recipients.each do |recp| %>
15
- <%= link_to image_tag(recp.logo.url(:contact), :title=>recp.name, :alt => recp.name), recp.subject %>
16
- <% end %>
12
+ <h3><%= t("message.participants") %>:</h3>
13
+ <% conversation.recipients.each do |recp| %>
14
+ <%= link_to image_tag(recp.logo.url(:contact), :title=>recp.name, :alt => recp.name), recp.subject %>
15
+ <% end %>
17
16
  </div>
18
17
  <div class="messages">
19
- <% @receipts.each do |receipt| %>
20
- <% message = receipt.message %>
21
- <% read_class = message.is_unread?(@actor) ? 'unread' : '' %>
22
- <%= render :partial => "messages/message",:object => message, :locals => {:read_class => read_class} %>
23
- <% end %>
18
+ <% @receipts.each do |receipt| %>
19
+ <% message = receipt.message %>
20
+ <% read_class = message.is_unread?(@actor) ? 'unread' : '' %>
21
+ <%= render :partial => "messages/message",:object => message, :locals => {:read_class => read_class} %>
22
+ <% end %>
24
23
 
25
- <% unless @box.eql?'trash' %>
26
- <br>
27
- <%= form_tag conversation_path(conversation), :method => :put, :class => "cont_conversation" do %>
28
- <% if @receipt and @receipt.errors.any? %>
29
- <div class="error">
30
- <h2><%= pluralize(@receipt.errors.count, "error") %> prohibited this message from being sent:</h2>
31
- <ul>
32
- <% @receipt.errors.full_messages.each do |msg| %>
33
- <li>
34
- <%= msg %>
35
- </li>
36
- <% end %>
37
- </ul>
38
- </div>
39
- <% end %>
40
- <div class="block">
41
- <div class="form_row">
42
- <%= t("message.answer") %>
43
- </div>
44
- <div class="form_row">
45
- <%= text_area_tag :body, nil,:rows =>6, :cols=> 53, :class => "required form_tag" %>
46
- </div>
47
- <div class="actions center">
48
- <%= submit_tag t('mailboxer.reply'), :name => :reply_all,:class => "button" %>
49
- </div>
50
- </div>
51
- <% end %>
52
- <%end %>
24
+ <% unless @box.eql?'trash' %>
25
+ <br>
26
+ <%= form_tag conversation_path(conversation), :method => :put, :class => "cont_conversation" do %>
27
+ <% if @receipt and @receipt.errors.any? %>
28
+ <div class="error">
29
+ <h2><%= pluralize(@receipt.errors.count, "error") %> prohibited this message from being sent:</h2>
30
+ <ul>
31
+ <% @receipt.errors.full_messages.each do |msg| %>
32
+ <li>
33
+ <%= msg %>
34
+ </li>
35
+ <% end %>
36
+ </ul>
37
+ </div>
38
+ <% end %>
39
+ <div class="block">
40
+ <div class="form_row">
41
+ <%= t("message.answer") %>
42
+ </div>
43
+ <div class="form_row">
44
+ <%= text_area_tag :body, nil,:rows =>6, :cols=> 53, :class => "required form_tag" %>
45
+ </div>
46
+ <div class="actions center">
47
+ <%= submit_tag t('mailboxer.reply'), :name => :reply_all,:class => "button" %>
48
+ </div>
49
+ </div>
50
+ <% end %>
51
+ <%end %>
53
52
  </div>
53
+ <%= javascript_tag do %>
54
+ $(document).ready(function(){
55
+ $(".message .body img").each(function(){
56
+ var link = '<a href=\"' + $(this).attr('src') + '\" class=\"img_link\"><img style=\"max-width:490px;max-height:490px;\"src=\"' + $(this).attr('src') + '\"></a>';
57
+ $(this).after(link);
58
+ $(this).remove();
59
+ $(".message .body img").aeImageResize({ height: 490, width: 490 });
60
+ $(".message .body a.img_link").lightBox({
61
+ maxHeight: 920,
62
+ maxWidth: 920,
63
+ imageLoading: '../assets/lightbox-ico-loading.gif',
64
+ imageBtnClose: '../assets/lightbox-btn-close.gif',
65
+ imageBtnPrev: '../assets/lightbox-btn-prev.gif',
66
+ imageBtnNext: '../assets/lightbox-btn-next.gif',
67
+ imageBlank: '../assets/lightbox-blank.gif'
68
+ });
69
+ })
70
+ });
71
+ <% end %>
@@ -13,7 +13,7 @@ $('.cont_conversation').validate({errorClass: "validation_error"});
13
13
  <% unless @box.eql?'trash' %>
14
14
  $("#body").cleditor({
15
15
  width:493,
16
- controls: "<%= t('cleditor.controls')%>"
16
+ controls: "<%= SocialStream.cleditor_controls %>"
17
17
  });
18
18
 
19
19
  var message_hash = window.location.hash.match(/^.*message_(\d+).*$/);
@@ -6,7 +6,7 @@ $('.cont_conversation').validate({errorClass: "validation_error"});
6
6
  <% unless @box.eql?'trash' %>
7
7
  $("#body").cleditor({
8
8
  width:493,
9
- controls: "<%= t('cleditor.controls')%>"
9
+ controls: "<%= SocialStream.cleditor_controls %>"
10
10
  });
11
11
 
12
12
  var message_hash = window.location.hash.match(/^.*message_(\d+).*$/);
@@ -1,2 +1,5 @@
1
1
  $('#wall').replaceWith("<%= escape_javascript render(:partial => 'activities/wall', :locals => { :activities => current_subject.wall(:home).page(params[:page]) }) %>");
2
+
3
+ setActivityPrivacyTooltips();
4
+
2
5
  $.scrollTo('#wall', 1500,{axis:'y'});
@@ -28,6 +28,7 @@
28
28
  </li>
29
29
  <li class="pipe">·</li>
30
30
  <li>
31
+ <%= link_to(t('notification.other'), notifications_path) %>
31
32
  <span id="header_notifications">
32
33
  <%= link_to( current_subject.mailbox.notifications.not_trashed.unread.count.to_s, notifications_path) %>
33
34
  </span>
@@ -18,7 +18,7 @@ var recipients = $("#_recipients").fcbkcomplete({
18
18
 
19
19
  $("#body").cleditor({
20
20
  width:493,
21
- controls: "<%= t('cleditor.controls')%>"
21
+ controls: "<%= SocialStream.cleditor_controls %>"
22
22
  });
23
23
 
24
24
  <% unless @recipient.nil? %>
@@ -0,0 +1,17 @@
1
+ <div class="block">
2
+ <div class="header">
3
+ <div class="header_text">
4
+ <%= t("#{ current_subject.class.to_s.underscore }.destroy.one")%>
5
+ </div>
6
+ </div>
7
+ <div class="content">
8
+ <div class="form_row">
9
+ <%= t("#{ current_subject.class.to_s.underscore }.destroy.explanation") %>
10
+ <%= link_to t("#{ current_subject.class.to_s.underscore }.destroy.go_ahead"),
11
+ current_subject,
12
+ :method => :delete,
13
+ :confirm => t("#{ current_subject.class.to_s.underscore }.destroy.last_confirm") %>
14
+ </div>
15
+ </div>
16
+ </div>
17
+
@@ -11,7 +11,8 @@
11
11
  <% if current_subject.respond_to? :authentication_token%>
12
12
  <%= render :partial => "api_key" %>
13
13
  <% end %>
14
- <%= render :partial => "contacts" %>
15
14
  <% if current_subject==current_user %>
16
- <%= render :partial => "devise/registrations/delete_account", :locals => { :resource => current_user, :resource_name => :user }%>
15
+ <%= render :partial => "devise/registrations/delete_account", :locals => { :resource => current_user, :resource_name => :user }%>
16
+ <% else %>
17
+ <%= render :partial => 'destroy' %>
17
18
  <% end %>
@@ -1,2 +1,5 @@
1
1
  $('#wall').replaceWith("<%= escape_javascript render(:partial => 'activities/wall', :locals => { :activities => subject.wall(:profile, :for => current_subject).page(params[:page]) }) %>");
2
+
3
+ setActivityPrivacyTooltips();
4
+
2
5
  $.scrollTo('#wall', 1500,{axis:'y'});
@@ -185,6 +185,11 @@ en:
185
185
  all: "All groups"
186
186
  all_n: "All groups (%{count})"
187
187
  by: "By groups"
188
+ destroy:
189
+ one: "Destroy group"
190
+ explanation: "All the activities, information and contacts of this group will be destroyed!"
191
+ go_ahead: "Yes, I am sure. Go ahead"
192
+ last_confirm: "This is your last chance. Are you really sure?"
188
193
  form:
189
194
  title: "Group"
190
195
  input: "What is the name of the group?"
@@ -170,7 +170,7 @@ es:
170
170
  default: "Encuentra"
171
171
  sentence1: "Descubre grupos y gente interesante"
172
172
  sentence2: "Encuentra la última actividad de tus contactos"
173
- register: "¡Inscríbete ahora!"
173
+ register: "¡Regístrate ahora!"
174
174
  share:
175
175
  default: "Comparte"
176
176
  sentence1: "Tus proyectos y actividades"
@@ -182,6 +182,11 @@ es:
182
182
  all: "Todos los grupos"
183
183
  all_n: "Todos los grupos (%{count})"
184
184
  by: "Por grupos"
185
+ destroy:
186
+ one: "Destruir grupo"
187
+ explanation: "¡Todas las actividades, información y contactos de este grupo serán destruídos!"
188
+ go_ahead: "Sí, estoy seguro/a. ¡Adelante!"
189
+ last_confirm: "Es tu última oportunidad. ¿Realmente estás seguro/a?"
185
190
  form:
186
191
  title: "Grupo"
187
192
  input: "¿Cuál es el nombre del grupo?"
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.9.21".freeze
3
+ VERSION = "0.9.22".freeze
4
4
  end
5
5
  end
@@ -9,13 +9,20 @@ describe ContactsController do
9
9
  @user = @tie.sender_subject
10
10
  end
11
11
 
12
- it "should be successful" do
12
+ it "should render index" do
13
13
  sign_in @user
14
14
 
15
15
  get 'index'
16
16
  response.should be_success
17
17
  end
18
18
 
19
+ it "should render pending" do
20
+ sign_in @user
21
+
22
+ get 'pending'
23
+ response.should be_success
24
+ end
25
+
19
26
  it "should render edit" do
20
27
  sign_in @user
21
28
 
@@ -19,21 +19,19 @@ describe GroupsController do
19
19
  end
20
20
 
21
21
  it "should not render new" do
22
- begin
23
- get :new
22
+ get :new
24
23
 
25
- assert false
26
- rescue CanCan::AccessDenied
27
- assert true
28
- end
24
+ response.should redirect_to(new_user_session_path)
29
25
  end
30
26
 
31
27
  context "faking a new group" do
32
- before do
33
- model_attributes[:_contact_id] = Factory(:user).ego_contact.id
34
- end
28
+ it "should deny creating" do
29
+ post :create, :group => { :name => "Test",
30
+ :_contact_id => Factory(:user).ego_contact.id
31
+ }
35
32
 
36
- it_should_behave_like "Deny Creating"
33
+ response.should redirect_to(new_user_session_path)
34
+ end
37
35
  end
38
36
 
39
37
  context "an existing group" do
@@ -158,7 +156,6 @@ describe GroupsController do
158
156
  # it_should_behave_like "Allow Updating"
159
157
  it_should_behave_like "Allow Destroying"
160
158
  end
161
-
162
159
  end
163
160
  end
164
161