social_stream-documents 0.13.2 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/documents_controller.rb +1 -1
- data/app/models/audio.rb +2 -5
- data/app/models/document.rb +5 -8
- data/app/models/picture.rb +2 -5
- data/app/models/video.rb +6 -8
- data/app/views/audios/_audio_processing.html.erb +3 -1
- data/app/views/documents/_document.html.erb +12 -3
- data/app/views/pictures/_picture.html.erb +2 -2
- data/app/views/videos/_video_processed.html.erb +2 -2
- data/app/views/videos/_video_processing.html.erb +3 -1
- data/config/locales/en.yml +2 -5
- data/config/locales/es.yml +2 -5
- data/lib/social_stream/documents/version.rb +1 -1
- data/lib/tasks/db/populate_documents.rake +1 -1
- data/social_stream-documents.gemspec +1 -1
- data/spec/factories/document.rb +2 -2
- data/spec/factories/picture.rb +2 -2
- metadata +21 -21
@@ -10,7 +10,7 @@ class DocumentsController < ApplicationController
|
|
10
10
|
|
11
11
|
def index
|
12
12
|
super do |format|
|
13
|
-
format.json { render :json => collection.map{|a| a.activity_objects.first.document
|
13
|
+
format.json { render :json => collection.map{|a| a.activity_objects.first.document} }
|
14
14
|
if params[:no_layout].present?
|
15
15
|
format.html { render :action => :index, :layout => false }
|
16
16
|
else
|
data/app/models/audio.rb
CHANGED
@@ -8,12 +8,9 @@ class Audio < Document
|
|
8
8
|
process_in_background :file
|
9
9
|
|
10
10
|
define_index do
|
11
|
-
|
11
|
+
activity_object_index
|
12
|
+
|
12
13
|
indexes file_file_name, :as => :file_name
|
13
|
-
indexes activity_object.description
|
14
|
-
indexes activity_object.tags.name, :as => :tags
|
15
|
-
|
16
|
-
has created_at
|
17
14
|
end
|
18
15
|
|
19
16
|
# Thumbnail file
|
data/app/models/document.rb
CHANGED
@@ -15,14 +15,11 @@ class Document < ActiveRecord::Base
|
|
15
15
|
end
|
16
16
|
|
17
17
|
define_index do
|
18
|
-
|
18
|
+
activity_object_index
|
19
|
+
|
19
20
|
indexes file_file_name, :as => :file_name
|
20
|
-
indexes activity_object.description
|
21
|
-
indexes activity_object.tags.name, :as => :tags
|
22
21
|
|
23
22
|
where "type IS NULL"
|
24
|
-
|
25
|
-
has created_at
|
26
23
|
end
|
27
24
|
|
28
25
|
class << self
|
@@ -70,13 +67,13 @@ class Document < ActiveRecord::Base
|
|
70
67
|
end
|
71
68
|
|
72
69
|
# JSON, generic version for most documents
|
73
|
-
def
|
74
|
-
{:id =>
|
70
|
+
def as_json(options = nil)
|
71
|
+
{:id => id,
|
75
72
|
:title => title,
|
76
73
|
:description => description,
|
77
74
|
:author => author.name,
|
78
75
|
:src => file.to_s
|
79
|
-
}
|
76
|
+
}
|
80
77
|
end
|
81
78
|
|
82
79
|
protected
|
data/app/models/picture.rb
CHANGED
@@ -10,12 +10,9 @@ class Picture < Document
|
|
10
10
|
}
|
11
11
|
|
12
12
|
define_index do
|
13
|
-
|
13
|
+
activity_object_index
|
14
|
+
|
14
15
|
indexes file_file_name, :as => :file_name
|
15
|
-
indexes activity_object.description
|
16
|
-
indexes activity_object.tags.name, :as => :tags
|
17
|
-
|
18
|
-
has created_at
|
19
16
|
end
|
20
17
|
|
21
18
|
# Thumbnail file
|
data/app/models/video.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class Video < Document
|
2
2
|
has_attached_file :file,
|
3
3
|
:url => '/:class/:id.:extension',
|
4
|
+
:default_url => 'missing_:style.png',
|
4
5
|
:path => ':rails_root/documents/:class/:id_partition/:style',
|
5
6
|
:styles => {
|
6
7
|
:webm => {:format => 'webm'},
|
@@ -15,12 +16,9 @@ class Video < Document
|
|
15
16
|
process_in_background :file
|
16
17
|
|
17
18
|
define_index do
|
18
|
-
|
19
|
+
activity_object_index
|
20
|
+
|
19
21
|
indexes file_file_name, :as => :file_name
|
20
|
-
indexes activity_object.description
|
21
|
-
indexes activity_object.tags.name, :as => :tags
|
22
|
-
|
23
|
-
has created_at
|
24
22
|
end
|
25
23
|
|
26
24
|
# Thumbnail file
|
@@ -29,8 +27,8 @@ class Video < Document
|
|
29
27
|
end
|
30
28
|
|
31
29
|
# JSON, special edition for video files
|
32
|
-
def
|
33
|
-
{:id =>
|
30
|
+
def as_json(options = nil)
|
31
|
+
{:id => id,
|
34
32
|
:title => title,
|
35
33
|
:description => description,
|
36
34
|
:author => author.name,
|
@@ -39,7 +37,7 @@ class Video < Document
|
|
39
37
|
{ :type => Mime::MP4.to_s, :src => file(:mp4).to_s },
|
40
38
|
{ :type => Mime::FLV.to_s, :src => file(:flv).to_s }
|
41
39
|
]
|
42
|
-
}
|
40
|
+
}
|
43
41
|
end
|
44
42
|
|
45
43
|
end
|
@@ -7,9 +7,18 @@
|
|
7
7
|
</div>
|
8
8
|
|
9
9
|
<div class="attachment_text">
|
10
|
-
|
11
|
-
document
|
12
|
-
|
10
|
+
<div class="title">
|
11
|
+
<%= document.title %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<%= simple_format auto_link(document.description) %>
|
15
|
+
|
16
|
+
<%= link_to t('details.msg'),
|
17
|
+
document_path(document),
|
18
|
+
:alt => t('details.msg'),
|
19
|
+
:type => document.type,
|
20
|
+
:path => document_path(document),
|
21
|
+
:class => "attachment_text_link document_link" %>
|
13
22
|
</div>
|
14
23
|
|
15
24
|
<% end %>
|
@@ -15,9 +15,9 @@
|
|
15
15
|
|
16
16
|
<%= simple_format auto_link(picture.description) %>
|
17
17
|
|
18
|
-
<%= link_to t('
|
18
|
+
<%= link_to t('details.msg'),
|
19
19
|
picture_path(picture),
|
20
|
-
:alt => t('
|
20
|
+
:alt => t('details.msg'),
|
21
21
|
:type => picture.type,
|
22
22
|
:path => document_path(picture),
|
23
23
|
:class => "attachment_text_link picture_link" %>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
<%= simple_format auto_link(video.description) %>
|
12
12
|
|
13
|
-
<%= link_to t('
|
13
|
+
<%= link_to t('details.msg'),
|
14
14
|
video,
|
15
|
-
:alt => t('
|
15
|
+
:alt => t('details.msg'),
|
16
16
|
:type => video.type,
|
17
17
|
:path => document_path(video),
|
18
18
|
:class => "attachment_text_link video_link" %>
|
data/config/locales/en.yml
CHANGED
@@ -7,7 +7,6 @@ en:
|
|
7
7
|
confirm_delete: "Delete audio?"
|
8
8
|
title: "Audios"
|
9
9
|
mine: "My audios"
|
10
|
-
msg: "Uploaded an audio:"
|
11
10
|
name: "audio"
|
12
11
|
not_mine: "Audios"
|
13
12
|
one: "an audio"
|
@@ -15,6 +14,8 @@ en:
|
|
15
14
|
title:
|
16
15
|
one: "Audio"
|
17
16
|
other: "Audios"
|
17
|
+
details:
|
18
|
+
msg: "See details..."
|
18
19
|
document:
|
19
20
|
actions:
|
20
21
|
delete: "Delete"
|
@@ -36,7 +37,6 @@ en:
|
|
36
37
|
title:
|
37
38
|
title: "Title"
|
38
39
|
mine: "My files"
|
39
|
-
msg: "Uploaded a file:"
|
40
40
|
name: "file"
|
41
41
|
not_mine: "Files"
|
42
42
|
one: "a file"
|
@@ -47,7 +47,6 @@ en:
|
|
47
47
|
picture:
|
48
48
|
confirm_delete: "Delete picture?"
|
49
49
|
mine: "My pictures"
|
50
|
-
msg: "See details..."
|
51
50
|
name: "picture"
|
52
51
|
not_mine: "Pictures"
|
53
52
|
one: "a picture"
|
@@ -65,12 +64,10 @@ en:
|
|
65
64
|
confirm_delete: "Delete resource?"
|
66
65
|
title: "Resources"
|
67
66
|
mine: "My resources"
|
68
|
-
msg: "Uploaded a resource:"
|
69
67
|
not_mine: "Resources"
|
70
68
|
video:
|
71
69
|
confirm_delete: "Delete video?"
|
72
70
|
mine: "My videos"
|
73
|
-
msg: "See details..."
|
74
71
|
name: "video"
|
75
72
|
not_mine: "Videos"
|
76
73
|
one: "a video"
|
data/config/locales/es.yml
CHANGED
@@ -6,7 +6,6 @@ es:
|
|
6
6
|
audio:
|
7
7
|
confirm_delete: "¿Borrar audios?"
|
8
8
|
mine: "Mis audios"
|
9
|
-
msg: "Subió un audio:"
|
10
9
|
name: "archivo de audio"
|
11
10
|
not_mine: "Audios"
|
12
11
|
one: "un archivo de audio"
|
@@ -14,6 +13,8 @@ es:
|
|
14
13
|
title:
|
15
14
|
one: "Audio"
|
16
15
|
other: "Audios"
|
16
|
+
details:
|
17
|
+
msg: "Ver detalles..."
|
17
18
|
document:
|
18
19
|
actions:
|
19
20
|
delete: "Borrar"
|
@@ -35,7 +36,6 @@ es:
|
|
35
36
|
title:
|
36
37
|
title: "Título"
|
37
38
|
mine: "Mis ficheros"
|
38
|
-
msg: "Subió un fichero:"
|
39
39
|
name: "fichero"
|
40
40
|
not_mine: "Ficheros"
|
41
41
|
one: "un fichero"
|
@@ -46,7 +46,6 @@ es:
|
|
46
46
|
picture:
|
47
47
|
confirm_delete: "¿Borrar imagen?"
|
48
48
|
mine: "Mis imágenes"
|
49
|
-
msg: "Ver detalles..."
|
50
49
|
name: "imagen"
|
51
50
|
not_mine: "Imágenes"
|
52
51
|
one: "una imagen"
|
@@ -64,12 +63,10 @@ es:
|
|
64
63
|
confirm_delete: "¿Borrar recursos?"
|
65
64
|
title: "Recursos"
|
66
65
|
mine: "Mis recursos"
|
67
|
-
msg: "Subió un recurso:"
|
68
66
|
not_mine: "Recursos"
|
69
67
|
video:
|
70
68
|
confirm_delete: "¿Borrar vídeo?"
|
71
69
|
mine: "Mis vídeos"
|
72
|
-
msg: "Ver detalles..."
|
73
70
|
name: "vídeo"
|
74
71
|
not_mine: "Vídeos"
|
75
72
|
one: "un vídeo"
|
@@ -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.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.20.0')
|
16
16
|
s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
|
17
17
|
s.add_runtime_dependency('paperclip','= 2.4.5')
|
18
18
|
s.add_runtime_dependency('delayed_paperclip','2.4.5.1')
|
data/spec/factories/document.rb
CHANGED
@@ -10,12 +10,12 @@ end
|
|
10
10
|
|
11
11
|
Factory.define :public_document, :parent => :document do |d|
|
12
12
|
d.owner_id { |q| q.author_id }
|
13
|
-
d.
|
13
|
+
d.relation_ids { |q| Array(Relation::Public.instance.id) }
|
14
14
|
end
|
15
15
|
|
16
16
|
Factory.define :private_document, :parent => :document do |d|
|
17
17
|
d.file { Rack::Test::UploadedFile.new(File.join(File.dirname(__FILE__), 'files', 'small.pdf'),
|
18
18
|
'application/pdf') }
|
19
19
|
d.owner_id { |q| q.author_id }
|
20
|
-
d.
|
20
|
+
d.relation_ids { |q| Actor.find(q.author_id).relation_customs.sort.first.id }
|
21
21
|
end
|
data/spec/factories/picture.rb
CHANGED
@@ -10,13 +10,13 @@ end
|
|
10
10
|
|
11
11
|
Factory.define :public_picture, :parent => :picture do |p|
|
12
12
|
p.owner_id { |q| q.author_id }
|
13
|
-
p.
|
13
|
+
p.relation_ids { |q| Array(Relation::Public.instance.id) }
|
14
14
|
end
|
15
15
|
|
16
16
|
Factory.define :private_picture, :parent => :picture do |p|
|
17
17
|
p.file { Rack::Test::UploadedFile.new(File.join(File.dirname(__FILE__), 'files', 'privado.png'),
|
18
18
|
'image/png') }
|
19
19
|
p.owner_id { |q| q.author_id }
|
20
|
-
p.
|
20
|
+
p.relation_ids { |q| Actor.find(q.author_id).relation_customs.sort.first.id }
|
21
21
|
end
|
22
22
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_stream-documents
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,22 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-04-
|
13
|
+
date: 2012-04-23 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: social_stream-base
|
17
|
-
requirement: &
|
17
|
+
requirement: &84319120 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.20.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *84319120
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: paperclip-ffmpeg
|
28
|
-
requirement: &
|
28
|
+
requirement: &84318870 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 0.7.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *84318870
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: paperclip
|
39
|
-
requirement: &
|
39
|
+
requirement: &84318640 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - =
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 2.4.5
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *84318640
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: delayed_paperclip
|
50
|
-
requirement: &
|
50
|
+
requirement: &84318410 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - =
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 2.4.5.1
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *84318410
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: sqlite3-ruby
|
61
|
-
requirement: &
|
61
|
+
requirement: &84318220 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *84318220
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec-rails
|
72
|
-
requirement: &
|
72
|
+
requirement: &84317940 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 2.6.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *84317940
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: factory_girl
|
83
|
-
requirement: &
|
83
|
+
requirement: &84317690 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 1.3.2
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *84317690
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: forgery
|
94
|
-
requirement: &
|
94
|
+
requirement: &84317460 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ~>
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: 0.4.2
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *84317460
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: capybara
|
105
|
-
requirement: &
|
105
|
+
requirement: &84317230 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
@@ -110,7 +110,7 @@ dependencies:
|
|
110
110
|
version: 0.3.9
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *84317230
|
114
114
|
description: ! 'Social Stream is a Ruby on Rails engine providing your application
|
115
115
|
with social networking features and activity streams.
|
116
116
|
|