social_stream-events 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -1 +1,8 @@
1
+ //= require social_stream-base
2
+ //
3
+ //= require_self
1
4
  //= require_tree .
5
+
6
+ SocialStream.Events = SocialStream.Events || {};
7
+ SocialStream.Events.current = SocialStream.Events.current || {};
8
+
@@ -0,0 +1,21 @@
1
+ SocialStream.Events.Poster = (function(SS, $, undefined){
2
+ var init = function(){
3
+ $('.event_poster_update').hide();
4
+
5
+ $('.event_poster').hover(
6
+ function(){
7
+ $(this).find(".event_poster_update").fadeIn("slow");
8
+
9
+ },
10
+ function(){
11
+ $(this).find(".event_poster_update").fadeOut("slow");
12
+ });
13
+ }
14
+
15
+ SS.Timeline.addInitCallback(init);
16
+
17
+ return {
18
+ init: init
19
+ };
20
+
21
+ })(SocialStream, jQuery);
@@ -15,6 +15,7 @@
15
15
  text-align: center;
16
16
  vertical-align: middle;
17
17
  padding: 10px;
18
+ width: 40px;
18
19
  }
19
20
 
20
21
 
@@ -48,6 +49,30 @@ div.event_date {
48
49
  padding-top: 10px;
49
50
  }
50
51
 
52
+ .event_poster {
53
+ width: 80px;
54
+ height: 113px;
55
+ margin-right: 10px;
56
+ float: left;
57
+ position: relative;
58
+ }
59
+
60
+ .event_poster_update {
61
+ top: 95px;
62
+ left: 10px;
63
+ float: left;
64
+ position: absolute;
65
+ background: $secondary-color;
66
+ text-align: center;
67
+ opacity: 0.8;
68
+ width: 80;
69
+ height: 18px;
70
+ /* For IE 5-7 */
71
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
72
+ /* For IE 8 */
73
+ -MS-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
74
+ }
75
+
51
76
  #calendar {
52
77
  margin-top: 20px;
53
78
  }
@@ -0,0 +1,9 @@
1
+ module EventsHelper
2
+ def event_timeline_thumb(event)
3
+ if event.poster.new_record?
4
+ image_tag("poster.png")
5
+ else
6
+ thumb_for(event.poster, 80)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+ class ActivityObjectProperty::Poster < ActivityObjectProperty
2
+ end
data/app/models/event.rb CHANGED
@@ -27,6 +27,18 @@ class Event < ActiveRecord::Base
27
27
  end
28
28
  end
29
29
 
30
+ def poster_object
31
+ object_properties.
32
+ where('activity_object_properties.type' => 'ActivityObjectProperty::Poster').
33
+ first
34
+ end
35
+
36
+ def poster
37
+ @poster ||=
38
+ poster_object.try(:document) ||
39
+ build_poster
40
+ end
41
+
30
42
  protected
31
43
 
32
44
  def build_json(start_time = start_at, end_time = end_at)
@@ -41,6 +53,12 @@ class Event < ActiveRecord::Base
41
53
 
42
54
  end
43
55
 
56
+ def build_poster
57
+ Document.new(:event_property_object_id => activity_object_id,
58
+ :owner_id => owner_id)
59
+ end
60
+
61
+
44
62
  private
45
63
 
46
64
  def room_belongs_to_receiver
@@ -1,34 +1,46 @@
1
- <%= link_to event, :class => "event_date" do %>
2
- <div id="event-<%= event.id %>" class="event_date_image">
3
- <div class="event_day">
4
- <%= event.start_at.day %>
5
- </div>
6
- <div class="event_month">
7
- <%= l event.start_at, :format => "%b" %>
8
- </div>
9
- <% unless event.all_day? %>
10
- <div class="event_hour">
11
- <%= l event.start_at, :format => "%H:%M" %>
1
+ <%= div_for event do %>
2
+ <%= link_to event, :class => "event_date" do %>
3
+ <div class="event_date_image">
4
+ <div class="event_day">
5
+ <%= event.start_at.day %>
6
+ </div>
7
+ <div class="event_month">
8
+ <%= l event.start_at, :format => "%b" %>
9
+ </div>
10
+ <% unless event.all_day? %>
11
+ <div class="event_hour">
12
+ <%= l event.start_at, :format => "%H:%M" %>
13
+ </div>
14
+ <% end %>
12
15
  </div>
13
16
  <% end %>
14
- </div>
15
- <% end %>
16
17
 
17
- <%= javascript_tag do %>
18
- var d = new Date(<%= 1000*event.start_at.to_i %>);
19
- $("#event-<%= event.id %> .event_day").text($.datepicker.formatDate('d', d));
20
- $("#event-<%= event.id %> .event_month").text($.datepicker.formatDate('M', d));
21
- if($("#event-<%= event.id %> .event_hour").length) {
22
- var minutes = d.getMinutes();
23
- if (minutes<10) minutes = "0" + minutes;
24
- $("#event-<%= event.id %> .event_hour").text(d.getHours() + ':' + minutes);
25
- }
26
- <% end %>
18
+ <%= javascript_tag do %>
19
+ var d = new Date(<%= 1000*event.start_at.to_i %>);
20
+ $("#<%= dom_id event %> .event_day").text($.datepicker.formatDate('d', d));
21
+ $("#<%= dom_id event %> .event_month").text($.datepicker.formatDate('M', d));
22
+ if($("#<%= dom_id event %> .event_hour").length) {
23
+ var minutes = d.getMinutes();
24
+ if (minutes<10) minutes = "0" + minutes;
25
+ $("#<%= dom_id event %> .event_hour").text(d.getHours() + ':' + minutes);
26
+ }
27
+ <% end %>
27
28
 
28
- <div class="event_details">
29
- <div class="title">
30
- <%= link_to event.title, event %>
29
+ <div class="event_poster">
30
+ <%= event_timeline_thumb(event) %>
31
+
32
+ <% if can? :update, event %>
33
+ <div class="event_poster_update">
34
+ <%= link_to t('event.poster.update'), edit_event_path(event, :poster => true), :remote => true %>
35
+ </div>
36
+ <% end %>
31
37
  </div>
32
- </div>
38
+
39
+ <div class="event_details">
40
+ <div class="title">
41
+ <%= link_to event.title, event %>
42
+ </div>
43
+ </div>
44
+ <% end %>
33
45
 
34
46
  <div class="clearfloat"></div>
@@ -0,0 +1,8 @@
1
+ <%= form_for @event.poster do |f| %>
2
+ <%= f.hidden_field :event_property_object_id %>
3
+ <%= f.hidden_field :owner_id %>
4
+
5
+ <%= f.file_field :file %>
6
+
7
+ <%= f.submit %>
8
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if params[:poster] %>
2
+ $("#<%= dom_id @event %> .event_poster").hide("slow");
3
+ $("#<%= dom_id @event %> .event_details").hide("slow");
4
+ $("#<%= dom_id @event %>").append("<%= escape_javascript render(:partial => 'events/form_poster', :locals => { :event => @event }) %>");
5
+ <% end %>
@@ -24,6 +24,8 @@ en:
24
24
  new:
25
25
  title: "New event"
26
26
  one: "an event"
27
+ poster:
28
+ update: "Upload poster"
27
29
  title:
28
30
  one: "Event"
29
31
  other: "Events"
@@ -24,6 +24,8 @@ es:
24
24
  new:
25
25
  title: "Nuevo evento"
26
26
  one: "un evento"
27
+ poster:
28
+ update: "Subir cartel"
27
29
  title:
28
30
  one: "Evento"
29
31
  other: "Eventos"
@@ -17,7 +17,8 @@ module SocialStream
17
17
  autoload :Ability, 'social_stream/events/ability'
18
18
 
19
19
  module Models
20
- autoload :Actor, 'social_stream/events/models/actor'
20
+ autoload :Actor, 'social_stream/events/models/actor'
21
+ autoload :Document, 'social_stream/events/models/document'
21
22
  end
22
23
 
23
24
  SocialStream.objects.push(:event) unless SocialStream.objects.include?(:event)
@@ -13,6 +13,12 @@ module SocialStream
13
13
  end
14
14
  end
15
15
 
16
+ initializer "social_stream-events.document" do
17
+ ActiveSupport.on_load(:document) do
18
+ include SocialStream::Events::Models::Document
19
+ end
20
+ end
21
+
16
22
  initializer "social_stream-events.views.settings" do
17
23
  SocialStream::Views::Settings.module_eval do
18
24
  include SocialStream::Views::Settings::Events
@@ -0,0 +1,26 @@
1
+ module SocialStream
2
+ module Events
3
+ module Models
4
+ module Document
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ attr_accessor :event_property_object_id
9
+
10
+ before_validation(:on => :create) do
11
+ set_event
12
+ end
13
+ end
14
+
15
+ protected
16
+
17
+ def set_event
18
+ return if event_property_object_id.blank?
19
+
20
+ activity_object_holders <<
21
+ ActivityObjectProperty::Poster.new(:activity_object_id => event_property_object_id)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Events
3
- VERSION = "0.8.2".freeze
3
+ VERSION = "0.9.0".freeze
4
4
  end
5
5
  end
@@ -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.16.4')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.17.0')
16
16
  s.add_runtime_dependency('rails-scheduler', '~> 0.0.6')
17
17
  s.add_runtime_dependency('coffee-rails', '>= 3.1.0')
18
18
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,22 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-03-01 00:00:00.000000000Z
13
+ date: 2012-03-07 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: social_stream-base
17
- requirement: &73637880 !ruby/object:Gem::Requirement
17
+ requirement: &87586580 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 0.16.4
22
+ version: 0.17.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *73637880
25
+ version_requirements: *87586580
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rails-scheduler
28
- requirement: &73634100 !ruby/object:Gem::Requirement
28
+ requirement: &87586170 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.0.6
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *73634100
36
+ version_requirements: *87586170
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-rails
39
- requirement: &73632270 !ruby/object:Gem::Requirement
39
+ requirement: &87585810 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 3.1.0
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *73632270
47
+ version_requirements: *87585810
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: sqlite3-ruby
50
- requirement: &73630440 !ruby/object:Gem::Requirement
50
+ requirement: &87585530 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *73630440
58
+ version_requirements: *87585530
59
59
  description: ! 'Social Stream is a Ruby on Rails engine providing your application
60
60
  with social networking features and activity streams.
61
61
 
@@ -71,21 +71,26 @@ files:
71
71
  - Gemfile
72
72
  - README.rdoc
73
73
  - Rakefile
74
- - app/assets/javascripts/0_init.js
74
+ - app/assets/images/poster.png
75
75
  - app/assets/javascripts/events.js.coffee
76
76
  - app/assets/javascripts/social_stream-events.js
77
+ - app/assets/javascripts/social_stream.events.poster.js
77
78
  - app/assets/stylesheets/events.css.scss
78
79
  - app/assets/stylesheets/social_stream-events.css
79
80
  - app/controllers/events_controller.rb
80
81
  - app/controllers/rooms_controller.rb
82
+ - app/helpers/events_helper.rb
83
+ - app/models/activity_object_property/poster.rb
81
84
  - app/models/event.rb
82
85
  - app/models/room.rb
83
86
  - app/views/events/_calendar_month.erb
84
87
  - app/views/events/_event.html.erb
88
+ - app/views/events/_form_poster.html.erb
85
89
  - app/views/events/_new.html.erb
86
90
  - app/views/events/_sidebar_calendar.html.erb
87
91
  - app/views/events/create.js.erb
88
92
  - app/views/events/destroy.js.erb
93
+ - app/views/events/edit.js.erb
89
94
  - app/views/events/index.html.erb
90
95
  - app/views/rooms/_form.html.erb
91
96
  - app/views/rooms/_index.html.erb
@@ -106,6 +111,7 @@ files:
106
111
  - lib/social_stream/events/ability.rb
107
112
  - lib/social_stream/events/engine.rb
108
113
  - lib/social_stream/events/models/actor.rb
114
+ - lib/social_stream/events/models/document.rb
109
115
  - lib/social_stream/events/version.rb
110
116
  - lib/social_stream/migrations/events.rb
111
117
  - lib/social_stream/toolbar_config/events.rb
@@ -1,4 +0,0 @@
1
- var SocialStream = SocialStream || {};
2
- SocialStream.Events = SocialStream.Events || {};
3
- SocialStream.Events.current = SocialStream.Events.current || {};
4
-