social_stream-documents 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -95,3 +95,59 @@
95
95
  right: 0px;
96
96
  width: 24px;
97
97
  }
98
+
99
+ #media_wall{
100
+ position: relative;
101
+ margin-left: auto;
102
+ margin-right: auto;
103
+ background-color: #e0edf2;
104
+ width: 100%;
105
+ margin-bottom: 20px;
106
+ height: 130px;
107
+ }
108
+
109
+ #media_wall_buttons{
110
+ position: relative;
111
+ margin-left: auto;
112
+ margin-right: auto;
113
+ width: 100%;
114
+ text-align: right;
115
+ }
116
+
117
+ #media_wall_buttons li{
118
+ display:inline;
119
+ margin-left:2px;
120
+ margin-right:2px;
121
+ padding: 0px;
122
+ }
123
+
124
+ .media_preview{
125
+ float:left;
126
+ margin: 10px;
127
+ width: 140px;
128
+ height: 110px;
129
+ text-align:center;
130
+ }
131
+
132
+ .media_preview_image{
133
+ position: relative;
134
+ top: 0px;
135
+ width:130px;
136
+ height: 80px;
137
+ }
138
+
139
+ .media_preview_title{
140
+ position:relative;
141
+ width: 100%;
142
+ overflow:hidden;
143
+ font-size: 12px;
144
+ color: #2A3890;
145
+ }
146
+
147
+ .media_preview_detail{
148
+ position: relative;
149
+ width: 100%;
150
+ overflow:hidden;
151
+ font-size: 11px;
152
+ color: #2A3890;
153
+ }
@@ -13,7 +13,7 @@ class AudiosController < InheritedResources::Base
13
13
  def index
14
14
  @document_activities = current_subject.wall(:profile,
15
15
  :for => current_subject,
16
- :object_type => :Audio).all;
16
+ :object_type => :Audio).page(params[:page]).per(params[:per])
17
17
  end
18
18
 
19
19
  end
@@ -30,7 +30,7 @@ class DocumentsController < InheritedResources::Base
30
30
  def index
31
31
  @document_activities = current_subject.wall(:profile,
32
32
  :for => current_subject,
33
- :object_type => [:Audio,:Video,:Picture,:Document]).all;
33
+ :object_type => [:Audio,:Video,:Picture,:Document]).page(params[:page]).per(params[:per])
34
34
  end
35
35
 
36
36
  def create
@@ -13,6 +13,6 @@ class PicturesController < InheritedResources::Base
13
13
  def index
14
14
  @document_activities = current_subject.wall(:profile,
15
15
  :for => current_subject,
16
- :object_type => :Picture).all;
16
+ :object_type => :Picture).page(params[:page]).per(params[:per])
17
17
  end
18
18
  end
@@ -16,7 +16,7 @@ class VideosController < InheritedResources::Base
16
16
  def index
17
17
  @document_activities = current_subject.wall(:profile,
18
18
  :for => current_subject,
19
- :object_type => :Video).all;
19
+ :object_type => :Video).page(params[:page]).per(params[:per])
20
20
  end
21
21
 
22
22
  end
@@ -8,13 +8,19 @@ module DocumentsHelper
8
8
  image_tag 'formats/'+format.split('/')[1]+'.png'
9
9
  else
10
10
  if is_image?(document)
11
- image_tag document.file.url(:thumb)+"?style=thumb"
11
+ format = Mime::Type.lookup(document.file_content_type)
12
+ image_tag url_for(document)+"."+format.to_sym.to_s+"?style=thumb"
12
13
  else
13
14
  image_tag 'formats/default.png'
14
15
  end
15
16
  end
16
17
  end
17
18
 
19
+ def link_for_wall(document)
20
+ format = Mime::Type.lookup(document.file_content_type)
21
+ url_for(document)+"."+format.to_sym.to_s+"?style=thumb0"
22
+ end
23
+
18
24
  def wrap_file_name(name)
19
25
  name
20
26
  if(name.length > 12)
@@ -2,5 +2,7 @@ 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.:extension',
5
- :styles => {:thumb => ["48x48#", :png]}
5
+ :styles => {:thumb => ["48x48#"],
6
+ :thumb0 => ["130x80#"]
7
+ }
6
8
  end
data/app/models/video.rb CHANGED
@@ -5,7 +5,8 @@ class Video < Document
5
5
  :url => '/:class/:id.:extension',
6
6
  :path => ':rails_root/documents/:class/:id_partition/:style.:extension',
7
7
  :styles => {:webm => {:format => 'webm'},
8
- :thumb => {:geometry => "48x48#", :format => 'png', :time => 5}
8
+ :thumb => {:geometry => "48x48#" , :format => 'png', :time => 5},
9
+ :thumb0 => {:geometry => "130x80#", :format => 'png', :time => 5}
9
10
  },:processors => [:ffmpeg]
10
11
 
11
12
  def videoprocess
File without changes
@@ -0,0 +1 @@
1
+ $('#media_wall').html("<%= escape_javascript(render :partial =>"audios/mediapreviews") %>");
@@ -1 +1 @@
1
- <%= image_tag("btn/document.png") %> <%=t('document.title')%>
1
+ <%= image_tag("btn/document.png") %> <%=t('resource.title')%>
@@ -0,0 +1,7 @@
1
+ <% @document_activities.each do |a| %>
2
+ <div class="media_preview all">
3
+ <img src="#" class="media_preview_image" />
4
+ <div class="media_preview_title">Some document</div>
5
+ <div class="media_preview_detail">some detail</div>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,111 @@
1
+ <div id="media_wall_buttons">
2
+ <ul>
3
+ <li>
4
+ <%= link_to( image_tag("btn/btn_conferences.png",
5
+ :media => "conference"), videos_path, :remote => true) %>
6
+ </li>
7
+ <li>
8
+ <%= link_to( image_tag("btn/btn_gallery.png",
9
+ :media => "picture"), pictures_path, :remote => true, :page => 1, :per => 1) %>
10
+ </li>
11
+ <li>
12
+ <%= link_to( image_tag("btn/btn_video.png",
13
+ :media => "video"), videos_path, :remote => true) %>
14
+ </li>
15
+ <li>
16
+ <%= link_to( image_tag("btn/btn_audio.png",
17
+ :media => "audio"), audios_path, :remote => true) %>
18
+ </li>
19
+ <li>
20
+ <%= link_to(t('document.simple_all'), documents_path, :remote => true) %>
21
+ </li>
22
+ </ul>
23
+ </div>
24
+
25
+ <div id="media_wall">
26
+ <div class="media_preview conference">
27
+ <img src="#" class="media_preview_image" />
28
+ <div class="media_preview_title">Some conference</div>
29
+ <div class="media_preview_detail">some detail</div>
30
+ </div>
31
+
32
+ <div class="media_preview conference">
33
+ <img src="#" class="media_preview_image" />
34
+ <div class="media_preview_title">Some conference</div>
35
+ <div class="media_preview_detail">some detail</div>
36
+ </div>
37
+
38
+ <div class="media_preview conference">
39
+ <img src="#" class="media_preview_image" />
40
+ <div class="media_preview_title">Some conference</div>
41
+ <div class="media_preview_detail">some detail</div>
42
+ </div>
43
+
44
+ <div class="media_preview picture">
45
+ <img src="#" class="media_preview_image" />
46
+ <div class="media_preview_title">Some picture</div>
47
+ <div class="media_preview_detail">some detail</div>
48
+ </div>
49
+
50
+ <div class="media_preview picture">
51
+ <img src="#" class="media_preview_image" />
52
+ <div class="media_preview_title">Some picture</div>
53
+ <div class="media_preview_detail">some detail</div>
54
+ </div>
55
+
56
+ <div class="media_preview picture">
57
+ <img src="#" class="media_preview_image" />
58
+ <div class="media_preview_title">Some picture</div>
59
+ <div class="media_preview_detail">some detail</div>
60
+ </div>
61
+
62
+ <div class="media_preview video">
63
+ <img src="#" class="media_preview_image" />
64
+ <div class="media_preview_title">Some video</div>
65
+ <div class="media_preview_detail">some detail</div>
66
+ </div>
67
+
68
+ <div class="media_preview video">
69
+ <img src="#" class="media_preview_image" />
70
+ <div class="media_preview_title">Some video</div>
71
+ <div class="media_preview_detail">some detail</div>
72
+ </div>
73
+
74
+ <div class="media_preview video">
75
+ <img src="#" class="media_preview_image" />
76
+ <div class="media_preview_title">Some video</div>
77
+ <div class="media_preview_detail">some detail</div>
78
+ </div>
79
+
80
+ <div class="media_preview audio">
81
+ <img src="#" class="media_preview_image" />
82
+ <div class="media_preview_title">Some audio</div>
83
+ <div class="media_preview_detail">some detail</div>
84
+ </div>
85
+
86
+ <div class="media_preview audio">
87
+ <img src="#" class="media_preview_image" />
88
+ <div class="media_preview_title">Some audio</div>
89
+ <div class="media_preview_detail">some detail</div>
90
+ </div>
91
+
92
+ <div class="media_preview audio">
93
+ <img src="#" class="media_preview_image" />
94
+ <div class="media_preview_title">Some audio</div>
95
+ <div class="media_preview_detail">some detail</div>
96
+ </div>
97
+ </div>
98
+
99
+ <% content_for :headers do %>
100
+ <%= stylesheet_link_tag "documents" %>
101
+ <% end %>
102
+
103
+ <script>
104
+ $('#media_wall div.media_preview').hide();
105
+ $('#media_wall div.conference').show();
106
+
107
+ $('#media_wall_buttons a').click(function(e){
108
+ $('#media_wall div.media_preview').hide("fast");
109
+ // $('#media_wall div.'+$(this).children('img').attr('media')).show("slow");
110
+ });
111
+ </script>
@@ -0,0 +1 @@
1
+ $('#media_wall').html("<%= escape_javascript(render :partial =>"documents/mediapreviews") %>");
@@ -0,0 +1,8 @@
1
+ <% @document_activities.each do |a| %>
2
+ <% document = a.activity_objects.first.document %>
3
+ <div class="media_preview picture">
4
+ <img src="<%= link_for_wall(document) %>" class="media_preview_image" />
5
+ <div class="media_preview_title"><%= document.file_file_name %></div>
6
+ <div class="media_preview_detail">some detail</div>
7
+ </div>
8
+ <% end %>
@@ -0,0 +1 @@
1
+ $('#media_wall').html("<%= escape_javascript(render :partial =>"pictures/mediapreviews") %>");
@@ -11,6 +11,7 @@ en:
11
11
  mine: "My conferences"
12
12
  msg: "Just uploaded a conference:"
13
13
  document:
14
+ simple_all: "All"
14
15
  all: "All documents"
15
16
  confirm_delete: "Delete document?"
16
17
  title: "Documents"
@@ -2,12 +2,8 @@ module SocialStream
2
2
  module Documents
3
3
  class Engine < Rails::Engine
4
4
 
5
- initializer "social_stream-documents.documents_in_social_stream_objects" do
6
- SocialStream.objects.push(:document) unless SocialStream.objects.include?(:document)
7
- end
8
-
9
5
  initializer "social_stream-documents.register_mime_types" do
10
- Mime::Type.register "image/jpeg", :jpeg, [ "image/pjpeg" ]
6
+ Mime::Type.register "image/jpeg", :jpeg, ["image/pjpeg","image/jpg"]
11
7
  Mime::Type.register "image/gif", :gif
12
8
  Mime::Type.register "image/png", :png, [ "image/x-png" ]
13
9
  Mime::Type.register "image/bmp", :bmp
@@ -2,6 +2,11 @@ require 'social_stream-base'
2
2
 
3
3
  module SocialStream
4
4
  module Documents
5
+ # Add :document to SocialStream.objects and SocialStream.activity_forms by default
6
+ # It can be configured by users at application's config/initializers/social_stream.rb
7
+ %w(objects activity_forms).each do |m|
8
+ SocialStream.__send__(m).push(:document) unless SocialStream.__send__(m).include?(:document)
9
+ end
5
10
  end
6
11
  end
7
12
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "social_stream-documents"
3
- s.version = "0.1.1"
3
+ s.version = "0.1.2"
4
4
  s.authors = ["Víctor Sánchez Belmar", "GING - DIT - UPM"]
5
5
  s.summary = "File capabilities for Social Stream, the core for building social network websites"
6
6
  s.description = "Social Stream is a Ruby on Rails engine providing your application with social networking features and activity streams.\n\nThis gem allow you upload almost any kind of file as new social stream activity."
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-documents
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "V\xC3\xADctor S\xC3\xA1nchez Belmar"
@@ -16,12 +16,11 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-04 00:00:00 +02:00
20
- default_executable:
19
+ date: 2011-07-06 00:00:00 Z
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
22
+ name: social_stream-base
23
23
  prerelease: false
24
- type: :runtime
25
24
  requirement: &id001 !ruby/object:Gem::Requirement
26
25
  none: false
27
26
  requirements:
@@ -33,11 +32,11 @@ dependencies:
33
32
  - 6
34
33
  - 0
35
34
  version: 0.6.0
36
- name: social_stream-base
35
+ type: :runtime
37
36
  version_requirements: *id001
38
37
  - !ruby/object:Gem::Dependency
38
+ name: paperclip-ffmpeg
39
39
  prerelease: false
40
- type: :runtime
41
40
  requirement: &id002 !ruby/object:Gem::Requirement
42
41
  none: false
43
42
  requirements:
@@ -49,11 +48,11 @@ dependencies:
49
48
  - 6
50
49
  - 0
51
50
  version: 0.6.0
52
- name: paperclip-ffmpeg
51
+ type: :runtime
53
52
  version_requirements: *id002
54
53
  - !ruby/object:Gem::Dependency
54
+ name: rails
55
55
  prerelease: false
56
- type: :development
57
56
  requirement: &id003 !ruby/object:Gem::Requirement
58
57
  none: false
59
58
  requirements:
@@ -67,11 +66,11 @@ dependencies:
67
66
  - rc
68
67
  - 4
69
68
  version: 3.1.0.rc4
70
- name: rails
69
+ type: :development
71
70
  version_requirements: *id003
72
71
  - !ruby/object:Gem::Dependency
72
+ name: sqlite3-ruby
73
73
  prerelease: false
74
- type: :development
75
74
  requirement: &id004 !ruby/object:Gem::Requirement
76
75
  none: false
77
76
  requirements:
@@ -81,11 +80,11 @@ dependencies:
81
80
  segments:
82
81
  - 0
83
82
  version: "0"
84
- name: sqlite3-ruby
83
+ type: :development
85
84
  version_requirements: *id004
86
85
  - !ruby/object:Gem::Dependency
86
+ name: ruby-debug
87
87
  prerelease: false
88
- type: :development
89
88
  requirement: &id005 !ruby/object:Gem::Requirement
90
89
  none: false
91
90
  requirements:
@@ -97,11 +96,11 @@ dependencies:
97
96
  - 10
98
97
  - 3
99
98
  version: 0.10.3
100
- name: ruby-debug
99
+ type: :development
101
100
  version_requirements: *id005
102
101
  - !ruby/object:Gem::Dependency
102
+ name: rspec-rails
103
103
  prerelease: false
104
- type: :development
105
104
  requirement: &id006 !ruby/object:Gem::Requirement
106
105
  none: false
107
106
  requirements:
@@ -113,11 +112,11 @@ dependencies:
113
112
  - 5
114
113
  - 0
115
114
  version: 2.5.0
116
- name: rspec-rails
115
+ type: :development
117
116
  version_requirements: *id006
118
117
  - !ruby/object:Gem::Dependency
118
+ name: factory_girl
119
119
  prerelease: false
120
- type: :development
121
120
  requirement: &id007 !ruby/object:Gem::Requirement
122
121
  none: false
123
122
  requirements:
@@ -129,11 +128,11 @@ dependencies:
129
128
  - 3
130
129
  - 2
131
130
  version: 1.3.2
132
- name: factory_girl
131
+ type: :development
133
132
  version_requirements: *id007
134
133
  - !ruby/object:Gem::Dependency
134
+ name: forgery
135
135
  prerelease: false
136
- type: :development
137
136
  requirement: &id008 !ruby/object:Gem::Requirement
138
137
  none: false
139
138
  requirements:
@@ -145,11 +144,11 @@ dependencies:
145
144
  - 3
146
145
  - 6
147
146
  version: 0.3.6
148
- name: forgery
147
+ type: :development
149
148
  version_requirements: *id008
150
149
  - !ruby/object:Gem::Dependency
150
+ name: capybara
151
151
  prerelease: false
152
- type: :development
153
152
  requirement: &id009 !ruby/object:Gem::Requirement
154
153
  none: false
155
154
  requirements:
@@ -161,7 +160,7 @@ dependencies:
161
160
  - 3
162
161
  - 9
163
162
  version: 0.3.9
164
- name: capybara
163
+ type: :development
165
164
  version_requirements: *id009
166
165
  description: |-
167
166
  Social Stream is a Ruby on Rails engine providing your application with social networking features and activity streams.
@@ -217,18 +216,25 @@ files:
217
216
  - app/models/video.rb
218
217
  - app/views/audios/_audio.html.erb
219
218
  - app/views/audios/_index.html.erb
219
+ - app/views/audios/_mediapreviews.html.erb
220
220
  - app/views/audios/_new.html.erb
221
221
  - app/views/audios/index.html.erb
222
+ - app/views/audios/index.js.erb
222
223
  - app/views/documents/_document.html.erb
223
224
  - app/views/documents/_fields.html.erb
224
225
  - app/views/documents/_header.html.erb
225
226
  - app/views/documents/_index.html.erb
227
+ - app/views/documents/_mediapreviews.html.erb
228
+ - app/views/documents/_mediawall.html.erb
226
229
  - app/views/documents/_new.html.erb
227
230
  - app/views/documents/index.html.erb
231
+ - app/views/documents/index.js.erb
228
232
  - app/views/pictures/_index.html.erb
233
+ - app/views/pictures/_mediapreviews.html.erb
229
234
  - app/views/pictures/_new.html.erb
230
235
  - app/views/pictures/_picture.html.erb
231
236
  - app/views/pictures/index.html.erb
237
+ - app/views/pictures/index.js.erb
232
238
  - app/views/toolbar/_uploads_menu.html.erb
233
239
  - app/views/videos/_index.html.erb
234
240
  - app/views/videos/_new.html.erb
@@ -276,7 +282,6 @@ files:
276
282
  - spec/integration/navigation_spec.rb
277
283
  - spec/socialstream_documents_spec.rb
278
284
  - spec/spec_helper.rb
279
- has_rdoc: true
280
285
  homepage: http://github.com/ging/social_stream-documents
281
286
  licenses: []
282
287
 
@@ -306,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
306
311
  requirements: []
307
312
 
308
313
  rubyforge_project:
309
- rubygems_version: 1.6.2
314
+ rubygems_version: 1.8.5
310
315
  signing_key:
311
316
  specification_version: 3
312
317
  summary: File capabilities for Social Stream, the core for building social network websites