social_stream-documents 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. data/Rakefile +3 -13
  2. data/app/assets/javascripts/documents.js.erb +21 -32
  3. data/app/assets/javascripts/social_stream-documents.js +2 -1
  4. data/app/assets/stylesheets/{documents.css → documents.css.scss} +32 -6
  5. data/app/assets/stylesheets/show.css.scss +75 -0
  6. data/app/assets/stylesheets/social_stream-documents.css +2 -1
  7. data/app/controllers/audios_controller.rb +0 -14
  8. data/app/controllers/common_documents_controller.rb +6 -3
  9. data/app/controllers/documents_controller.rb +9 -3
  10. data/app/controllers/pictures_controller.rb +0 -1
  11. data/app/controllers/videos_controller.rb +0 -15
  12. data/app/helpers/documents_helper.rb +11 -7
  13. data/app/models/audio.rb +1 -1
  14. data/app/models/document.rb +9 -5
  15. data/app/models/picture.rb +1 -1
  16. data/app/models/video.rb +8 -6
  17. data/app/views/audios/_audio.html.erb +2 -2
  18. data/app/views/audios/_audio_processed.html.erb +4 -4
  19. data/app/views/audios/_audio_show.html.erb +62 -0
  20. data/app/views/audios/index.html.erb +1 -1
  21. data/app/views/audios/show.html.erb +2 -2
  22. data/app/views/common_documents/_document_info.html.erb +34 -0
  23. data/app/views/common_documents/_index.html.erb +49 -0
  24. data/app/views/common_documents/_show.html.erb +36 -0
  25. data/app/views/documents/_document.html.erb +2 -6
  26. data/app/views/documents/_document_show.html.erb +7 -0
  27. data/app/views/documents/index.html.erb +1 -1
  28. data/app/views/documents/show.html.erb +2 -2
  29. data/app/views/pictures/_picture.html.erb +13 -12
  30. data/app/views/pictures/_picture_show.html.erb +26 -0
  31. data/app/views/pictures/index.html.erb +1 -1
  32. data/app/views/pictures/show.html.erb +2 -2
  33. data/app/views/videos/_video.html.erb +2 -2
  34. data/app/views/videos/_video_processed.html.erb +4 -3
  35. data/app/views/videos/_video_show.html.erb +64 -0
  36. data/app/views/videos/index.html.erb +1 -1
  37. data/app/views/videos/show.html.erb +2 -2
  38. data/config/locales/en.yml +19 -1
  39. data/config/locales/es.yml +18 -0
  40. data/lib/social_stream/documents/engine.rb +2 -0
  41. data/lib/social_stream/documents/version.rb +1 -1
  42. data/social_stream-documents.gemspec +1 -1
  43. data/spec/controllers/documents_controller_spec.rb +40 -2
  44. data/spec/controllers/pictures_controller_spec.rb +4 -4
  45. data/spec/dummy/config/environments/development.rb +0 -1
  46. data/spec/dummy/config/environments/test.rb +2 -0
  47. metadata +37 -31
  48. data/app/views/common-documents/_index.html.erb +0 -45
  49. data/app/views/toolbar/_uploads_menu.html.erb +0 -21
@@ -0,0 +1,36 @@
1
+ <% profile_subject ||= document.post_activity.receiver_subject %>
2
+
3
+ <% content_for :title do %>
4
+ <%= profile_subject.name + ": " + t('repository.title') %>
5
+ <% end %>
6
+
7
+ <% content_for :sidebar do %>
8
+ <%= render :partial => 'home/sidebar' %>
9
+ <% end %>
10
+
11
+ <%if profile_subject_is_current?%>
12
+ <%= location(
13
+ link_to(t('repository.title'), polymorphic_path(controller.controller_name),:remote => true)
14
+ ) %>
15
+ <%else%>
16
+ <%= location(
17
+ link_to(profile_subject.name, polymorphic_path(profile_subject),:remote => true),
18
+ link_to(t('repository.title'), polymorphic_path([profile_subject, controller.controller_name]),:remote => true)
19
+ ) %>
20
+ <%end%>
21
+
22
+ <% toolbar :profile => profile_subject %>
23
+
24
+ <br class="clearfloat" />
25
+ <div class="space_center"></div>
26
+ <h2><%= document.title.nil? ? document.file_file_name : document.title %></h2>
27
+ <div class="space_center"></div>
28
+
29
+ <%= show_view_for document %>
30
+
31
+ <%= render :partial => "document_info", :locals => {:document => document} %>
32
+
33
+ <div id="document_comments">
34
+ <%= render :partial => 'activities/comments', :locals => { :activity => document.post_activity } %>
35
+ <%= render :partial => 'comments/new', :locals => { :activity => document.post_activity } %>
36
+ </div>
@@ -1,18 +1,14 @@
1
- <% content_for :headers do %>
2
- <%= stylesheet_link_tag "documents" %>
3
- <% end %>
4
-
5
1
  <%= div_for document, :class => 'content_size' do %>
6
2
 
7
3
  <div class="attachment_thumb">
8
4
  <%= link_to thumb_for(document, 16),
9
- {:controller => "documents", :action => "download", :id => document},
5
+ document,
10
6
  :class => "" %>
11
7
  </div>
12
8
 
13
9
  <div class="attachment_text">
14
10
  <%= t('document.msg') %><%= link_to "\""+document.file_file_name+"\"",
15
- {:controller => "documents", :action => "download", :id => document},
11
+ document,
16
12
  :class => "attachment_text_link" %>
17
13
  </div>
18
14
 
@@ -0,0 +1,7 @@
1
+ <%= div_for document, :class => 'content_size' do %>
2
+
3
+ <div class="document_show">
4
+ <%= thumb_for(document, 48) %>
5
+ </div>
6
+
7
+ <% end %>
@@ -1 +1 @@
1
- <%=render(:partial => 'common-documents/index') %>
1
+ <%=render(:partial => 'common_documents/index') %>
@@ -1,2 +1,2 @@
1
- <%= render :partial => 'objects/show',
2
- :locals => { :object => @document } %>
1
+ <%= render :partial => 'common_documents/show',
2
+ :locals => { :document => @document } %>
@@ -2,24 +2,25 @@
2
2
 
3
3
  <div class="attachment_thumb picture_link">
4
4
  <%= link_to thumb_for(picture, 16),
5
- {:controller => "documents", :action => "download", :id => picture},
6
- :type => picture.type,
7
- :title => picture.file_file_name,
8
- :path => document_path(picture) %>
5
+ picture_path(picture),
6
+ :type => picture.type,
7
+ :title => picture.file_file_name,
8
+ :path => document_path(picture) %>
9
9
  </div>
10
10
 
11
11
  <div class="attachment_text picture_summary_class picture_link">
12
- <%= t('picture.msg') %><%= link_to "\""+picture.file_file_name+"\"",
13
- {:controller => "documents", :action => "download", :id => picture},
14
- :alt => picture.file_file_name,
15
- :type => picture.type,
16
- :path => document_path(picture),
17
- :class => "attachment_text_link" %>
12
+ <%= t('picture.msg') %>
13
+ <%= link_to "\""+picture.file_file_name+"\"",
14
+ picture_path(picture),
15
+ :alt => picture.file_file_name,
16
+ :type => picture.type,
17
+ :path => document_path(picture),
18
+ :class => "attachment_text_link" %>
18
19
  </div>
19
20
 
20
21
  <div class="picture_link picture_thumbnail_show">
21
22
  <%= link_to thumb_for(picture, 130),
22
- picture,
23
+ download_document_path(picture),
23
24
  :type => picture.type,
24
25
  :title => picture.file_file_name,
25
26
  :path => document_path(picture) %>
@@ -38,4 +39,4 @@
38
39
  imageBtnNext: 'assets/lightbox-btn-next.gif',
39
40
  imageBlank: 'assets/lightbox-blank.gif'});
40
41
  })
41
- <% end %>
42
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <%= div_for picture, :class => 'content_size' do %>
2
+ <div class="picture_show">
3
+ <%= link_to image_tag_for(picture),
4
+ download_document_path(picture),
5
+ :id => dom_id(picture) + "_a",
6
+ :type => picture.type,
7
+ :title => picture.file_file_name,
8
+ :path => document_path(picture) %>
9
+ </div>
10
+ <% end %>
11
+
12
+
13
+ <%= javascript_tag do %>
14
+ $(document).ready(function() {
15
+ $("#<%= dom_id picture %> #<%= dom_id picture %>_img").aeImageResize({ height: 500, width: 500 });
16
+ $("#<%= dom_id picture %> #<%= dom_id picture %>_a").lightBox({
17
+ maxHeight: 920,
18
+ maxWidth: 920,
19
+ imageLoading: '../assets/lightbox-ico-loading.gif',
20
+ imageBtnClose: '../assets/lightbox-btn-close.gif',
21
+ imageBtnPrev: '../assets/lightbox-btn-prev.gif',
22
+ imageBtnNext: '../assets/lightbox-btn-next.gif',
23
+ imageBlank: '../assets/lightbox-blank.gif'});
24
+
25
+ })
26
+ <% end %>
@@ -1 +1 @@
1
- <%=render(:partial => 'common-documents/index') %>
1
+ <%=render(:partial => 'common_documents/index') %>
@@ -1,2 +1,2 @@
1
- <%= render :partial => 'objects/show',
2
- :locals => { :object => @picture } %>
1
+ <%= render :partial => 'common_documents/show',
2
+ :locals => { :document => @picture } %>
@@ -3,8 +3,8 @@
3
3
  $("#jpId<%=video.id%>").jPlayer( {
4
4
  ready: function () {
5
5
  $(this).jPlayer("setMedia", {
6
- webmv: "<%= video_path(video)+"?style=webm" %>", // Defines the webm url
7
- flv: "<%= video_path(video)+"?style=flv" %>"
6
+ webmv: "<%= video_url(video, :format => 'webm' ) %>", // Defines the webm url
7
+ flv: "<%= video_url(video, :format => 'flv') %>"
8
8
  });
9
9
  },
10
10
  solution:"flash, html",
@@ -1,14 +1,15 @@
1
1
  <div class="attachment_thumb">
2
2
  <%= link_to thumb_for(video, 16),
3
- {:controller => "documents", :action => "download", :id => video},
3
+ video_path(video),
4
+ :id => video,
4
5
  :class => "" %>
5
6
  </div>
6
7
  <div class="attachment_text">
7
8
  <%= t('video.msg') %><%= link_to "\""+video.file_file_name+"\"",
8
- {:controller => "documents", :action => "download", :id => video},
9
+ video,
9
10
  :class => "attachment_text_link" %>
10
11
  <div id="video_thumbnail_<%= video.id%>" class="video_thumbnail_class">
11
- <%= image_tag(video_path(video)+"?style=thumb", :class => "video_thumbnail_image", :alt => "")%> <div id="<%= video.id%>" class="video_thumbnail_play_over"></div>
12
+ <%= image_tag(video_path(video, :format => :png, :style => 'thumb0'), :class => "video_thumbnail_image", :alt => "")%> <div id="<%= video.id%>" class="video_thumbnail_play_over"></div>
12
13
  </div>
13
14
  <div id="full_video_<%= video.id%>" class="jp-video jp-video-270p">
14
15
  <div class="jp-type-single">
@@ -0,0 +1,64 @@
1
+ <% content_for :javascript do %>
2
+
3
+ $("#jpId<%=video.id%>").jPlayer( {
4
+ ready: function () {
5
+ $(this).jPlayer("setMedia", {
6
+ webmv: "<%= video_url(video, :format => 'webm' ) %>", // Defines the webm url
7
+ flv: "<%= video_url(video, :format => 'flv') %>"
8
+ });
9
+ },
10
+ solution:"flash, html",
11
+ preload: "none",
12
+ supplied: "webmv, flv",
13
+ swfPath: "assets",
14
+ cssSelectorAncestor: "#jp_interface_<%=video.id%>"
15
+ });
16
+
17
+ <% end %>
18
+
19
+ <%= div_for video, :class => 'content_size' do %>
20
+ <div class="video_show">
21
+ <% if video.file_processing %>
22
+ <div class="processing_text">
23
+ <%= t('video.processing')%>
24
+ </div>
25
+ <% else %>
26
+ <div id="full_video_<%= video.id%>" class="jp-video jp-video-270p">
27
+ <div class="jp-type-single">
28
+ <div id="jpId<%= video.id%>" class="jp-jplayer"></div>
29
+ <div id="jp_interface_<%= video.id%>" class="jp-interface">
30
+ <div class="jp-video-play"></div>
31
+ <ul class="jp-controls">
32
+ <li>
33
+ <a href="#" class="jp-play" tabindex="1">play</a>
34
+ </li>
35
+ <li>
36
+ <a href="#" class="jp-pause" tabindex="1">pause</a>
37
+ </li>
38
+ <li>
39
+ <a href="#" class="jp-stop" tabindex="1">stop</a>
40
+ </li>
41
+ <li>
42
+ <a href="#" class="jp-mute" tabindex="1">mute</a>
43
+ </li>
44
+ <li>
45
+ <a href="#" class="jp-unmute" tabindex="1">unmute</a>
46
+ </li>
47
+ </ul>
48
+ <div class="jp-progress">
49
+ <div class="jp-seek-bar">
50
+ <div class="jp-play-bar"></div>
51
+ </div>
52
+ </div>
53
+ <div class="jp-volume-bar">
54
+ <div class="jp-volume-bar-value"></div>
55
+ </div>
56
+ <div class="jp-current-time"></div>
57
+ <div class="jp-duration"></div>
58
+ </div>
59
+ <div id="jp_playlist_<%= video.id%>" class="jp-playlist"></div>
60
+ </div>
61
+ </div>
62
+ <% end %>
63
+ </div>
64
+ <% end %>
@@ -1 +1 @@
1
- <%=render(:partial => 'common-documents/index') %>
1
+ <%=render(:partial => 'common_documents/index') %>
@@ -1,2 +1,2 @@
1
- <%= render :partial => 'objects/show',
2
- :locals => { :object => @video } %>
1
+ <%= render :partial => 'common_documents/show',
2
+ :locals => { :document => @video } %>
@@ -7,10 +7,22 @@ en:
7
7
  not_mine: "Audios"
8
8
  processing: "Processing audio clip"
9
9
  document:
10
- all: "All documents"
10
+ actions:
11
+ delete: "Delete"
12
+ download: "Download"
13
+ edit: "Edit"
14
+ all: "All documents"
11
15
  confirm_delete: "Delete document?"
12
16
  form:
13
17
  title: "File"
18
+ info:
19
+ date:
20
+ created_at: "Created at"
21
+ updated_at: "Updated at"
22
+ description:
23
+ title: "Description"
24
+ title:
25
+ title: "Title"
14
26
  mine: "My documents"
15
27
  msg: "Uploaded a document:"
16
28
  not_mine: "Documents"
@@ -22,6 +34,12 @@ en:
22
34
  mine: "My pictures"
23
35
  msg: "Uploaded a picture:"
24
36
  not_mine: "Pictures"
37
+ repository:
38
+ title: "Repository"
39
+ order:
40
+ by: "Order by"
41
+ last_modified: "Last modified"
42
+ most_popular: "Most popular"
25
43
  resource:
26
44
  all: "All Resources"
27
45
  confirm_delete: "Delete resource?"
@@ -7,10 +7,22 @@ es:
7
7
  not_mine: "Audios"
8
8
  processing: "Procesando fichero de audio..."
9
9
  document:
10
+ actions:
11
+ delete: "Borrar"
12
+ download: "Descargar"
13
+ edit: "Editar"
10
14
  all: "Todos los documentos"
11
15
  confirm_delete: "¿Borrar documento?"
12
16
  form:
13
17
  title: "Fichero"
18
+ info:
19
+ date:
20
+ created_at: "Creado"
21
+ updated_at: "Última modificación"
22
+ description:
23
+ title: "Descripción"
24
+ title:
25
+ title: "Título"
14
26
  mine: "Mis documentos"
15
27
  msg: "Subió un documento:"
16
28
  not_mine: "Documentos"
@@ -22,6 +34,12 @@ es:
22
34
  mine: "Mis imágenes"
23
35
  msg: "Subió una imagen:"
24
36
  not_mine: "Imágenes"
37
+ repository:
38
+ title: "Repositorio"
39
+ order:
40
+ by: "Ordenar por"
41
+ last_modified: "Última modificación"
42
+ most_popular: "Popularidad"
25
43
  resource:
26
44
  all: "Todos los recursos"
27
45
  confirm_delete: "¿Borrar recursos?"
@@ -29,9 +29,11 @@ module SocialStream
29
29
  Mime::Type.register "audio/x-wav", :wav, [ "audio/wav" ]
30
30
  Mime::Type.register "audio/mpeg", :mpeg
31
31
  Mime::Type.register "audio/x-vorbis+ogg", :ogg, [ "application/ogg" ]
32
+ Mime::Type.register "audio/webm", :webma
32
33
 
33
34
  # Video
34
35
  Mime::Type.register "video/x-flv", :flv
36
+ Mime::Type.register "video/webm", :webm
35
37
  end
36
38
 
37
39
  initializer "social_stream-documents.toolbar_config" do
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Documents
3
- VERSION = "0.3.3".freeze
3
+ VERSION = "0.4.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.9.22')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.9.23')
16
16
  s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
17
17
  s.add_runtime_dependency('paperclip','2.3.11')
18
18
  s.add_runtime_dependency('delayed_paperclip','>= 0.7.2')
@@ -21,9 +21,15 @@ describe DocumentsController do
21
21
  response.body.should =~ /small.pdf/
22
22
  end
23
23
 
24
- it "should render receiver's show" do
24
+ it "should render receiver's html show" do
25
25
  get :show, :id => @public_document.to_param
26
26
  response.should be_success
27
+ response.headers["Content-Type"].should include('text/html')
28
+ end
29
+
30
+ it "should render receiver's format pdf download" do
31
+ get :download, :id => @public_document.to_param
32
+ response.should be_success
27
33
  response.headers["Content-Type"].should include('application/pdf')
28
34
  end
29
35
  end
@@ -40,9 +46,15 @@ describe DocumentsController do
40
46
  response.body.should =~ /small.pdf/
41
47
  end
42
48
 
43
- it "should render show" do
49
+ it "should render html show" do
44
50
  get :show, :id => @public_document.to_param
45
51
  response.should be_success
52
+ response.headers["Content-Type"].should include('text/html')
53
+ end
54
+
55
+ it "should render format pdf download" do
56
+ get :download, :id => @public_document.to_param, :format => :pdf
57
+ response.should be_success
46
58
  response.headers["Content-Type"].should include('application/pdf')
47
59
  end
48
60
  end
@@ -77,4 +89,30 @@ describe DocumentsController do
77
89
  end
78
90
  end
79
91
  end
92
+
93
+ context "with public picture" do
94
+ before do
95
+ @public_picture = Factory(:public_picture)
96
+ end
97
+
98
+ describe "when not authenticated" do
99
+ it "should render receiver's format png download" do
100
+ get :download, :id => @public_picture.to_param
101
+ response.should be_success
102
+ response.headers["Content-Type"].should include('image/png')
103
+ end
104
+ end
105
+
106
+ describe "when authenticated" do
107
+ before do
108
+ sign_in Factory(:user)
109
+ end
110
+
111
+ it "should render format png download" do
112
+ get :download, :id => @public_picture.to_param
113
+ response.should be_success
114
+ response.headers["Content-Type"].should include('image/png')
115
+ end
116
+ end
117
+ end
80
118
  end
@@ -21,10 +21,10 @@ describe PicturesController do
21
21
  response.body.should =~ /rails.png/
22
22
  end
23
23
 
24
- it "should render receiver's show" do
24
+ it "should render receiver's html show" do
25
25
  get :show, :id => @public_picture.to_param
26
26
  response.should be_success
27
- response.headers["Content-Type"].should include('image/png')
27
+ response.headers["Content-Type"].should include('text/html')
28
28
  end
29
29
  end
30
30
 
@@ -40,10 +40,10 @@ describe PicturesController do
40
40
  response.body.should =~ /rails.png/
41
41
  end
42
42
 
43
- it "should render show" do
43
+ it "should render html show" do
44
44
  get :show, :id => @public_picture.to_param
45
45
  response.should be_success
46
- response.headers["Content-Type"].should include('image/png')
46
+ response.headers["Content-Type"].should include('text/html')
47
47
  end
48
48
  end
49
49
  end #end of the context
@@ -11,7 +11,6 @@ Dummy::Application.configure do
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
14
- config.action_view.debug_rjs = true
15
14
  config.action_controller.perform_caching = false
16
15
 
17
16
  # Don't care if the mailer can't send
@@ -32,4 +32,6 @@ Dummy::Application.configure do
32
32
 
33
33
  # Print deprecation notices to the stderr
34
34
  config.active_support.deprecation = :stderr
35
+
36
+ config.assets.enabled = true
35
37
  end