social_stream-base 0.16.4 → 0.17.0
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.
- data/app/assets/javascripts/activities.js.erb +0 -85
- data/app/assets/javascripts/social_stream.comments.js +63 -0
- data/app/assets/javascripts/social_stream.objects.js +23 -0
- data/app/assets/javascripts/social_stream.timeline.js +37 -10
- data/app/assets/javascripts/social_stream.wall.js.erb +135 -118
- data/app/assets/stylesheets/cheesecake.css.scss +6 -3
- data/app/models/activity_object.rb +18 -0
- data/app/models/activity_object_property.rb +5 -0
- data/app/views/activities/_new.html.erb +1 -1
- data/app/views/activities/_wall.html.erb +1 -1
- data/app/views/cheesecake/_cheesecake.html.erb +44 -10
- data/app/views/cheesecake/_index.html.erb +18 -130
- data/app/views/cheesecake/_sector_form.html.erb +176 -17
- data/app/views/comments/_new.html.erb +0 -14
- data/app/views/objects/_show.html.erb +6 -0
- data/app/views/toolbar/_home.html.erb +1 -1
- data/app/views/toolbar/_messages.html.erb +1 -1
- data/app/views/toolbar/_profile.html.erb +1 -1
- data/config/locales/es.yml +7 -0
- data/db/migrate/20120302215722_activity_object_properties.rb +24 -0
- data/lib/social_stream/ability/base.rb +2 -2
- data/lib/social_stream/base/version.rb +1 -1
- metadata +70 -66
@@ -3,91 +3,6 @@
|
|
3
3
|
//
|
4
4
|
//= require social_stream.wall
|
5
5
|
//
|
6
|
-
//initial state
|
7
|
-
|
8
|
-
$('#masterSubmitButton').live('click',function(){
|
9
|
-
$('#wrapper_activities_header form:visible').submit();
|
10
|
-
});
|
11
|
-
|
12
|
-
|
13
|
-
//clicks form selector
|
14
|
-
$('.activity_form_selector').live('click',function(){
|
15
|
-
$('.activity_form_selector').removeClass('selected');
|
16
|
-
$(this).addClass('selected');
|
17
|
-
$('#wrapper_activities_header form').hide();
|
18
|
-
$('#new_'+this.id.split("_")[1]).show();
|
19
|
-
});
|
20
|
-
|
21
|
-
//javascript for main activities input
|
22
|
-
$(function() {
|
23
|
-
$("#input_activities").click(function(){
|
24
|
-
$("#masterSubmitButton").show();
|
25
|
-
});
|
26
|
-
});
|
27
|
-
|
28
|
-
|
29
|
-
//javascript for comments
|
30
|
-
$(function() {
|
31
|
-
//show only the text fields for new comment if there are any comment to the post
|
32
|
-
$(".activity_new_comment").each(function(){
|
33
|
-
if ($.trim($(this).siblings(".activity_comments").text()) != ""){
|
34
|
-
$(this).show();
|
35
|
-
}
|
36
|
-
});
|
37
|
-
$(".activities_comment_btn").hide();
|
38
|
-
$(".actor_name_new_comment").hide();
|
39
|
-
$(".actor_logo_new_comment").hide();
|
40
|
-
|
41
|
-
//if there are 4 or more commments we only show the last 2 and a link to show the rest
|
42
|
-
$("#wall .activity_comments").each(function(){
|
43
|
-
var comments = $(this).children(".subactivity");
|
44
|
-
//check if there are more than 3 comments
|
45
|
-
if (comments.size() > 3){
|
46
|
-
$(this).prepend("<div class='hide_show_comments'><a href='#' onclick='showAllComments(\""+
|
47
|
-
$(this).attr('id') +"\"); return false;'>" + I18n.t('comment.view_all') + "(" +
|
48
|
-
comments.size() + ")</a></div><div class='space_comments'></div>");
|
49
|
-
comments.slice(0,comments.size()-2).hide();
|
50
|
-
//hide alto space_comments
|
51
|
-
$(this).children(".space_comments").slice(0,comments.size()-2).hide();
|
52
|
-
}
|
53
|
-
});
|
54
|
-
});
|
55
|
-
|
56
|
-
showAllComments = function(id){
|
57
|
-
$("#"+id).children().show();
|
58
|
-
//and hide the hide_show_comments
|
59
|
-
$("#"+id).children(".hide_show_comments").hide();
|
60
|
-
};
|
61
|
-
|
62
|
-
//usa livequery para usar el javascript luego de una accion con AJAX
|
63
|
-
$(".input_new_comments").live("click", function(){
|
64
|
-
$(".activities_comment_btn").hide();
|
65
|
-
$(".new_comment").removeClass("new_comment_shown");
|
66
|
-
$(".actor_name_new_comment").hide();
|
67
|
-
$(".actor_logo_new_comment").hide();
|
68
|
-
var comment= $(this).parents(".activity_new_comment");
|
69
|
-
comment.find(".activities_comment_btn").show();
|
70
|
-
$(this).parents(".new_comment").addClass("new_comment_shown");
|
71
|
-
comment.find(".actor_name_new_comment").show();
|
72
|
-
comment.find(".actor_logo_new_comment").show();
|
73
|
-
return false;
|
74
|
-
});
|
75
|
-
|
76
|
-
autoSize= function(activity_dom_id) {
|
77
|
-
// Copy textarea contents; browser will calculate correct height of copy,
|
78
|
-
// which will make overall container taller, which will make textarea taller.
|
79
|
-
var text = $("#comment_text_"+activity_dom_id).val().replace(/\n/g, '<br/>');
|
80
|
-
$("#copy_comment_text_"+activity_dom_id).html(text);
|
81
|
-
}
|
82
|
-
|
83
|
-
|
84
|
-
//javascript for tocomment option
|
85
|
-
$(".to_comment").live("click", function(){
|
86
|
-
$(this).parents(".activity_content").find(".activity_new_comment").show();
|
87
|
-
$(this).parents(".activity_content").find(".input_new_comments").click();
|
88
|
-
$(this).parents(".activity_content").find(".input_new_comments").focus();
|
89
|
-
return false;
|
90
|
-
});
|
91
6
|
|
92
7
|
//move he last list item before the first item. The purpose of this is if the user clicks to slide left he will be able to see the last item.
|
93
8
|
$('#carousel_ul li:first').before($('#carousel_ul li:last'));
|
@@ -0,0 +1,63 @@
|
|
1
|
+
//= require social_stream.timeline
|
2
|
+
//= require social_stream.objects
|
3
|
+
|
4
|
+
SocialStream.Comments = (function(SS, $, undefined){
|
5
|
+
var initNew = function(){
|
6
|
+
// show only the text fields for new comment
|
7
|
+
// if there are any comment to the post
|
8
|
+
$(".activity_new_comment").each(function(){
|
9
|
+
if ($.trim($(this).siblings(".activity_comments").text()) != ""){
|
10
|
+
$(this).show();
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
$(".activities_comment_btn").hide();
|
15
|
+
$(".actor_name_new_comment").hide();
|
16
|
+
$(".actor_logo_new_comment").hide();
|
17
|
+
|
18
|
+
$(".input_new_comments").Watermark(I18n.t('comment.input'),"#666");
|
19
|
+
|
20
|
+
$(".input_new_comments")
|
21
|
+
.change(function(){autoSize(this);})
|
22
|
+
.keydown(function(){autoSize(this);})
|
23
|
+
.keyup(function(){autoSize(this);});
|
24
|
+
|
25
|
+
$(".input_new_comments").each(function(){autoSize(this)});
|
26
|
+
|
27
|
+
$(".input_new_comments").click(function(){
|
28
|
+
$(".activities_comment_btn").hide();
|
29
|
+
$(".new_comment").removeClass("new_comment_shown");
|
30
|
+
$(".actor_name_new_comment").hide();
|
31
|
+
$(".actor_logo_new_comment").hide();
|
32
|
+
var comment= $(this).parents(".activity_new_comment");
|
33
|
+
comment.find(".activities_comment_btn").show();
|
34
|
+
$(this).parents(".new_comment").addClass("new_comment_shown");
|
35
|
+
comment.find(".actor_name_new_comment").show();
|
36
|
+
comment.find(".actor_logo_new_comment").show();
|
37
|
+
return false;
|
38
|
+
});
|
39
|
+
|
40
|
+
//javascript for tocomment option
|
41
|
+
$(".to_comment").click(function(){
|
42
|
+
$(this).parents(".activity_content").find(".activity_new_comment").show();
|
43
|
+
$(this).parents(".activity_content").find(".input_new_comments").click();
|
44
|
+
$(this).parents(".activity_content").find(".input_new_comments").focus();
|
45
|
+
return false;
|
46
|
+
});
|
47
|
+
}
|
48
|
+
|
49
|
+
var autoSize = function(e) {
|
50
|
+
// Copy textarea contents; browser will calculate correct height of copy,
|
51
|
+
// which will make overall container taller, which will make textarea taller.
|
52
|
+
var text = $(e).val().replace(/\n/g, '<br/>');
|
53
|
+
$(e).siblings(".copy_new_comment").html(text);
|
54
|
+
}
|
55
|
+
|
56
|
+
SocialStream.Timeline.addInitCallback(initNew);
|
57
|
+
SocialStream.Objects.addInitCallback(initNew);
|
58
|
+
|
59
|
+
return {
|
60
|
+
initNew: initNew
|
61
|
+
};
|
62
|
+
|
63
|
+
})(SocialStream, jQuery);
|
@@ -0,0 +1,23 @@
|
|
1
|
+
//= require social_stream.timeline
|
2
|
+
//= require social_stream.wall
|
3
|
+
|
4
|
+
SocialStream.Objects = (function(SS, $, undefined){
|
5
|
+
var initCallbacks = [];
|
6
|
+
|
7
|
+
var addInitCallback = function(callback){
|
8
|
+
initCallbacks.push(callback);
|
9
|
+
}
|
10
|
+
|
11
|
+
var init = function(){
|
12
|
+
$.each(initCallbacks, function(i, callback){ callback(); });
|
13
|
+
}
|
14
|
+
|
15
|
+
addInitCallback(SocialStream.Timeline.initPrivacyTooltips);
|
16
|
+
addInitCallback(SocialStream.Wall.activateAntiRebounds);
|
17
|
+
|
18
|
+
return {
|
19
|
+
addInitCallback: addInitCallback,
|
20
|
+
init: init
|
21
|
+
}
|
22
|
+
|
23
|
+
})(SocialStream, jQuery);
|
@@ -1,15 +1,15 @@
|
|
1
1
|
SocialStream.Timeline = (function(SS, $, undefined){
|
2
|
-
var
|
2
|
+
var initCallbacks = [];
|
3
3
|
|
4
|
-
var
|
5
|
-
|
4
|
+
var addInitCallback = function(callback){
|
5
|
+
initCallbacks.push(callback);
|
6
6
|
}
|
7
7
|
|
8
|
-
var
|
9
|
-
$.each(
|
8
|
+
var init = function(){
|
9
|
+
$.each(initCallbacks, function(i, callback){ callback(); });
|
10
10
|
}
|
11
11
|
|
12
|
-
var
|
12
|
+
var initPrivacyTooltips = function(activityId) {
|
13
13
|
var fullId = '.activity_audience';
|
14
14
|
var summaryId = '.activity_audience_summary';
|
15
15
|
|
@@ -27,16 +27,43 @@ SocialStream.Timeline = (function(SS, $, undefined){
|
|
27
27
|
});
|
28
28
|
};
|
29
29
|
|
30
|
+
var initComments = function(){
|
31
|
+
//if there are 4 or more commments we only show the last 2 and a link to show the rest
|
32
|
+
$("#wall .activity_comments").each(function(){
|
33
|
+
var comments = $(this).children(".subactivity");
|
34
|
+
//check if there are more than 3 comments
|
35
|
+
if (comments.size() > 3){
|
36
|
+
$(this).prepend("<div class='hide_show_comments'><a href='#' onclick='SocialStream.Timeline.showAllComments(\""+
|
37
|
+
$(this).attr('id') +"\"); return false;'>" + I18n.t('comment.view_all') + "(" +
|
38
|
+
comments.size() + ")</a></div><div class='space_comments'></div>");
|
39
|
+
comments.slice(0,comments.size()-2).hide();
|
40
|
+
//hide alto space_comments
|
41
|
+
$(this).children(".space_comments").slice(0,comments.size()-2).hide();
|
42
|
+
}
|
43
|
+
});
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
var showAllComments = function(id){
|
48
|
+
$("#"+id).children().show();
|
49
|
+
//and hide the hide_show_comments
|
50
|
+
$("#"+id).children(".hide_show_comments").hide();
|
51
|
+
};
|
52
|
+
|
53
|
+
|
30
54
|
var newActivity = function(activityId){
|
31
|
-
|
55
|
+
initPrivacyTooltips(activityId);
|
32
56
|
SS.Wall.unblockForms();
|
33
57
|
}
|
34
58
|
|
35
|
-
|
59
|
+
addInitCallback(initPrivacyTooltips);
|
60
|
+
addInitCallback(initComments);
|
36
61
|
|
37
62
|
return {
|
38
|
-
|
39
|
-
|
63
|
+
addInitCallback: addInitCallback,
|
64
|
+
init: init,
|
65
|
+
initPrivacyTooltips: initPrivacyTooltips,
|
66
|
+
showAllComments: showAllComments,
|
40
67
|
newActivity: newActivity
|
41
68
|
};
|
42
69
|
}) (SocialStream, jQuery);
|
@@ -1,125 +1,142 @@
|
|
1
1
|
//= require social_stream.timeline
|
2
2
|
//
|
3
3
|
SocialStream.Wall = (function(SS, $, undefined){
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
// Remove width calculation
|
62
|
-
$('#securities input.default').css('width', default_security_width);
|
63
|
-
|
64
|
-
}
|
65
|
-
|
66
|
-
var activateAntiRebounds = function(){
|
67
|
-
$('#wrapper_activities_header form').submit(function() {
|
68
|
-
$(this).find('input[type=text]').each(function() {
|
69
|
-
$(this).blur().attr('readonly', true);
|
70
|
-
});
|
71
|
-
$("#masterSubmitButton").val(I18n.t('activity.sending') + '...').attr("disabled", true);
|
72
|
-
|
73
|
-
// Add _relation_ids[] parameter from authorization selector
|
74
|
-
$('.liveAdded').remove();
|
75
|
-
|
76
|
-
var currentForm = $(this);
|
77
|
-
|
78
|
-
$('#security option:selected').each(function() {
|
79
|
-
currentForm.append(
|
80
|
-
$('<input/>')
|
81
|
-
.addClass('liveAdded')
|
82
|
-
.attr('type', 'hidden')
|
83
|
-
.attr('name', currentForm
|
84
|
-
.attr('id').split('_')[1]+'[_relation_ids][]')
|
85
|
-
.val($(this).attr('value')));
|
86
|
-
});
|
87
|
-
return true;
|
88
|
-
});
|
89
|
-
|
90
|
-
$('.new_comment').submit(function() {
|
91
|
-
$(this).find('input[type=text]').each(function() {
|
92
|
-
$(this).blur().attr('readonly', true);
|
93
|
-
});
|
94
|
-
$(this).find(".submitActivity").each(function() {
|
95
|
-
$(this).val(I18n.t('activity.sending') + '...').attr("disabled", true);
|
96
|
-
});
|
97
|
-
return true;
|
98
|
-
});
|
4
|
+
var initCallbacks = [];
|
5
|
+
|
6
|
+
var addInitCallback = function(callback){
|
7
|
+
initCallbacks.push(callback);
|
8
|
+
}
|
9
|
+
|
10
|
+
var init = function(){
|
11
|
+
$.each(initCallbacks, function(i, callback){ callback(); });
|
12
|
+
}
|
13
|
+
|
14
|
+
var initFirstForm = function(){
|
15
|
+
$('#wrapper_activities_header form').hide();
|
16
|
+
$('#new_<%= SocialStream.activity_forms.first %>').show();
|
17
|
+
$('#select_<%= SocialStream.activity_forms.first %>').addClass('selected');
|
18
|
+
}
|
19
|
+
|
20
|
+
var initFormButton = function(){
|
21
|
+
$('#masterSubmitButton').click(function(){
|
22
|
+
$('#wrapper_activities_header form:visible').submit();
|
23
|
+
});
|
24
|
+
}
|
25
|
+
|
26
|
+
var initFormSelector = function(){
|
27
|
+
$('.activity_form_selector').click(function(){
|
28
|
+
$('.activity_form_selector').removeClass('selected');
|
29
|
+
$(this).addClass('selected');
|
30
|
+
$('#wrapper_activities_header form').hide();
|
31
|
+
$('#new_'+this.id.split("_")[1]).show();
|
32
|
+
});
|
33
|
+
}
|
34
|
+
|
35
|
+
var initSecuritySelect = function(){
|
36
|
+
var default_security_width = '100px';
|
37
|
+
|
38
|
+
chosen = $('#security').security_chosen();
|
39
|
+
|
40
|
+
$('#security').change(function() {
|
41
|
+
$(this).children("option:selected").each(function(i,opt){
|
42
|
+
if(opt.value==relation_public){
|
43
|
+
if(public_selected==false){
|
44
|
+
public_selected = true;
|
45
|
+
for(id in relation_options){
|
46
|
+
if(id==relation_public_pos){
|
47
|
+
$("#securitychzn_o_" + relation_public_pos).click();
|
48
|
+
}else{
|
49
|
+
chosen.result_deselect(id);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
chosen.results_update_field();
|
53
|
+
}else{
|
54
|
+
if($('#security').children("option:selected").size()>1){
|
55
|
+
public_selected = false;
|
56
|
+
chosen.result_deselect(relation_public_pos);
|
57
|
+
chosen.results_update_field();
|
58
|
+
}
|
59
|
+
}
|
99
60
|
}
|
61
|
+
});
|
100
62
|
|
101
|
-
|
102
|
-
|
103
|
-
$(
|
104
|
-
//Header activities form
|
105
|
-
$("#masterSubmitButton").val(I18n.t('share')).removeAttr("disabled");
|
106
|
-
$('#wrapper_activities_header form').find('input[type=text]').each(function() {
|
107
|
-
$(this).removeAttr("readonly").val("").blur();
|
108
|
-
});
|
109
|
-
//New comments
|
110
|
-
$('.input_new_comments').each(function() {chosen.result_deselect(0)
|
111
|
-
$(this).removeAttr("readonly").val("");
|
112
|
-
});
|
63
|
+
$('#securities .search-choice a').click(function(){
|
64
|
+
if($('#security').children("option:selected").size()==0){
|
65
|
+
$('#securities input').css('width', default_security_width)
|
113
66
|
}
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
67
|
+
});
|
68
|
+
});
|
69
|
+
|
70
|
+
$('#securities input').blur(function(){
|
71
|
+
if($('#security').children("option:selected").size()==0){
|
72
|
+
$('#securities input').css('width', default_security_width)
|
73
|
+
}
|
74
|
+
});
|
75
|
+
|
76
|
+
// Remove width calculation
|
77
|
+
$('#securities input.default').css('width', default_security_width);
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
var activateAntiRebounds = function(){
|
82
|
+
$('#wrapper_activities_header form').submit(function() {
|
83
|
+
$(this).find('input[type=text]').each(function() {
|
84
|
+
$(this).blur().attr('readonly', true);
|
85
|
+
});
|
86
|
+
$("#masterSubmitButton").val(I18n.t('activity.sending') + '...').attr("disabled", true);
|
87
|
+
|
88
|
+
// Add _relation_ids[] parameter from authorization selector
|
89
|
+
$('.liveAdded').remove();
|
90
|
+
|
91
|
+
var currentForm = $(this);
|
92
|
+
|
93
|
+
$('#security option:selected').each(function() {
|
94
|
+
currentForm.append(
|
95
|
+
$('<input/>')
|
96
|
+
.addClass('liveAdded')
|
97
|
+
.attr('type', 'hidden')
|
98
|
+
.attr('name', currentForm
|
99
|
+
.attr('id').split('_')[1]+'[_relation_ids][]')
|
100
|
+
.val($(this).attr('value')));
|
101
|
+
});
|
102
|
+
return true;
|
103
|
+
});
|
104
|
+
|
105
|
+
$('.new_comment').submit(function() {
|
106
|
+
$(this).find('input[type=text]').each(function() {
|
107
|
+
$(this).blur().attr('readonly', true);
|
108
|
+
});
|
109
|
+
$(this).find(".submitActivity").each(function() {
|
110
|
+
$(this).val(I18n.t('activity.sending') + '...').attr("disabled", true);
|
111
|
+
});
|
112
|
+
return true;
|
113
|
+
});
|
114
|
+
}
|
115
|
+
|
116
|
+
var unblockForms = function() {
|
117
|
+
//Sharing buttons
|
118
|
+
$(".submitActivity").val(I18n.t('share')).removeAttr("disabled");
|
119
|
+
//Header activities form
|
120
|
+
$("#masterSubmitButton").val(I18n.t('share')).removeAttr("disabled");
|
121
|
+
$('#wrapper_activities_header form').find('input[type=text]').each(function() {
|
122
|
+
$(this).removeAttr("readonly").val("").blur();
|
123
|
+
});
|
124
|
+
//New comments
|
125
|
+
$('.input_new_comments').each(function() {chosen.result_deselect(0)
|
126
|
+
$(this).removeAttr("readonly").val("");
|
127
|
+
});
|
128
|
+
}
|
129
|
+
|
130
|
+
addInitCallback(initFirstForm);
|
131
|
+
addInitCallback(initFormButton);
|
132
|
+
addInitCallback(initFormSelector);
|
133
|
+
addInitCallback(initSecuritySelect);
|
134
|
+
addInitCallback(activateAntiRebounds);
|
135
|
+
|
136
|
+
return {
|
137
|
+
addInitCallback: addInitCallback,
|
138
|
+
init: init,
|
139
|
+
activateAntiRebounds: activateAntiRebounds,
|
140
|
+
unblockForms: unblockForms
|
141
|
+
};
|
125
142
|
}) (SocialStream, jQuery)
|