social_stream-documents 1.1.4 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/icons/attach.png +0 -0
- data/app/assets/javascripts/{social_stream.audio.js.erb → social_stream/audio.js.erb} +7 -3
- data/app/assets/javascripts/social_stream/document.js +27 -0
- data/app/assets/javascripts/social_stream/documents.timeline.js +11 -0
- data/app/assets/javascripts/social_stream/documents.wall.js +48 -0
- data/app/assets/javascripts/{social_stream.video.js.erb → social_stream/video.js.erb} +11 -8
- data/app/assets/javascripts/social_stream-documents.js +1 -1
- data/{spec/dummy/config/navigation.rb → app/assets/stylesheets/social_stream/documents/_toolbar.css.sass} +0 -0
- data/app/assets/stylesheets/social_stream/documents/aside/_documents.css.sass +4 -0
- data/app/assets/stylesheets/social_stream/documents/aside/layout/_documents.css.sass +30 -0
- data/{spec/dummy/db/.gitkeep → app/assets/stylesheets/social_stream/documents/create/_new.css.sass} +0 -0
- data/app/assets/stylesheets/social_stream/documents/create/layout/_new.css.sass +32 -0
- data/app/assets/stylesheets/social_stream/documents/documents/_documents.css.sass +4 -0
- data/app/assets/stylesheets/social_stream/documents/documents/layout/_documents.css.sass +52 -0
- data/app/assets/stylesheets/social_stream/documents/explore/_explore-documents.css.sass +12 -0
- data/app/assets/stylesheets/social_stream/documents/explore/layout/_explore-documents.css.sass +20 -0
- data/app/assets/stylesheets/social_stream/documents/responsive/_responsive-1200px-min.css.sass +21 -0
- data/app/assets/stylesheets/social_stream/documents/responsive/_responsive-767px-max.css.sass +58 -0
- data/app/assets/stylesheets/social_stream/documents/responsive/_responsive-768px-979px.css.sass +54 -0
- data/app/assets/stylesheets/social_stream/documents/search/_header.css.sass +25 -0
- data/app/assets/stylesheets/social_stream/documents/search/layout/_header.css.sass +33 -0
- data/app/assets/stylesheets/social_stream/documents/show/_show.css.sass +72 -0
- data/app/assets/stylesheets/social_stream/documents/show/layout/_show.css.sass +112 -0
- data/app/assets/stylesheets/social_stream/documents/timeline/_audios.css.sass +21 -0
- data/app/assets/stylesheets/social_stream/documents/timeline/_wallinput.css.sass +10 -0
- data/app/assets/stylesheets/social_stream/documents/timeline/layout/_audios.css.sass +67 -0
- data/app/assets/stylesheets/social_stream/documents/timeline/layout/_wallinput.css.sass +10 -0
- data/app/assets/stylesheets/social_stream-documents.css.sass +49 -0
- data/app/controllers/documents_controller.rb +16 -5
- data/app/decorators/social_stream/base/activity_object_decorator.rb +1 -0
- data/app/helpers/documents_helper.rb +35 -18
- data/app/models/audio.rb +1 -6
- data/app/models/document.rb +23 -28
- data/app/models/picture.rb +0 -19
- data/app/models/video.rb +0 -5
- data/app/views/audios/_audio.html.erb +2 -11
- data/app/views/audios/_audio_processed.html.erb +28 -23
- data/app/views/audios/_audio_processing.html.erb +5 -5
- data/app/views/audios/_quick_search_result.html.erb +3 -0
- data/app/views/audios/_search_result.html.erb +1 -0
- data/app/views/audios/_timeline.html.erb +11 -0
- data/app/views/audios/index.html.erb +3 -1
- data/app/views/common_documents/_document.html.erb +18 -0
- data/app/views/common_documents/_filter.html.erb +1 -0
- data/app/views/common_documents/_form.html.erb +44 -0
- data/app/views/common_documents/_index.html.erb +27 -63
- data/app/views/common_documents/_info.html.erb +50 -0
- data/app/views/common_documents/_list.html.erb +2 -0
- data/app/views/common_documents/_new.modal.html.erb +13 -0
- data/app/views/common_documents/_new_button.html.erb +11 -0
- data/app/views/common_documents/_quick_search_result.html.erb +19 -0
- data/app/views/common_documents/_show.html.erb +76 -27
- data/app/views/documents/_document.html.erb +2 -26
- data/app/views/documents/_document_show.html.erb +2 -4
- data/app/views/documents/_new_activity.html.erb +3 -1
- data/app/views/documents/_quick_search_result.html.erb +3 -0
- data/app/views/documents/_search_result.html.erb +1 -0
- data/app/views/documents/_timeline.html.erb +15 -0
- data/app/views/documents/index.html.erb +7 -1
- data/app/views/documents/new.html.erb +9 -0
- data/app/views/documents/search.html.erb +1 -1
- data/app/views/pictures/_picture.html.erb +2 -41
- data/app/views/pictures/_picture_show.html.erb +1 -16
- data/app/views/pictures/_quick_search_result.html.erb +3 -0
- data/app/views/pictures/_search_result.html.erb +1 -0
- data/app/views/pictures/_timeline.html.erb +17 -0
- data/app/views/pictures/index.html.erb +3 -1
- data/app/views/videos/_quick_search_result.html.erb +3 -0
- data/app/views/videos/_search_result.html.erb +1 -0
- data/app/views/videos/_timeline.html.erb +9 -0
- data/app/views/videos/_video.html.erb +2 -11
- data/app/views/videos/_video_processed.html.erb +11 -15
- data/app/views/videos/_video_processing.html.erb +6 -5
- data/app/views/videos/_video_show.html.erb +1 -1
- data/app/views/videos/index.html.erb +3 -1
- data/config/locales/en.yml +25 -12
- data/config/locales/es.yml +23 -12
- data/lib/generators/social_stream/documents/install_generator.rb +2 -3
- data/lib/generators/social_stream/documents/templates/initializer.rb +37 -9
- data/lib/social_stream/documents/dependencies.rb +1 -0
- data/lib/social_stream/documents/engine.rb +5 -14
- data/lib/social_stream/documents/models/activity_object.rb +18 -0
- data/lib/social_stream/documents/version.rb +1 -1
- data/lib/social_stream-documents.rb +56 -13
- data/lib/tasks/db/populate.rake +21 -0
- data/social_stream-documents.gemspec +4 -1
- data/spec/controllers/documents_controller_spec.rb +15 -9
- data/spec/controllers/pictures_controller_spec.rb +8 -8
- data/spec/socialstream_documents_spec.rb +6 -0
- data/vendor/assets/stylesheets/jplayer.blue.monday.css +2 -1
- metadata +71 -74
- data/app/assets/javascripts/social_stream.repository.js.erb +0 -27
- data/app/assets/stylesheets/documents.css.scss +0 -302
- data/app/assets/stylesheets/show.css.scss +0 -111
- data/app/assets/stylesheets/social_stream-documents.css +0 -6
- data/app/views/audios/_audio_focus_search.html.erb +0 -3
- data/app/views/audios/_audio_global_search.html.erb +0 -3
- data/app/views/audios/_audio_with_details.html.erb +0 -3
- data/app/views/common_documents/_document_info.html.erb +0 -48
- data/app/views/common_documents/_edit_form.html.erb +0 -57
- data/app/views/common_documents/_headers.html.erb +0 -77
- data/app/views/documents/_document_focus_search.html.erb +0 -2
- data/app/views/documents/_document_global_search.html.erb +0 -2
- data/app/views/documents/_document_with_details.html.erb +0 -13
- data/app/views/documents/_new_activity_fields.html.erb +0 -15
- data/app/views/pictures/_picture_focus_search.html.erb +0 -2
- data/app/views/pictures/_picture_global_search.html.erb +0 -2
- data/app/views/pictures/_picture_with_details.html.erb +0 -2
- data/app/views/videos/_video_focus_search.html.erb +0 -2
- data/app/views/videos/_video_global_search.html.erb +0 -2
- data/app/views/videos/_video_with_details.html.erb +0 -2
- data/config/locales/de.yml +0 -78
- data/config/locales/fr.yml +0 -78
- data/config/locales/hu.yml +0 -77
- data/config/locales/nl.yml +0 -78
- data/lib/social_stream/views/toolbar/documents.rb +0 -28
- data/lib/tasks/db/populate_documents.rake +0 -19
- data/spec/dummy/.gitignore +0 -1
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/javascripts/application.js +0 -9
- data/spec/dummy/app/assets/stylesheets/application.css +0 -7
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/config/application.rb +0 -45
- data/spec/dummy/config/boot.rb +0 -10
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -30
- data/spec/dummy/config/environments/production.rb +0 -60
- data/spec/dummy/config/environments/test.rb +0 -39
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/devise.rb +0 -176
- data/spec/dummy/config/initializers/inflections.rb +0 -10
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/relations.yml +0 -39
- data/spec/dummy/config/routes.rb +0 -60
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/schema.rb +0 -6
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -26
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/application.js +0 -2
- data/spec/dummy/public/javascripts/controls.js +0 -965
- data/spec/dummy/public/javascripts/dragdrop.js +0 -974
- data/spec/dummy/public/javascripts/effects.js +0 -1123
- data/spec/dummy/public/javascripts/prototype.js +0 -6001
- data/spec/dummy/public/javascripts/rails.js +0 -191
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +0 -6
@@ -0,0 +1,112 @@
|
|
1
|
+
.picture,
|
2
|
+
.audio,
|
3
|
+
.video,
|
4
|
+
.documents
|
5
|
+
.central
|
6
|
+
@include grid-core-span(7, $fluidGridColumnWidth, $fluidGridGutterWidth)
|
7
|
+
float: left
|
8
|
+
margin-left: 30px
|
9
|
+
padding-bottom: 40px
|
10
|
+
.show
|
11
|
+
padding: 10px
|
12
|
+
|
13
|
+
.actions
|
14
|
+
width: 11%
|
15
|
+
margin: 10px auto -7px
|
16
|
+
|
17
|
+
.tabbable
|
18
|
+
margin-top: 10px
|
19
|
+
.nav
|
20
|
+
margin-bottom: 0
|
21
|
+
.tab-content
|
22
|
+
.media
|
23
|
+
padding: 16px 0 9px 0
|
24
|
+
margin-top: 0
|
25
|
+
&:first-child
|
26
|
+
padding-top: 10px
|
27
|
+
.actions
|
28
|
+
width: 100%
|
29
|
+
display: inline-block
|
30
|
+
margin-bottom: 10px
|
31
|
+
.post_time_ago
|
32
|
+
display: inline-block
|
33
|
+
font-size: 11px
|
34
|
+
.to_comment,
|
35
|
+
.to_like
|
36
|
+
display: inline-block
|
37
|
+
font-size: 12px
|
38
|
+
margin-left: 5px
|
39
|
+
.audience
|
40
|
+
display: inline-block
|
41
|
+
font-size: 12px
|
42
|
+
margin-left: 7px
|
43
|
+
.tooltip
|
44
|
+
width: 28%
|
45
|
+
margin-top: 26px 0px 0px 53px
|
46
|
+
.audience_logo
|
47
|
+
display: inline-block
|
48
|
+
width: auto
|
49
|
+
padding: 4px
|
50
|
+
|
51
|
+
.details
|
52
|
+
@extend .hidden-phone
|
53
|
+
width: 21.8%
|
54
|
+
float: left
|
55
|
+
margin-left: 30px
|
56
|
+
h4
|
57
|
+
margin-bottom: 5px
|
58
|
+
.tabbable
|
59
|
+
ul
|
60
|
+
margin-bottom: 0px
|
61
|
+
|
62
|
+
.tab-content
|
63
|
+
padding-bottom: 20px
|
64
|
+
padding-top: 10px
|
65
|
+
|
66
|
+
|
67
|
+
#document-info
|
68
|
+
.counters
|
69
|
+
margin-left: 10px
|
70
|
+
.counter
|
71
|
+
display: inline
|
72
|
+
.description,
|
73
|
+
.tags,
|
74
|
+
.autor,
|
75
|
+
.dates
|
76
|
+
margin-left: 10px
|
77
|
+
|
78
|
+
|
79
|
+
#picture_description
|
80
|
+
height: 200px
|
81
|
+
|
82
|
+
#document-edit
|
83
|
+
margin-left: 8px
|
84
|
+
.fcbk
|
85
|
+
margin-bottom: 20px
|
86
|
+
input
|
87
|
+
&[type="submit"]
|
88
|
+
float: right
|
89
|
+
|
90
|
+
|
91
|
+
#comments
|
92
|
+
div.new_comment
|
93
|
+
margin-top: 10px
|
94
|
+
min-height: 100px
|
95
|
+
height: auto
|
96
|
+
width: 90%
|
97
|
+
float: right
|
98
|
+
.avatar
|
99
|
+
float: right
|
100
|
+
width: 11%
|
101
|
+
form.new_comment
|
102
|
+
float: right
|
103
|
+
margin-right: 4px
|
104
|
+
min-height: 80px
|
105
|
+
display: inline-block
|
106
|
+
width: 83.8%
|
107
|
+
margin-top: 3px
|
108
|
+
input
|
109
|
+
&[type="submit"]
|
110
|
+
float: right
|
111
|
+
display: inline-block !important
|
112
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
@import "jplayer.blue.monday"
|
2
|
+
|
3
|
+
|
4
|
+
#jp_interface_audio_290
|
5
|
+
border: none
|
6
|
+
|
7
|
+
div.jp-progress
|
8
|
+
div.jp-seek-bar
|
9
|
+
background: none
|
10
|
+
|
11
|
+
div.jp-play-bar
|
12
|
+
background: none black
|
13
|
+
|
14
|
+
|
15
|
+
.jp-interface
|
16
|
+
border: none !important
|
17
|
+
|
18
|
+
|
19
|
+
div.jp-playlist
|
20
|
+
border: none
|
21
|
+
|
@@ -0,0 +1,67 @@
|
|
1
|
+
@import "jplayer.blue.monday"
|
2
|
+
|
3
|
+
div.jp-audio
|
4
|
+
width: 100%
|
5
|
+
div.jp-type-single,
|
6
|
+
div.jp-progress
|
7
|
+
top: 2px !important
|
8
|
+
left: 8px !important
|
9
|
+
width: 97% !important
|
10
|
+
height: 60% !important
|
11
|
+
|
12
|
+
|
13
|
+
#jp_interface_audio_290
|
14
|
+
height: 118px
|
15
|
+
|
16
|
+
div.jp-progress
|
17
|
+
@include size (100%, 75px)
|
18
|
+
@include centered
|
19
|
+
|
20
|
+
div.jp-seek-bar
|
21
|
+
width: 100%
|
22
|
+
.waveform
|
23
|
+
float: left
|
24
|
+
|
25
|
+
.jp-interface
|
26
|
+
height: 125px !important
|
27
|
+
|
28
|
+
|
29
|
+
a.jp-play,
|
30
|
+
a.jp-pause
|
31
|
+
left: 4px !important
|
32
|
+
|
33
|
+
|
34
|
+
a.jp-play,
|
35
|
+
a.jp-pause,
|
36
|
+
a.jp-mute,
|
37
|
+
a.jp-unmute,
|
38
|
+
top: 80px !important
|
39
|
+
left: -2px !important
|
40
|
+
|
41
|
+
a.jp-mute,
|
42
|
+
a.jp-unmute,
|
43
|
+
top: 93px !important
|
44
|
+
left: 45px !important
|
45
|
+
|
46
|
+
.jp-volume-bar
|
47
|
+
top: 98px !important
|
48
|
+
left: 45px !important
|
49
|
+
|
50
|
+
|
51
|
+
div.jp-duration,
|
52
|
+
div.jp-current-time,
|
53
|
+
top: 89px !important
|
54
|
+
left: 137px !important
|
55
|
+
width: 100px !important
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
div.jp-audio
|
60
|
+
div.jp-type-single
|
61
|
+
div.jp-volume-bar
|
62
|
+
top: 93px !important
|
63
|
+
left: 72px !important
|
64
|
+
|
65
|
+
|
66
|
+
div.jp-playlist
|
67
|
+
margin-bottom: 10px
|
@@ -0,0 +1,49 @@
|
|
1
|
+
@import "social_stream/documents/responsive/responsive-1200px-min"
|
2
|
+
@import "social_stream/documents/responsive/responsive-768px-979px"
|
3
|
+
@import "social_stream/documents/responsive/responsive-767px-max"
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
@import "social_stream/documents/show/show"
|
9
|
+
|
10
|
+
@import "social_stream/documents/show/layout/show"
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
@import "social_stream/documents/create/new"
|
16
|
+
|
17
|
+
@import "social_stream/documents/create/layout/new"
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
@import "social_stream/documents/explore/explore-documents"
|
23
|
+
|
24
|
+
@import "social_stream/documents/explore/layout/explore-documents"
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
@import "social_stream/documents/search/header"
|
30
|
+
|
31
|
+
@import "social_stream/documents/search/layout/header"
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
@import "social_stream/documents/documents/documents"
|
37
|
+
|
38
|
+
@import "social_stream/documents/documents/layout/documents"
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
@import "social_stream/documents/timeline/wallinput"
|
44
|
+
|
45
|
+
@import "social_stream/documents/timeline/layout/wallinput"
|
46
|
+
|
47
|
+
@import "social_stream/documents/timeline/audios"
|
48
|
+
|
49
|
+
@import "social_stream/documents/timeline/layout/audios"
|
@@ -8,9 +8,7 @@ class DocumentsController < ApplicationController
|
|
8
8
|
format.html {
|
9
9
|
collection
|
10
10
|
|
11
|
-
if
|
12
|
-
render :layout => false
|
13
|
-
end
|
11
|
+
render collection if request.xhr?
|
14
12
|
}
|
15
13
|
|
16
14
|
format.json { render :json => collection }
|
@@ -21,7 +19,20 @@ class DocumentsController < ApplicationController
|
|
21
19
|
super do |format|
|
22
20
|
format.json { render :json => resource }
|
23
21
|
format.js
|
24
|
-
format.all {
|
22
|
+
format.all {
|
23
|
+
if resource.new_record?
|
24
|
+
render action: :new
|
25
|
+
else
|
26
|
+
redirect =
|
27
|
+
( request.referer.present? ?
|
28
|
+
( request.referer =~ /new$/ ?
|
29
|
+
resource :
|
30
|
+
request.referer ) :
|
31
|
+
home_path )
|
32
|
+
|
33
|
+
redirect_to redirect
|
34
|
+
end
|
35
|
+
}
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
@@ -66,7 +77,7 @@ class DocumentsController < ApplicationController
|
|
66
77
|
private
|
67
78
|
|
68
79
|
def allowed_params
|
69
|
-
[:file]
|
80
|
+
[ :file ]
|
70
81
|
end
|
71
82
|
|
72
83
|
class << self
|
@@ -0,0 +1 @@
|
|
1
|
+
ActivityObject.send :include, SocialStream::Documents::Models::ActivityObject
|
@@ -1,30 +1,47 @@
|
|
1
1
|
module DocumentsHelper
|
2
|
-
|
3
|
-
FORMATS = ["msword","vnd.ms-powerpoint","msexcel","rar","zip","mp3","plain","pdf"]
|
4
|
-
|
5
|
-
|
6
2
|
#size can be any of the names that the document has size for
|
7
3
|
def thumb_for(document, size)
|
8
|
-
image_tag document
|
4
|
+
image_tag thumb_file_for(document, size)
|
9
5
|
end
|
10
|
-
|
6
|
+
|
11
7
|
def thumb_file_for(document, size)
|
12
|
-
document.
|
8
|
+
style = document.class.attachment_definitions[:file][:styles]
|
9
|
+
|
10
|
+
format = style.respond_to?('[]') && style[:format] || document.format
|
11
|
+
|
12
|
+
if style
|
13
|
+
polymorphic_path document, format: format, style: size
|
14
|
+
else
|
15
|
+
icon document, size
|
16
|
+
end
|
13
17
|
end
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
|
19
|
+
# Return the right icon based on {#document}'s mime type
|
20
|
+
def icon document, size = 50
|
21
|
+
"<i class=\"icon_file_#{ size }-#{ icon_mime_type document }\"></i>".html_safe
|
18
22
|
end
|
19
|
-
|
20
|
-
def link_for_wall(document)
|
21
|
-
format = Mime::Type.lookup(document.file_content_type)
|
22
23
|
|
23
|
-
|
24
|
+
# Find the right class for the icon of this document, based on its format
|
25
|
+
def icon_mime_type document
|
26
|
+
if SocialStream::Documents.icon_mime_types[:subtypes].include?(document.format)
|
27
|
+
document.format
|
28
|
+
elsif SocialStream::Documents.icon_mime_types[:types].include?(document.mime_type_type_sym)
|
29
|
+
document.mime_type_type_sym
|
30
|
+
else
|
31
|
+
SocialStream::Documents.icon_mime_types[:default]
|
32
|
+
end
|
24
33
|
end
|
25
34
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
35
|
+
def document_details_tab_class(document, tab)
|
36
|
+
editing = document && document.errors.present?
|
37
|
+
|
38
|
+
case tab
|
39
|
+
when :edit
|
40
|
+
editing ? 'active' : ''
|
41
|
+
when :info
|
42
|
+
editing ? '' : 'active'
|
43
|
+
else
|
44
|
+
''
|
45
|
+
end
|
29
46
|
end
|
30
47
|
end
|
data/app/models/audio.rb
CHANGED
@@ -3,7 +3,7 @@ class Audio < Document
|
|
3
3
|
:url => '/:class/:id.:content_type_extension',
|
4
4
|
:path => ':rails_root/documents/:class/:id_partition/:style',
|
5
5
|
:styles => SocialStream::Documents.audio_styles,
|
6
|
-
:processors => [ :ffmpeg ]
|
6
|
+
:processors => [ :ffmpeg, :waveform ]
|
7
7
|
|
8
8
|
process_in_background :file
|
9
9
|
|
@@ -13,9 +13,4 @@ class Audio < Document
|
|
13
13
|
indexes file_file_name, :as => :file_name
|
14
14
|
end
|
15
15
|
|
16
|
-
# Thumbnail file
|
17
|
-
def thumb(size, helper)
|
18
|
-
"#{ size.to_s }/audio.png"
|
19
|
-
end
|
20
|
-
|
21
16
|
end
|
data/app/models/document.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
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
|
-
|
6
4
|
has_attached_file :file,
|
7
5
|
:url => '/:class/:id.:content_type_extension',
|
8
6
|
:path => ':rails_root/documents/:class/:id_partition/:style/:filename.:extension'
|
@@ -24,46 +22,43 @@ class Document < ActiveRecord::Base
|
|
24
22
|
|
25
23
|
class << self
|
26
24
|
def new(*args)
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
# If already called from subtype, continue through the stack
|
26
|
+
return super if self.name != "Document"
|
27
|
+
|
30
28
|
doc = super
|
31
29
|
|
32
|
-
if
|
33
|
-
return doc
|
34
|
-
end
|
35
|
-
|
36
|
-
if !(doc.file_content_type =~ /^image.*/).nil?
|
37
|
-
return Picture.new *args
|
38
|
-
end
|
30
|
+
return doc if doc.file_content_type.blank?
|
39
31
|
|
40
|
-
if
|
41
|
-
return
|
32
|
+
if klass = lookup_subtype_class(doc)
|
33
|
+
return klass.new *args
|
42
34
|
end
|
43
|
-
|
44
|
-
|
45
|
-
|
35
|
+
|
36
|
+
doc
|
37
|
+
end
|
38
|
+
|
39
|
+
# Searches for the suitable class based on its mime type
|
40
|
+
def lookup_subtype_class(doc)
|
41
|
+
SocialStream::Documents.subtype_classes_mime_types.each_pair do |klass, mime_types|
|
42
|
+
return klass.to_s.classify.constantize if mime_types.include?(doc.mime_type.to_sym)
|
46
43
|
end
|
47
|
-
|
48
|
-
|
44
|
+
|
45
|
+
nil
|
49
46
|
end
|
50
47
|
end
|
51
48
|
|
49
|
+
# The Mime::Type of this document's file
|
52
50
|
def mime_type
|
53
51
|
Mime::Type.lookup(file_content_type)
|
54
52
|
end
|
55
53
|
|
56
|
-
|
57
|
-
|
54
|
+
# The type part of the {#mime_type}
|
55
|
+
def mime_type_type_sym
|
56
|
+
mime_type.to_s.split('/').first.to_sym
|
58
57
|
end
|
59
58
|
|
60
|
-
#
|
61
|
-
def
|
62
|
-
|
63
|
-
"#{ size.to_s }/#{ format }.png"
|
64
|
-
else
|
65
|
-
"#{ size.to_s }/default.png"
|
66
|
-
end
|
59
|
+
# {#mime_type}'s symbol
|
60
|
+
def format
|
61
|
+
mime_type.to_sym
|
67
62
|
end
|
68
63
|
|
69
64
|
# JSON, generic version for most documents
|
data/app/models/picture.rb
CHANGED
@@ -9,23 +9,4 @@ class Picture < Document
|
|
9
9
|
|
10
10
|
indexes file_file_name, :as => :file_name
|
11
11
|
end
|
12
|
-
|
13
|
-
# Thumbnail file
|
14
|
-
def thumb(size, helper)
|
15
|
-
case size
|
16
|
-
when 16
|
17
|
-
"#{ size.to_s }/photo.png"
|
18
|
-
when 48
|
19
|
-
helper.picture_path self, :format => format, :style => 'thumb48sq'
|
20
|
-
when 80
|
21
|
-
helper.picture_path self, :format => format, :style => 'midwall'
|
22
|
-
when 130
|
23
|
-
helper.picture_path self, :format => format, :style => 'thumbwall'
|
24
|
-
when 500
|
25
|
-
helper.picture_path self, :format => format, :style => 'preview'
|
26
|
-
when 1000
|
27
|
-
helper.picture_path self, :format => format, :style => 'original'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
12
|
end
|
data/app/models/video.rb
CHANGED
@@ -1,11 +1,2 @@
|
|
1
|
-
<%=
|
2
|
-
|
3
|
-
<% if audio.file_processing %>
|
4
|
-
<%= render :partial => 'audios/audio_processing', :locals => {:audio => audio}%>
|
5
|
-
<% else %>
|
6
|
-
<%= render :partial => 'audios/audio_processed', :locals => {:audio => audio}%>
|
7
|
-
<% end %>
|
8
|
-
|
9
|
-
<% end %>
|
10
|
-
|
11
|
-
<div class="clearfloat"></div>
|
1
|
+
<%= render partial: 'common_documents/document',
|
2
|
+
object: audio %>
|
@@ -1,39 +1,44 @@
|
|
1
|
-
<div class="
|
1
|
+
<div class="format-links">
|
2
2
|
<%= link_to "WebMA", audio_path(audio, :format => :webma), :class => "audio-webma" %>
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<div id="full_audio_<%= dom_id audio %>" class="audio-full jp-audio">
|
6
|
-
<div id="jpId<%= dom_id audio %>" class="jpId_size0 jp-jplayer"
|
6
|
+
<div id="jpId<%= dom_id audio %>" class="jpId_size0 jp-jplayer">
|
7
|
+
</div>
|
7
8
|
<div class="jp-audio">
|
8
9
|
<div class="jp-type-single">
|
9
10
|
<div id="jp_interface_<%= dom_id audio %>" class="jp-interface">
|
10
|
-
<ul class="jp-controls">
|
11
|
-
<li>
|
12
|
-
<a href="#" class="jp-play" tabindex="1">play</a>
|
13
|
-
</li>
|
14
|
-
<li>
|
15
|
-
<a href="#" class="jp-pause" tabindex="1">pause</a>
|
16
|
-
</li>
|
17
|
-
<li>
|
18
|
-
<a href="#" class="jp-stop" tabindex="1">stop</a>
|
19
|
-
</li>
|
20
|
-
<li>
|
21
|
-
<a href="#" class="jp-mute" tabindex="1">mute</a>
|
22
|
-
</li>
|
23
|
-
<li>
|
24
|
-
<a href="#" class="jp-unmute" tabindex="1">unmute</a>
|
25
|
-
</li>
|
26
|
-
</ul>
|
27
11
|
<div class="jp-progress">
|
28
12
|
<div class="jp-seek-bar">
|
13
|
+
<%= image_tag document_path(audio, format: :png, style: :waveform), class: 'waveform' %>
|
29
14
|
<div class="jp-play-bar"></div>
|
30
15
|
</div>
|
31
16
|
</div>
|
32
|
-
<div class="jp-
|
33
|
-
<div class="jp-
|
17
|
+
<div class="jp-down">
|
18
|
+
<div class="jp-current-time"></div>
|
19
|
+
|
20
|
+
<ul class="jp-controls">
|
21
|
+
<li>
|
22
|
+
<a href="#" class="jp-play" tabindex="1">play</a>
|
23
|
+
</li>
|
24
|
+
<li>
|
25
|
+
<a href="#" class="jp-pause" tabindex="1">pause</a>
|
26
|
+
</li>
|
27
|
+
<li>
|
28
|
+
<a href="#" class="jp-mute" tabindex="1">mute</a>
|
29
|
+
</li>
|
30
|
+
<li>
|
31
|
+
<a href="#" class="jp-unmute" tabindex="1">unmute</a>
|
32
|
+
</li>
|
33
|
+
</ul>
|
34
|
+
|
35
|
+
<div class="jp-volume-bar">
|
36
|
+
<div class="jp-volume-bar-value"></div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="jp-duration">
|
40
|
+
</div>
|
34
41
|
</div>
|
35
|
-
<div class="jp-current-time"></div>
|
36
|
-
<div class="jp-duration"></div>
|
37
42
|
</div>
|
38
43
|
<div id="jp_playlist_<%= dom_id audio %>" class="jp-playlist"></div>
|
39
44
|
</div>
|
@@ -1,9 +1,9 @@
|
|
1
|
-
<div class="
|
2
|
-
<%=
|
1
|
+
<div class="thumb">
|
2
|
+
<%= icon audio, 70 %>
|
3
3
|
</div>
|
4
|
-
<div class="
|
5
|
-
<
|
4
|
+
<div class="text">
|
5
|
+
<h6>
|
6
6
|
<%= audio.title %>
|
7
|
-
</
|
7
|
+
</h6>
|
8
8
|
<div class="processing_text"><%= t('audio.processing')%></div>
|
9
9
|
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render audio %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= div_for audio do %>
|
2
|
+
|
3
|
+
<% if audio.file_processing %>
|
4
|
+
<%= render :partial => 'audios/audio_processing', :locals => {:audio => audio}%>
|
5
|
+
<% else %>
|
6
|
+
<%= render :partial => 'audios/audio_processed', :locals => {:audio => audio}%>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<div class="clearfloat"></div>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= div_for document do %>
|
2
|
+
<div class="thumb">
|
3
|
+
<%= link_to icon(document, 50), document, :title => document.file_file_name %>
|
4
|
+
</div>
|
5
|
+
<div class="brifing">
|
6
|
+
<h5>
|
7
|
+
<%= link_to truncate(document.title, :length => 15), document %>
|
8
|
+
</h5>
|
9
|
+
|
10
|
+
<div class="author">
|
11
|
+
<%= raw t('document.by', author: link_to(document.author.name, document.author_subject)) %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<%= render partial: 'objects/counters', locals: { object: document } %>
|
15
|
+
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= text_field_tag :q, nil,:autocomplete => :off, :placeholder => t('document.filter') %>
|