social_stream-documents 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/app/assets/images/formats/btn_video.png +0 -0
  2. data/app/assets/images/formats/photo.png +0 -0
  3. data/app/assets/images/formats/ppt-big.png +0 -0
  4. data/app/assets/images/formats/ppt.png +0 -0
  5. data/app/assets/images/formats/rar-big.png +0 -0
  6. data/app/assets/images/formats/rar.png +0 -0
  7. data/app/assets/images/formats/zip-big.png +0 -0
  8. data/app/assets/images/formats/zip.png +0 -0
  9. data/app/assets/images/formats_big/default.png +0 -0
  10. data/app/assets/images/formats_big/doc.png +0 -0
  11. data/app/assets/images/formats_big/pdf.png +0 -0
  12. data/app/assets/images/formats_big/ppt.png +0 -0
  13. data/app/assets/images/formats_big/rar.png +0 -0
  14. data/app/assets/images/formats_big/zip.png +0 -0
  15. data/app/assets/javascripts/documents.js +4 -1
  16. data/app/assets/stylesheets/documents.css +3 -4
  17. data/app/controllers/audios_controller.rb +6 -0
  18. data/app/controllers/documents_controller.rb +10 -1
  19. data/app/controllers/pictures_controller.rb +6 -0
  20. data/app/controllers/videos_controller.rb +5 -0
  21. data/app/helpers/documents_helper.rb +4 -0
  22. data/app/models/document.rb +10 -1
  23. data/app/models/picture.rb +7 -1
  24. data/app/models/video.rb +1 -1
  25. data/app/views/audios/_audio.html.erb +2 -6
  26. data/app/views/audios/destroy.js.erb +2 -0
  27. data/app/views/documents/_document.html.erb +3 -3
  28. data/app/views/documents/_header.html.erb +5 -1
  29. data/app/views/documents/_index.html.erb +3 -2
  30. data/app/views/documents/destroy.js.erb +2 -0
  31. data/app/views/documents/index.html.erb +11 -3
  32. data/app/views/pictures/_picture.html.erb +2 -6
  33. data/app/views/pictures/destroy.js.erb +2 -0
  34. data/app/views/videos/_video.html.erb +2 -6
  35. data/app/views/videos/destroy.js.erb +2 -0
  36. data/config/locales/en.yml +11 -8
  37. data/config/routes.rb +13 -0
  38. data/social_stream-documents.gemspec +2 -2
  39. metadata +22 -7
Binary file
Binary file
Binary file
Binary file
@@ -1,4 +1,7 @@
1
1
  $('.attachment_tile a').live("click",function(e){
2
+ if(this.type ==""){
3
+ return true;
4
+ }
2
5
  e.preventDefault();
3
6
 
4
7
  var download_link = this;
@@ -28,7 +31,7 @@ $('.attachment_tile a').live("click",function(e){
28
31
  $(this).parent().parent().addClass("selected");
29
32
  $('body').append("<img class='player' id='picture_player' src='"+download_link+"' />");
30
33
  $('body').append("<a href='"+download_link+"'><img id='downloadButton' src='assets/formats/default.png' /></a>");
31
- }
34
+ }
32
35
  });
33
36
 
34
37
  function removePlayers(){
@@ -6,7 +6,7 @@
6
6
  .attachment_text
7
7
  {
8
8
  position: relative;
9
- width: 70%;
9
+ width: 90%;
10
10
  vertical-align: middle;
11
11
  line-height: 20px;
12
12
  height: auto;
@@ -128,7 +128,6 @@
128
128
  color: #2A3890;
129
129
  }
130
130
 
131
- .picture_summary_class{
132
- margin-top: 14px;
131
+ .size_19px {
132
+ width: 19px;
133
133
  }
134
-
@@ -16,4 +16,10 @@ class AudiosController < InheritedResources::Base
16
16
  :object_type => :Audio).page(params[:page]).per(params[:per])
17
17
  end
18
18
 
19
+
20
+ def destroy
21
+ @post_activity = resource.post_activity
22
+
23
+ destroy!
24
+ end
19
25
  end
@@ -28,7 +28,10 @@ class DocumentsController < InheritedResources::Base
28
28
  end
29
29
 
30
30
  def index
31
- @document_activities = current_subject.wall(:profile,
31
+ @subject = User.find_by_slug(params[:user_id]) || Group.find_by_slug(params[:group_id])
32
+
33
+ #TODO, clarify if use :home or :profile
34
+ @document_activities = (@subject ? @subject : current_subject).wall(:home,
32
35
  :for => current_subject,
33
36
  :object_type => [:Audio,:Video,:Picture,:Document]).page(params[:page]).per(params[:per])
34
37
  end
@@ -38,5 +41,11 @@ class DocumentsController < InheritedResources::Base
38
41
  format.all {redirect_to request.referer || home_path}
39
42
  end
40
43
  end
44
+
45
+ def destroy
46
+ @post_activity = resource.post_activity
47
+
48
+ destroy!
49
+ end
41
50
 
42
51
  end
@@ -15,4 +15,10 @@ class PicturesController < InheritedResources::Base
15
15
  :for => current_subject,
16
16
  :object_type => :Picture).page(params[:page]).per(params[:per])
17
17
  end
18
+
19
+ def destroy
20
+ @post_activity = resource.post_activity
21
+
22
+ destroy!
23
+ end
18
24
  end
@@ -19,4 +19,9 @@ class VideosController < InheritedResources::Base
19
19
  :object_type => :Video).page(params[:page]).per(params[:per])
20
20
  end
21
21
 
22
+ def destroy
23
+ @post_activity = resource.post_activity
24
+
25
+ destroy!
26
+ end
22
27
  end
@@ -6,6 +6,10 @@ module DocumentsHelper
6
6
  image_tag document.thumb(self)
7
7
  end
8
8
 
9
+ def big_thumb_for(document)
10
+ image_tag document.big_thumb(self)
11
+ end
12
+
9
13
  def link_for_wall(document)
10
14
  format = Mime::Type.lookup(document.file_content_type)
11
15
  url_for(document)+"."+format.to_sym.to_s+"?style=thumb0"
@@ -5,7 +5,7 @@ class Document < ActiveRecord::Base
5
5
 
6
6
  has_attached_file :file,
7
7
  :url => '/:class/:id.:extension',
8
- :path => ':rails_root/documents/:class/:id_partition/:style.:extension'
8
+ :path => ':rails_root/documents/:class/:id_partition/:basename.:extension'
9
9
 
10
10
  validates_attachment_presence :file
11
11
 
@@ -53,4 +53,13 @@ class Document < ActiveRecord::Base
53
53
  end
54
54
  end
55
55
 
56
+ # Thumbnail file
57
+ def big_thumb helper
58
+ if format && IMAGE_FORMATS.include?(format.to_s)
59
+ "formats_big/#{ format }.png"
60
+ else
61
+ "formats_big/default.png"
62
+ end
63
+ end
64
+
56
65
  end
@@ -1,11 +1,17 @@
1
1
  class Picture < Document
2
2
  has_attached_file :file,
3
3
  :url => '/:class/:id.:extension',
4
- :path => ':rails_root/documents/:class/:id_partition/:style.:extension',
4
+ :path => ':rails_root/documents/:class/:id_partition/:style_:basename.:extension',
5
5
  :styles => {:thumb => ["48x48#"],
6
6
  :thumb0 => ["130x80#"]
7
7
  }
8
8
  def thumb helper
9
+ "formats/photo.png"
10
+ end
11
+
12
+ def big_thumb helper
9
13
  helper.picture_path self, :format => format, :style => 'thumb'
10
14
  end
15
+
16
+
11
17
  end
data/app/models/video.rb CHANGED
@@ -3,7 +3,7 @@ class Video < Document
3
3
 
4
4
  has_attached_file :file,
5
5
  :url => '/:class/:id.:extension',
6
- :path => ':rails_root/documents/:class/:id_partition/:style.:extension',
6
+ :path => ':rails_root/documents/:class/:id_partition/:style_:basename.:extension',
7
7
  :styles => {:webm => {:format => 'webm'},
8
8
  :thumb => {:geometry => "48x48" , :format => 'png', :time => 5},
9
9
  :thumb0 => {:geometry => "130x80", :format => 'png', :time => 5}
@@ -1,7 +1,3 @@
1
- <% content_for :headers do %>
2
- <%= stylesheet_link_tag "documents" %>
3
- <% end %>
4
-
5
1
  <%= div_for audio, :class => 'content_size' do %>
6
2
 
7
3
  <div class="attachment_thumb">
@@ -11,7 +7,7 @@
11
7
  </div>
12
8
 
13
9
  <div class="attachment_text">
14
- <%= t('audio.msg') %><%= link_to audio.file_file_name,
10
+ <%= t('audio.msg') %><%= link_to "\""+audio.file_file_name+"\"",
15
11
  {:controller => "documents", :action => "download", :id => audio},
16
12
  :class => "" %>
17
13
 
@@ -20,4 +16,4 @@
20
16
  </audio>
21
17
  </div>
22
18
 
23
- <% end %>
19
+ <% end %>
@@ -0,0 +1,2 @@
1
+ $("#<%= dom_id(@post_activity) %>").hide();
2
+
@@ -1,5 +1,5 @@
1
1
  <% content_for :headers do %>
2
- <%= stylesheet_link_tag "documents" %>
2
+ <%= stylesheet_link_tag "documents" %>
3
3
  <% end %>
4
4
 
5
5
  <%= div_for document, :class => 'content_size' do %>
@@ -11,9 +11,9 @@
11
11
  </div>
12
12
 
13
13
  <div class="attachment_text">
14
- <%= t('document.msg') %><%= link_to document.file_file_name,
14
+ <%= t('document.msg') %><%= link_to "\""+document.file_file_name+"\"",
15
15
  {:controller => "documents", :action => "download", :id => document},
16
16
  :class => "" %>
17
17
  </div>
18
18
 
19
- <% end %>
19
+ <% end %>
@@ -1 +1,5 @@
1
- <%= image_tag("btn/document.png") %> <%=t('resource.title')%>
1
+ <% content_for :headers do %>
2
+ <%= stylesheet_link_tag "documents" %>
3
+ <% end %>
4
+
5
+ <%= image_tag("btn/document.png", :class => "size_19px") %> <%=t('resource.title')%>
@@ -1,13 +1,14 @@
1
1
  <div class="attachment_section_header">
2
- <h3><%= t('document.mine') %></h3>
2
+ <h3><%= @subject ? t('document.not_mine') : t('document.mine') %></h3>
3
3
  </div>
4
4
  <% @document_activities.each do |a| %>
5
5
  <% document = a.activity_objects.first.document %>
6
6
  <div class="attachment_tile">
7
7
  <div class="attachment_tile_thumb">
8
- <%= link_to thumb_for(document),
8
+ <%= link_to big_thumb_for(document),
9
9
  {:controller => "documents", :action => "download", :id => document},
10
10
  :type => document.type,
11
+ :title => document.file_file_name,
11
12
  :path => document_path(document) %>
12
13
  </div>
13
14
 
@@ -0,0 +1,2 @@
1
+ $("#<%= dom_id(@post_activity) %>").hide();
2
+
@@ -11,10 +11,18 @@
11
11
  <%= javascript_include_tag 'documents' %>
12
12
  <% end %>
13
13
 
14
+ <%if @subject%>
14
15
  <%= location(
15
- link_to(image_tag("btn/btn_resources.png", :class => "menu_icon")+t('resource.title'), documents_path,:remote => true)
16
- ) %>
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_resource.png", :class => "menu_icon")+t('resource.title'), polymorphic_path([@subject, Document.new]),:remote => true)
18
+ ) %>
19
+ <% toolbar :profile => @subject %>
20
+ <%else%>
21
+ <%= location(
22
+ link_to(image_tag("btn/btn_resource.png", :class => "menu_icon")+t('resource.title'), @user ? user_documents_path(@user) : documents_path,:remote => true)
23
+ ) %>
24
+ <% toolbar %>
25
+ <%end%>
17
26
 
18
- <% toolbar %>
19
27
 
20
28
  <%= render :partial => 'index' %>
@@ -1,7 +1,3 @@
1
- <% content_for :headers do %>
2
- <%= stylesheet_link_tag "documents" %>
3
- <% end %>
4
-
5
1
  <%= div_for picture, :class => 'content_size' do %>
6
2
 
7
3
  <div class="attachment_thumb">
@@ -11,9 +7,9 @@
11
7
  </div>
12
8
 
13
9
  <div class="attachment_text picture_summary_class">
14
- <%= t('picture.msg') %><%= link_to picture.file_file_name,
10
+ <%= t('picture.msg') %><%= link_to "\""+picture.file_file_name+"\"",
15
11
  {:controller => "documents", :action => "download", :id => picture},
16
12
  :class => "" %>
17
13
  </div>
18
14
 
19
- <% end %>
15
+ <% end %>
@@ -0,0 +1,2 @@
1
+ $("#<%= dom_id(@post_activity) %>").hide();
2
+
@@ -1,7 +1,3 @@
1
- <% content_for :headers do %>
2
- <%= stylesheet_link_tag "documents" %>
3
- <% end %>
4
-
5
1
  <%= div_for video, :class => 'content_size' do %>
6
2
 
7
3
  <div class="attachment_thumb">
@@ -11,7 +7,7 @@
11
7
  </div>
12
8
 
13
9
  <div class="attachment_text">
14
- <%= t('video.msg') %><%= link_to video.file_file_name,
10
+ <%= t('video.msg') %><%= link_to "\""+video.file_file_name+"\"",
15
11
  {:controller => "documents", :action => "download", :id => video},
16
12
  :class => "" %>
17
13
 
@@ -20,4 +16,4 @@
20
16
  </video>
21
17
  </div>
22
18
 
23
- <% end %>
19
+ <% end %>
@@ -0,0 +1,2 @@
1
+ $("#<%= dom_id(@post_activity) %>").hide();
2
+
@@ -3,33 +3,36 @@ en:
3
3
  confirm_delete: "Delete audio?"
4
4
  title: "Audios"
5
5
  mine: "My audios"
6
- msg: "Just uploaded an audio:"
6
+ msg: "Uploaded an audio:"
7
7
  conference:
8
8
  all: "All conferences"
9
9
  confirm_delete: "Delete conference?"
10
10
  title: "Conferences"
11
11
  mine: "My conferences"
12
- msg: "Just uploaded a conference:"
12
+ msg: "Uploaded a conference:"
13
13
  document:
14
- simple_all: "All"
15
14
  all: "All documents"
16
15
  confirm_delete: "Delete document?"
17
- title: "Documents"
16
+ form:
17
+ title: "Resource"
18
18
  mine: "My documents"
19
- msg: "Just uploaded a document:"
19
+ msg: "Uploaded a document:"
20
+ not_mine: "Documents"
21
+ simple_all: "All"
22
+ title: "Documents"
20
23
  picture:
21
24
  confirm_delete: "Delete picture?"
22
25
  title: "Pictures"
23
26
  mine: "My pictures"
24
- msg: "Just uploaded a picture:"
27
+ msg: "Uploaded a picture:"
25
28
  resource:
26
29
  all: "All Resources"
27
30
  confirm_delete: "Delete resource?"
28
31
  title: "Resources"
29
32
  mine: "My resources"
30
- msg: "Just uploaded a resource:"
33
+ msg: "Uploaded a resource:"
31
34
  video:
32
35
  confirm_delete: "Delete video?"
33
36
  title: "Videos"
34
37
  mine: "My videos"
35
- msg: "Just uploaded a video:"
38
+ msg: "Uploaded a video:"
data/config/routes.rb CHANGED
@@ -6,4 +6,17 @@ Rails.application.routes.draw do
6
6
  resources :documents do
7
7
  get "download", :on => :member
8
8
  end
9
+
10
+ # Social Stream subjects configured in config/initializers/social_stream.rb
11
+ SocialStream.subjects.each do |actor|
12
+ resources actor.to_s.pluralize do
13
+ resources :pictures
14
+ resources :audios
15
+ resources :videos
16
+
17
+ resources :documents do
18
+ get "download", :on => :member
19
+ end
20
+ end
21
+ end
9
22
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "social_stream-documents"
3
- s.version = "0.1.5"
3
+ s.version = "0.1.6"
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."
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.files = `git ls-files`.split("\n")
10
10
 
11
11
  # Gem dependencies
12
- s.add_runtime_dependency('social_stream-base','~> 0.6.2')
12
+ s.add_runtime_dependency('social_stream-base','~> 0.7.0')
13
13
  s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.6.0')
14
14
  s.add_runtime_dependency('paperclip','2.3.11')
15
15
  # Development Gem dependencies
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: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - "V\xC3\xADctor S\xC3\xA1nchez Belmar"
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-13 00:00:00 +02:00
19
+ date: 2011-07-20 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -30,9 +30,9 @@ dependencies:
30
30
  hash: 3
31
31
  segments:
32
32
  - 0
33
- - 6
34
- - 2
35
- version: 0.6.2
33
+ - 7
34
+ - 0
35
+ version: 0.7.0
36
36
  name: social_stream-base
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency
@@ -211,15 +211,26 @@ files:
211
211
  - app/assets/images/btn/btn_word.png
212
212
  - app/assets/images/btn/document.png
213
213
  - app/assets/images/formats/btn_documents.png
214
+ - app/assets/images/formats/btn_video.png
214
215
  - app/assets/images/formats/default.png
215
216
  - app/assets/images/formats/doc.png
216
217
  - app/assets/images/formats/mpeg.png
217
218
  - app/assets/images/formats/pdf.png
219
+ - app/assets/images/formats/photo.png
218
220
  - app/assets/images/formats/plain.png
221
+ - app/assets/images/formats/ppt-big.png
219
222
  - app/assets/images/formats/ppt.png
223
+ - app/assets/images/formats/rar-big.png
220
224
  - app/assets/images/formats/rar.png
221
225
  - app/assets/images/formats/xls.png
226
+ - app/assets/images/formats/zip-big.png
222
227
  - app/assets/images/formats/zip.png
228
+ - app/assets/images/formats_big/default.png
229
+ - app/assets/images/formats_big/doc.png
230
+ - app/assets/images/formats_big/pdf.png
231
+ - app/assets/images/formats_big/ppt.png
232
+ - app/assets/images/formats_big/rar.png
233
+ - app/assets/images/formats_big/zip.png
223
234
  - app/assets/javascripts/documents.js
224
235
  - app/assets/stylesheets/documents.css
225
236
  - app/controllers/audios_controller.rb
@@ -235,6 +246,7 @@ files:
235
246
  - app/views/audios/_index.html.erb
236
247
  - app/views/audios/_mediapreviews.html.erb
237
248
  - app/views/audios/_new.html.erb
249
+ - app/views/audios/destroy.js.erb
238
250
  - app/views/audios/index.html.erb
239
251
  - app/views/audios/index.js.erb
240
252
  - app/views/documents/_document.html.erb
@@ -242,18 +254,21 @@ files:
242
254
  - app/views/documents/_header.html.erb
243
255
  - app/views/documents/_index.html.erb
244
256
  - app/views/documents/_new.html.erb
257
+ - app/views/documents/destroy.js.erb
245
258
  - app/views/documents/index.html.erb
246
259
  - app/views/documents/index.js.erb
247
260
  - app/views/pictures/_index.html.erb
248
261
  - app/views/pictures/_mediapreviews.html.erb
249
262
  - app/views/pictures/_new.html.erb
250
263
  - app/views/pictures/_picture.html.erb
264
+ - app/views/pictures/destroy.js.erb
251
265
  - app/views/pictures/index.html.erb
252
266
  - app/views/pictures/index.js.erb
253
267
  - app/views/toolbar/_uploads_menu.html.erb
254
268
  - app/views/videos/_index.html.erb
255
269
  - app/views/videos/_new.html.erb
256
270
  - app/views/videos/_video.html.erb
271
+ - app/views/videos/destroy.js.erb
257
272
  - app/views/videos/index.html.erb
258
273
  - app/worker/videoencoder.rb
259
274
  - config/locales/en.yml