social_stream-documents 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -9,4 +9,4 @@ Gemfile.lock
9
9
  .project
10
10
  .idea/*
11
11
  .idea/social_stream-documents.iml
12
-
12
+ app/views/*/.tmp_*
@@ -14,7 +14,7 @@ $('.attachment_tile a').live("click",function(e){
14
14
  removePlayers();
15
15
  $(this).parent().parent().addClass("selected");
16
16
  $('body').append("<audio class='player' autoplay='autoplay' id='audio_player' src='"+this+"' controls='controls'></audio>");
17
- $('body').append("<a href='"+download_link+"'><img id='downloadButton' src='assets/formats/default.png' /></a>");
17
+ $('body').append("<a href='"+download_link+"'><img id='downloadButton' src='<%= asset_path "formats/default.png" %>' /></a>");
18
18
  return;
19
19
  }
20
20
  if(this.type == "Video"){
@@ -23,14 +23,14 @@ $('.attachment_tile a').live("click",function(e){
23
23
  var show = (this+"").split('/download')[0];
24
24
  show = show.replace("documents","videos");
25
25
  $('body').append("<video class='player' autoplay='autoplay' id='video_player' src='"+show+"?style=webm' controls='controls'></video>");
26
- $('body').append("<a href='"+download_link+"'><img id='downloadButton' src='assets/formats/default.png' /></a>");
26
+ $('body').append("<a href='"+download_link+"'><img id='downloadButton' src='<%= asset_path "formats/default.png" %>' /></a>");
27
27
  return;
28
28
  }
29
29
  if(this.type == "Picture"){
30
30
  removePlayers();
31
31
  $(this).parent().parent().addClass("selected");
32
- $('body').append("<img class='player' id='picture_player' src='"+download_link+"' />");
33
- $('body').append("<a href='"+download_link+"'><img id='downloadButton' src='assets/formats/default.png' /></a>");
32
+ $('body').append("<img class='player' id='picture_player' src='"+download_link+"' />");
33
+ $('body').append("<a href='" + download_link + "'><img id='downloadButton' src='<%= asset_path "formats/default.png" %>' /></a>");
34
34
  }
35
35
  });
36
36
 
@@ -0,0 +1 @@
1
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require_tree .
3
+ */
@@ -1,25 +1,3 @@
1
- class AudiosController < InheritedResources::Base
2
- load_and_authorize_resource
3
-
4
- def show
5
- path = @audio.file.path(params[:style])
6
- respond_to do |format|
7
- format.all {send_file path,
8
- :type => @audio.file_content_type,
9
- :disposition => "inline"}
10
- end
11
- end
12
-
13
- def index
14
- @document_activities = current_subject.wall(:profile,
15
- :for => current_subject,
16
- :object_type => :Audio).page(params[:page]).per(params[:per])
17
- end
18
-
19
-
20
- def destroy
21
- @post_activity = resource.post_activity
22
-
23
- destroy!
24
- end
25
- end
1
+ class AudiosController < CommonDocumentsController
2
+ respond_to :html,:js
3
+ end
@@ -0,0 +1,37 @@
1
+ class CommonDocumentsController < InheritedResources::Base
2
+ belongs_to_subjects :optional => true
3
+
4
+ load_and_authorize_resource
5
+
6
+ def index
7
+ @activities = subject.wall(:profile,
8
+ :for => current_subject,
9
+ :object_type => [:Picture]).
10
+ page(params[:page]).
11
+ per(params[:per])
12
+ end
13
+
14
+ def show
15
+ path = resource.file.path(params[:style])
16
+
17
+ respond_to do |format|
18
+ format.all {
19
+ send_file path,
20
+ :type => resource.file_content_type,
21
+ :disposition => "inline"
22
+ }
23
+ end
24
+ end
25
+
26
+ def destroy
27
+ @post_activity = resource.post_activity
28
+
29
+ destroy!
30
+ end
31
+
32
+ private
33
+
34
+ def subject
35
+ @subject ||= parent || current_subject
36
+ end
37
+ end
@@ -1,16 +1,19 @@
1
- class DocumentsController < InheritedResources::Base
2
- load_and_authorize_resource
3
-
1
+ class DocumentsController < CommonDocumentsController
4
2
  respond_to :html,:js,:png,:jpeg,:bmp,:gif
5
3
 
6
4
  SEND_FILE_METHOD = :default
7
-
8
- def show
9
- path = @document.file.path(params[:style])
10
- respond_to do |format|
11
- format.all {send_file path,
12
- :type => @document.file_content_type,
13
- :disposition => "inline"}
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
+ def create
15
+ super do |format|
16
+ format.all {redirect_to request.referer || home_path}
14
17
  end
15
18
  end
16
19
 
@@ -26,26 +29,4 @@ class DocumentsController < InheritedResources::Base
26
29
 
27
30
  send_file(path, send_file_options)
28
31
  end
29
-
30
- def index
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,
35
- :for => current_subject,
36
- :object_type => [:Audio,:Video,:Picture,:Document]).page(params[:page]).per(params[:per])
37
- end
38
-
39
- def create
40
- super do |format|
41
- format.all {redirect_to request.referer || home_path}
42
- end
43
- end
44
-
45
- def destroy
46
- @post_activity = resource.post_activity
47
-
48
- destroy!
49
- end
50
-
51
- end
32
+ end
@@ -1,24 +1,3 @@
1
- class PicturesController < InheritedResources::Base
2
- load_and_authorize_resource
3
-
4
- def show
5
- path = @picture.file.path(params[:style])
6
- respond_to do |format|
7
- format.all {send_file path,
8
- :type => @picture.file_content_type,
9
- :disposition => "inline"}
10
- end
11
- end
12
-
13
- def index
14
- @document_activities = current_subject.wall(:profile,
15
- :for => current_subject,
16
- :object_type => :Picture).page(params[:page]).per(params[:per])
17
- end
18
-
19
- def destroy
20
- @post_activity = resource.post_activity
21
-
22
- destroy!
23
- end
24
- end
1
+ class PicturesController < CommonDocumentsController
2
+ respond_to :html,:js
3
+ end
@@ -1,5 +1,5 @@
1
- class VideosController < InheritedResources::Base
2
- load_and_authorize_resource
1
+ class VideosController < CommonDocumentsController
2
+ respond_to :html,:js
3
3
 
4
4
  def show
5
5
  path = @video.file.path(params[:style])
@@ -12,16 +12,4 @@ class VideosController < InheritedResources::Base
12
12
  :disposition => "inline"}
13
13
  end
14
14
  end
15
-
16
- def index
17
- @document_activities = current_subject.wall(:profile,
18
- :for => current_subject,
19
- :object_type => :Video).page(params[:page]).per(params[:per])
20
- end
21
-
22
- def destroy
23
- @post_activity = resource.post_activity
24
-
25
- destroy!
26
- end
27
- end
15
+ end
@@ -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/:basename.:extension'
8
+ :path => ':rails_root/documents/:class/:id_partition/:style.:extension'
9
9
 
10
10
  validates_attachment_presence :file
11
11
 
@@ -1,7 +1,7 @@
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_:basename.:extension',
4
+ :path => ':rails_root/documents/:class/:id_partition/:style.:extension',
5
5
  :styles => {:thumb => ["48x48#"],
6
6
  :thumb0 => ["130x80#"]
7
7
  }
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_:basename.:extension',
6
+ :path => ':rails_root/documents/:class/:id_partition/:style.: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,7 @@
1
1
  <div class="attachment_section_header">
2
2
  <h3><%= t('audio.mine') %></h3>
3
3
  </div>
4
- <% @document_activities.each do |a| %>
4
+ <% @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">
@@ -19,4 +19,4 @@
19
19
  :path => document_path(document) %>
20
20
  </div>
21
21
  </div>
22
- <% end %>
22
+ <% end %>
@@ -1,2 +1 @@
1
- $("#<%= dom_id(@post_activity) %>").hide();
2
-
1
+ <%=render(:partial => 'objects/destroy') %>
@@ -6,11 +6,6 @@
6
6
  <%= render :partial => 'home/sidebar' %>
7
7
  <% end %>
8
8
 
9
- <% content_for :headers do %>
10
- <%= stylesheet_link_tag "documents" %>
11
- <%= javascript_include_tag 'documents' %>
12
- <% end %>
13
-
14
9
  <%= location(
15
10
  link_to(image_tag("btn/btn_audio.png", :class => "menu_icon")+t('audio.title'), audios_path,:remote => true)
16
11
  ) %>
@@ -0,0 +1,2 @@
1
+ <%= render :partial => 'objects/show',
2
+ :locals => { :object => @audio } %>
@@ -1,7 +1,7 @@
1
1
  <div class="attachment_section_header">
2
2
  <h3><%= @subject ? t('document.not_mine') : t('document.mine') %></h3>
3
3
  </div>
4
- <% @document_activities.each do |a| %>
4
+ <% @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">
@@ -20,4 +20,4 @@
20
20
  :path => document_path(document) %>
21
21
  </div>
22
22
  </div>
23
- <% end %>
23
+ <% end %>
@@ -1,2 +1 @@
1
- $("#<%= dom_id(@post_activity) %>").hide();
2
-
1
+ <%=render(:partial => 'objects/destroy') %>
@@ -6,11 +6,6 @@
6
6
  <%= render :partial => 'home/sidebar' %>
7
7
  <% end %>
8
8
 
9
- <% content_for :headers do %>
10
- <%= stylesheet_link_tag "documents" %>
11
- <%= javascript_include_tag 'documents' %>
12
- <% end %>
13
-
14
9
  <%if @subject%>
15
10
  <%= location(
16
11
  link_to(image_tag("btn/btn_profile.png", :class => "menu_icon")+ @subject.name, polymorphic_path(@subject),:remote => true),
@@ -0,0 +1,2 @@
1
+ <%= render :partial => 'objects/show',
2
+ :locals => { :object => @document } %>
@@ -1,7 +1,7 @@
1
1
  <div class="attachment_section_header">
2
2
  <h3><%= t('picture.mine') %></h3>
3
3
  </div>
4
- <% @document_activities.each do |a| %>
4
+ <% @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">
@@ -19,4 +19,4 @@
19
19
  :path => document_path(document) %>
20
20
  </div>
21
21
  </div>
22
- <% end %>
22
+ <% end %>
@@ -1,2 +1 @@
1
- $("#<%= dom_id(@post_activity) %>").hide();
2
-
1
+ <%=render(:partial => 'objects/destroy') %>
@@ -6,11 +6,6 @@
6
6
  <%= render :partial => 'home/sidebar' %>
7
7
  <% end %>
8
8
 
9
- <% content_for :headers do %>
10
- <%= stylesheet_link_tag "documents" %>
11
- <%= javascript_include_tag 'documents' %>
12
- <% end %>
13
-
14
9
  <%= location(
15
10
  link_to(image_tag("btn/btn_gallery.png", :class => "menu_icon")+t('picture.title'), pictures_path,:remote => true)
16
11
  ) %>
@@ -0,0 +1,2 @@
1
+ <%= render :partial => 'objects/show',
2
+ :locals => { :object => @picture } %>
@@ -1,7 +1,7 @@
1
1
  <div class="attachment_section_header">
2
2
  <h3><%= t('video.mine') %></h3>
3
3
  </div>
4
- <% @document_activities.each do |a| %>
4
+ <% @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">
@@ -19,4 +19,4 @@
19
19
  :path => document_path(document) %>
20
20
  </div>
21
21
  </div>
22
- <% end %>
22
+ <% end %>
@@ -1,2 +1 @@
1
- $("#<%= dom_id(@post_activity) %>").hide();
2
-
1
+ <%=render(:partial => 'objects/destroy') %>
@@ -6,11 +6,6 @@
6
6
  <%= render :partial => 'home/sidebar' %>
7
7
  <% end %>
8
8
 
9
- <% content_for :headers do %>
10
- <%= stylesheet_link_tag "documents" %>
11
- <%= javascript_include_tag 'documents' %>
12
- <% end %>
13
-
14
9
  <%= location(
15
10
  link_to(image_tag("btn/btn_video.png", :class => "menu_icon")+t('video.title'), videos_path,:remote => true)
16
11
  ) %>
@@ -0,0 +1,2 @@
1
+ <%= render :partial => 'objects/show',
2
+ :locals => { :object => @video } %>
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "social_stream-documents"
3
- s.version = "0.1.6"
3
+ s.version = "0.1.7"
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.7.0')
12
+ s.add_runtime_dependency('social_stream-base','~> 0.7.2')
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
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-20 00:00:00 +02:00
19
+ date: 2011-07-21 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -27,12 +27,12 @@ dependencies:
27
27
  requirements:
28
28
  - - ~>
29
29
  - !ruby/object:Gem::Version
30
- hash: 3
30
+ hash: 7
31
31
  segments:
32
32
  - 0
33
33
  - 7
34
- - 0
35
- version: 0.7.0
34
+ - 2
35
+ version: 0.7.2
36
36
  name: social_stream-base
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency
@@ -231,9 +231,12 @@ files:
231
231
  - app/assets/images/formats_big/ppt.png
232
232
  - app/assets/images/formats_big/rar.png
233
233
  - app/assets/images/formats_big/zip.png
234
- - app/assets/javascripts/documents.js
234
+ - app/assets/javascripts/documents.js.erb
235
+ - app/assets/javascripts/social_stream-documents.js
235
236
  - app/assets/stylesheets/documents.css
237
+ - app/assets/stylesheets/social_stream-documents.css
236
238
  - app/controllers/audios_controller.rb
239
+ - app/controllers/common_documents_controller.rb
237
240
  - app/controllers/documents_controller.rb
238
241
  - app/controllers/pictures_controller.rb
239
242
  - app/controllers/videos_controller.rb
@@ -249,6 +252,7 @@ files:
249
252
  - app/views/audios/destroy.js.erb
250
253
  - app/views/audios/index.html.erb
251
254
  - app/views/audios/index.js.erb
255
+ - app/views/audios/show.html.erb
252
256
  - app/views/documents/_document.html.erb
253
257
  - app/views/documents/_fields.html.erb
254
258
  - app/views/documents/_header.html.erb
@@ -257,6 +261,7 @@ files:
257
261
  - app/views/documents/destroy.js.erb
258
262
  - app/views/documents/index.html.erb
259
263
  - app/views/documents/index.js.erb
264
+ - app/views/documents/show.html.erb
260
265
  - app/views/pictures/_index.html.erb
261
266
  - app/views/pictures/_mediapreviews.html.erb
262
267
  - app/views/pictures/_new.html.erb
@@ -264,12 +269,14 @@ files:
264
269
  - app/views/pictures/destroy.js.erb
265
270
  - app/views/pictures/index.html.erb
266
271
  - app/views/pictures/index.js.erb
272
+ - app/views/pictures/show.html.erb
267
273
  - app/views/toolbar/_uploads_menu.html.erb
268
274
  - app/views/videos/_index.html.erb
269
275
  - app/views/videos/_new.html.erb
270
276
  - app/views/videos/_video.html.erb
271
277
  - app/views/videos/destroy.js.erb
272
278
  - app/views/videos/index.html.erb
279
+ - app/views/videos/show.html.erb
273
280
  - app/worker/videoencoder.rb
274
281
  - config/locales/en.yml
275
282
  - config/routes.rb