social_stream-documents 0.1.10 → 0.1.11

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 (64) hide show
  1. data/app/assets/flash/Jplayer.swf +0 -0
  2. data/app/assets/images/{formats → 16}/audio.png +0 -0
  3. data/app/assets/images/{formats → 16}/btn_documents.png +0 -0
  4. data/app/assets/images/{formats → 16}/default.png +0 -0
  5. data/app/assets/images/{formats → 16}/doc.png +0 -0
  6. data/app/assets/images/{formats/video.png → 16/mpeg.png} +0 -0
  7. data/app/assets/images/{formats → 16}/pdf.png +0 -0
  8. data/app/assets/images/{formats → 16}/photo.png +0 -0
  9. data/app/assets/images/{formats → 16}/plain.png +0 -0
  10. data/app/assets/images/16/ppt.png +0 -0
  11. data/app/assets/images/16/rar.png +0 -0
  12. data/app/assets/images/16/video.png +0 -0
  13. data/app/assets/images/{formats → 16}/xls.png +0 -0
  14. data/app/assets/images/16/zip.png +0 -0
  15. data/app/assets/images/48/audio.png +0 -0
  16. data/app/assets/images/48/default.png +0 -0
  17. data/app/assets/images/48/excel.png +0 -0
  18. data/app/assets/images/48/mpeg.png +0 -0
  19. data/app/assets/images/48/pdf.png +0 -0
  20. data/app/assets/images/48/ppt.png +0 -0
  21. data/app/assets/images/48/rar.png +0 -0
  22. data/app/assets/images/48/resource.png +0 -0
  23. data/app/assets/images/48/video.png +0 -0
  24. data/app/assets/images/48/word.png +0 -0
  25. data/app/assets/images/48/zip.png +0 -0
  26. data/app/assets/images/btn/document.png +0 -0
  27. data/app/assets/javascripts/documents.js.erb +21 -1
  28. data/app/assets/javascripts/social_stream-documents.js +1 -0
  29. data/app/assets/stylesheets/documents.css +54 -2
  30. data/app/assets/stylesheets/social_stream-documents.css +1 -0
  31. data/app/helpers/documents_helper.rb +4 -6
  32. data/app/models/audio.rb +6 -7
  33. data/app/models/document.rb +4 -13
  34. data/app/models/picture.rb +9 -7
  35. data/app/models/video.rb +7 -7
  36. data/app/views/audios/_audio.html.erb +50 -9
  37. data/app/views/common/_index.html.erb +1 -1
  38. data/app/views/documents/_document.html.erb +2 -2
  39. data/app/views/pictures/_picture.html.erb +2 -2
  40. data/app/views/toolbar/_uploads_menu.html.erb +1 -1
  41. data/app/views/videos/_video.html.erb +56 -5
  42. data/social_stream-documents.gemspec +1 -2
  43. data/vendor/assets/javascripts/jquery.jplayer.js +78 -0
  44. data/vendor/assets/stylesheets/jplayer.blue.monday.css +448 -0
  45. data/vendor/assets/stylesheets/jplayer.blue.monday.jpg +0 -0
  46. data/vendor/assets/stylesheets/jplayer.blue.monday.video.play.hover.png +0 -0
  47. data/vendor/assets/stylesheets/jplayer.blue.monday.video.play.png +0 -0
  48. data/vendor/assets/stylesheets/pbar-ani.gif +0 -0
  49. metadata +66 -77
  50. data/app/assets/images/formats/mpeg.png +0 -0
  51. data/app/assets/images/formats/ppt-big.png +0 -0
  52. data/app/assets/images/formats/ppt.png +0 -0
  53. data/app/assets/images/formats/rar-big.png +0 -0
  54. data/app/assets/images/formats/rar.png +0 -0
  55. data/app/assets/images/formats/zip-big.png +0 -0
  56. data/app/assets/images/formats/zip.png +0 -0
  57. data/app/assets/images/formats_big/audio.png +0 -0
  58. data/app/assets/images/formats_big/default.png +0 -0
  59. data/app/assets/images/formats_big/doc.png +0 -0
  60. data/app/assets/images/formats_big/pdf.png +0 -0
  61. data/app/assets/images/formats_big/ppt.png +0 -0
  62. data/app/assets/images/formats_big/rar.png +0 -0
  63. data/app/assets/images/formats_big/video.png +0 -0
  64. data/app/assets/images/formats_big/zip.png +0 -0
@@ -42,4 +42,24 @@ function removePlayers(){
42
42
 
43
43
  $('#closeButton').live("click",function(){
44
44
  removePlayers();
45
- });
45
+ });
46
+
47
+ function hideJplayer(jplayerid){
48
+ $("#full_video_"+jplayerid).removeClass("jp-video-270p");
49
+ $("#jp_interface_"+jplayerid).hide();
50
+ $("#jp_playlist_"+jplayerid).hide();
51
+ }
52
+
53
+ function showJplayer(jplayerid){
54
+ $("#full_video_"+jplayerid).addClass("jp-video-270p");
55
+ $("#jp_interface_"+jplayerid).show();
56
+ $("#jp_playlist_"+jplayerid).show();
57
+
58
+ }
59
+
60
+ $(".video_thumbnail_play_over").livequery("click",function(){
61
+ the_id = $(this).attr('id');
62
+ showJplayer(the_id);
63
+ $(this).parent().hide();
64
+ $("#jpId"+the_id).jPlayer("play", 0);
65
+ });
@@ -1 +1,2 @@
1
+ //= require jquery.jplayer
1
2
  //= require_tree .
@@ -3,7 +3,7 @@
3
3
  padding-top: 10px;
4
4
  }
5
5
 
6
- .attachment_text
6
+ .attachment_content
7
7
  {
8
8
  position: relative;
9
9
  width: 90%;
@@ -11,10 +11,17 @@
11
11
  line-height: 20px;
12
12
  height: auto;
13
13
  float:left;
14
+ font-size:13px;
15
+ }
16
+
17
+ .attachment_text
18
+ {
19
+ line-height: 20px;
20
+ height: auto;
14
21
  font-size:13px;
15
22
  }
16
23
 
17
- .attachment_text a
24
+ .attachment_text_link
18
25
  {
19
26
  color: #2A3890;
20
27
  padding-left: 10px;
@@ -131,3 +138,48 @@
131
138
  .size_19px {
132
139
  width: 19px;
133
140
  }
141
+
142
+
143
+ #jpId {
144
+
145
+ }
146
+
147
+ .jp-audio, .jp-video {
148
+ margin: 5px 0 5px 0;
149
+ }
150
+
151
+ .hidenJplayer {
152
+ height: 0px;
153
+ width: 0px;
154
+ }
155
+
156
+ .video_thumbnail_class {
157
+ width: 180px;
158
+ height: 135px;
159
+ }
160
+
161
+ .video_thumbnail_image{
162
+ position: relative;
163
+ top:0px;
164
+ width: 180px;
165
+ z-index:1;
166
+ }
167
+
168
+ .video_thumbnail_play_over {
169
+ background: transparent url("jplayer.blue.monday.video.play.png") no-repeat center;
170
+ /* position: relative; */
171
+ position: relative;
172
+ cursor:pointer;
173
+ z-index:2;
174
+ }
175
+
176
+ .video_thumbnail_play_over:hover {
177
+ background: transparent url("jplayer.blue.monday.video.play.hover.png") no-repeat center;
178
+ }
179
+
180
+ .video_thumbnail_play_over {
181
+ top:-135px;
182
+ width:180px;
183
+ height:135px;
184
+ }
185
+
@@ -1,3 +1,4 @@
1
1
  /*
2
+ *= require jplayer.blue.monday
2
3
  *= require_tree .
3
4
  */
@@ -2,14 +2,12 @@ module DocumentsHelper
2
2
 
3
3
  FORMATS = ["msword","vnd.ms-powerpoint","msexcel","rar","zip","mp3","plain","pdf"]
4
4
 
5
- def thumb_for(document)
6
- image_tag document.thumb(self)
7
- end
8
5
 
9
- def big_thumb_for(document)
10
- image_tag document.big_thumb(self)
6
+ #size can be any of the names that the document has size for
7
+ def thumb_for(document, size)
8
+ image_tag document.thumb(size, self)
11
9
  end
12
-
10
+
13
11
  def link_for_wall(document)
14
12
  format = Mime::Type.lookup(document.file_content_type)
15
13
  url_for(document)+"."+format.to_sym.to_s+"?style=thumb0"
@@ -1,12 +1,11 @@
1
1
  class Audio < Document
2
2
 
3
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"
4
+ def thumb(size, helper)
5
+ if format && IMAGE_FORMATS.include?(format.to_s)
6
+ "#{ size.to_s }/audio.png"
7
+ else
8
+ "#{ size.to_s }/audio.png"
9
+ end
11
10
  end
12
11
  end
@@ -45,21 +45,12 @@ class Document < ActiveRecord::Base
45
45
  end
46
46
 
47
47
  # Thumbnail file
48
- def thumb helper
48
+ def thumb(size, helper)
49
49
  if format && IMAGE_FORMATS.include?(format.to_s)
50
- "formats/#{ format }.png"
50
+ "#{ size.to_s }/#{ format }.png"
51
51
  else
52
- "formats/default.png"
52
+ "#{ size.to_s }/default.png"
53
53
  end
54
54
  end
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
-
55
+
65
56
  end
@@ -5,13 +5,15 @@ class Picture < Document
5
5
  :styles => {:thumb => ["48x48#"],
6
6
  :thumb0 => ["130x80#"]
7
7
  }
8
- def thumb helper
9
- "formats/photo.png"
8
+ # Thumbnail file
9
+ def thumb(size, helper)
10
+ case size
11
+ when 16
12
+ "#{ size.to_s }/photo.png"
13
+ when 48
14
+ helper.picture_path self, :format => format, :style => 'thumb'
15
+ end
10
16
  end
11
-
12
- def big_thumb helper
13
- helper.picture_path self, :format => format, :style => 'thumb'
14
- end
15
-
17
+
16
18
 
17
19
  end
@@ -5,6 +5,7 @@ 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
+ :flv => { :format => 'flv' }
8
9
  :thumb => {:geometry => "48x48" , :format => 'png', :time => 5},
9
10
  :thumb0 => {:geometry => "130x80", :format => 'png', :time => 5}
10
11
  },:processors => [:ffmpeg]
@@ -15,12 +16,11 @@ class Video < Document
15
16
 
16
17
 
17
18
  # 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"
19
+ def thumb(size, helper)
20
+ if format && IMAGE_FORMATS.include?(format.to_s)
21
+ "#{ size.to_s }/video.png"
22
+ else
23
+ "#{ size.to_s }/video.png"
24
+ end
25
25
  end
26
26
  end
@@ -1,19 +1,60 @@
1
+ <% content_for :javascript do %>
2
+
3
+ $("#jpId<%=audio.id%>").jPlayer( {
4
+ ready: function () {
5
+ $(this).jPlayer("setMedia", {
6
+ mp3: "<%= download_document_path(audio) %>" // Defines the mp3 url
7
+ });
8
+ },
9
+ swfPath: "assets",
10
+ cssSelectorAncestor: "#jp_interface_<%=audio.id%>"
11
+ });
12
+
13
+ <% end %>
14
+
1
15
  <%= div_for audio, :class => 'content_size' do %>
2
16
 
3
17
  <div class="attachment_thumb">
4
- <%= link_to thumb_for(audio),
18
+ <%= link_to thumb_for(audio, 16),
5
19
  {:controller => "documents", :action => "download", :id => audio},
6
20
  :class => "" %>
7
21
  </div>
8
22
 
9
- <div class="attachment_text">
10
- <%= t('audio.msg') %><%= link_to "\""+audio.file_file_name+"\"",
11
- {:controller => "documents", :action => "download", :id => audio},
12
- :class => "" %>
13
-
14
- <audio src="<%= download_document_path(audio) %>" controls="controls">
15
- Your browser does not support the audio element.
16
- </audio>
23
+ <div class="attachment_content">
24
+ <div class="attachment_text">
25
+ <%= t('audio.msg') %><%= link_to "\""+audio.file_file_name+"\"",
26
+ {:controller => "documents", :action => "download", :id => audio},
27
+ :class => "attachment_text_link" %>
28
+ </div>
29
+ <div id="jpId<%=audio.id%>"></div>
30
+
31
+ <div class="jp-audio">
32
+ <div class="jp-type-single">
33
+ <div id="jp_interface_<%=audio.id%>" class="jp-interface">
34
+ <ul class="jp-controls">
35
+ <li><a href="#" class="jp-play" tabindex="1">play</a></li>
36
+ <li><a href="#" class="jp-pause" tabindex="1">pause</a></li>
37
+ <li><a href="#" class="jp-stop" tabindex="1">stop</a></li>
38
+ <li><a href="#" class="jp-mute" tabindex="1">mute</a></li>
39
+ <li><a href="#" class="jp-unmute" tabindex="1">unmute</a></li>
40
+ </ul>
41
+ <div class="jp-progress">
42
+ <div class="jp-seek-bar">
43
+ <div class="jp-play-bar"></div>
44
+ </div>
45
+ </div>
46
+ <div class="jp-volume-bar">
47
+ <div class="jp-volume-bar-value"></div>
48
+ </div>
49
+ <div class="jp-current-time"></div>
50
+ <div class="jp-duration"></div>
51
+ </div>
52
+ <div id="jp_playlist_<%=audio.id%>" class="jp-playlist">
53
+
54
+ </div>
55
+ </div>
56
+ </div>
57
+
17
58
  </div>
18
59
 
19
60
  <% end %>
@@ -27,7 +27,7 @@
27
27
  <% document = a.activity_objects.first.document %>
28
28
  <div class="attachment_tile">
29
29
  <div class="attachment_tile_thumb">
30
- <%= link_to big_thumb_for(document),
30
+ <%= link_to thumb_for(document,48),
31
31
  {:controller => "documents", :action => "download", :id => document},
32
32
  :type => document.type,
33
33
  :title => document.file_file_name,
@@ -5,7 +5,7 @@
5
5
  <%= div_for document, :class => 'content_size' do %>
6
6
 
7
7
  <div class="attachment_thumb">
8
- <%= link_to thumb_for(document),
8
+ <%= link_to thumb_for(document, 16),
9
9
  {:controller => "documents", :action => "download", :id => document},
10
10
  :class => "" %>
11
11
  </div>
@@ -13,7 +13,7 @@
13
13
  <div class="attachment_text">
14
14
  <%= t('document.msg') %><%= link_to "\""+document.file_file_name+"\"",
15
15
  {:controller => "documents", :action => "download", :id => document},
16
- :class => "" %>
16
+ :class => "attachment_text_link" %>
17
17
  </div>
18
18
 
19
19
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <%= div_for picture, :class => 'content_size' do %>
2
2
 
3
3
  <div class="attachment_thumb">
4
- <%= link_to thumb_for(picture),
4
+ <%= link_to thumb_for(picture, 16),
5
5
  {:controller => "documents", :action => "download", :id => picture},
6
6
  :class => "" %>
7
7
  </div>
@@ -9,7 +9,7 @@
9
9
  <div class="attachment_text picture_summary_class">
10
10
  <%= t('picture.msg') %><%= link_to "\""+picture.file_file_name+"\"",
11
11
  {:controller => "documents", :action => "download", :id => picture},
12
- :class => "" %>
12
+ :class => "attachment_text_link" %>
13
13
  </div>
14
14
 
15
15
  <% end %>
@@ -2,7 +2,7 @@
2
2
  <%= link_to( image_tag("btn/btn_resource.png",:class =>"menu_icon")+t('resource.title'),"#") %>
3
3
  <ul>
4
4
  <li>
5
- <%= link_to( image_tag("btn/btn_documents.png",
5
+ <%= link_to( image_tag("btn/btn_document.png",
6
6
  :class => "menu_icon")+t('document.title'), documents_path) %>
7
7
  </li>
8
8
  <li>
@@ -1,7 +1,27 @@
1
+ <% content_for :javascript do %>
2
+
3
+ $("#jpId<%=video.id%>").jPlayer( {
4
+ ready: function () {
5
+ $(this).jPlayer("setMedia", {
6
+ webmv: "<%= video_path(video)+"?style=webm" %>", // Defines the webm url
7
+ flv: "<%= video_path(video)+"?style=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
+ hideJplayer(<%=video.id%>);
18
+
19
+ <% end %>
20
+
1
21
  <%= div_for video, :class => 'content_size' do %>
2
22
 
3
23
  <div class="attachment_thumb">
4
- <%= link_to thumb_for(video),
24
+ <%= link_to thumb_for(video, 16),
5
25
  {:controller => "documents", :action => "download", :id => video},
6
26
  :class => "" %>
7
27
  </div>
@@ -9,11 +29,42 @@
9
29
  <div class="attachment_text">
10
30
  <%= t('video.msg') %><%= link_to "\""+video.file_file_name+"\"",
11
31
  {:controller => "documents", :action => "download", :id => video},
12
- :class => "" %>
32
+ :class => "attachment_text_link" %>
13
33
 
14
- <video src="<%= video_path(video)+"?style=webm" %>" controls="controls">
15
- Your browser does not support the video element.
16
- </video>
34
+ <div id="video_thumbnail_<%=video.id%>" class="video_thumbnail_class">
35
+ <%=image_tag(video_path(video)+"?style=png", :class => "video_thumbnail_image")%>
36
+ <div id="<%=video.id%>" class="video_thumbnail_play_over"></div>
37
+ </div>
38
+
39
+
40
+ <div id="full_video_<%=video.id%>" class="jp-video jp-video-270p">
41
+ <div class="jp-type-single">
42
+ <div id="jpId<%=video.id%>" class="jp-jplayer"></div>
43
+ <div id="jp_interface_<%=video.id%>" class="jp-interface">
44
+ <div class="jp-video-play"></div>
45
+ <ul class="jp-controls">
46
+ <li><a href="#" class="jp-play" tabindex="1">play</a></li>
47
+ <li><a href="#" class="jp-pause" tabindex="1">pause</a></li>
48
+ <li><a href="#" class="jp-stop" tabindex="1">stop</a></li>
49
+ <li><a href="#" class="jp-mute" tabindex="1">mute</a></li>
50
+ <li><a href="#" class="jp-unmute" tabindex="1">unmute</a></li>
51
+ </ul>
52
+ <div class="jp-progress">
53
+ <div class="jp-seek-bar">
54
+ <div class="jp-play-bar"></div>
55
+ </div>
56
+ </div>
57
+ <div class="jp-volume-bar">
58
+ <div class="jp-volume-bar-value"></div>
59
+ </div>
60
+ <div class="jp-current-time"></div>
61
+ <div class="jp-duration"></div>
62
+ </div>
63
+ <div id="jp_playlist_<%=video.id%>" class="jp-playlist">
64
+ </div>
65
+ </div>
66
+ </div>
67
+
17
68
  </div>
18
69
 
19
70
  <% end %>