social_stream-base 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@
14
14
  */
15
15
 
16
16
  /*
17
- * This have been modified: added telephone number validation
17
+ * This have been modified: added telephone number and emails validation
18
18
  */
19
19
 
20
20
  (function($) {
@@ -242,6 +242,7 @@ $.extend($.validator, {
242
242
  required: " This field is required.",
243
243
  remote: " Please fix this field.",
244
244
  email: " Please enter a valid email address.",
245
+ emails: " Please enter valid email addresses.",
245
246
  url: " Please enter a valid URL.",
246
247
  date: " Please enter a valid date.",
247
248
  dateISO: " Please enter a valid date (ISO).",
@@ -717,6 +718,8 @@ $.extend($.validator, {
717
718
  classRuleSettings: {
718
719
  required: {required: true},
719
720
  email: {email: true},
721
+ //ADDED
722
+ emails: {emails: true},
720
723
  url: {url: true},
721
724
  date: {date: true},
722
725
  dateISO: {dateISO: true},
@@ -972,6 +975,11 @@ $.extend($.validator, {
972
975
  // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
973
976
  return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
974
977
  },
978
+ //ADDED
979
+ emails: function(value, element) {
980
+ // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
981
+ return this.optional(element) || /^((, *)*((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)+$/i.test(value);
982
+ },
975
983
 
976
984
  // http://docs.jquery.com/Plugins/Validation/Methods/url
977
985
  url: function(value, element) {
@@ -8,7 +8,7 @@
8
8
  .toolbar_menu li ul li a, ul.menu ul.menu li ul li a { background: #fff; border-left: 5px #2A3890 solid;
9
9
  color: #2A3890; padding-left: 10px;}
10
10
  .toolbar_menu li ul li a:hover { background: #DEEFF8; border-left: 5px #2A3890 solid; padding-left: 15px;}
11
-
11
+ .toolbar_menu img { vertical-align: middle; padding-bottom: 3px; padding-right: 3px; padding-left: 3px; display: inline-block;}
12
12
  /*
13
13
  div.panel { border: 1px #2A3890 solid; padding: 5px; margin-top: 0px;}
14
14
  ul.menu li ul li a:hover, ul.menu ul.menu li ul li a:hover { background: #DEEFF8; border-left: 5px #2A3890 solid;
@@ -7,16 +7,18 @@ module ContactsHelper
7
7
  # to create new ties to actor
8
8
  def contact_to(a)
9
9
  if user_signed_in?
10
- if current_subject.ties_to?(a)
11
- current_subject.ties_to(a).map(&:relation_name).join(", ")
12
- else
13
- link_to t("contact.new.link"),
14
- edit_contact_path(current_subject.contact_to!(a)),
15
- :title => t("contact.new.title",
16
- :name => a.name)
17
- end
10
+ link_to contact_status(a),
11
+ edit_contact_path(current_subject.contact_to!(a)),
12
+ :title => t("contact.new.title",
13
+ :name => a.name)
18
14
  else
19
15
  link_to t("contact.new.link"), new_user_session_path
20
16
  end
21
17
  end
18
+
19
+ def contact_status(a)
20
+ current_subject.ties_to?(a) ?
21
+ current_subject.ties_to(a).map(&:relation_name).join(", ") :
22
+ t("contact.new.link")
23
+ end
22
24
  end
@@ -39,10 +39,6 @@ module ToolbarHelper
39
39
  # <% toolbar :profile => @group, :option => :contacts %>
40
40
  #
41
41
  def toolbar(options = {}, &block)
42
- old_toolbar(options,&block)
43
- end
44
-
45
- def old_toolbar(options = {}, &block)
46
42
  if options[:option] && block_given?
47
43
  menu_options[options[:option]] = capture(&block)
48
44
  end
@@ -85,7 +81,7 @@ module ToolbarHelper
85
81
  end
86
82
 
87
83
  def default_toolbar_menu
88
- home_menu
84
+ home_toolbar_menu
89
85
  end
90
86
 
91
87
  def home_toolbar_menu
@@ -147,15 +143,34 @@ module ToolbarHelper
147
143
  return render_items items
148
144
  end
149
145
 
150
- def profile_toolbar_menu(subject=current_subject)
146
+ def profile_toolbar_menu(subject = current_subject)
151
147
  items = Array.new
152
148
 
153
149
  if subject!=current_subject
150
+ #Like button
154
151
  items << {:key => :like_button,
155
152
  :name => link_like_params(subject)[0],
156
153
  :url => link_like_params(subject)[1],
157
154
  :options => {:link => link_like_params(subject)[2]}}
155
+
156
+ if user_signed_in?
157
+ #Relation button
158
+ items << {:key => :subject_relation,
159
+ :name => image_tag("btn/btn_friend.png") + contact_status(subject),
160
+ :url => edit_contact_path(current_subject.contact_to!(subject))
161
+ }
162
+ #Send message button
163
+ items << {:key => :send_message,
164
+ :name => image_tag("btn/btn_send.png")+t('message.send'),
165
+ :url => new_message_path(:receiver => subject.slug)
166
+ }
167
+ end
158
168
  end
169
+ #Information button
170
+ items << {:key => :subject_info,
171
+ :name => image_tag("btn/btn_edit.png")+t('menu.information'),
172
+ :url => [subject, :profile]
173
+ }
159
174
  return render_items items
160
175
  end
161
176
 
@@ -1,6 +1,6 @@
1
1
  class InvitationMailer < ActionMailer::Base
2
2
 
3
-
3
+ default :from => Mailboxer.default_from
4
4
 
5
5
  def send_invitation(receiver, sender, message)
6
6
  @sender= sender
data/app/models/actor.rb CHANGED
@@ -369,7 +369,7 @@ class Actor < ActiveRecord::Base
369
369
 
370
370
  # Build a new {Contact} from each that has not inverse
371
371
  def pending_contacts
372
- received_contacts.pending.all.map do |c|
372
+ received_contacts.not_reflexive.pending.all.map do |c|
373
373
  c.inverse ||
374
374
  c.receiver.contact_to!(c.sender)
375
375
  end
@@ -50,6 +50,8 @@ class Contact < ActiveRecord::Base
50
50
 
51
51
  scope :active, where(arel_table[:ties_count].gt(0))
52
52
 
53
+ scope :not_reflexive, where(arel_table[:sender_id].not_eq(arel_table[:receiver_id]))
54
+
53
55
  validates_presence_of :sender_id, :receiver_id
54
56
  validates_uniqueness_of :sender_id, :scope => :receiver_id
55
57
  validates_uniqueness_of :receiver_id, :scope => :sender_id
@@ -7,6 +7,8 @@
7
7
  ),
8
8
  :html => { :class => "new_comment", :id => "new_comment"+dom_id(activity) },
9
9
  :remote => true do |f| %>
10
+
11
+ <%= f.hidden_field :_contact_id %>
10
12
  <%= f.hidden_field :_activity_parent_id %>
11
13
 
12
14
  <%= f.text_field :text, :class =>"input_new_comments" , :id => "comment_text_"+dom_id(activity) %>
@@ -1,38 +1,55 @@
1
1
  <div>
2
- <div><%= @sender.name %> has invited you to <%= link_to( t('socialstream'), new_user_registration_path)%>
3
- <div><%= @message%></div>
2
+ <div>
3
+ <span id="name" style="font-weight: bold;"><%= @sender.name %></span> has invited you to <%= link_to( t('socialstream'), new_user_registration_url)%>
4
+ <br/>
5
+ <table width="50%" style="border-style: solid; border-color: #2A3890; margin:10px; border-width: 2px;">
6
+ <tr>
7
+ <td><img src="http://<%= ActionMailer::Base.default_url_options[:host] +@sender.logo.url(:profile)%>" alt="<%=@sender.name%>"></td>
8
+ <td>"<%= @message%>"</td>
9
+ </tr>
10
+ </table>
4
11
  </div>
5
12
  <div>
6
13
  <div>
7
- <%= t('frontpage.share.default')%>
14
+ <%= t('frontpage.share.default')%>:
8
15
  </div>
9
16
  <div>
10
17
  <ul>
11
- <li><%= t('frontpage.share.sentence1') %></li>
12
- <li><%= t('frontpage.share.sentence2') %></li>
18
+ <li>
19
+ <%= t('frontpage.share.sentence1') %>
20
+ </li>
21
+ <li>
22
+ <%= t('frontpage.share.sentence2') %>
23
+ </li>
13
24
  </ul>
14
25
  </div>
15
26
  </div>
16
-
27
+
17
28
  <div>
18
29
  <div>
19
- <%= t('frontpage.meet.default')%>
30
+ <%= t('frontpage.meet.default')%>:
20
31
  </div>
21
32
  <div>
22
33
  <ul>
23
- <li><%= t('frontpage.meet.sentence1') %></li>
34
+ <li>
35
+ <%= t('frontpage.meet.sentence1') %>
36
+ </li>
24
37
  </ul>
25
38
  </div>
26
39
  </div>
27
40
 
28
41
  <div>
29
42
  <div>
30
- <%= t('frontpage.collaborate.default')%>
43
+ <%= t('frontpage.collaborate.default')%>:
31
44
  </div>
32
45
  <div>
33
46
  <ul>
34
- <li><%= t('frontpage.collaborate.sentence1') %></li>
35
- <li><%= t('frontpage.collaborate.sentence2') %></li>
47
+ <li>
48
+ <%= t('frontpage.collaborate.sentence1') %>
49
+ </li>
50
+ <li>
51
+ <%= t('frontpage.collaborate.sentence2') %>
52
+ </li>
36
53
  </ul>
37
54
  </div>
38
55
  </div>
@@ -17,7 +17,7 @@
17
17
  </div>
18
18
 
19
19
  <div class="form_row">
20
- <%= text_field_tag 'mails', nil, :class => "required form_tag" %>
20
+ <%= text_field_tag 'mails', nil, :class => "required emails form_tag" %>
21
21
  </div>
22
22
  <div class="form_row form_label">
23
23
  <%=t('invitation.text')%>
@@ -9,10 +9,6 @@
9
9
  </div>
10
10
 
11
11
  <div id="menu_lateral" class="toolbar_menu">
12
- Testing SimpleNavigation
13
- <br>
14
- Please comment any bug
15
- <hr>
16
12
  <%= yield(:toolbar_menu).empty? ? home_toolbar_menu : yield(:toolbar_menu)%>
17
13
  </div>
18
14
 
@@ -1,6 +1,6 @@
1
1
  <% content_for :headers do %>
2
- <%= stylesheet_link_tag "menu", :media => "screen, projection" %>
3
- <%= javascript_include_tag 'menu' %>
2
+ <%= stylesheet_link_tag "menu", :media => "screen, projection" %>
3
+ <%= javascript_include_tag 'menu' %>
4
4
  <% end %>
5
5
 
6
6
  <%= render :partial => 'toolbar/logo', :locals => { :subject => subject } %>
@@ -9,19 +9,7 @@
9
9
  </div>
10
10
 
11
11
  <div id="menu_lateral" class="toolbar_menu">
12
- <ul>
13
- <% unless subject == current_subject %>
14
- <%= render :partial => "toolbar/profile_menu_tie_options", :locals => { :subject => subject } %>
15
- <% end %>
16
-
17
- <%= render :partial => "toolbar/profile_menu_basic_options", :locals => { :subject => subject } %>
18
- </ul>
19
- <hr>
20
- Testing SimpleNavigation
21
- <br>
22
- Please move along
23
- <hr>
24
- <%= yield(:toolbar_menu).empty? ? profile_toolbar_menu(subject) : yield(:toolbar_menu) %>
12
+ <%= yield(:toolbar_menu).empty? ? profile_toolbar_menu(subject) : yield(:toolbar_menu) %>
25
13
  </div>
26
14
 
27
15
  <div class="block space_center">
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.6.2".freeze
3
+ VERSION = "0.6.3".freeze
4
4
  end
5
5
  end
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  # Slug generation
24
24
  s.add_runtime_dependency('stringex', '~> 1.2.0')
25
25
  # Avatar attachments
26
- s.add_runtime_dependency('avatars_for_rails', '~> 0.1.0')
26
+ s.add_runtime_dependency('avatars_for_rails', '~> 0.1.3')
27
27
  # jQuery
28
28
  s.add_runtime_dependency('jquery-rails', '~> 1.0.9')
29
29
  # Authorization
@@ -21,6 +21,17 @@ describe CommentsController do
21
21
  end
22
22
 
23
23
  it_should_behave_like "Allow Creating"
24
+
25
+ it "should create with js" do
26
+ count = model_count
27
+ post :create, attributes.merge(:format => :js)
28
+
29
+ resource = assigns(model_sym)
30
+
31
+ model_count.should eq(count + 1)
32
+ resource.should be_valid
33
+ response.should be_success
34
+ end
24
35
  end
25
36
 
26
37
  describe "comment to friend" do
@@ -16,4 +16,13 @@ describe Actor do
16
16
  it "should generate relations" do
17
17
  assert Factory(:actor).relation_customs.present?
18
18
  end
19
+
20
+ context 'pending contacts' do
21
+ it 'should not include self' do
22
+ a = Factory(:actor)
23
+ c = a.contact_to!(a)
24
+
25
+ a.pending_contacts.should_not include(c)
26
+ end
27
+ end
19
28
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-base
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 2
10
- version: 0.6.2
9
+ - 3
10
+ version: 0.6.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - GING - DIT - UPM
@@ -107,12 +107,12 @@ dependencies:
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- hash: 27
110
+ hash: 29
111
111
  segments:
112
112
  - 0
113
113
  - 1
114
- - 0
115
- version: 0.1.0
114
+ - 3
115
+ version: 0.1.3
116
116
  type: :runtime
117
117
  version_requirements: *id006
118
118
  - !ruby/object:Gem::Dependency
@@ -1065,9 +1065,6 @@ files:
1065
1065
  - app/views/toolbar/_home.html.erb
1066
1066
  - app/views/toolbar/_logo.html.erb
1067
1067
  - app/views/toolbar/_profile.html.erb
1068
- - app/views/toolbar/_profile_menu_basic_options.html.erb
1069
- - app/views/toolbar/_profile_menu_options.html.erb
1070
- - app/views/toolbar/_profile_menu_tie_options.html.erb
1071
1068
  - app/views/users/_groups.html.erb
1072
1069
  - app/views/users/_index.html.erb
1073
1070
  - app/views/users/_sidebar_index.html.erb
@@ -1,5 +0,0 @@
1
- <%= menu_options[:profile] || capture do %>
2
- <li>
3
- <%= link_to( image_tag("btn/btn_edit.png", :class => "menu_icon")+t('menu.information'), [subject, :profile]) %>
4
- </li>
5
- <% end %>
@@ -1,10 +0,0 @@
1
- <%= menu_options[:profile] || capture do %>
2
- <li>
3
- <%= link_to( image_tag("btn/btn_edit.png", :class => "menu_icon")+t('menu.information'), [subject, :profile]) %>
4
- </li>
5
- <% end %>
6
-
7
- <%= menu_options[:uploads] || capture do %>
8
- <%= render :partial =>'toolbar/home_menu_uploads'%>
9
- <% end %>
10
-
@@ -1,26 +0,0 @@
1
- <%= menu_options[:like] || capture do %>
2
- <li>
3
- <div class="verb_like" id="like_<%= dom_id(subject) %>">
4
- <%= link_like(subject)%>
5
- </div>
6
- </li>
7
- <% end %>
8
-
9
- <%= menu_options[:contacts] || capture do %>
10
- <!-- TODO: create helper -->
11
- <% if user_signed_in? %>
12
- <li >
13
- <%= link_to image_tag("btn/btn_friend.png", :class => "menu_icon") +
14
- current_subject.ties_to(subject).map(&:relation_name).join(", "),
15
- edit_contact_path(current_subject.contact_to!(subject)) %>
16
- </li>
17
- <% end %>
18
- <% end %>
19
-
20
- <%= menu_options[:messages] || capture do %>
21
- <% if user_signed_in? %>
22
- <li >
23
- <%= link_to(image_tag("btn/btn_send.png", :class => "menu_icon")+t('message.send'), new_message_path(:receiver => subject.slug)) %>
24
- </li>
25
- <% end %>
26
- <% end %>