social_stream 0.17.1 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +6 -6
- data/base/app/assets/images/flags/en.png +0 -0
- data/base/app/assets/images/flags/es.png +0 -0
- data/base/app/assets/javascripts/toolbar.js +22 -1
- data/base/app/assets/stylesheets/activities.css.scss +1 -1
- data/base/app/assets/stylesheets/cheesecake.css.scss +46 -4
- data/base/app/assets/stylesheets/settings.css +11 -0
- data/base/app/controllers/cheesecake_controller.rb +15 -3
- data/base/app/controllers/contacts_controller.rb +2 -0
- data/base/app/controllers/conversations_controller.rb +5 -5
- data/base/app/controllers/likes_controller.rb +1 -1
- data/base/app/helpers/notifications_helper.rb +10 -0
- data/base/app/models/activity.rb +55 -36
- data/base/app/models/activity_object.rb +3 -23
- data/base/app/models/actor.rb +20 -4
- data/base/app/models/channel.rb +13 -1
- data/base/app/models/comment.rb +4 -0
- data/base/app/models/contact.rb +55 -19
- data/base/app/models/group.rb +5 -2
- data/base/app/models/like.rb +2 -2
- data/base/app/models/relation/custom.rb +1 -1
- data/base/app/models/tie.rb +4 -3
- data/base/app/views/cheesecake/_cheesecake.html.erb +63 -0
- data/base/app/views/cheesecake/_index.html.erb +43 -86
- data/base/app/views/cheesecake/index.html.erb +2 -0
- data/base/app/views/cheesecake/update.js.erb +3 -0
- data/base/app/views/devise/passwords/new.html.erb +1 -1
- data/base/app/views/devise/registrations/new.html.erb +1 -1
- data/base/app/views/devise/sessions/new.html.erb +1 -1
- data/base/app/{assets/stylesheets/0_devise_sign.css → views/layouts/_devise_style.html.erb} +3 -1
- data/base/app/views/layouts/_header_signed_in.erb +1 -1
- data/base/app/views/message_mailer/new_message_email.html.erb +2 -1
- data/base/app/views/message_mailer/new_message_email.text.erb +2 -1
- data/base/app/views/message_mailer/reply_message_email.html.erb +2 -1
- data/base/app/views/message_mailer/reply_message_email.text.erb +2 -1
- data/base/app/views/notification_mailer/new_notification_email.html.erb +2 -1
- data/base/app/views/notification_mailer/new_notification_email.text.erb +2 -1
- data/base/app/views/notifications/activities/_post.html.erb +24 -1
- data/base/app/views/notifications/activities/_post.text.erb +22 -3
- data/base/app/views/settings/_language.html.erb +1 -1
- data/base/config/locales/en.yml +3 -2
- data/base/config/locales/es.yml +4 -3
- data/base/config/routes.rb +1 -0
- data/base/db/migrate/20120111141717_activity_channels.rb +74 -0
- data/base/lib/social_stream-base.rb +1 -0
- data/base/lib/social_stream/base/engine.rb +2 -1
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/models/channeled.rb +50 -0
- data/base/lib/social_stream/models/object.rb +4 -13
- data/base/lib/social_stream/toolbar_config/base.rb +1 -1
- data/base/lib/tasks/db/populate.rake +1 -1
- data/base/social_stream-base.gemspec +2 -2
- data/base/spec/controllers/comments_controller_spec.rb +3 -3
- data/base/spec/factories/activity.rb +3 -3
- data/base/spec/factories/contact.rb +2 -0
- data/base/spec/models/activity_authorization_spec.rb +5 -1
- data/base/spec/models/like_spec.rb +3 -3
- data/base/spec/models/tie_spec.rb +4 -4
- data/documents/app/assets/stylesheets/documents.css.scss +30 -5
- data/documents/app/helpers/documents_helper.rb +1 -1
- data/documents/app/models/picture.rb +9 -6
- data/documents/app/models/video.rb +2 -2
- data/documents/app/views/pictures/_picture.html.erb +16 -21
- data/documents/app/views/pictures/_picture_show.html.erb +2 -3
- data/documents/app/views/videos/_video_processed.html.erb +2 -2
- data/documents/config/locales/en.yml +1 -1
- data/documents/config/locales/es.yml +1 -1
- data/documents/lib/social_stream/documents/version.rb +1 -1
- data/documents/social_stream-documents.gemspec +1 -1
- data/events/app/models/event.rb +1 -12
- data/events/app/views/events/_sidebar_calendar.html.erb +37 -4
- data/events/app/views/events/index.html.erb +1 -0
- data/events/lib/social_stream/events/version.rb +1 -1
- data/events/social_stream-events.gemspec +1 -1
- data/lib/social_stream/release.rb +14 -2
- data/lib/social_stream/release/component/release.rb +1 -1
- data/lib/social_stream/version.rb +1 -1
- data/linkser/app/assets/stylesheets/linkser.css.scss +3 -3
- data/linkser/lib/social_stream/linkser/version.rb +1 -1
- data/linkser/social_stream-linkser.gemspec +1 -1
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/social_stream-presence.gemspec +1 -1
- data/social_stream.gemspec +5 -5
- data/social_stream.thor +7 -1
- metadata +37 -32
- data/base/vendor/assets/javascripts/menu.js +0 -25
- data/events/app/helpers/events_helper.rb +0 -26
@@ -76,7 +76,7 @@ module SocialStream
|
|
76
76
|
:url => new_message_path,
|
77
77
|
:options => {:link =>{:remote=> false}}}
|
78
78
|
items << { :key => :message_inbox,
|
79
|
-
:name => image_tag("btn/message_inbox.png")+t('message.inbox')+' (' + current_subject.
|
79
|
+
:name => image_tag("btn/message_inbox.png")+t('message.inbox')+' (' + current_subject.unread_messages_count.to_s + ')',
|
80
80
|
:url => conversations_path,
|
81
81
|
:options => {:link =>{:remote=> false}}}
|
82
82
|
items << { :key => :message_sentbox,
|
@@ -12,7 +12,7 @@ namespace :db do
|
|
12
12
|
require 'forgery'
|
13
13
|
|
14
14
|
LOGOS_PATH = File.join(Rails.root, 'lib', 'logos')
|
15
|
-
LOGOS_TOTAL = (ENV["LOGOS_TOTAL"] || 10).to_i
|
15
|
+
LOGOS_TOTAL = (ENV["LOGOS_TOTAL"] || 10).to_i
|
16
16
|
USERS = (ENV["USERS"] || 9).to_i
|
17
17
|
GROUPS = (ENV["GROUPS"] || 10).to_i
|
18
18
|
CHEESECAKE = (ENV["CHEESECAKE"].present? || false)
|
@@ -34,11 +34,11 @@ Gem::Specification.new do |s|
|
|
34
34
|
# Authorization
|
35
35
|
s.add_runtime_dependency('cancan', '~> 1.6.4')
|
36
36
|
# Pagination
|
37
|
-
s.add_runtime_dependency('kaminari', '~> 0.
|
37
|
+
s.add_runtime_dependency('kaminari', '~> 0.13.0')
|
38
38
|
# OAuth client
|
39
39
|
s.add_runtime_dependency('omniauth','~> 0.2.6')
|
40
40
|
# Messages
|
41
|
-
s.add_runtime_dependency('mailboxer','~> 0.
|
41
|
+
s.add_runtime_dependency('mailboxer','~> 0.6.0')
|
42
42
|
# Tagging
|
43
43
|
s.add_runtime_dependency('acts-as-taggable-on','~> 2.0.6')
|
44
44
|
# HTML Forms
|
@@ -13,7 +13,7 @@ describe CommentsController do
|
|
13
13
|
|
14
14
|
describe "comment from user" do
|
15
15
|
before do
|
16
|
-
activity = Factory(:self_activity, :
|
16
|
+
activity = Factory(:self_activity, :channel => @user.self_channel)
|
17
17
|
|
18
18
|
model_attributes[:author_id] = @user.actor_id
|
19
19
|
model_attributes[:owner_id] = @user.actor_id
|
@@ -38,7 +38,7 @@ describe CommentsController do
|
|
38
38
|
describe "comment to friend" do
|
39
39
|
before do
|
40
40
|
f = Factory(:friend, :contact => Factory(:contact, :receiver => @user.actor)).sender
|
41
|
-
activity = Factory(:self_activity, :
|
41
|
+
activity = Factory(:self_activity, :channel => f.contact_to!(f).channel)
|
42
42
|
|
43
43
|
model_attributes[:author_id] = @user.actor_id
|
44
44
|
model_attributes[:owner_id] = f.id
|
@@ -52,7 +52,7 @@ describe CommentsController do
|
|
52
52
|
describe "post to acquaintance" do
|
53
53
|
before do
|
54
54
|
a = Factory(:acquaintance, :contact => Factory(:contact, :receiver => @user.actor)).sender
|
55
|
-
activity = Factory(:self_activity, :
|
55
|
+
activity = Factory(:self_activity, :channel => a.self_channel)
|
56
56
|
|
57
57
|
model_attributes[:author_id] = @user.actor_id
|
58
58
|
model_attributes[:owner_id] = a.id
|
@@ -23,14 +23,14 @@ end
|
|
23
23
|
## End of helpers
|
24
24
|
|
25
25
|
Factory.define :activity do |a|
|
26
|
-
a.
|
26
|
+
a.channel { Factory(:friend).contact.channel }
|
27
27
|
a.activity_verb { ActivityVerb["post"] }
|
28
28
|
a.relation_ids { |b| Array(b.sender.relation_custom('friend').id) }
|
29
29
|
a.activity_object_ids { Array(Factory(:post_spec_helper).activity_object_spec_helper.id) }
|
30
30
|
end
|
31
31
|
|
32
32
|
Factory.define :self_activity, :parent => :activity do |a|
|
33
|
-
a.
|
33
|
+
a.channel { Factory(:self_contact).channel }
|
34
34
|
a.relation_ids { |b| Array(b.sender.relation_custom('friend').id) }
|
35
35
|
end
|
36
36
|
|
@@ -40,7 +40,7 @@ end
|
|
40
40
|
|
41
41
|
Factory.define :like_activity, :class => 'Activity' do |a|
|
42
42
|
a.association :parent, :factory => :activity
|
43
|
-
a.
|
43
|
+
a.channel { |b| Factory(:friend, :sender => b.parent.sender).receiver.contact_to!(b.parent.sender).channel }
|
44
44
|
a.activity_verb { ActivityVerb["like"] }
|
45
45
|
a.relation_ids { |b| b.parent.relation_ids }
|
46
46
|
a.after_build{ |b| b.activity_object_ids = b.parent.activity_object_ids }
|
@@ -1,6 +1,7 @@
|
|
1
1
|
Factory.define :contact do |c|
|
2
2
|
c.sender { |s| Factory(:user).actor }
|
3
3
|
c.receiver { |r| Factory(:user).actor }
|
4
|
+
c.user_author { |d| d.sender }
|
4
5
|
end
|
5
6
|
|
6
7
|
Factory.define :self_contact, :parent => :contact do |c|
|
@@ -9,6 +10,7 @@ end
|
|
9
10
|
|
10
11
|
Factory.define :group_contact, :parent => :contact do |g|
|
11
12
|
g.sender { |s| Factory(:group).actor }
|
13
|
+
g.after_build { |h| h.user_author = h.sender.user_author }
|
12
14
|
end
|
13
15
|
|
14
16
|
Factory.define :g2g_contact, :parent => :group_contact do |g|
|
@@ -281,7 +281,11 @@ describe Activity do
|
|
281
281
|
describe "build to non replied contact" do
|
282
282
|
before do
|
283
283
|
@tie = Factory(:friend, :contact => Factory(:contact, :sender => @user.actor))
|
284
|
-
|
284
|
+
partner = @tie.receiver
|
285
|
+
@activity = Activity.new :author => @user.actor,
|
286
|
+
:user_author => @user.author,
|
287
|
+
:owner => partner
|
288
|
+
|
285
289
|
create_ability_accessed_by @tie.sender_subject
|
286
290
|
end
|
287
291
|
|
@@ -20,7 +20,7 @@ describe Like do
|
|
20
20
|
describe "actor" do
|
21
21
|
shared_examples_for "creates activity" do
|
22
22
|
it "should recognize the user who likes it" do
|
23
|
-
Like.build(@sender, @receiver).save
|
23
|
+
Like.build(@sender, @sender, @receiver).save
|
24
24
|
|
25
25
|
assert @receiver.liked_by?(@sender)
|
26
26
|
end
|
@@ -28,13 +28,13 @@ describe Like do
|
|
28
28
|
it "should increment like count" do
|
29
29
|
count = @receiver.like_count
|
30
30
|
|
31
|
-
Like.build(@sender, @receiver).save
|
31
|
+
Like.build(@sender, @sender, @receiver).save
|
32
32
|
|
33
33
|
@receiver.like_count.should eq(count + 1)
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should decrement like count" do
|
37
|
-
@like = Like.build(@sender, @receiver)
|
37
|
+
@like = Like.build(@sender, @sender, @receiver)
|
38
38
|
@like.save
|
39
39
|
|
40
40
|
count = @receiver.like_count
|
@@ -41,8 +41,8 @@ describe Tie do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should create activity with follow verb" do
|
44
|
-
@tie.contact.activities.should be_present
|
45
|
-
@tie.contact.activities.first.verb.should eq('follow')
|
44
|
+
@tie.contact.channel.activities.should be_present
|
45
|
+
@tie.contact.channel.activities.first.verb.should eq('follow')
|
46
46
|
end
|
47
47
|
|
48
48
|
context "reciprocal" do
|
@@ -51,8 +51,8 @@ describe Tie do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should create activity with make-friend verb" do
|
54
|
-
@reciprocal.contact.activities.should be_present
|
55
|
-
@reciprocal.contact.activities.first.verb.should eq('make-friend')
|
54
|
+
@reciprocal.contact.channel.activities.should be_present
|
55
|
+
@reciprocal.contact.channel.activities.first.verb.should eq('make-friend')
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -18,15 +18,23 @@
|
|
18
18
|
|
19
19
|
.attachment_text
|
20
20
|
{
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
float: left;
|
22
|
+
font-size:11px;
|
23
|
+
margin-bottom: 3px;
|
24
|
+
text-align: left;
|
25
|
+
width: 310px;
|
26
|
+
}
|
27
|
+
|
28
|
+
.attachment_text .title
|
29
|
+
{
|
30
|
+
font-weight: bold;
|
31
|
+
margin: 10px 0 3px 0;
|
24
32
|
}
|
25
33
|
|
26
34
|
.attachment_text_link
|
27
35
|
{
|
28
36
|
color: #2A3890;
|
29
|
-
|
37
|
+
text-decoration: underline;
|
30
38
|
}
|
31
39
|
|
32
40
|
.attachment_text audio
|
@@ -46,7 +54,7 @@
|
|
46
54
|
/*width: 10%;*/
|
47
55
|
float: left;
|
48
56
|
/*height: 50px;*/
|
49
|
-
|
57
|
+
padding-right:5px;
|
50
58
|
vertical-align: middle;
|
51
59
|
}
|
52
60
|
|
@@ -278,3 +286,20 @@
|
|
278
286
|
width: 100%;
|
279
287
|
text-align: center;
|
280
288
|
}
|
289
|
+
|
290
|
+
/* Uploaded images, audio and vids */
|
291
|
+
.picture_thumbnail_show {
|
292
|
+
padding: 10px;
|
293
|
+
}
|
294
|
+
|
295
|
+
.picture_thumbnail_show, .picture_thumbnail_show img {
|
296
|
+
position: relative;
|
297
|
+
float: left;
|
298
|
+
max-height: 100px;
|
299
|
+
width: 130px;
|
300
|
+
}
|
301
|
+
|
302
|
+
.attachment_thumb {
|
303
|
+
position: relative;
|
304
|
+
float: left;
|
305
|
+
}
|
@@ -20,7 +20,7 @@ module DocumentsHelper
|
|
20
20
|
def link_for_wall(document)
|
21
21
|
format = Mime::Type.lookup(document.file_content_type)
|
22
22
|
|
23
|
-
polymorphic_path(document, :format => format, :style => '
|
23
|
+
polymorphic_path(document, :format => format, :style => 'thumbwall')
|
24
24
|
end
|
25
25
|
|
26
26
|
def show_view_for(document)
|
@@ -2,8 +2,9 @@ class Picture < Document
|
|
2
2
|
has_attached_file :file,
|
3
3
|
:url => '/:class/:id.:extension',
|
4
4
|
:path => ':rails_root/documents/:class/:id_partition/:style',
|
5
|
-
:styles => {:
|
6
|
-
:
|
5
|
+
:styles => {:thumb48sq => ["48x48"],
|
6
|
+
:thumbwall => ["130x97#"],
|
7
|
+
:preview => ["500>"]
|
7
8
|
}
|
8
9
|
|
9
10
|
define_index do
|
@@ -14,17 +15,19 @@ class Picture < Document
|
|
14
15
|
|
15
16
|
has created_at
|
16
17
|
end
|
18
|
+
|
17
19
|
# Thumbnail file
|
18
20
|
def thumb(size, helper)
|
19
21
|
case size
|
20
22
|
when 16
|
21
23
|
"#{ size.to_s }/photo.png"
|
22
24
|
when 48
|
23
|
-
helper.picture_path self, :format => format, :style => '
|
25
|
+
helper.picture_path self, :format => format, :style => 'thumb48sq'
|
24
26
|
when 130
|
25
|
-
helper.picture_path self, :format => format, :style => '
|
27
|
+
helper.picture_path self, :format => format, :style => 'thumbwall'
|
28
|
+
when 500
|
29
|
+
helper.picture_path self, :format => format, :style => 'preview'
|
26
30
|
end
|
27
31
|
end
|
28
|
-
|
29
|
-
|
32
|
+
|
30
33
|
end
|
@@ -5,8 +5,8 @@ class Video < Document
|
|
5
5
|
:styles => {
|
6
6
|
:webm => {:format => 'webm'},
|
7
7
|
:flv => { :format => 'flv' },
|
8
|
-
:
|
9
|
-
:
|
8
|
+
:thumb48sq => {:geometry => "48x48" , :format => 'png', :time => 5},
|
9
|
+
:thumbwall => {:geometry => "130x97#", :format => 'png', :time => 5}
|
10
10
|
},
|
11
11
|
:processors => [:ffmpeg]
|
12
12
|
|
@@ -1,29 +1,24 @@
|
|
1
1
|
<%= div_for picture, :class => 'content_size' do %>
|
2
2
|
|
3
|
-
<div class="attachment_thumb picture_link">
|
4
|
-
<%= link_to thumb_for(picture, 16),
|
5
|
-
picture_path(picture),
|
6
|
-
:type => picture.type,
|
7
|
-
:title => picture.title,
|
8
|
-
:path => document_path(picture) %>
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<div class="attachment_text picture_summary_class picture_link">
|
12
|
-
<%= t('picture.msg') %>
|
13
|
-
<%= link_to "\""+picture.title+"\"",
|
14
|
-
picture_path(picture),
|
15
|
-
:alt => picture.title,
|
16
|
-
:type => picture.type,
|
17
|
-
:path => document_path(picture),
|
18
|
-
:class => "attachment_text_link" %>
|
19
|
-
</div>
|
20
|
-
|
21
3
|
<div class="picture_link picture_thumbnail_show">
|
22
4
|
<%= link_to thumb_for(picture, 130),
|
23
5
|
download_document_path(picture),
|
24
|
-
:type => picture.type,
|
25
|
-
|
26
|
-
|
6
|
+
:type => picture.type,
|
7
|
+
:title => picture.title,
|
8
|
+
:path => document_path(picture) %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="attachment_text picture_summary_class">
|
12
|
+
<div class="title">
|
13
|
+
<%= picture.title %>
|
14
|
+
</div>
|
15
|
+
<%= picture.description %>
|
16
|
+
<%= link_to t('picture.msg'),
|
17
|
+
picture_path(picture),
|
18
|
+
:alt => t('picture.msg'),
|
19
|
+
:type => picture.type,
|
20
|
+
:path => document_path(picture),
|
21
|
+
:class => "attachment_text_link picture_link" %>
|
27
22
|
</div>
|
28
23
|
<% end %>
|
29
24
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= div_for picture, :class => 'content_size' do %>
|
2
2
|
<div class="picture_show">
|
3
|
-
<%= link_to
|
3
|
+
<%= link_to thumb_for(picture, 500),
|
4
4
|
download_document_path(picture),
|
5
5
|
:id => dom_id(picture) + "_a",
|
6
6
|
:type => picture.type,
|
@@ -12,7 +12,6 @@
|
|
12
12
|
|
13
13
|
<%= javascript_tag do %>
|
14
14
|
$(document).ready(function() {
|
15
|
-
$("#<%= dom_id picture %> #<%= dom_id picture %>_img").aeImageResize({ height: 500, width: 500 });
|
16
15
|
$("#<%= dom_id picture %> #<%= dom_id picture %>_a").lightBox({
|
17
16
|
maxHeight: 920,
|
18
17
|
maxWidth: 920,
|
@@ -23,4 +22,4 @@
|
|
23
22
|
imageBlank: '../assets/lightbox-blank.gif'});
|
24
23
|
|
25
24
|
})
|
26
|
-
<% end %>
|
25
|
+
<% end %>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
video,
|
10
10
|
:class => "attachment_text_link" %>
|
11
11
|
<div id="video_thumbnail_<%= video.id%>" class="video_thumbnail_class">
|
12
|
-
<%= image_tag(video_path(video, :format => :png, :style => '
|
12
|
+
<%= image_tag(video_path(video, :format => :png, :style => 'thumbwall'), :class => "video_thumbnail_image", :alt => "")%> <div id="<%= video.id%>" class="video_thumbnail_play_over"></div>
|
13
13
|
</div>
|
14
14
|
<div id="full_video_<%= video.id%>" class="jp-video jp-video-270p">
|
15
15
|
<div class="jp-type-single">
|
@@ -47,4 +47,4 @@
|
|
47
47
|
<div id="jp_playlist_<%= video.id%>" class="jp-playlist"></div>
|
48
48
|
</div>
|
49
49
|
</div>
|
50
|
-
</div>
|
50
|
+
</div>
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
|
14
14
|
# Gem dependencies
|
15
|
-
s.add_runtime_dependency('social_stream-base', '~> 0.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.13.0')
|
16
16
|
s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
|
17
17
|
# Waiting for version > 2.4.5, which fixes:
|
18
18
|
# https://github.com/thoughtbot/paperclip/issues/293
|
data/events/app/models/event.rb
CHANGED
@@ -9,23 +9,12 @@ class Event < ActiveRecord::Base
|
|
9
9
|
|
10
10
|
validate :room_belongs_to_receiver
|
11
11
|
|
12
|
-
class << self
|
13
|
-
def ocurrences(start_date, end_date)
|
14
|
-
between(start_date, end_date).
|
15
|
-
map { |e|
|
16
|
-
e.ocurrences(start_date, end_date)
|
17
|
-
}.
|
18
|
-
flatten.
|
19
|
-
uniq
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
12
|
def to_json(options = {})
|
24
13
|
if recurrence
|
25
14
|
st = options[:start].try(:to_date)
|
26
15
|
en = (options[:end] || end_at.end_of_month + 7.days).to_date
|
27
16
|
|
28
|
-
|
17
|
+
recurrence.events(:starts => st, :until => en).map do |d|
|
29
18
|
|
30
19
|
start_diff = d - start_at.to_date
|
31
20
|
end_diff = d - end_at.to_date
|
@@ -3,20 +3,21 @@
|
|
3
3
|
<div class="block">
|
4
4
|
<div class="content">
|
5
5
|
|
6
|
+
<% bow = (Time.now - 1.days).beginning_of_week %>
|
7
|
+
|
6
8
|
<%= render :partial => 'events/calendar_month',
|
7
9
|
:locals => {
|
8
10
|
:position => :top,
|
9
|
-
:date =>
|
11
|
+
:date => bow.to_date
|
10
12
|
} %>
|
11
13
|
|
12
14
|
<table id="sidebar_calendar">
|
13
|
-
<% bow = Time.now.beginning_of_week %>
|
14
15
|
|
15
16
|
<% 28.times do |i| %>
|
16
17
|
<% day = bow + i.days %>
|
17
18
|
|
18
19
|
<%= raw cycle(*(Array.wrap("<tr>") + 6.times.map{""}) + Array.wrap(:name => "tr_start")) %>
|
19
|
-
<td
|
20
|
+
<td id="sidebar_day_<%= day.day %>_<%= day.month %>_<%= day.year %>" class="sidebar_day">
|
20
21
|
<%= link_to day.day, polymorphic_path([profile_or_current_subject, Event.new], :date => day.to_i, :view => "agendaDay") %>
|
21
22
|
</td>
|
22
23
|
|
@@ -24,10 +25,42 @@
|
|
24
25
|
<% end %>
|
25
26
|
</table>
|
26
27
|
|
28
|
+
<%= javascript_tag do %>
|
29
|
+
var now = new Date();
|
30
|
+
$('#sidebar_day_' + now.getDate() + '_' + (now.getMonth()+1) + '_' + now.getFullYear()).addClass('today');
|
31
|
+
var re = new RegExp('sidebar_day_(..?)_(..?)_(..?.?.?)');
|
32
|
+
$('.sidebar_day').each(function(index, domEl){
|
33
|
+
var m = re.exec(domEl.id);
|
34
|
+
if(m == null) return;
|
35
|
+
var d = new Date(m[3], (m[2]-1), m[1], 23, 59, 59);
|
36
|
+
if(d < now) $(domEl).addClass('past');
|
37
|
+
if(m[2] != (now.getMonth()+1)) $(domEl).addClass('next_month');
|
38
|
+
});
|
39
|
+
$.ajax({
|
40
|
+
dataType: 'json',
|
41
|
+
cache: false,
|
42
|
+
url: "<%= escape_javascript polymorphic_path([@current_subject, Event.new]) %>",
|
43
|
+
data: {
|
44
|
+
start: <%= bow.to_i %>,
|
45
|
+
end: <%= (bow + 28.days).to_i %>
|
46
|
+
},
|
47
|
+
success: function(events) {
|
48
|
+
$.map(events, function(event) {
|
49
|
+
var start = new Date(event.start); // This applies TZ
|
50
|
+
var end = new Date(event.end);
|
51
|
+
for(loopTime=start.getTime(); loopTime <= end.getTime(); loopTime+=86400000) {
|
52
|
+
var d = new Date(loopTime);
|
53
|
+
$('#sidebar_day_'+ d.getDate() + '_' + (d.getMonth()+1) + '_' + d.getFullYear()).addClass("busy");
|
54
|
+
}
|
55
|
+
})
|
56
|
+
}
|
57
|
+
});
|
58
|
+
<% end %>
|
59
|
+
|
27
60
|
<%= render :partial => 'events/calendar_month',
|
28
61
|
:locals => {
|
29
62
|
:position => :bottom,
|
30
|
-
:date =>
|
63
|
+
:date => (bow + 28.days).to_date
|
31
64
|
} %>
|
32
65
|
|
33
66
|
</div>
|