social_stream 0.3.3 → 0.3.4

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 (50) hide show
  1. data/.gitignore +3 -0
  2. data/Rakefile +2 -0
  3. data/app/controllers/contacts_controller.rb +28 -0
  4. data/app/controllers/groups_controller.rb +11 -0
  5. data/app/controllers/users_controller.rb +11 -0
  6. data/app/helpers/contacts_helper.rb +2 -0
  7. data/app/models/group.rb +21 -2
  8. data/app/models/profile.rb +26 -0
  9. data/app/views/contacts/index.html.erb +2 -0
  10. data/app/views/groups/_index.html.erb +2 -4
  11. data/app/views/groups/_middle_index.html.erb +74 -0
  12. data/app/views/groups/_new.html.erb +22 -3
  13. data/app/views/groups/_right_index.html.erb +19 -0
  14. data/app/views/groups/_right_show.html.erb +3 -3
  15. data/app/views/groups/index.html.erb +15 -51
  16. data/app/views/groups/index.js.erb +1 -0
  17. data/app/views/home/_options.html.erb +1 -1
  18. data/app/views/layouts/application.html.erb +5 -10
  19. data/app/views/users/_index.html.erb +2 -4
  20. data/app/views/users/_middle_index.html.erb +6 -0
  21. data/app/views/users/_profile.html.erb +60 -10
  22. data/app/views/users/_right_index.html.erb +19 -0
  23. data/app/views/users/edit.html.erb +19 -14
  24. data/app/views/users/index.html.erb +14 -33
  25. data/app/views/users/index.js.erb +1 -0
  26. data/app/views/users/update.js.erb +32 -10
  27. data/config/locales/en.yml +7 -1
  28. data/config/routes.rb +1 -1
  29. data/lib/generators/social_stream/templates/migration.rb +1 -0
  30. data/lib/generators/social_stream/templates/public/images/btn/search.png +0 -0
  31. data/lib/generators/social_stream/templates/public/images/fcbkcomplete/close.gif +0 -0
  32. data/lib/generators/social_stream/templates/public/images/loader.gif +0 -0
  33. data/lib/generators/social_stream/templates/public/javascripts/ajax.paginate.js +53 -0
  34. data/lib/generators/social_stream/templates/public/javascripts/jqcloud-0.1.3.min.js +11 -0
  35. data/lib/generators/social_stream/templates/public/javascripts/jquery.ba-url.js +1091 -0
  36. data/lib/generators/social_stream/templates/public/javascripts/jquery.fcbkcomplete.min.js +77 -0
  37. data/lib/generators/social_stream/templates/public/javascripts/jquery.js +640 -344
  38. data/lib/generators/social_stream/templates/public/javascripts/jquery.min.js +16 -0
  39. data/lib/generators/social_stream/templates/public/javascripts/jquery.validate.js +31 -19
  40. data/lib/generators/social_stream/templates/public/javascripts/rails.js +157 -146
  41. data/lib/generators/social_stream/templates/public/stylesheets/edit_user.css +14 -3
  42. data/lib/generators/social_stream/templates/public/stylesheets/fcbkComplete.css +36 -0
  43. data/lib/generators/social_stream/templates/public/stylesheets/jqcloud.css +62 -0
  44. data/lib/generators/social_stream/templates/public/stylesheets/social_stream.css +3 -0
  45. data/lib/generators/social_stream/templates/public/stylesheets/users.css +22 -0
  46. data/lib/social_stream/models/subject.rb +2 -1
  47. data/lib/social_stream/version.rb +1 -1
  48. data/social_stream.gemspec +2 -1
  49. data/spec/controllers/contacts_controller_spec.rb +12 -0
  50. metadata +40 -7
@@ -1,146 +1,157 @@
1
- jQuery(function ($) {
2
- var csrf_token = $('meta[name=csrf-token]').attr('content'),
3
- csrf_param = $('meta[name=csrf-param]').attr('content');
4
-
5
- $.fn.extend({
6
- /**
7
- * Triggers a custom event on an element and returns the event result
8
- * this is used to get around not being able to ensure callbacks are placed
9
- * at the end of the chain.
10
- *
11
- * TODO: deprecate with jQuery 1.4.2 release, in favor of subscribing to our
12
- * own events and placing ourselves at the end of the chain.
13
- */
14
- triggerAndReturn: function (name, data) {
15
- var event = new $.Event(name);
16
- this.trigger(event, data);
17
-
18
- return event.result !== false;
19
- },
20
-
21
- /**
22
- * Handles execution of remote calls firing overridable events along the way
23
- */
24
- callRemote: function () {
25
- var el = this,
26
- method = el.attr('method') || el.attr('data-method') || 'GET',
27
- url = el.attr('action') || el.attr('href'),
28
- dataType = el.attr('data-type') || 'script';
29
-
30
- if (url === undefined) {
31
- throw "No URL specified for remote call (action or href must be present).";
32
- } else {
33
- if (el.triggerAndReturn('ajax:before')) {
34
- var data = el.is('form') ? el.serializeArray() : [];
35
- $.ajax({
36
- url: url,
37
- data: data,
38
- dataType: dataType,
39
- type: method.toUpperCase(),
40
- beforeSend: function (xhr) {
41
- el.trigger('ajax:loading', xhr);
42
- },
43
- success: function (data, status, xhr) {
44
- el.trigger('ajax:success', [data, status, xhr]);
45
- },
46
- complete: function (xhr) {
47
- el.trigger('ajax:complete', xhr);
48
- },
49
- error: function (xhr, status, error) {
50
- el.trigger('ajax:failure', [xhr, status, error]);
51
- }
52
- });
53
- }
54
-
55
- el.trigger('ajax:after');
56
- }
57
- }
58
- });
59
-
60
- /**
61
- * confirmation handler
62
- */
63
- var jqueryVersion = $().jquery;
64
-
65
- if ( (jqueryVersion === '1.4') || (jqueryVersion === '1.4.1') || (jqueryVersion === '1.4.2')){
66
- $('a[data-confirm],input[data-confirm]').live('click', function () {
67
- var el = $(this);
68
- if (el.triggerAndReturn('confirm')) {
69
- if (!confirm(el.attr('data-confirm'))) {
70
- return false;
71
- }
72
- }
73
- });
74
- } else {
75
- $('body').delegate('a[data-confirm],input[data-confirm]', 'click', function () {
76
- var el = $(this);
77
- if (el.triggerAndReturn('confirm')) {
78
- if (!confirm(el.attr('data-confirm'))) {
79
- return false;
80
- }
81
- }
82
- });
83
- }
84
-
85
-
86
-
87
- /**
88
- * remote handlers
89
- */
90
- $('form[data-remote]').live('submit', function (e) {
91
- $(this).callRemote();
92
- e.preventDefault();
93
- });
94
-
95
- $('a[data-remote],input[data-remote]').live('click', function (e) {
96
- $(this).callRemote();
97
- e.preventDefault();
98
- });
99
-
100
- $('a[data-method]:not([data-remote])').live('click', function (e){
101
- var link = $(this),
102
- href = link.attr('href'),
103
- method = link.attr('data-method'),
104
- form = $('<form method="post" action="'+href+'"></form>'),
105
- metadata_input = '<input name="_method" value="'+method+'" type="hidden" />';
106
-
107
- if (csrf_param != null && csrf_token != null) {
108
- metadata_input += '<input name="'+csrf_param+'" value="'+csrf_token+'" type="hidden" />';
109
- }
110
-
111
- form.hide()
112
- .append(metadata_input)
113
- .appendTo('body');
114
-
115
- e.preventDefault();
116
- form.submit();
117
- });
118
-
119
- /**
120
- * disable-with handlers
121
- */
122
- var disable_with_input_selector = 'input[data-disable-with]';
123
- var disable_with_form_remote_selector = 'form[data-remote]:has(' + disable_with_input_selector + ')';
124
- var disable_with_form_not_remote_selector = 'form:not([data-remote]):has(' + disable_with_input_selector + ')';
125
-
126
- var disable_with_input_function = function () {
127
- $(this).find(disable_with_input_selector).each(function () {
128
- var input = $(this);
129
- input.data('enable-with', input.val())
130
- .attr('value', input.attr('data-disable-with'))
131
- .attr('disabled', 'disabled');
132
- });
133
- };
134
-
135
- $(disable_with_form_remote_selector).live('ajax:before', disable_with_input_function);
136
- $(disable_with_form_not_remote_selector).live('submit', disable_with_input_function);
137
-
138
- $(disable_with_form_remote_selector).live('ajax:complete', function () {
139
- $(this).find(disable_with_input_selector).each(function () {
140
- var input = $(this);
141
- input.removeAttr('disabled')
142
- .val(input.data('enable-with'));
143
- });
144
- });
145
-
146
- });
1
+ /**
2
+ * Unobtrusive scripting adapter for jQuery
3
+ *
4
+ * Requires jQuery 1.4.3 or later.
5
+ * https://github.com/rails/jquery-ujs
6
+ */
7
+
8
+ (function($) {
9
+ // Make sure that every Ajax request sends the CSRF token
10
+ function CSRFProtection(xhr) {
11
+ var token = $('meta[name="csrf-token"]').attr('content');
12
+ if (token) xhr.setRequestHeader('X-CSRF-Token', token);
13
+ }
14
+ if ('ajaxPrefilter' in $) $.ajaxPrefilter(function(options, originalOptions, xhr){ CSRFProtection(xhr) });
15
+ else $(document).ajaxSend(function(e, xhr){ CSRFProtection(xhr) });
16
+
17
+ // Triggers an event on an element and returns the event result
18
+ function fire(obj, name, data) {
19
+ var event = new $.Event(name);
20
+ obj.trigger(event, data);
21
+ return event.result !== false;
22
+ }
23
+
24
+ // Submits "remote" forms and links with ajax
25
+ function handleRemote(element) {
26
+ var method, url, data,
27
+ dataType = element.attr('data-type') || ($.ajaxSettings && $.ajaxSettings.dataType);
28
+
29
+ if (element.is('form')) {
30
+ method = element.attr('method');
31
+ url = element.attr('action');
32
+ data = element.serializeArray();
33
+ // memoized value from clicked submit button
34
+ var button = element.data('ujs:submit-button');
35
+ if (button) {
36
+ data.push(button);
37
+ element.data('ujs:submit-button', null);
38
+ }
39
+ } else {
40
+ method = element.attr('data-method');
41
+ url = element.attr('href');
42
+ data = null;
43
+ }
44
+
45
+ $.ajax({
46
+ url: url, type: method || 'GET', data: data, dataType: dataType,
47
+ // stopping the "ajax:beforeSend" event will cancel the ajax request
48
+ beforeSend: function(xhr, settings) {
49
+ if (settings.dataType === undefined) {
50
+ xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
51
+ }
52
+ return fire(element, 'ajax:beforeSend', [xhr, settings]);
53
+ },
54
+ success: function(data, status, xhr) {
55
+ element.trigger('ajax:success', [data, status, xhr]);
56
+ },
57
+ complete: function(xhr, status) {
58
+ element.trigger('ajax:complete', [xhr, status]);
59
+ },
60
+ error: function(xhr, status, error) {
61
+ element.trigger('ajax:error', [xhr, status, error]);
62
+ }
63
+ });
64
+ }
65
+
66
+ // Handles "data-method" on links such as:
67
+ // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
68
+ function handleMethod(link) {
69
+ var href = link.attr('href'),
70
+ method = link.attr('data-method'),
71
+ csrf_token = $('meta[name=csrf-token]').attr('content'),
72
+ csrf_param = $('meta[name=csrf-param]').attr('content'),
73
+ form = $('<form method="post" action="' + href + '"></form>'),
74
+ metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
75
+
76
+ if (csrf_param !== undefined && csrf_token !== undefined) {
77
+ metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
78
+ }
79
+
80
+ form.hide().append(metadata_input).appendTo('body');
81
+ form.submit();
82
+ }
83
+
84
+ function disableFormElements(form) {
85
+ form.find('input[data-disable-with]').each(function() {
86
+ var input = $(this);
87
+ input.data('ujs:enable-with', input.val())
88
+ .val(input.attr('data-disable-with'))
89
+ .attr('disabled', 'disabled');
90
+ });
91
+ }
92
+
93
+ function enableFormElements(form) {
94
+ form.find('input[data-disable-with]').each(function() {
95
+ var input = $(this);
96
+ input.val(input.data('ujs:enable-with')).removeAttr('disabled');
97
+ });
98
+ }
99
+
100
+ function allowAction(element) {
101
+ var message = element.attr('data-confirm');
102
+ return !message || (fire(element, 'confirm') && confirm(message));
103
+ }
104
+
105
+ function requiredValuesMissing(form) {
106
+ var missing = false;
107
+ form.find('input[name][required]').each(function() {
108
+ if (!$(this).val()) missing = true;
109
+ });
110
+ return missing;
111
+ }
112
+
113
+ $('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
114
+ var link = $(this);
115
+ if (!allowAction(link)) return false;
116
+
117
+ if (link.attr('data-remote') != undefined) {
118
+ handleRemote(link);
119
+ return false;
120
+ } else if (link.attr('data-method')) {
121
+ handleMethod(link);
122
+ return false;
123
+ }
124
+ });
125
+
126
+ $('form').live('submit.rails', function(e) {
127
+ var form = $(this), remote = form.attr('data-remote') != undefined;
128
+ if (!allowAction(form)) return false;
129
+
130
+ // skip other logic when required values are missing
131
+ if (requiredValuesMissing(form)) return !remote;
132
+
133
+ if (remote) {
134
+ handleRemote(form);
135
+ return false;
136
+ } else {
137
+ // slight timeout so that the submit button gets properly serialized
138
+ setTimeout(function(){ disableFormElements(form) }, 13);
139
+ }
140
+ });
141
+
142
+ $('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() {
143
+ var button = $(this);
144
+ if (!allowAction(button)) return false;
145
+ // register the pressed submit button
146
+ var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
147
+ button.closest('form').data('ujs:submit-button', data);
148
+ });
149
+
150
+ $('form').live('ajax:beforeSend.rails', function(event) {
151
+ if (this == event.target) disableFormElements($(this));
152
+ });
153
+
154
+ $('form').live('ajax:complete.rails', function(event) {
155
+ if (this == event.target) enableFormElements($(this));
156
+ });
157
+ })( jQuery );
@@ -23,16 +23,27 @@
23
23
  float: left;
24
24
  }
25
25
 
26
- .space_profile {
26
+ #personal_info {
27
27
  padding-right: 4px;
28
- padding-top: 9px;
29
- text-align: center;
28
+ padding-top: 30px;
30
29
  }
31
30
 
32
31
  /*Edit*/
32
+ .confirmed{
33
+ color: #009933;
34
+ padding-left: 5%;
35
+ }
33
36
  .editField{
34
37
  padding-top: 5px;
35
38
  }
39
+ .error{
40
+ color: #A2042B;
41
+ font-weight: bold;
42
+ }
43
+ .error_explanation{
44
+ color: #A2042B;
45
+ padding-left: 5%;
46
+ }
36
47
  .section_highlight{
37
48
  border-left: none;
38
49
  border-bottom: thin solid #D4E4EA;
@@ -0,0 +1,36 @@
1
+ /* TextboxList sample CSS */
2
+ ul.holder { margin: 0; border: 1px solid #999; overflow: hidden; height: auto !important; height: 1%; padding: 4px 5px 0; }
3
+ *:first-child+html ul.holder { padding-bottom: 2px; } * html ul.holder { padding-bottom: 2px; } /* ie7 and below */
4
+ ul.holder li { float: left; list-style-type: none; margin: 0 5px 4px 0; white-space:nowrap;}
5
+ ul.holder li.bit-box, ul.holder li.bit-input input { font: 11px "Lucida Grande", "Verdana"; }
6
+ ul.holder li.bit-box { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; border: 1px solid #CAD8F3; background: #DEE7F8; padding: 1px 5px 2px; }
7
+ ul.holder li.bit-box-focus { border-color: #598BEC; background: #598BEC; color: #fff; }
8
+ ul.holder li.bit-input input { width: auto; overflow:visible; margin: 0; border: 0px; outline: 0; padding: 3px 0px 2px; } /* no left/right padding here please */
9
+ ul.holder li.bit-input input.smallinput { width: 20px; }
10
+
11
+ /* Facebook demo CSS */
12
+ ul.holder { width: 500px; }
13
+ ul.holder { margin: 0 !important }
14
+ ul.holder li.bit-box, #apple-list ul.holder li.bit-box { padding-right: 15px; position: relative; z-index:1000;}
15
+ #apple-list ul.holder li.bit-input { margin: 0; }
16
+ #apple-list ul.holder li.bit-input input.smallinput { width: 5px; }
17
+ ul.holder li.bit-hover { background: #BBCEF1; border: 1px solid #6D95E0; }
18
+ ul.holder li.bit-box-focus { border-color: #598BEC; background: #598BEC; color: #fff; }
19
+ ul.holder li.bit-box a.closebutton { position: absolute; right: 4px; top: 5px; display: block; width: 7px; height: 7px; font-size: 1px; background: url('../images/fcbkcomplete/close.gif'); }
20
+ ul.holder li.bit-box a.closebutton:hover { background-position: 7px; }
21
+ ul.holder li.bit-box-focus a.closebutton, ul.holder li.bit-box-focus a.closebutton:hover { background-position: bottom; }
22
+
23
+ /* Autocompleter */
24
+
25
+ .facebook-auto { display: none; position: absolute; width: 512px; background: #eee; z-index:1001;}
26
+ .facebook-auto .default { padding: 5px 7px; border: 1px solid #ccc; border-width: 0 1px 1px;font-family:"Lucida Grande","Verdana"; font-size:11px; }
27
+ .facebook-auto ul { display: none; margin: 0; padding: 0; overflow: auto; position:absolute; z-index:9999}
28
+ .facebook-auto ul li { padding: 5px 12px; z-index: 1000; cursor: pointer; margin: 0; list-style-type: none; border: 1px solid #ccc; border-width: 0 1px 1px; font: 11px "Lucida Grande", "Verdana"; background-color: #eee }
29
+ .facebook-auto ul li em { font-weight: bold; font-style: normal; background: #ccc; }
30
+ .facebook-auto ul li.auto-focus { background: #4173CC; color: #fff; }
31
+ .facebook-auto ul li.auto-focus em { background: none; }
32
+ .deleted { background-color:#4173CC !important; color:#ffffff !important;}
33
+ .hidden { display:none;}
34
+
35
+ #demo ul.holder li.bit-input input { padding: 2px 0 1px; border: 1px solid #999; }
36
+ .ie6fix {height:1px;width:1px; position:absolute;top:0px;left:0px;z-index:1;}
@@ -0,0 +1,62 @@
1
+ div#wordcloud {
2
+ font-family: "Helvetica", "Arial", sans-serif;
3
+ color: #09f;
4
+ overflow: hidden;
5
+ position: relative;
6
+ width: 200px;
7
+ height: 200px;
8
+ }
9
+
10
+ div#wordcloud a {
11
+ color: inherit;
12
+ text-decoration: none;
13
+ }
14
+ div#wordcloud a:hover {
15
+ color: #0df;
16
+ }
17
+ div#wordcloud a:hover {
18
+ color: #0cf;
19
+ }
20
+ div#wordcloud span {
21
+ padding: 0;
22
+ }
23
+ div#wordcloud span.w10 {
24
+ font-size: 44px;
25
+ color: #0cf;
26
+ }
27
+ div#wordcloud span.w9 {
28
+ font-size: 40px;
29
+ color: #0cf;
30
+ }
31
+ div#wordcloud span.w8 {
32
+ font-size: 34px;
33
+ color: #0cf;
34
+ }
35
+ div#wordcloud span.w7 {
36
+ font-size: 30px;
37
+ color: #39d;
38
+ }
39
+ div#wordcloud span.w6 {
40
+ font-size: 24px;
41
+ color: #90c5f0;
42
+ }
43
+ div#wordcloud span.w5 {
44
+ font-size: 20px;
45
+ color: #90a0dd;
46
+ }
47
+ div#wordcloud span.w4 {
48
+ font-size: 14px;
49
+ color: #90c5f0;
50
+ }
51
+ div#wordcloud span.w3 {
52
+ font-size: 10px;
53
+ color: #a0ddff;
54
+ }
55
+ div#wordcloud span.w2 {
56
+ font-size: 4px;
57
+ color: #99ccee;
58
+ }
59
+ div#wordcloud span.w1 {
60
+ font-size: 1px;
61
+ color: #aab5f0;
62
+ }
@@ -0,0 +1,22 @@
1
+ #ajax_loader_icon, .pagination{
2
+ text-align:center;
3
+ padding-top: 20px;
4
+ }
5
+
6
+ .letters{
7
+ text-align:center;
8
+ padding-bottom: 20px;
9
+ }
10
+
11
+ .search_input{
12
+ border-color: #0656a4;
13
+ color: #2A3890;
14
+ margin-left: 5px;
15
+ padding: 2px 2px 2px 2px;
16
+ border:1px solid #BDC7D8;
17
+ }
18
+
19
+ #search_button{
20
+ cursor: pointer;
21
+ margin-top: 2px;
22
+ }
@@ -32,7 +32,8 @@ module SocialStream
32
32
  validates_presence_of :name
33
33
 
34
34
  scope :alphabetic, includes(:actor).order('actors.name')
35
-
35
+ scope :search, lambda{|param|
36
+ joins(:actor).where('actors.name like ?',param)}
36
37
  scope :with_sent_ties, joins(:actor => :sent_ties)
37
38
  scope :with_received_ties, joins(:actor => :received_ties)
38
39
  end
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "0.3.3".freeze
2
+ VERSION = "0.3.4".freeze
3
3
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.add_runtime_dependency('atd-ancestry', '1.3.0')
13
13
  s.add_runtime_dependency('nested_set', '~> 1.5.3')
14
14
  s.add_runtime_dependency('foreigner', '~> 0.9.1')
15
- s.add_runtime_dependency('devise', '~> 1.1.3')
15
+ s.add_runtime_dependency('devise', '~> 1.1.7')
16
16
  s.add_runtime_dependency('inherited_resources', '~> 1.1.2')
17
17
  s.add_runtime_dependency('stringex', '~> 1.2.0')
18
18
  s.add_runtime_dependency('paperclip', '~> 2.3.4')
@@ -28,4 +28,5 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency('rspec-rails', '~> 2.4.1')
29
29
  s.add_development_dependency('factory_girl', '~> 1.3.2')
30
30
  s.add_development_dependency('forgery', '~> 0.3.6')
31
+ s.add_development_dependency('ci_reporter', '~> 1.6.4')
31
32
  end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe ContactsController do
4
+
5
+ describe "GET 'index'" do
6
+ it "should be successful" do
7
+ get 'index'
8
+ response.should be_success
9
+ end
10
+ end
11
+
12
+ end