social_stream-documents 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -6,7 +6,7 @@ class CommonDocumentsController < InheritedResources::Base
6
6
  def index
7
7
  @activities = subject.wall(:profile,
8
8
  :for => current_subject,
9
- :object_type => [:Picture]).
9
+ :object_type => Array(self.class.index_object_type)).
10
10
  page(params[:page]).
11
11
  per(params[:per])
12
12
  end
@@ -17,6 +17,7 @@ class CommonDocumentsController < InheritedResources::Base
17
17
  respond_to do |format|
18
18
  format.all {
19
19
  send_file path,
20
+ :filename => resource.file_file_name,
20
21
  :type => resource.file_content_type,
21
22
  :disposition => "inline"
22
23
  }
@@ -34,4 +35,10 @@ class CommonDocumentsController < InheritedResources::Base
34
35
  def subject
35
36
  @subject ||= parent || current_subject
36
37
  end
38
+
39
+ class << self
40
+ def index_object_type
41
+ controller_name.classify
42
+ end
43
+ end
37
44
  end
@@ -3,14 +3,6 @@ class DocumentsController < CommonDocumentsController
3
3
 
4
4
  SEND_FILE_METHOD = :default
5
5
 
6
- def index
7
- @activities = subject.wall(:profile,
8
- :for => current_subject,
9
- :object_type => [:Audio,:Video,:Picture,:Document]).
10
- page(params[:page]).
11
- per(params[:per])
12
- end
13
-
14
6
  def create
15
7
  super do |format|
16
8
  format.all {redirect_to request.referer || home_path}
@@ -20,7 +12,7 @@ class DocumentsController < CommonDocumentsController
20
12
  def download
21
13
  path = @document.file.path(params[:style])
22
14
  head(:bad_request) and return unless File.exist?(path)
23
- send_file_options = {}
15
+ send_file_options = {:filename=>@document.file_file_name}
24
16
 
25
17
  case SEND_FILE_METHOD
26
18
  when :apache then send_file_options[:x_sendfile] = true
@@ -29,4 +21,10 @@ class DocumentsController < CommonDocumentsController
29
21
 
30
22
  send_file(path, send_file_options)
31
23
  end
24
+
25
+ class << self
26
+ def index_object_type
27
+ [:Audio,:Video,:Picture,:Document]
28
+ end
29
+ end
32
30
  end
data/app/models/audio.rb CHANGED
@@ -1,3 +1,12 @@
1
1
  class Audio < Document
2
2
 
3
+ # Thumbnail file
4
+ def thumb helper
5
+ "formats/audio.png"
6
+ end
7
+
8
+ # Thumbnail file
9
+ def big_thumb helper
10
+ "formats_big/audio.png"
11
+ end
3
12
  end
data/app/models/video.rb CHANGED
@@ -12,5 +12,15 @@ class Video < Document
12
12
  def videoprocess
13
13
  Resque.enqueue(Videoencoder, self.id)
14
14
  end
15
+
15
16
 
17
+ # Thumbnail file
18
+ def thumb helper
19
+ "formats/video.png"
20
+ end
21
+
22
+ # Thumbnail file
23
+ def big_thumb helper
24
+ "formats_big/video.png"
25
+ end
16
26
  end
@@ -1,15 +1 @@
1
- <% content_for :title do %>
2
- <%= current_subject.name %>
3
- <% end %>
4
-
5
- <% content_for :sidebar do %>
6
- <%= render :partial => 'home/sidebar' %>
7
- <% end %>
8
-
9
- <%= location(
10
- link_to(image_tag("btn/btn_audio.png", :class => "menu_icon")+t('audio.title'), audios_path,:remote => true)
11
- ) %>
12
-
13
- <% toolbar %>
14
-
15
- <%= render :partial => 'index' %>
1
+ <%=render(:partial => 'common/index') %>
@@ -0,0 +1,45 @@
1
+ <% content_for :title do %>
2
+ <%= current_subject.name %>
3
+ <% end %>
4
+
5
+ <% content_for :sidebar do %>
6
+ <%= render :partial => 'home/sidebar' %>
7
+ <% end %>
8
+
9
+ <%if @subject == current_subject%>
10
+ <%= location(
11
+ link_to(image_tag(("btn/btn_#{controller.controller_name.singularize}.png"), :class => "menu_icon")+t(controller.controller_name.singularize + '.title'), polymorphic_path(controller.controller_name),:remote => true)
12
+ ) %>
13
+ <% toolbar %>
14
+ <%else%>
15
+ <%= location(
16
+ link_to(image_tag("btn/btn_profile.png", :class => "menu_icon")+ @subject.name, polymorphic_path(@subject),:remote => true),
17
+ link_to(image_tag(("btn/btn_#{controller.controller_name.singularize}.png"), :class => "menu_icon")+t(controller.controller_name.singularize + '.title'), polymorphic_path([@subject, controller.controller_name]),:remote => true)
18
+ ) %>
19
+ <% toolbar :profile => @subject %>
20
+ <%end%>
21
+
22
+
23
+ <div class="attachment_section_header">
24
+ <h3><%= @subject == current_subject ? t(controller.controller_name.singularize + '.mine') : t(controller.controller_name.singularize + '.not_mine') %></h3>
25
+ </div>
26
+ <% @activities.each do |a| %>
27
+ <% document = a.activity_objects.first.document %>
28
+ <div class="attachment_tile">
29
+ <div class="attachment_tile_thumb">
30
+ <%= link_to big_thumb_for(document),
31
+ {:controller => "documents", :action => "download", :id => document},
32
+ :type => document.type,
33
+ :title => document.file_file_name,
34
+ :path => document_path(document) %>
35
+ </div>
36
+
37
+ <div class="attachment_tile_text">
38
+ <%= link_to document.file_file_name,
39
+ {:controller => "documents", :action => "download", :id => document},
40
+ :alt => document.file_file_name,
41
+ :type => document.type,
42
+ :path => document_path(document) %>
43
+ </div>
44
+ </div>
45
+ <% end %>
@@ -1,23 +1 @@
1
- <% content_for :title do %>
2
- <%= current_subject.name %>
3
- <% end %>
4
-
5
- <% content_for :sidebar do %>
6
- <%= render :partial => 'home/sidebar' %>
7
- <% end %>
8
-
9
- <%if @subject%>
10
- <%= location(
11
- link_to(image_tag("btn/btn_profile.png", :class => "menu_icon")+ @subject.name, polymorphic_path(@subject),:remote => true),
12
- link_to(image_tag("btn/btn_resource.png", :class => "menu_icon")+t('resource.title'), polymorphic_path([@subject, Document.new]),:remote => true)
13
- ) %>
14
- <% toolbar :profile => @subject %>
15
- <%else%>
16
- <%= location(
17
- link_to(image_tag("btn/btn_resource.png", :class => "menu_icon")+t('resource.title'), @user ? user_documents_path(@user) : documents_path,:remote => true)
18
- ) %>
19
- <% toolbar %>
20
- <%end%>
21
-
22
-
23
- <%= render :partial => 'index' %>
1
+ <%=render(:partial => 'common/index') %>
@@ -1,15 +1 @@
1
- <% content_for :title do %>
2
- <%= current_subject.name %>
3
- <% end %>
4
-
5
- <% content_for :sidebar do %>
6
- <%= render :partial => 'home/sidebar' %>
7
- <% end %>
8
-
9
- <%= location(
10
- link_to(image_tag("btn/btn_gallery.png", :class => "menu_icon")+t('picture.title'), pictures_path,:remote => true)
11
- ) %>
12
-
13
- <% toolbar %>
14
-
15
- <%= render :partial => 'index' %>
1
+ <%=render(:partial => 'common/index') %>
@@ -1,15 +1 @@
1
- <% content_for :title do %>
2
- <%= current_subject.name %>
3
- <% end %>
4
-
5
- <% content_for :sidebar do %>
6
- <%= render :partial => 'home/sidebar' %>
7
- <% end %>
8
-
9
- <%= location(
10
- link_to(image_tag("btn/btn_video.png", :class => "menu_icon")+t('video.title'), videos_path,:remote => true)
11
- ) %>
12
-
13
- <% toolbar %>
14
-
15
- <%= render :partial => 'index' %>
1
+ <%=render(:partial => 'common/index') %>
@@ -4,12 +4,14 @@ en:
4
4
  title: "Audios"
5
5
  mine: "My audios"
6
6
  msg: "Uploaded an audio:"
7
+ not_mine: "Audios"
7
8
  conference:
8
9
  all: "All conferences"
9
10
  confirm_delete: "Delete conference?"
10
11
  title: "Conferences"
11
12
  mine: "My conferences"
12
13
  msg: "Uploaded a conference:"
14
+ not_mine: "Conferences"
13
15
  document:
14
16
  all: "All documents"
15
17
  confirm_delete: "Delete document?"
@@ -25,14 +27,17 @@ en:
25
27
  title: "Pictures"
26
28
  mine: "My pictures"
27
29
  msg: "Uploaded a picture:"
30
+ not_mine: "Pictures"
28
31
  resource:
29
32
  all: "All Resources"
30
33
  confirm_delete: "Delete resource?"
31
34
  title: "Resources"
32
35
  mine: "My resources"
33
36
  msg: "Uploaded a resource:"
37
+ not_mine: "Resources"
34
38
  video:
35
39
  confirm_delete: "Delete video?"
36
40
  title: "Videos"
37
41
  mine: "My videos"
38
42
  msg: "Uploaded a video:"
43
+ not_mine: "Videos"
@@ -9,4 +9,16 @@ class SocialStream::Documents::InstallGenerator < Rails::Generators::Base
9
9
  Rake::Task['railties:install:migrations'].reenable
10
10
  Rake::Task['social_stream_documents_engine:install:migrations'].invoke
11
11
  end
12
+
13
+ def require_javascripts
14
+ inject_into_file 'app/assets/javascripts/application.js',
15
+ "//= require social_stream-documents\n",
16
+ :before => '//= require_tree .'
17
+ end
18
+
19
+ def require_stylesheets
20
+ inject_into_file 'app/assets/stylesheets/application.css',
21
+ " *= require social_stream-documents\n",
22
+ :before => ' *= require_tree .'
23
+ end
12
24
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "social_stream-documents"
3
- s.version = "0.1.8"
3
+ s.version = "0.1.9"
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: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 8
10
- version: 0.1.8
9
+ - 9
10
+ version: 0.1.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - "V\xC3\xADctor S\xC3\xA1nchez Belmar"
@@ -202,16 +202,16 @@ files:
202
202
  - README.rdoc
203
203
  - Rakefile
204
204
  - app/assets/images/btn/btn_audio.png
205
- - app/assets/images/btn/btn_documents.png
205
+ - app/assets/images/btn/btn_document.png
206
206
  - app/assets/images/btn/btn_excel.png
207
207
  - app/assets/images/btn/btn_pdf.png
208
- - app/assets/images/btn/btn_photo.png
208
+ - app/assets/images/btn/btn_picture.png
209
209
  - app/assets/images/btn/btn_resource.png
210
210
  - app/assets/images/btn/btn_video.png
211
211
  - app/assets/images/btn/btn_word.png
212
212
  - app/assets/images/btn/document.png
213
+ - app/assets/images/formats/audio.png
213
214
  - app/assets/images/formats/btn_documents.png
214
- - app/assets/images/formats/btn_video.png
215
215
  - app/assets/images/formats/default.png
216
216
  - app/assets/images/formats/doc.png
217
217
  - app/assets/images/formats/mpeg.png
@@ -222,14 +222,17 @@ files:
222
222
  - app/assets/images/formats/ppt.png
223
223
  - app/assets/images/formats/rar-big.png
224
224
  - app/assets/images/formats/rar.png
225
+ - app/assets/images/formats/video.png
225
226
  - app/assets/images/formats/xls.png
226
227
  - app/assets/images/formats/zip-big.png
227
228
  - app/assets/images/formats/zip.png
229
+ - app/assets/images/formats_big/audio.png
228
230
  - app/assets/images/formats_big/default.png
229
231
  - app/assets/images/formats_big/doc.png
230
232
  - app/assets/images/formats_big/pdf.png
231
233
  - app/assets/images/formats_big/ppt.png
232
234
  - app/assets/images/formats_big/rar.png
235
+ - app/assets/images/formats_big/video.png
233
236
  - app/assets/images/formats_big/zip.png
234
237
  - app/assets/javascripts/documents.js.erb
235
238
  - app/assets/javascripts/social_stream-documents.js
@@ -246,23 +249,21 @@ files:
246
249
  - app/models/picture.rb
247
250
  - app/models/video.rb
248
251
  - app/views/audios/_audio.html.erb
249
- - app/views/audios/_index.html.erb
250
252
  - app/views/audios/_mediapreviews.html.erb
251
253
  - app/views/audios/_new.html.erb
252
254
  - app/views/audios/destroy.js.erb
253
255
  - app/views/audios/index.html.erb
254
256
  - app/views/audios/index.js.erb
255
257
  - app/views/audios/show.html.erb
258
+ - app/views/common/_index.html.erb
256
259
  - app/views/documents/_document.html.erb
257
260
  - app/views/documents/_fields.html.erb
258
261
  - app/views/documents/_header.html.erb
259
- - app/views/documents/_index.html.erb
260
262
  - app/views/documents/_new.html.erb
261
263
  - app/views/documents/destroy.js.erb
262
264
  - app/views/documents/index.html.erb
263
265
  - app/views/documents/index.js.erb
264
266
  - app/views/documents/show.html.erb
265
- - app/views/pictures/_index.html.erb
266
267
  - app/views/pictures/_mediapreviews.html.erb
267
268
  - app/views/pictures/_new.html.erb
268
269
  - app/views/pictures/_picture.html.erb
@@ -271,7 +272,6 @@ files:
271
272
  - app/views/pictures/index.js.erb
272
273
  - app/views/pictures/show.html.erb
273
274
  - app/views/toolbar/_uploads_menu.html.erb
274
- - app/views/videos/_index.html.erb
275
275
  - app/views/videos/_new.html.erb
276
276
  - app/views/videos/_video.html.erb
277
277
  - app/views/videos/destroy.js.erb
@@ -1,22 +0,0 @@
1
- <div class="attachment_section_header">
2
- <h3><%= t('audio.mine') %></h3>
3
- </div>
4
- <% @activities.each do |a| %>
5
- <% document = a.activity_objects.first.document %>
6
- <div class="attachment_tile">
7
- <div class="attachment_tile_thumb">
8
- <%= link_to thumb_for(document),
9
- {:controller => "documents", :action => "download", :id => document},
10
- :type => document.type,
11
- :path => document_path(document) %>
12
- </div>
13
-
14
- <div class="attachment_tile_text">
15
- <%= link_to document.file_file_name,
16
- {:controller => "documents", :action => "download", :id => document},
17
- :alt => document.file_file_name,
18
- :type => document.type,
19
- :path => document_path(document) %>
20
- </div>
21
- </div>
22
- <% end %>
@@ -1,23 +0,0 @@
1
- <div class="attachment_section_header">
2
- <h3><%= @subject ? t('document.not_mine') : t('document.mine') %></h3>
3
- </div>
4
- <% @activities.each do |a| %>
5
- <% document = a.activity_objects.first.document %>
6
- <div class="attachment_tile">
7
- <div class="attachment_tile_thumb">
8
- <%= link_to big_thumb_for(document),
9
- {:controller => "documents", :action => "download", :id => document},
10
- :type => document.type,
11
- :title => document.file_file_name,
12
- :path => document_path(document) %>
13
- </div>
14
-
15
- <div class="attachment_tile_text">
16
- <%= link_to document.file_file_name,
17
- {:controller => "documents", :action => "download", :id => document},
18
- :alt => document.file_file_name,
19
- :type => document.type,
20
- :path => document_path(document) %>
21
- </div>
22
- </div>
23
- <% end %>
@@ -1,22 +0,0 @@
1
- <div class="attachment_section_header">
2
- <h3><%= t('picture.mine') %></h3>
3
- </div>
4
- <% @activities.each do |a| %>
5
- <% document = a.activity_objects.first.document %>
6
- <div class="attachment_tile">
7
- <div class="attachment_tile_thumb">
8
- <%= link_to thumb_for(document),
9
- {:controller => "documents", :action => "download", :id => document},
10
- :type => document.type,
11
- :path => document_path(document) %>
12
- </div>
13
-
14
- <div class="attachment_tile_text">
15
- <%= link_to document.file_file_name,
16
- {:controller => "documents", :action => "download", :id => document},
17
- :alt => document.file_file_name,
18
- :type => document.type,
19
- :path => document_path(document) %>
20
- </div>
21
- </div>
22
- <% end %>
@@ -1,22 +0,0 @@
1
- <div class="attachment_section_header">
2
- <h3><%= t('video.mine') %></h3>
3
- </div>
4
- <% @activities.each do |a| %>
5
- <% document = a.activity_objects.first.document %>
6
- <div class="attachment_tile">
7
- <div class="attachment_tile_thumb">
8
- <%= link_to thumb_for(document),
9
- {:controller => "documents", :action => "download", :id => document},
10
- :type => document.type,
11
- :path => document_path(document) %>
12
- </div>
13
-
14
- <div class="attachment_tile_text">
15
- <%= link_to document.file_file_name,
16
- {:controller => "documents", :action => "download", :id => document},
17
- :alt => document.file_file_name,
18
- :type => document.type,
19
- :path => document_path(document) %>
20
- </div>
21
- </div>
22
- <% end %>