social_stream-base 0.14.2 → 0.14.3
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/stylesheets/cheesecake.css.scss +43 -12
- data/app/controllers/contacts_controller.rb +1 -1
- data/app/models/activity.rb +4 -1
- data/app/models/actor.rb +2 -14
- data/app/models/relation/single.rb +2 -7
- data/app/models/relation.rb +2 -4
- data/app/models/tie.rb +2 -1
- data/app/views/activities/_new.html.erb +1 -1
- data/app/views/cheesecake/_cheesecake.html.erb +170 -105
- data/app/views/cheesecake/_index.html.erb +45 -47
- data/app/views/cheesecake/_sector_form.html.erb +1 -0
- data/app/views/toolbar/_home.html.erb +1 -1
- data/config/locales/en.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/locales/rails.es.yml +192 -0
- data/db/migrate/20110912074426_add_reject_relation.rb +2 -2
- data/db/migrate/20120201185454_singleton_single_relations.rb +46 -0
- data/lib/social_stream/base/version.rb +1 -1
- data/lib/tasks/db/populate.rake +1 -1
- data/spec/controllers/posts_controller_spec.rb +2 -2
- data/spec/factories/activity.rb +1 -1
- data/spec/factories/post.rb +1 -1
- data/spec/factories/tie.rb +3 -3
- data/spec/models/activity_authorization_spec.rb +3 -3
- data/spec/support/db.rb +3 -1
- metadata +69 -66
@@ -1,40 +1,46 @@
|
|
1
1
|
|
2
2
|
<div id="contacts_cheesecake"></div>
|
3
|
-
<div id="
|
4
|
-
<%=
|
3
|
+
<div id="sector_form" style="display:none;">
|
4
|
+
<%= render :partial => "sector_form" %>
|
5
5
|
</div>
|
6
|
-
<div id="
|
7
|
-
<
|
8
|
-
|
9
|
-
<div id="contacts_grid">
|
10
|
-
<div id="contacts_grid_saving" style="display:none;">
|
11
|
-
<%= image_tag('loading.gif') %>
|
6
|
+
<div id="contacts_explorer">
|
7
|
+
<div id="contacts_filter">
|
8
|
+
<%= text_field_tag :filter_query, nil,:autocomplete => :off, :id => :contacts_filter_input %>
|
12
9
|
</div>
|
13
|
-
<div id="
|
14
|
-
<
|
10
|
+
<div id="contacts_selector_modifiers">
|
11
|
+
<span id="contacts_selector_clear">Unselect all</span>
|
15
12
|
</div>
|
16
|
-
<div id="
|
17
|
-
|
18
|
-
<%=
|
19
|
-
|
13
|
+
<div id="contacts_grid">
|
14
|
+
<div id="contacts_grid_saving" style="display:none;">
|
15
|
+
<%= image_tag('loading.gif') %>
|
16
|
+
</div>
|
17
|
+
<div id="contacts_grid_selected">
|
18
|
+
<div id="contacts_grid_selected_hint"><%= t('cheesecake.select.hint') %></div>
|
19
|
+
<br class="clearfloat">
|
20
|
+
</div>
|
21
|
+
<div id="contacts_grid_available">
|
22
|
+
<% @actors.each do |actor|%>
|
23
|
+
<%= render :partial => "actors/actor_cheesecake", :locals => {:actor => actor} %>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
20
26
|
</div>
|
21
|
-
|
22
|
-
<
|
23
|
-
<form action="<%= update_cheesecake_path %>" method="get" data-remote="true" id="contacts_save_form">
|
24
|
-
<input type="submit" id="contacts_save_button" value="<%= t('cheesecake.changes.save') %>">
|
25
|
-
<input type="hidden" id="contacts_save_changes" name="contacts_save_changes">
|
26
|
-
</form>
|
27
|
-
</div>
|
28
|
-
<div id="contacts_changes_button" style="display:none;">
|
29
|
-
<%= t('cheesecake.changes.details') %> (<span id="contacts_changes_button_total">0</span>)
|
30
|
-
</div>
|
31
|
-
<br class="clearfloat">
|
32
|
-
<div id="contacts_changes">
|
33
|
-
<div id="contacts_changes_title">
|
34
|
-
<%= t('cheesecake.changes.details') %>
|
27
|
+
<div id="contacts_changes_button" style="display:none;">
|
28
|
+
<%= t('cheesecake.changes.details') %> (<span id="contacts_changes_button_total">0</span>)
|
35
29
|
</div>
|
36
|
-
<div id="
|
37
|
-
|
30
|
+
<div id="contacts_save" style="display:none;">
|
31
|
+
<form action="<%= update_cheesecake_path %>" method="get" data-remote="true" id="contacts_save_form">
|
32
|
+
<input type="submit" id="contacts_save_button" value="<%= t('cheesecake.changes.save') %>">
|
33
|
+
<input type="hidden" id="contacts_save_changes" name="contacts_save_changes">
|
34
|
+
</form>
|
35
|
+
</div>
|
36
|
+
<br class="clearfloat">
|
37
|
+
<div id="contacts_changes">
|
38
|
+
<div id="contacts_changes_title">
|
39
|
+
<%= t('cheesecake.changes.details') %>
|
40
|
+
</div>
|
41
|
+
<div id="contacts_changes_details">
|
42
|
+
|
43
|
+
</div>
|
38
44
|
</div>
|
39
45
|
</div>
|
40
46
|
<%= javascript_tag do %>
|
@@ -50,36 +56,36 @@
|
|
50
56
|
var unselected_actor_click = function(){
|
51
57
|
var clone = $(this).clone();
|
52
58
|
clone.attr("id",$(this).attr("id") + "_selected");
|
53
|
-
$(this).
|
59
|
+
$(this).fadeOut("fast",function(){
|
54
60
|
clone.hide();
|
55
61
|
$(this).before(clone);
|
56
|
-
$("#
|
62
|
+
$("#contacts_grid_selected_hint").before($(this));
|
57
63
|
$(this).off("click.unselected_actor");
|
58
64
|
$(this).on("click.selected_actor", selected_actor_click);
|
59
|
-
if($("#
|
60
|
-
$("#contacts_grid_selected").slideToggle("fast");
|
65
|
+
if($("#contacts_grid_selected_hint").css("display")!="none"){
|
61
66
|
$("#contacts_selector_modifiers").css("opacity",1);
|
67
|
+
$("#contacts_grid_selected_hint").hide();
|
62
68
|
}
|
63
69
|
var height = 336 - Math.ceil(($("#contacts_grid_selected").children().length - 1) / 10) * 28;
|
64
70
|
if(height != $("#contacts_grid_available").height())
|
65
71
|
$("#contacts_grid_available").animate({height: height});
|
66
|
-
$(this).
|
72
|
+
$(this).fadeIn("fast");
|
67
73
|
});
|
68
74
|
};
|
69
75
|
var selected_actor_click = function(){
|
70
76
|
var clone = $("#" + $(this).attr("id") + "_selected");
|
71
|
-
$(this).
|
77
|
+
$(this).fadeOut("fast",function(){
|
72
78
|
clone.before($(this));
|
73
79
|
$(this).off("click.selected_actor");
|
74
80
|
$(this).on("click.unselected_actor", unselected_actor_click);
|
75
|
-
if($("#contacts_grid_selected").children().length <=
|
76
|
-
$("#contacts_grid_selected").slideToggle("fast");
|
81
|
+
if($("#contacts_grid_selected").children().length <= 2){
|
77
82
|
$("#contacts_selector_modifiers").css("opacity",0);
|
83
|
+
$("#contacts_grid_selected_hint").fadeIn("fast");
|
78
84
|
}
|
79
85
|
var height = 336 - Math.ceil(($("#contacts_grid_selected").children().length - 1) / 10) * 28;
|
80
86
|
if(height != $("#contacts_grid_available").height())
|
81
87
|
$("#contacts_grid_available").animate({height: height});
|
82
|
-
$(this).
|
88
|
+
$(this).fadeIn("fast");
|
83
89
|
clone.remove();
|
84
90
|
});
|
85
91
|
};
|
@@ -102,13 +108,5 @@
|
|
102
108
|
});
|
103
109
|
}
|
104
110
|
});
|
105
|
-
$("#contacts_save_form").submit(function(){
|
106
|
-
if($(".contacts_changes_tipsy_menu").length != 0){
|
107
|
-
$("#contacts_changes_button").tipsy("hide");
|
108
|
-
}
|
109
|
-
$("#contacts_grid_saving").show();
|
110
|
-
cheese.disable();
|
111
|
-
$("#contacts_save_button").val("<%= t('cheesecake.changes.saving') %>").attr("disabled","true");
|
112
|
-
});
|
113
111
|
<%= render :partial => 'cheesecake' %>
|
114
112
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Sector form in construction. Please, be patient :D
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
@@ -0,0 +1,192 @@
|
|
1
|
+
es:
|
2
|
+
date:
|
3
|
+
abbr_day_names:
|
4
|
+
- dom
|
5
|
+
- lun
|
6
|
+
- mar
|
7
|
+
- mié
|
8
|
+
- jue
|
9
|
+
- vie
|
10
|
+
- sáb
|
11
|
+
abbr_month_names:
|
12
|
+
-
|
13
|
+
- ene
|
14
|
+
- feb
|
15
|
+
- mar
|
16
|
+
- abr
|
17
|
+
- may
|
18
|
+
- jun
|
19
|
+
- jul
|
20
|
+
- ago
|
21
|
+
- sep
|
22
|
+
- oct
|
23
|
+
- nov
|
24
|
+
- dic
|
25
|
+
day_names:
|
26
|
+
- domingo
|
27
|
+
- lunes
|
28
|
+
- martes
|
29
|
+
- miércoles
|
30
|
+
- jueves
|
31
|
+
- viernes
|
32
|
+
- sábado
|
33
|
+
formats:
|
34
|
+
default: ! '%d/%m/%Y'
|
35
|
+
long: ! '%d de %B de %Y'
|
36
|
+
short: ! '%d de %b'
|
37
|
+
month_names:
|
38
|
+
-
|
39
|
+
- enero
|
40
|
+
- febrero
|
41
|
+
- marzo
|
42
|
+
- abril
|
43
|
+
- mayo
|
44
|
+
- junio
|
45
|
+
- julio
|
46
|
+
- agosto
|
47
|
+
- septiembre
|
48
|
+
- octubre
|
49
|
+
- noviembre
|
50
|
+
- diciembre
|
51
|
+
order:
|
52
|
+
- :day
|
53
|
+
- :month
|
54
|
+
- :year
|
55
|
+
datetime:
|
56
|
+
distance_in_words:
|
57
|
+
about_x_hours:
|
58
|
+
one: alrededor de 1 hora
|
59
|
+
other: alrededor de %{count} horas
|
60
|
+
about_x_months:
|
61
|
+
one: alrededor de 1 mes
|
62
|
+
other: alrededor de %{count} meses
|
63
|
+
about_x_years:
|
64
|
+
one: alrededor de 1 año
|
65
|
+
other: alrededor de %{count} años
|
66
|
+
almost_x_years:
|
67
|
+
one: casi 1 año
|
68
|
+
other: casi %{count} años
|
69
|
+
half_a_minute: medio minuto
|
70
|
+
less_than_x_minutes:
|
71
|
+
one: menos de 1 minuto
|
72
|
+
other: menos de %{count} minutos
|
73
|
+
less_than_x_seconds:
|
74
|
+
one: menos de 1 segundo
|
75
|
+
other: menos de %{count} segundos
|
76
|
+
over_x_years:
|
77
|
+
one: más de 1 año
|
78
|
+
other: más de %{count} años
|
79
|
+
x_days:
|
80
|
+
one: 1 día
|
81
|
+
other: ! '%{count} días'
|
82
|
+
x_minutes:
|
83
|
+
one: 1 minuto
|
84
|
+
other: ! '%{count} minutos'
|
85
|
+
x_months:
|
86
|
+
one: 1 mes
|
87
|
+
other: ! '%{count} meses'
|
88
|
+
x_seconds:
|
89
|
+
one: 1 segundo
|
90
|
+
other: ! '%{count} segundos'
|
91
|
+
prompts:
|
92
|
+
day: Día
|
93
|
+
hour: Hora
|
94
|
+
minute: Minutos
|
95
|
+
month: Mes
|
96
|
+
second: Segundos
|
97
|
+
year: Año
|
98
|
+
errors:
|
99
|
+
format: ! '%{attribute} %{message}'
|
100
|
+
messages:
|
101
|
+
accepted: debe ser aceptado
|
102
|
+
blank: no puede estar en blanco
|
103
|
+
confirmation: no coincide con la confirmación
|
104
|
+
empty: no puede estar vacío
|
105
|
+
equal_to: debe ser igual a %{count}
|
106
|
+
even: debe ser par
|
107
|
+
exclusion: está reservado
|
108
|
+
greater_than: debe ser mayor que %{count}
|
109
|
+
greater_than_or_equal_to: debe ser mayor que o igual a %{count}
|
110
|
+
inclusion: no está incluido en la lista
|
111
|
+
invalid: no es válido
|
112
|
+
less_than: debe ser menor que %{count}
|
113
|
+
less_than_or_equal_to: debe ser menor que o igual a %{count}
|
114
|
+
not_a_number: no es un número
|
115
|
+
not_an_integer: debe ser un entero
|
116
|
+
odd: debe ser impar
|
117
|
+
record_invalid: ! 'La validación falló: %{errors}'
|
118
|
+
taken: ya está en uso
|
119
|
+
too_long: es demasiado largo (%{count} caracteres máximo)
|
120
|
+
too_short: es demasiado corto (%{count} caracteres mínimo)
|
121
|
+
wrong_length: no tiene la longitud correcta (%{count} caracteres exactos)
|
122
|
+
template:
|
123
|
+
body: ! 'Se encontraron problemas con los siguientes campos:'
|
124
|
+
header:
|
125
|
+
one: No se pudo guardar este/a %{model} porque se encontró 1 error
|
126
|
+
other: No se pudo guardar este/a %{model} porque se encontraron %{count} errores
|
127
|
+
helpers:
|
128
|
+
select:
|
129
|
+
prompt: Por favor seleccione
|
130
|
+
submit:
|
131
|
+
create: Crear %{model}
|
132
|
+
submit: Guardar %{model}
|
133
|
+
update: Actualizar %{model}
|
134
|
+
number:
|
135
|
+
currency:
|
136
|
+
format:
|
137
|
+
delimiter: .
|
138
|
+
format: ! '%n %u'
|
139
|
+
precision: 2
|
140
|
+
separator: ! ','
|
141
|
+
significant: false
|
142
|
+
strip_insignificant_zeros: false
|
143
|
+
unit: €
|
144
|
+
format:
|
145
|
+
delimiter: .
|
146
|
+
precision: 3
|
147
|
+
separator: ! ','
|
148
|
+
significant: false
|
149
|
+
strip_insignificant_zeros: false
|
150
|
+
human:
|
151
|
+
decimal_units:
|
152
|
+
format: ! '%n %u'
|
153
|
+
units:
|
154
|
+
billion: mil millones
|
155
|
+
million: millón
|
156
|
+
quadrillion: mil billones
|
157
|
+
thousand: mil
|
158
|
+
trillion: billón
|
159
|
+
unit: ''
|
160
|
+
format:
|
161
|
+
delimiter: ''
|
162
|
+
precision: 1
|
163
|
+
significant: true
|
164
|
+
strip_insignificant_zeros: true
|
165
|
+
storage_units:
|
166
|
+
format: ! '%n %u'
|
167
|
+
units:
|
168
|
+
byte:
|
169
|
+
one: Byte
|
170
|
+
other: Bytes
|
171
|
+
gb: GB
|
172
|
+
kb: KB
|
173
|
+
mb: MB
|
174
|
+
tb: TB
|
175
|
+
percentage:
|
176
|
+
format:
|
177
|
+
delimiter: ''
|
178
|
+
precision:
|
179
|
+
format:
|
180
|
+
delimiter: ''
|
181
|
+
support:
|
182
|
+
array:
|
183
|
+
last_word_connector: ! ', y '
|
184
|
+
two_words_connector: ! ' y '
|
185
|
+
words_connector: ! ', '
|
186
|
+
time:
|
187
|
+
am: am
|
188
|
+
formats:
|
189
|
+
default: ! '%A, %d de %B de %Y %H:%M:%S %z'
|
190
|
+
long: ! '%d de %B de %Y %H:%M'
|
191
|
+
short: ! '%d de %b %H:%M'
|
192
|
+
pm: pm
|
@@ -12,7 +12,7 @@ class AddRejectRelation < ActiveRecord::Migration
|
|
12
12
|
logger.warn "Public contact #{ t.contact_id } has #{ contact.ties_count }, when expecting 1"
|
13
13
|
end
|
14
14
|
|
15
|
-
t.update_attribute :relation_id,
|
15
|
+
t.update_attribute :relation_id, Relation::Reject.instance.id
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -21,7 +21,7 @@ class AddRejectRelation < ActiveRecord::Migration
|
|
21
21
|
includes(:relation, :contact).
|
22
22
|
merge(Relation.where(:type => 'Relation::Reject')).
|
23
23
|
each do |t|
|
24
|
-
t.update_attribute :relation_id,
|
24
|
+
t.update_attribute :relation_id, Relation::Public.instance.id
|
25
25
|
end
|
26
26
|
|
27
27
|
Relation::Reject.destroy_all
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class SingletonSingleRelations < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
Tie.record_timestamps = false
|
4
|
+
Audience.record_timestamps = false
|
5
|
+
|
6
|
+
r_new = Relation::Public.instance
|
7
|
+
|
8
|
+
Relation::Public.all.each do |r|
|
9
|
+
next if r == r_new
|
10
|
+
|
11
|
+
# Reassign r -> r_new
|
12
|
+
r.ties.each do |t|
|
13
|
+
t.update_column(:relation_id, r_new.id)
|
14
|
+
end
|
15
|
+
|
16
|
+
r.audiences.each do |a|
|
17
|
+
a.update_column(:relation_id, r_new.id)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Delete r
|
21
|
+
r.delete
|
22
|
+
end
|
23
|
+
|
24
|
+
r_new = Relation::Reject.instance
|
25
|
+
|
26
|
+
Relation::Reject.all.each do |r|
|
27
|
+
next if r == r_new
|
28
|
+
|
29
|
+
# Reassign r -> r_new
|
30
|
+
r.ties.each do |t|
|
31
|
+
t.update_column(:relation_id, r_new.id)
|
32
|
+
end
|
33
|
+
|
34
|
+
r.audiences.each do |a|
|
35
|
+
a.update_column(:relation_id, r_new.id)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Delete r
|
39
|
+
r.delete
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def down
|
44
|
+
raise ActiveRecord::IrreversibleMigration
|
45
|
+
end
|
46
|
+
end
|
data/lib/tasks/db/populate.rake
CHANGED
@@ -125,7 +125,7 @@ namespace :db do
|
|
125
125
|
# = Ties
|
126
126
|
available_actors.each do |a|
|
127
127
|
actors = available_actors.dup - Array(a)
|
128
|
-
relations = a.relation_customs + Array.wrap(
|
128
|
+
relations = a.relation_customs + Array.wrap(Relation::Reject.instance)
|
129
129
|
break if actors.size==0
|
130
130
|
if CHEESECAKE
|
131
131
|
actor = Actor.first
|
@@ -55,7 +55,7 @@ describe PostsController do
|
|
55
55
|
describe "with public relation" do
|
56
56
|
before do
|
57
57
|
contact = @user.contact_to!(@user)
|
58
|
-
relation =
|
58
|
+
relation = Relation::Public.instance
|
59
59
|
model_assigned_to @user.contact_to!(@user), relation
|
60
60
|
@current_model = Factory(:post, :author_id => @user.actor_id,
|
61
61
|
:owner_id => @user.actor_id,
|
@@ -146,7 +146,7 @@ describe PostsController do
|
|
146
146
|
describe "with public relation" do
|
147
147
|
before do
|
148
148
|
contact = @group.contact_to!(@group)
|
149
|
-
relation =
|
149
|
+
relation = Relation::Public.instance
|
150
150
|
model_assigned_to contact, relation
|
151
151
|
@current_model = Factory(:post, :author_id => contact.sender.id,
|
152
152
|
:owner_id => contact.receiver.id,
|
data/spec/factories/activity.rb
CHANGED
@@ -35,7 +35,7 @@ Factory.define :self_activity, :parent => :activity do |a|
|
|
35
35
|
end
|
36
36
|
|
37
37
|
Factory.define :public_activity, :parent => :activity do |a|
|
38
|
-
a.relation_ids { |b| Array(
|
38
|
+
a.relation_ids { |b| Array(Relation::Public.instance.id) }
|
39
39
|
end
|
40
40
|
|
41
41
|
Factory.define :like_activity, :class => 'Activity' do |a|
|
data/spec/factories/post.rb
CHANGED
data/spec/factories/tie.rb
CHANGED
@@ -13,11 +13,11 @@ Factory.define :acquaintance, :parent => :tie do |t|
|
|
13
13
|
end
|
14
14
|
|
15
15
|
Factory.define :public, :parent => :tie do |t|
|
16
|
-
t.after_build { |u| u.relation =
|
16
|
+
t.after_build { |u| u.relation = Relation::Public.instance }
|
17
17
|
end
|
18
18
|
|
19
19
|
Factory.define :reject, :parent => :tie do |t|
|
20
|
-
t.after_build { |u| u.relation =
|
20
|
+
t.after_build { |u| u.relation = Relation::Reject.instance }
|
21
21
|
end
|
22
22
|
|
23
23
|
# Group ties
|
@@ -38,6 +38,6 @@ Factory.define :partner, :parent => :g2g_tie do |t|
|
|
38
38
|
end
|
39
39
|
|
40
40
|
Factory.define :group_public, :parent => :g2g_tie do |t|
|
41
|
-
t.after_build { |u| u.relation =
|
41
|
+
t.after_build { |u| u.relation = Relation::Public.instance }
|
42
42
|
end
|
43
43
|
|
@@ -89,7 +89,7 @@ describe Activity do
|
|
89
89
|
context "with public activity" do
|
90
90
|
before do
|
91
91
|
contact = @user.contact_to!(@user)
|
92
|
-
create_activity(contact,
|
92
|
+
create_activity(contact, Relation::Public.instance)
|
93
93
|
end
|
94
94
|
|
95
95
|
describe "sender home" do
|
@@ -219,7 +219,7 @@ describe Activity do
|
|
219
219
|
describe "belonging to user's public relation" do
|
220
220
|
|
221
221
|
before do
|
222
|
-
create_activity(@user.contact_to!(@user),
|
222
|
+
create_activity(@user.contact_to!(@user), Relation::Public.instance)
|
223
223
|
end
|
224
224
|
|
225
225
|
describe "accessed by the sender" do
|
@@ -271,7 +271,7 @@ describe Activity do
|
|
271
271
|
|
272
272
|
before do
|
273
273
|
@tie = Factory(:public)
|
274
|
-
create_activity @tie.contact,
|
274
|
+
create_activity @tie.contact, Relation::Public.instance
|
275
275
|
create_ability_accessed_by @tie.receiver_subject
|
276
276
|
end
|
277
277
|
|