social_stream 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +2 -0
  2. data/Gemfile.lock +1 -1
  3. data/README.rdoc +4 -4
  4. data/app/controllers/private_messages_controller.rb +3 -0
  5. data/app/controllers/users_controller.rb +26 -0
  6. data/app/models/permission.rb +19 -0
  7. data/app/models/private_message.rb +6 -0
  8. data/app/models/profile.rb +3 -0
  9. data/app/models/tie.rb +28 -2
  10. data/app/models/user.rb +29 -13
  11. data/app/views/home/_options.html.erb +4 -1
  12. data/app/views/home/_right.html.erb +1 -1
  13. data/app/views/layouts/application.html.erb +7 -4
  14. data/app/views/private_messages/_form.html.erb +24 -0
  15. data/app/views/private_messages/_index.html.erb +24 -0
  16. data/app/views/private_messages/_location.html.erb +3 -0
  17. data/app/views/private_messages/_messages.html.erb +2 -0
  18. data/app/views/private_messages/_private_message.html.erb +17 -0
  19. data/app/views/private_messages/edit.html.erb +6 -0
  20. data/app/views/private_messages/index.html.erb +1 -0
  21. data/app/views/private_messages/index.js.erb +1 -0
  22. data/app/views/private_messages/new.html.erb +14 -0
  23. data/app/views/private_messages/show.html.erb +21 -0
  24. data/app/views/users/_contacts.html.erb +2 -0
  25. data/app/views/users/_profile.html.erb +44 -57
  26. data/app/views/users/edit.html.erb +164 -0
  27. data/config/locales/en.yml +5 -4
  28. data/config/routes.rb +1 -0
  29. data/lib/generators/social_stream/install_generator.rb +4 -0
  30. data/lib/generators/social_stream/templates/migration.rb +21 -3
  31. data/lib/generators/social_stream/templates/public/javascripts/jquery-ui.min.js +401 -0
  32. data/lib/generators/social_stream/templates/public/stylesheets/edit_user.css +80 -0
  33. data/lib/generators/social_stream/templates/public/stylesheets/message.css +46 -0
  34. data/lib/social_stream/populate.rb +26 -0
  35. data/lib/social_stream/version.rb +1 -1
  36. data/lib/tasks/db/populate.rake +2 -2
  37. data/spec/controllers/.groups_controller_spec.rb.swp +0 -0
  38. data/spec/controllers/.users_controller_spec.rb.swp +0 -0
  39. data/spec/controllers/frontpage_controller_spec.rb +11 -0
  40. data/spec/controllers/groups_controller_spec.rb +51 -0
  41. data/spec/controllers/home_controller_spec.rb +24 -0
  42. data/spec/controllers/users_controller_spec.rb +48 -0
  43. data/spec/factories/post.rb +1 -0
  44. data/spec/factories/user.rb +2 -0
  45. data/spec/spec_helper.rb +1 -1
  46. data/spec/support/devise.rb +4 -0
  47. metadata +29 -7
  48. data/spec/dummy/app/models/post.rb +0 -2
  49. data/spec/dummy/app/models/user.rb +0 -2
  50. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
@@ -0,0 +1,80 @@
1
+ /*Profile*/
2
+
3
+ .contact_link{
4
+ color: #4A58E0;
5
+ text-align: center;
6
+ text-decoration: underline;
7
+ }
8
+
9
+ .contact_link :hover{
10
+ color: #009933;
11
+ }
12
+ .title_section {
13
+ display: inline-block;
14
+ padding-bottom: 2px;
15
+ font-size: 12px;
16
+ font-weight: bold;
17
+ }
18
+ .title_righ{
19
+ color: #6C6D6F;
20
+ }
21
+
22
+ .info_left{
23
+ float: left;
24
+ }
25
+
26
+ .space_profile {
27
+ padding-right: 4px;
28
+ padding-top: 9px;
29
+ text-align: center;
30
+ }
31
+
32
+ /*Edit*/
33
+ .editField{
34
+ padding-top: 5px;
35
+ }
36
+ .section_highlight{
37
+ border-left: none;
38
+ border-bottom: thin solid #D4E4EA;
39
+ border-top: thin solid #D4E4EA;
40
+ border-right: thin solid #D4E4EA;
41
+ }
42
+ .section_normal{
43
+ border-left: thin solid #D4E4EA;
44
+ background-color: #EEF;
45
+ }
46
+
47
+ .sectionEdit{
48
+ border-bottom-color: #E1EEF5;
49
+ border-bottom-style: solid;
50
+ /*text-decoration: underline;*/
51
+ font-weight: bold;
52
+ font-size: 14px;
53
+ }
54
+ #user_profile_attributes_description, #user_profile_attributes_experience{
55
+ width: 95% ;
56
+ max-width: 95% ;
57
+ }
58
+
59
+
60
+ /*Datepicker*/
61
+ .ui-widget-header {
62
+ color: #2A3890;
63
+ font-weight: bold;
64
+ background: #E1EEF5;
65
+ border: solid #D4E4EA;
66
+ border-width: 2px;
67
+ }
68
+ .ui-widget-content {
69
+ color: #2A3890;
70
+ }
71
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
72
+ background: #E1EEF5;
73
+ border: solid #D4E4EA;
74
+ border-width: 2px;
75
+ color: #2A3890;
76
+ font-weight: normal;
77
+ }
78
+ #ui-datepicker-div{
79
+ font-size: 12px;
80
+ }
@@ -0,0 +1,46 @@
1
+ .option_msg{
2
+ float:right;
3
+ display:inline-block;
4
+ }
5
+
6
+ .edit_message{
7
+ display:inline-block;
8
+ }
9
+
10
+ .detele_message{
11
+ display:inline-block;
12
+ }
13
+
14
+ #new_message{
15
+ float:right;
16
+ padding-right:5px;
17
+ display:block;
18
+ }
19
+ #messages{
20
+ display:block;
21
+ }
22
+
23
+ .private_message{
24
+ display:block;
25
+ }
26
+
27
+ .actor_logo_message {
28
+ width: 38px;
29
+ padding: 8px 0px 8px 5px;
30
+ display: inline-block;
31
+ vertical-align: top;
32
+ }
33
+
34
+ .activity_content_message {
35
+ padding: 0px 0px 0px 0px;
36
+ display: inline-block;
37
+ color: #000;
38
+ width: 90%;
39
+ }
40
+
41
+ .actor_name_message {
42
+ font-weight: bold;
43
+ color: #2A3890;
44
+ font-size: 13px;
45
+ display: inline-block;
46
+ }
@@ -0,0 +1,26 @@
1
+ module SocialStream
2
+ module Populate
3
+
4
+ class << self
5
+ # Yields each element of array y times given by
6
+ # {power law distribution}[http://en.wikipedia.org/wiki/Power_law]
7
+ # y = ax**k + e
8
+ #
9
+ # Options: Each constant in the function
10
+ #
11
+ def power_law(array, options = {})
12
+ options[:a] ||= array.size
13
+ options[:k] ||= -2.5
14
+ options[:e] ||= 1
15
+
16
+ array.each do |i|
17
+ value = options[:a] * (array.index(i) + 1) ** options[:k] + options[:e]
18
+
19
+ value.round.times do
20
+ yield i
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "0.2.1".freeze
2
+ VERSION = "0.2.2".freeze
3
3
  end
@@ -58,7 +58,7 @@ namespace :db do
58
58
  # = Ties
59
59
  available_users.each do |u|
60
60
  users = available_users.dup - Array(u)
61
- user_relations = %w( Friend ).map{ |r| Relation.mode('User', 'User').find_by_name(r) }
61
+ user_relations = %w( friend ).map{ |r| Relation.mode('User', 'User').find_by_name(r) }
62
62
 
63
63
  Forgery::Basic.number(:at_most => users.size).times do
64
64
  user = users.delete_at((rand * users.size).to_i)
@@ -78,7 +78,7 @@ namespace :db do
78
78
 
79
79
  # = Posts
80
80
 
81
- Tie.all.each do |t|
81
+ SocialStream::Populate.power_law(Tie.all) do |t|
82
82
  # Only Post from users
83
83
  next if t.relation.sender_type == "Group"
84
84
 
@@ -0,0 +1,11 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe FrontpageController do
4
+ render_views
5
+
6
+ it "should render index" do
7
+ get :index
8
+ assert_response :success
9
+ end
10
+ end
11
+
@@ -0,0 +1,51 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe GroupsController do
4
+ render_views
5
+
6
+ describe "when Anonymous" do
7
+ it "should render index" do
8
+ pending
9
+
10
+ get :index
11
+
12
+ assert_response :success
13
+ end
14
+
15
+ it "should render show" do
16
+ pending
17
+
18
+ get :show, :id => Factory(:group).to_param
19
+
20
+ assert_response :success
21
+ end
22
+ end
23
+
24
+ describe "when authenticated" do
25
+ before do
26
+ @user = Factory(:user)
27
+
28
+ sign_in @user
29
+ end
30
+
31
+ it "should render index" do
32
+ get :index
33
+
34
+ assert_response :success
35
+ end
36
+
37
+ it "should render member group" do
38
+ @group = Factory(:member, :sender => @user.actor).receiver_subject
39
+ get :show, :id => @group.to_param
40
+
41
+ assert_response :success
42
+ end
43
+
44
+ it "should render other group" do
45
+ get :show, :id => Factory(:group).to_param
46
+
47
+ assert_response :success
48
+ end
49
+ end
50
+ end
51
+
@@ -0,0 +1,24 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe HomeController do
4
+ render_views
5
+
6
+ describe "when Anonymous" do
7
+ it "should redirect to login" do
8
+ get :index
9
+ response.should redirect_to(new_user_session_path)
10
+ end
11
+ end
12
+
13
+ describe "when authenticated" do
14
+ before do
15
+ sign_in Factory(:user)
16
+ end
17
+
18
+ it "should render" do
19
+ get :index
20
+ assert_response :success
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,48 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe UsersController do
4
+ render_views
5
+
6
+ describe "when Anonymous" do
7
+ it "should render index" do
8
+ get :index
9
+
10
+ assert_response :success
11
+ end
12
+
13
+ it "should render show" do
14
+ pending
15
+
16
+ get :show, :id => Factory(:user).to_param
17
+
18
+ assert_response :success
19
+ end
20
+ end
21
+
22
+ describe "when authenticated" do
23
+ before do
24
+ @user = Factory(:user)
25
+
26
+ sign_in @user
27
+ end
28
+
29
+ it "should render index" do
30
+ get :index
31
+
32
+ assert_response :success
33
+ end
34
+
35
+ it "should render self page" do
36
+ get :show, :id => @user.to_param
37
+
38
+ assert_response :success
39
+ end
40
+
41
+ it "should render self page" do
42
+ get :show, :id => Factory(:user).to_param
43
+
44
+ assert_response :success
45
+ end
46
+ end
47
+ end
48
+
@@ -1,3 +1,4 @@
1
1
  Factory.define :post do |p|
2
+ p.sequence(:text) { |n| "Post #{ n }" }
2
3
  p._activity_tie_id { |q| q.association(:tie) }
3
4
  end
@@ -1,4 +1,6 @@
1
1
  Factory.define :user do |u|
2
2
  u.sequence(:name) { |n| "User #{ n }" }
3
3
  u.sequence(:email) { |n| "user#{ n }@example.com" }
4
+ u.password "testing"
5
+ u.password_confirmation "testing"
4
6
  end
data/spec/spec_helper.rb CHANGED
@@ -17,7 +17,7 @@ Capybara.default_driver = :rack_test
17
17
  Capybara.default_selector = :css
18
18
 
19
19
  # FIXME orm
20
- #ActiveRecord::Migration.verbose = false
20
+ ActiveRecord::Migration.verbose = false
21
21
 
22
22
  # Base migration
23
23
  #require 'lib/generators/social_stream/templates/migration'
@@ -0,0 +1,4 @@
1
+ RSpec.configure do |config|
2
+ # Add authentication helpers
3
+ config.include Devise::TestHelpers, :type => :controller
4
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Antonio Tapiador
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-17 00:00:00 +01:00
19
+ date: 2010-11-24 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -312,6 +312,7 @@ files:
312
312
  - app/controllers/home_controller.rb
313
313
  - app/controllers/likes_controller.rb
314
314
  - app/controllers/posts_controller.rb
315
+ - app/controllers/private_messages_controller.rb
315
316
  - app/controllers/ties_controller.rb
316
317
  - app/controllers/users_controller.rb
317
318
  - app/helpers/activities_helper.rb
@@ -328,6 +329,8 @@ files:
328
329
  - app/models/group.rb
329
330
  - app/models/permission.rb
330
331
  - app/models/post.rb
332
+ - app/models/private_message.rb
333
+ - app/models/profile.rb
331
334
  - app/models/relation.rb
332
335
  - app/models/relation_permission.rb
333
336
  - app/models/tie.rb
@@ -378,6 +381,16 @@ files:
378
381
  - app/views/posts/_post.html.erb
379
382
  - app/views/posts/create.js.erb
380
383
  - app/views/posts/destroy.js.erb
384
+ - app/views/private_messages/_form.html.erb
385
+ - app/views/private_messages/_index.html.erb
386
+ - app/views/private_messages/_location.html.erb
387
+ - app/views/private_messages/_messages.html.erb
388
+ - app/views/private_messages/_private_message.html.erb
389
+ - app/views/private_messages/edit.html.erb
390
+ - app/views/private_messages/index.html.erb
391
+ - app/views/private_messages/index.js.erb
392
+ - app/views/private_messages/new.html.erb
393
+ - app/views/private_messages/show.html.erb
381
394
  - app/views/ties/_form.html.erb
382
395
  - app/views/ties/_new.html.erb
383
396
  - app/views/ties/_pending.html.erb
@@ -401,6 +414,7 @@ files:
401
414
  - app/views/users/_profile.html.erb
402
415
  - app/views/users/_right_index.html.erb
403
416
  - app/views/users/_right_show.html.erb
417
+ - app/views/users/edit.html.erb
404
418
  - app/views/users/index.html.erb
405
419
  - app/views/users/show.html.erb
406
420
  - config/locales/en.yml
@@ -533,6 +547,7 @@ files:
533
547
  - lib/generators/social_stream/templates/public/images/ui-icons_cd0a0a_256x240.png
534
548
  - lib/generators/social_stream/templates/public/javascripts/hoverIntent.js
535
549
  - lib/generators/social_stream/templates/public/javascripts/jquery-ui-1.8.4.custom.min.js
550
+ - lib/generators/social_stream/templates/public/javascripts/jquery-ui.min.js
536
551
  - lib/generators/social_stream/templates/public/javascripts/jquery.boxy.js
537
552
  - lib/generators/social_stream/templates/public/javascripts/jquery.livequery.js
538
553
  - lib/generators/social_stream/templates/public/javascripts/menu.js
@@ -542,11 +557,13 @@ files:
542
557
  - lib/generators/social_stream/templates/public/stylesheets/boxy.css
543
558
  - lib/generators/social_stream/templates/public/stylesheets/browse.css
544
559
  - lib/generators/social_stream/templates/public/stylesheets/carousel.css
560
+ - lib/generators/social_stream/templates/public/stylesheets/edit_user.css
545
561
  - lib/generators/social_stream/templates/public/stylesheets/frontpage.css
546
562
  - lib/generators/social_stream/templates/public/stylesheets/header.css
547
563
  - lib/generators/social_stream/templates/public/stylesheets/home.css
548
564
  - lib/generators/social_stream/templates/public/stylesheets/index.css
549
565
  - lib/generators/social_stream/templates/public/stylesheets/menu.css
566
+ - lib/generators/social_stream/templates/public/stylesheets/message.css
550
567
  - lib/generators/social_stream/templates/public/stylesheets/middle.css
551
568
  - lib/generators/social_stream/templates/public/stylesheets/right.css
552
569
  - lib/generators/social_stream/templates/public/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
@@ -573,6 +590,7 @@ files:
573
590
  - lib/social_stream/models/activity_object.rb
574
591
  - lib/social_stream/models/actor.rb
575
592
  - lib/social_stream/models/supertype.rb
593
+ - lib/social_stream/populate.rb
576
594
  - lib/social_stream/rails.rb
577
595
  - lib/social_stream/rails/common.rb
578
596
  - lib/social_stream/rails/engine.rb
@@ -581,12 +599,15 @@ files:
581
599
  - lib/social_stream/version.rb
582
600
  - lib/tasks/db/populate.rake
583
601
  - social_stream.gemspec
602
+ - spec/controllers/.groups_controller_spec.rb.swp
603
+ - spec/controllers/.users_controller_spec.rb.swp
604
+ - spec/controllers/frontpage_controller_spec.rb
605
+ - spec/controllers/groups_controller_spec.rb
606
+ - spec/controllers/home_controller_spec.rb
607
+ - spec/controllers/users_controller_spec.rb
584
608
  - spec/dummy/Rakefile
585
609
  - spec/dummy/app/controllers/application_controller.rb
586
610
  - spec/dummy/app/helpers/application_helper.rb
587
- - spec/dummy/app/models/post.rb
588
- - spec/dummy/app/models/user.rb
589
- - spec/dummy/app/views/layouts/application.html.erb
590
611
  - spec/dummy/config.ru
591
612
  - spec/dummy/config/application.rb
592
613
  - spec/dummy/config/boot.rb
@@ -638,6 +659,7 @@ files:
638
659
  - spec/spec_helper.rb
639
660
  - spec/support/cancan.rb
640
661
  - spec/support/db.rb
662
+ - spec/support/devise.rb
641
663
  has_rdoc: true
642
664
  homepage:
643
665
  licenses: []