social_stream-documents 0.2.0 → 0.2.3

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.
data/.gitignore CHANGED
@@ -11,3 +11,4 @@ Gemfile.lock
11
11
  .idea/social_stream-documents.iml
12
12
  app/views/*/.tmp_*
13
13
  **.*swp
14
+ .idea
data/Gemfile CHANGED
@@ -1,5 +1,9 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'social_stream-base', :path => '../social_stream-base'
3
+ if File.exists?(File.join(File.dirname(__FILE__), '..', 'social_stream-base'))
4
+ gem 'social_stream-base', :path => '../social_stream-base'
5
+ else
6
+ gem 'social_stream-base', :git => 'https://github.com/ging/social_stream-base.git'
7
+ end
4
8
 
5
9
  gemspec
@@ -183,3 +183,8 @@
183
183
  height:135px;
184
184
  }
185
185
 
186
+ /* needed to hide the flash element when used */
187
+ .jpId_size0{
188
+ width: 0px;
189
+ height: 0px;
190
+ }
@@ -1,7 +1,7 @@
1
1
  class CommonDocumentsController < InheritedResources::Base
2
2
  belongs_to_subjects :optional => true
3
3
 
4
- before_filter :subject!, :only => :index
4
+ before_filter :profile_subject!, :only => :index
5
5
 
6
6
  load_and_authorize_resource :except => :index
7
7
 
@@ -26,20 +26,12 @@ class CommonDocumentsController < InheritedResources::Base
26
26
 
27
27
  private
28
28
 
29
- def subject
30
- @subject ||= association_chain[-1] || current_subject
31
- end
32
-
33
- def subject!
34
- @subject ||= association_chain[-1] || warden.authenticate!(:user)
35
- end
36
-
37
29
  def collection
38
- @activities = subject.wall(:profile,
39
- :for => current_subject,
40
- :object_type => Array(self.class.index_object_type)).
41
- page(params[:page]).
42
- per(params[:per])
30
+ @activities = profile_subject.wall(:profile,
31
+ :for => current_subject,
32
+ :object_type => Array(self.class.index_object_type)).
33
+ page(params[:page]).
34
+ per(params[:per])
43
35
  end
44
36
 
45
37
  class << self
@@ -1,14 +1,16 @@
1
1
  class VideosController < CommonDocumentsController
2
2
  respond_to :html,:js
3
3
 
4
+
5
+
4
6
  def show
5
7
  path = @video.file.path(params[:style])
6
- if(params[:style].present?)
7
- path = path.split('.')[0]+'.'+params[:style]
8
+ if(params[:style].present?) && Document::STYLE_FORMAT[params[:style]]
9
+ path = path.split('.')[0]+'.'+Document::STYLE_FORMAT[params[:style]]
8
10
  end
9
11
  respond_to do |format|
10
12
  format.all {send_file path,
11
- :type => @video.file_content_type,
13
+ :type => params[:style]=="thumb" ? "image/png" : @video.file_content_type,
12
14
  :disposition => "inline"}
13
15
  end
14
16
  end
data/app/models/audio.rb CHANGED
@@ -2,10 +2,6 @@ class Audio < Document
2
2
 
3
3
  # Thumbnail file
4
4
  def thumb(size, helper)
5
- if format && IMAGE_FORMATS.include?(format.to_s)
6
5
  "#{ size.to_s }/audio.png"
7
- else
8
- "#{ size.to_s }/audio.png"
9
- end
10
6
  end
11
7
  end
@@ -3,6 +3,8 @@ class Document < ActiveRecord::Base
3
3
 
4
4
  IMAGE_FORMATS = ["doc","ppt","xls","rar","zip","mpeg","plain","pdf"]
5
5
 
6
+ STYLE_FORMAT = {"webm" =>"webm", "flv"=>"flv", "thumb"=>"png", "thumb0"=>"png"}
7
+
6
8
  has_attached_file :file,
7
9
  :url => '/:class/:id.:extension',
8
10
  :path => ':rails_root/documents/:class/:id_partition/:style.:extension'
data/app/models/video.rb CHANGED
@@ -17,10 +17,7 @@ class Video < Document
17
17
 
18
18
  # Thumbnail file
19
19
  def thumb(size, helper)
20
- if format && IMAGE_FORMATS.include?(format.to_s)
21
20
  "#{ size.to_s }/video.png"
22
- else
23
- "#{ size.to_s }/video.png"
24
- end
25
21
  end
22
+
26
23
  end
@@ -26,7 +26,7 @@
26
26
  {:controller => "documents", :action => "download", :id => audio},
27
27
  :class => "attachment_text_link" %>
28
28
  </div>
29
- <div id="jpId<%=audio.id%>"></div>
29
+ <div id="jpId<%=audio.id%>" class="jpId_size0"></div>
30
30
 
31
31
  <div class="jp-audio">
32
32
  <div class="jp-type-single">
@@ -1 +1 @@
1
- <%=render(:partial => 'common/index') %>
1
+ <%=render(:partial => 'common-documents/index') %>
@@ -1,27 +1,27 @@
1
1
  <% content_for :title do %>
2
- <%= @subject.name %>
2
+ <%= profile_subject.name %>
3
3
  <% end %>
4
4
 
5
5
  <% content_for :sidebar do %>
6
6
  <%= render :partial => 'home/sidebar' %>
7
7
  <% end %>
8
8
 
9
- <%if @subject == current_subject%>
9
+ <%if profile_subject_is_current?%>
10
10
  <%= location(
11
11
  link_to(image_tag(("btn/btn_#{controller.controller_name.singularize}.png"), :class => "menu_icon")+t(controller.controller_name.singularize + '.title'), polymorphic_path(controller.controller_name),:remote => true)
12
12
  ) %>
13
13
  <% toolbar %>
14
14
  <%else%>
15
15
  <%= location(
16
- link_to(image_tag("btn/btn_profile.png", :class => "menu_icon")+ @subject.name, polymorphic_path(@subject),:remote => true),
17
- link_to(image_tag(("btn/btn_#{controller.controller_name.singularize}.png"), :class => "menu_icon")+t(controller.controller_name.singularize + '.title'), polymorphic_path([@subject, controller.controller_name]),:remote => true)
16
+ link_to(image_tag("btn/btn_profile.png", :class => "menu_icon")+ profile_subject.name, polymorphic_path(profile_subject),:remote => true),
17
+ link_to(image_tag(("btn/btn_#{controller.controller_name.singularize}.png"), :class => "menu_icon")+t(controller.controller_name.singularize + '.title'), polymorphic_path([profile_subject, controller.controller_name]),:remote => true)
18
18
  ) %>
19
- <% toolbar :profile => @subject %>
19
+ <% toolbar :profile => profile_subject %>
20
20
  <%end%>
21
21
 
22
22
 
23
23
  <div class="attachment_section_header">
24
- <h3><%= @subject == current_subject ? t(controller.controller_name.singularize + '.mine') : t(controller.controller_name.singularize + '.not_mine') %></h3>
24
+ <h3><%= profile_subject_is_current? ? t(controller.controller_name.singularize + '.mine') : t(controller.controller_name.singularize + '.not_mine') %></h3>
25
25
  </div>
26
26
  <% @activities.each do |a| %>
27
27
  <% document = a.activity_objects.first.document %>
@@ -1 +1 @@
1
- <%=render(:partial => 'common/index') %>
1
+ <%=render(:partial => 'common-documents/index') %>
@@ -1 +1 @@
1
- <%=render(:partial => 'common/index') %>
1
+ <%=render(:partial => 'common-documents/index') %>
@@ -32,7 +32,7 @@
32
32
  :class => "attachment_text_link" %>
33
33
 
34
34
  <div id="video_thumbnail_<%=video.id%>" class="video_thumbnail_class">
35
- <%=image_tag(video_path(video)+"?style=png", :class => "video_thumbnail_image")%>
35
+ <%=image_tag(video_path(video)+"?style=thumb", :class => "video_thumbnail_image")%>
36
36
  <div id="<%=video.id%>" class="video_thumbnail_play_over"></div>
37
37
  </div>
38
38
 
@@ -1 +1 @@
1
- <%=render(:partial => 'common/index') %>
1
+ <%=render(:partial => 'common-documents/index') %>
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "social_stream-documents"
3
- s.version = "0.2.0"
3
+ s.version = "0.2.3"
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."
@@ -9,6 +9,12 @@ describe PicturesController do
9
9
  end
10
10
 
11
11
  it "should render index" do
12
+ get :index
13
+
14
+ response.should redirect_to(:new_user_session)
15
+ end
16
+
17
+ it "should render receiver's index" do
12
18
  get :index, :user_id => @picture.post_activity.receiver.to_param
13
19
 
14
20
  response.should be_success
File without changes
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: 23
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - "V\xC3\xADctor S\xC3\xA1nchez Belmar"
@@ -16,13 +16,12 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-28 00:00:00 +02:00
20
- default_executable:
19
+ date: 2011-08-01 00:00:00 Z
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
22
+ name: social_stream-base
23
23
  prerelease: false
24
- type: :runtime
25
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
25
  none: false
27
26
  requirements:
28
27
  - - ~>
@@ -33,12 +32,12 @@ dependencies:
33
32
  - 7
34
33
  - 10
35
34
  version: 0.7.10
36
- name: social_stream-base
37
- version_requirements: *id001
35
+ type: :runtime
36
+ requirement: *id001
38
37
  - !ruby/object:Gem::Dependency
38
+ name: paperclip-ffmpeg
39
39
  prerelease: false
40
- type: :runtime
41
- requirement: &id002 !ruby/object:Gem::Requirement
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
42
41
  none: false
43
42
  requirements:
44
43
  - - ~>
@@ -49,12 +48,12 @@ dependencies:
49
48
  - 7
50
49
  - 0
51
50
  version: 0.7.0
52
- name: paperclip-ffmpeg
53
- version_requirements: *id002
51
+ type: :runtime
52
+ requirement: *id002
54
53
  - !ruby/object:Gem::Dependency
54
+ name: paperclip
55
55
  prerelease: false
56
- type: :runtime
57
- requirement: &id003 !ruby/object:Gem::Requirement
56
+ version_requirements: &id003 !ruby/object:Gem::Requirement
58
57
  none: false
59
58
  requirements:
60
59
  - - "="
@@ -65,12 +64,12 @@ dependencies:
65
64
  - 3
66
65
  - 11
67
66
  version: 2.3.11
68
- name: paperclip
69
- version_requirements: *id003
67
+ type: :runtime
68
+ requirement: *id003
70
69
  - !ruby/object:Gem::Dependency
70
+ name: sqlite3-ruby
71
71
  prerelease: false
72
- type: :development
73
- requirement: &id004 !ruby/object:Gem::Requirement
72
+ version_requirements: &id004 !ruby/object:Gem::Requirement
74
73
  none: false
75
74
  requirements:
76
75
  - - ">="
@@ -79,12 +78,12 @@ dependencies:
79
78
  segments:
80
79
  - 0
81
80
  version: "0"
82
- name: sqlite3-ruby
83
- version_requirements: *id004
81
+ type: :development
82
+ requirement: *id004
84
83
  - !ruby/object:Gem::Dependency
84
+ name: ruby-debug
85
85
  prerelease: false
86
- type: :development
87
- requirement: &id005 !ruby/object:Gem::Requirement
86
+ version_requirements: &id005 !ruby/object:Gem::Requirement
88
87
  none: false
89
88
  requirements:
90
89
  - - ~>
@@ -95,12 +94,12 @@ dependencies:
95
94
  - 10
96
95
  - 3
97
96
  version: 0.10.3
98
- name: ruby-debug
99
- version_requirements: *id005
97
+ type: :development
98
+ requirement: *id005
100
99
  - !ruby/object:Gem::Dependency
100
+ name: rspec-rails
101
101
  prerelease: false
102
- type: :development
103
- requirement: &id006 !ruby/object:Gem::Requirement
102
+ version_requirements: &id006 !ruby/object:Gem::Requirement
104
103
  none: false
105
104
  requirements:
106
105
  - - ~>
@@ -111,12 +110,12 @@ dependencies:
111
110
  - 6
112
111
  - 0
113
112
  version: 2.6.0
114
- name: rspec-rails
115
- version_requirements: *id006
113
+ type: :development
114
+ requirement: *id006
116
115
  - !ruby/object:Gem::Dependency
116
+ name: factory_girl
117
117
  prerelease: false
118
- type: :development
119
- requirement: &id007 !ruby/object:Gem::Requirement
118
+ version_requirements: &id007 !ruby/object:Gem::Requirement
120
119
  none: false
121
120
  requirements:
122
121
  - - ~>
@@ -127,12 +126,12 @@ dependencies:
127
126
  - 3
128
127
  - 2
129
128
  version: 1.3.2
130
- name: factory_girl
131
- version_requirements: *id007
129
+ type: :development
130
+ requirement: *id007
132
131
  - !ruby/object:Gem::Dependency
132
+ name: forgery
133
133
  prerelease: false
134
- type: :development
135
- requirement: &id008 !ruby/object:Gem::Requirement
134
+ version_requirements: &id008 !ruby/object:Gem::Requirement
136
135
  none: false
137
136
  requirements:
138
137
  - - ~>
@@ -143,12 +142,12 @@ dependencies:
143
142
  - 3
144
143
  - 6
145
144
  version: 0.3.6
146
- name: forgery
147
- version_requirements: *id008
145
+ type: :development
146
+ requirement: *id008
148
147
  - !ruby/object:Gem::Dependency
148
+ name: capybara
149
149
  prerelease: false
150
- type: :development
151
- requirement: &id009 !ruby/object:Gem::Requirement
150
+ version_requirements: &id009 !ruby/object:Gem::Requirement
152
151
  none: false
153
152
  requirements:
154
153
  - - ~>
@@ -159,8 +158,8 @@ dependencies:
159
158
  - 3
160
159
  - 9
161
160
  version: 0.3.9
162
- name: capybara
163
- version_requirements: *id009
161
+ type: :development
162
+ requirement: *id009
164
163
  description: |-
165
164
  Social Stream is a Ruby on Rails engine providing your application with social networking features and activity streams.
166
165
 
@@ -174,11 +173,6 @@ extra_rdoc_files: []
174
173
 
175
174
  files:
176
175
  - .gitignore
177
- - .idea/encodings.xml
178
- - .idea/misc.xml
179
- - .idea/modules.xml
180
- - .idea/social_stream-documents.iml
181
- - .idea/vcs.xml
182
176
  - .rspec
183
177
  - Gemfile
184
178
  - MIT-LICENSE
@@ -239,7 +233,7 @@ files:
239
233
  - app/views/audios/index.html.erb
240
234
  - app/views/audios/index.js.erb
241
235
  - app/views/audios/show.html.erb
242
- - app/views/common/_index.html.erb
236
+ - app/views/common-documents/_index.html.erb
243
237
  - app/views/documents/_document.html.erb
244
238
  - app/views/documents/_fields.html.erb
245
239
  - app/views/documents/_header.html.erb
@@ -294,6 +288,7 @@ files:
294
288
  - spec/dummy/config/navigation.rb
295
289
  - spec/dummy/config/relations.yml
296
290
  - spec/dummy/config/routes.rb
291
+ - spec/dummy/db/.gitkeep
297
292
  - spec/dummy/public/404.html
298
293
  - spec/dummy/public/422.html
299
294
  - spec/dummy/public/500.html
@@ -322,7 +317,6 @@ files:
322
317
  - vendor/assets/stylesheets/jplayer.blue.monday.video.play.hover.png
323
318
  - vendor/assets/stylesheets/jplayer.blue.monday.video.play.png
324
319
  - vendor/assets/stylesheets/pbar-ani.gif
325
- has_rdoc: true
326
320
  homepage: http://github.com/ging/social_stream-documents
327
321
  licenses: []
328
322
 
@@ -352,7 +346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
346
  requirements: []
353
347
 
354
348
  rubyforge_project:
355
- rubygems_version: 1.6.2
349
+ rubygems_version: 1.8.6
356
350
  signing_key:
357
351
  specification_version: 3
358
352
  summary: File capabilities for Social Stream, the core for building social network websites
data/.idea/encodings.xml DELETED
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
- </project>
5
-
data/.idea/misc.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="DependencyValidationManager">
4
- <option name="SKIP_IMPORT_STATEMENTS" value="false" />
5
- </component>
6
- <component name="ProjectRootManager" version="2" project-jdk-name="Ruby SDK 1.8.7 (/home/dcarrera/.rvm/rubies/ruby-1.8.7-p334/bin/ruby)" project-jdk-type="RUBY_SDK" />
7
- </project>
8
-
data/.idea/modules.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/social_stream-documents.iml" filepath="$PROJECT_DIR$/.idea/social_stream-documents.iml" />
6
- </modules>
7
- </component>
8
- </project>
9
-
@@ -1,35 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="GemRequirementsHolder" version="3">
4
- <requirement>
5
- <requirement>
6
- <dependency name="paperclip-ffmpeg" version="0.6.0" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
7
- </requirement>
8
- <source from="Gemfile" />
9
- </requirement>
10
- <requirement>
11
- <requirement>
12
- <dependency name="social_stream-base" version="0.6.0" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
13
- </requirement>
14
- <source from="Gemfile" />
15
- </requirement>
16
- </component>
17
- <component name="NewModuleRootManager">
18
- <content url="file://$MODULE_DIR$" />
19
- <orderEntry type="inheritedJdk" />
20
- <orderEntry type="sourceFolder" forTests="false" />
21
- <orderEntry type="library" scope="PROVIDED" name="[gem] bundler (v1.0.13, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/bundler-1.0.13)" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="[gem] paperclip-ffmpeg (v0.6.0, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/paperclip-ffmpeg-0.6.0)" level="application" />
23
- <orderEntry type="library" scope="PROVIDED" name="[gem] multi_json (v1.0.3, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/multi_json-1.0.3)" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="[gem] builder (v3.0.0, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/builder-3.0.0)" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="[gem] tzinfo (v0.3.28, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/tzinfo-0.3.28)" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="[gem] activerecord (v3.1.0.rc4, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.1.0.rc4)" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="[gem] activesupport (v3.1.0.rc4, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-3.1.0.rc4)" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="[gem] bcrypt-ruby (v2.1.4, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/bcrypt-ruby-2.1.4)" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="[gem] activemodel (v3.1.0.rc4, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/activemodel-3.1.0.rc4)" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="[gem] paperclip (v2.3.11, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/paperclip-2.3.11)" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="[gem] i18n (v0.6.0, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/i18n-0.6.0)" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="[gem] arel (v2.1.1, /home/dcarrera/.rvm/gems/ruby-1.8.7-p334/gems/arel-2.1.1)" level="application" />
33
- </component>
34
- </module>
35
-
data/.idea/vcs.xml DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
7
-