social_stream-documents 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/images/formats/{msword.png → doc.png} +0 -0
- data/app/assets/images/formats/{mp3.png → mpeg.png} +0 -0
- data/app/assets/images/formats/{vnd.ms-powerpoint.png → ppt.png} +0 -0
- data/app/assets/images/formats/{msexcel.png → xls.png} +0 -0
- data/app/assets/stylesheets/documents.css +8 -27
- data/app/controllers/documents_controller.rb +1 -1
- data/app/helpers/documents_helper.rb +2 -16
- data/app/models/audio.rb +1 -1
- data/app/models/document.rb +19 -0
- data/app/models/picture.rb +4 -1
- data/app/models/video.rb +3 -3
- data/app/views/documents/_document.html.erb +1 -1
- data/app/views/pictures/_picture.html.erb +1 -1
- data/lib/social_stream/documents/engine.rb +28 -3
- data/social_stream-documents.gemspec +1 -1
- metadata +8 -10
- data/app/views/documents/_mediapreviews.html.erb +0 -7
- data/app/views/documents/_mediawall.html.erb +0 -111
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -6,7 +6,7 @@
|
|
6
6
|
.attachment_text
|
7
7
|
{
|
8
8
|
position: relative;
|
9
|
-
width:
|
9
|
+
width: 70%;
|
10
10
|
vertical-align: middle;
|
11
11
|
line-height: 20px;
|
12
12
|
height: auto;
|
@@ -46,6 +46,7 @@
|
|
46
46
|
margin-left: 15px;
|
47
47
|
margin-bottom: 10px;
|
48
48
|
clear: both;
|
49
|
+
text-align: left;
|
49
50
|
}
|
50
51
|
|
51
52
|
.attachment_tile{
|
@@ -96,31 +97,6 @@
|
|
96
97
|
width: 24px;
|
97
98
|
}
|
98
99
|
|
99
|
-
#media_wall{
|
100
|
-
position: relative;
|
101
|
-
margin-left: auto;
|
102
|
-
margin-right: auto;
|
103
|
-
background-color: #e0edf2;
|
104
|
-
width: 100%;
|
105
|
-
margin-bottom: 20px;
|
106
|
-
height: 130px;
|
107
|
-
}
|
108
|
-
|
109
|
-
#media_wall_buttons{
|
110
|
-
position: relative;
|
111
|
-
margin-left: auto;
|
112
|
-
margin-right: auto;
|
113
|
-
width: 100%;
|
114
|
-
text-align: right;
|
115
|
-
}
|
116
|
-
|
117
|
-
#media_wall_buttons li{
|
118
|
-
display:inline;
|
119
|
-
margin-left:2px;
|
120
|
-
margin-right:2px;
|
121
|
-
padding: 0px;
|
122
|
-
}
|
123
|
-
|
124
100
|
.media_preview{
|
125
101
|
float:left;
|
126
102
|
margin: 10px;
|
@@ -150,4 +126,9 @@
|
|
150
126
|
overflow:hidden;
|
151
127
|
font-size: 11px;
|
152
128
|
color: #2A3890;
|
153
|
-
}
|
129
|
+
}
|
130
|
+
|
131
|
+
.picture_summary_class{
|
132
|
+
margin-top: 14px;
|
133
|
+
}
|
134
|
+
|
@@ -3,17 +3,7 @@ module DocumentsHelper
|
|
3
3
|
FORMATS = ["msword","vnd.ms-powerpoint","msexcel","rar","zip","mp3","plain","pdf"]
|
4
4
|
|
5
5
|
def thumb_for(document)
|
6
|
-
|
7
|
-
if FORMATS.include?(format.split('/')[1])
|
8
|
-
image_tag 'formats/'+format.split('/')[1]+'.png'
|
9
|
-
else
|
10
|
-
if is_image?(document)
|
11
|
-
format = Mime::Type.lookup(document.file_content_type)
|
12
|
-
image_tag url_for(document)+"."+format.to_sym.to_s+"?style=thumb"
|
13
|
-
else
|
14
|
-
image_tag 'formats/default.png'
|
15
|
-
end
|
16
|
-
end
|
6
|
+
image_tag document.thumb(self)
|
17
7
|
end
|
18
8
|
|
19
9
|
def link_for_wall(document)
|
@@ -27,8 +17,4 @@ module DocumentsHelper
|
|
27
17
|
name[0,12]+"..."
|
28
18
|
end
|
29
19
|
end
|
30
|
-
|
31
|
-
def is_image?(document)
|
32
|
-
!(document.file_content_type =~ /^image.*/).nil?
|
33
|
-
end
|
34
|
-
end
|
20
|
+
end
|
data/app/models/audio.rb
CHANGED
data/app/models/document.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
class Document < ActiveRecord::Base
|
2
2
|
include SocialStream::Models::Object
|
3
3
|
|
4
|
+
IMAGE_FORMATS = ["doc","ppt","xls","rar","zip","mpeg","plain","pdf"]
|
5
|
+
|
4
6
|
has_attached_file :file,
|
5
7
|
:url => '/:class/:id.:extension',
|
6
8
|
:path => ':rails_root/documents/:class/:id_partition/:style.:extension'
|
@@ -33,5 +35,22 @@ class Document < ActiveRecord::Base
|
|
33
35
|
return doc
|
34
36
|
end
|
35
37
|
end
|
38
|
+
|
39
|
+
def mime_type
|
40
|
+
Mime::Type.lookup(file_content_type)
|
41
|
+
end
|
42
|
+
|
43
|
+
def format
|
44
|
+
mime_type.to_sym
|
45
|
+
end
|
46
|
+
|
47
|
+
# Thumbnail file
|
48
|
+
def thumb helper
|
49
|
+
if format && IMAGE_FORMATS.include?(format.to_s)
|
50
|
+
"formats/#{ format }.png"
|
51
|
+
else
|
52
|
+
"formats/default.png"
|
53
|
+
end
|
54
|
+
end
|
36
55
|
|
37
56
|
end
|
data/app/models/picture.rb
CHANGED
data/app/models/video.rb
CHANGED
@@ -5,12 +5,12 @@ 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
|
-
:thumb => {:geometry => "48x48
|
9
|
-
:thumb0 => {:geometry => "130x80
|
8
|
+
:thumb => {:geometry => "48x48" , :format => 'png', :time => 5},
|
9
|
+
:thumb0 => {:geometry => "130x80", :format => 'png', :time => 5}
|
10
10
|
},:processors => [:ffmpeg]
|
11
11
|
|
12
12
|
def videoprocess
|
13
13
|
Resque.enqueue(Videoencoder, self.id)
|
14
14
|
end
|
15
15
|
|
16
|
-
end
|
16
|
+
end
|
@@ -9,7 +9,7 @@
|
|
9
9
|
{:controller => "documents", :action => "download", :id => document},
|
10
10
|
:class => "" %>
|
11
11
|
</div>
|
12
|
-
|
12
|
+
|
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},
|
@@ -10,7 +10,7 @@
|
|
10
10
|
:class => "" %>
|
11
11
|
</div>
|
12
12
|
|
13
|
-
<div class="attachment_text">
|
13
|
+
<div class="attachment_text picture_summary_class">
|
14
14
|
<%= t('picture.msg') %><%= link_to picture.file_file_name,
|
15
15
|
{:controller => "documents", :action => "download", :id => picture},
|
16
16
|
:class => "" %>
|
@@ -3,10 +3,35 @@ module SocialStream
|
|
3
3
|
class Engine < Rails::Engine
|
4
4
|
|
5
5
|
initializer "social_stream-documents.register_mime_types" do
|
6
|
+
# Documents
|
7
|
+
Mime::Type.register "text/plain", :txt
|
8
|
+
Mime::Type.register "application/zip", :zip
|
9
|
+
Mime::Type.register "application/x-rar", :rar
|
10
|
+
Mime::Type.register "application/pdf", :pdf
|
11
|
+
Mime::Type.register "application/postscript", :ps, [ "application/ps" ]
|
12
|
+
Mime::Type.register "application/vnd.oasis.opendocument.text", :odt
|
13
|
+
Mime::Type.register "application/vnd.oasis.opendocument.presentation", :odp
|
14
|
+
Mime::Type.register "application/vnd.oasis.opendocument.presentation", :ods
|
15
|
+
Mime::Type.register "application/vnd.ms-word", :doc, [ "application/msword" ]
|
16
|
+
Mime::Type.register "application/vnd.ms-powerpoint", :ppt, [ "application/mspowerpoint" ]
|
17
|
+
Mime::Type.register "application/vnd.ms-excel", :xls, [ "application/msexcel" ]
|
18
|
+
Mime::Type.register "application/rtf", :rtf
|
19
|
+
Mime::Type.register "application/vnd.scribus", :sla
|
20
|
+
|
21
|
+
# Picture
|
6
22
|
Mime::Type.register "image/jpeg", :jpeg, ["image/pjpeg","image/jpg"]
|
7
|
-
Mime::Type.register "image/gif",
|
8
|
-
Mime::Type.register "image/png",
|
9
|
-
Mime::Type.register "image/bmp",
|
23
|
+
Mime::Type.register "image/gif", :gif
|
24
|
+
Mime::Type.register "image/png", :png, [ "image/x-png" ]
|
25
|
+
Mime::Type.register "image/bmp", :bmp
|
26
|
+
Mime::Type.register "image/x-xcf", :xcf
|
27
|
+
|
28
|
+
# Audio
|
29
|
+
Mime::Type.register "audio/x-wav", :wav, [ "audio/wav" ]
|
30
|
+
Mime::Type.register "audio/mpeg", :mpeg
|
31
|
+
Mime::Type.register "audio/x-vorbis+ogg", :ogg, [ "application/ogg" ]
|
32
|
+
|
33
|
+
# Video
|
34
|
+
Mime::Type.register "video/x-flv", :flv
|
10
35
|
end
|
11
36
|
|
12
37
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "social_stream-documents"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.5"
|
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:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
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-
|
19
|
+
date: 2011-07-13 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -212,13 +212,13 @@ files:
|
|
212
212
|
- app/assets/images/btn/document.png
|
213
213
|
- app/assets/images/formats/btn_documents.png
|
214
214
|
- app/assets/images/formats/default.png
|
215
|
-
- app/assets/images/formats/
|
216
|
-
- app/assets/images/formats/
|
217
|
-
- app/assets/images/formats/msword.png
|
215
|
+
- app/assets/images/formats/doc.png
|
216
|
+
- app/assets/images/formats/mpeg.png
|
218
217
|
- app/assets/images/formats/pdf.png
|
219
218
|
- app/assets/images/formats/plain.png
|
219
|
+
- app/assets/images/formats/ppt.png
|
220
220
|
- app/assets/images/formats/rar.png
|
221
|
-
- app/assets/images/formats/
|
221
|
+
- app/assets/images/formats/xls.png
|
222
222
|
- app/assets/images/formats/zip.png
|
223
223
|
- app/assets/javascripts/documents.js
|
224
224
|
- app/assets/stylesheets/documents.css
|
@@ -241,8 +241,6 @@ files:
|
|
241
241
|
- app/views/documents/_fields.html.erb
|
242
242
|
- app/views/documents/_header.html.erb
|
243
243
|
- app/views/documents/_index.html.erb
|
244
|
-
- app/views/documents/_mediapreviews.html.erb
|
245
|
-
- app/views/documents/_mediawall.html.erb
|
246
244
|
- app/views/documents/_new.html.erb
|
247
245
|
- app/views/documents/index.html.erb
|
248
246
|
- app/views/documents/index.js.erb
|
@@ -1,111 +0,0 @@
|
|
1
|
-
<div id="media_wall_buttons">
|
2
|
-
<ul>
|
3
|
-
<li>
|
4
|
-
<%= link_to( image_tag("btn/btn_conferences.png",
|
5
|
-
:media => "conference"), videos_path, :remote => true) %>
|
6
|
-
</li>
|
7
|
-
<li>
|
8
|
-
<%= link_to( image_tag("btn/btn_gallery.png",
|
9
|
-
:media => "picture"), pictures_path, :remote => true, :page => 1, :per => 1) %>
|
10
|
-
</li>
|
11
|
-
<li>
|
12
|
-
<%= link_to( image_tag("btn/btn_video.png",
|
13
|
-
:media => "video"), videos_path, :remote => true) %>
|
14
|
-
</li>
|
15
|
-
<li>
|
16
|
-
<%= link_to( image_tag("btn/btn_audio.png",
|
17
|
-
:media => "audio"), audios_path, :remote => true) %>
|
18
|
-
</li>
|
19
|
-
<li>
|
20
|
-
<%= link_to(t('document.simple_all'), documents_path, :remote => true) %>
|
21
|
-
</li>
|
22
|
-
</ul>
|
23
|
-
</div>
|
24
|
-
|
25
|
-
<div id="media_wall">
|
26
|
-
<div class="media_preview conference">
|
27
|
-
<img src="#" class="media_preview_image" />
|
28
|
-
<div class="media_preview_title">Some conference</div>
|
29
|
-
<div class="media_preview_detail">some detail</div>
|
30
|
-
</div>
|
31
|
-
|
32
|
-
<div class="media_preview conference">
|
33
|
-
<img src="#" class="media_preview_image" />
|
34
|
-
<div class="media_preview_title">Some conference</div>
|
35
|
-
<div class="media_preview_detail">some detail</div>
|
36
|
-
</div>
|
37
|
-
|
38
|
-
<div class="media_preview conference">
|
39
|
-
<img src="#" class="media_preview_image" />
|
40
|
-
<div class="media_preview_title">Some conference</div>
|
41
|
-
<div class="media_preview_detail">some detail</div>
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<div class="media_preview picture">
|
45
|
-
<img src="#" class="media_preview_image" />
|
46
|
-
<div class="media_preview_title">Some picture</div>
|
47
|
-
<div class="media_preview_detail">some detail</div>
|
48
|
-
</div>
|
49
|
-
|
50
|
-
<div class="media_preview picture">
|
51
|
-
<img src="#" class="media_preview_image" />
|
52
|
-
<div class="media_preview_title">Some picture</div>
|
53
|
-
<div class="media_preview_detail">some detail</div>
|
54
|
-
</div>
|
55
|
-
|
56
|
-
<div class="media_preview picture">
|
57
|
-
<img src="#" class="media_preview_image" />
|
58
|
-
<div class="media_preview_title">Some picture</div>
|
59
|
-
<div class="media_preview_detail">some detail</div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<div class="media_preview video">
|
63
|
-
<img src="#" class="media_preview_image" />
|
64
|
-
<div class="media_preview_title">Some video</div>
|
65
|
-
<div class="media_preview_detail">some detail</div>
|
66
|
-
</div>
|
67
|
-
|
68
|
-
<div class="media_preview video">
|
69
|
-
<img src="#" class="media_preview_image" />
|
70
|
-
<div class="media_preview_title">Some video</div>
|
71
|
-
<div class="media_preview_detail">some detail</div>
|
72
|
-
</div>
|
73
|
-
|
74
|
-
<div class="media_preview video">
|
75
|
-
<img src="#" class="media_preview_image" />
|
76
|
-
<div class="media_preview_title">Some video</div>
|
77
|
-
<div class="media_preview_detail">some detail</div>
|
78
|
-
</div>
|
79
|
-
|
80
|
-
<div class="media_preview audio">
|
81
|
-
<img src="#" class="media_preview_image" />
|
82
|
-
<div class="media_preview_title">Some audio</div>
|
83
|
-
<div class="media_preview_detail">some detail</div>
|
84
|
-
</div>
|
85
|
-
|
86
|
-
<div class="media_preview audio">
|
87
|
-
<img src="#" class="media_preview_image" />
|
88
|
-
<div class="media_preview_title">Some audio</div>
|
89
|
-
<div class="media_preview_detail">some detail</div>
|
90
|
-
</div>
|
91
|
-
|
92
|
-
<div class="media_preview audio">
|
93
|
-
<img src="#" class="media_preview_image" />
|
94
|
-
<div class="media_preview_title">Some audio</div>
|
95
|
-
<div class="media_preview_detail">some detail</div>
|
96
|
-
</div>
|
97
|
-
</div>
|
98
|
-
|
99
|
-
<% content_for :headers do %>
|
100
|
-
<%= stylesheet_link_tag "documents" %>
|
101
|
-
<% end %>
|
102
|
-
|
103
|
-
<script>
|
104
|
-
$('#media_wall div.media_preview').hide();
|
105
|
-
$('#media_wall div.conference').show();
|
106
|
-
|
107
|
-
$('#media_wall_buttons a').click(function(e){
|
108
|
-
$('#media_wall div.media_preview').hide("fast");
|
109
|
-
// $('#media_wall div.'+$(this).children('img').attr('media')).show("slow");
|
110
|
-
});
|
111
|
-
</script>
|