chili_presentations 0.1.0 → 0.1.1
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/History.txt +7 -1
- data/README.md +17 -0
- data/app/controllers/presentations_controller.rb +2 -2
- data/app/models/presentation.rb +10 -4
- data/lib/chili_presentations/version.rb +1 -1
- data/lib/tasks/contributor_tasks.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -58,6 +58,23 @@ of that project's presentations.
|
|
58
58
|
|
59
59
|
## INSTALL:
|
60
60
|
|
61
|
+
### In nginx
|
62
|
+
|
63
|
+
Add the following block to your ChiliProject nginx config (inside your `server`
|
64
|
+
block):
|
65
|
+
|
66
|
+
```
|
67
|
+
location ~ /contents/ {
|
68
|
+
# NOTE: Below, `root` is NOT set to `RAILS_ROOT/public`!
|
69
|
+
root RAILS_ROOT/uploaded_presentations;
|
70
|
+
internal;
|
71
|
+
}
|
72
|
+
```
|
73
|
+
|
74
|
+
Cycle `nginx`.
|
75
|
+
|
76
|
+
### In ChiliProject
|
77
|
+
|
61
78
|
```
|
62
79
|
gem install chili_presentations
|
63
80
|
```
|
@@ -28,7 +28,7 @@ class PresentationsController < ApplicationController
|
|
28
28
|
redirect_to(project_presentations_path(@project))
|
29
29
|
end
|
30
30
|
|
31
|
-
head :x_accel_redirect => presentation.
|
31
|
+
head :x_accel_redirect => presentation.x_accel_redirect_path_to(params[:static_asset_path]), :content_type => requested_content_type
|
32
32
|
end
|
33
33
|
|
34
34
|
def destroy
|
@@ -68,7 +68,7 @@ class PresentationsController < ApplicationController
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def requested_content_type
|
71
|
-
case presentation.
|
71
|
+
case presentation.x_accel_redirect_path_to(params[:static_asset_path])
|
72
72
|
when /\.css$/ then "text/css"
|
73
73
|
when /\.js$/ then "text/javascript"
|
74
74
|
else "text/html"
|
data/app/models/presentation.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
class Presentation < ActiveRecord::Base
|
2
|
+
UPLOAD_BASE_DIR = File.join(Rails.root, "uploaded_presentations")
|
2
3
|
INDEX_FILENAME = "index.html"
|
3
4
|
UNPACKED_DIRNAME = "unpacked"
|
4
5
|
|
@@ -8,7 +9,7 @@ class Presentation < ActiveRecord::Base
|
|
8
9
|
|
9
10
|
has_friendly_id :title, :use_slug => true
|
10
11
|
has_attached_file :contents,
|
11
|
-
:path => "
|
12
|
+
:path => "#{UPLOAD_BASE_DIR}/:attachment/:id_partition/:style/:filename"
|
12
13
|
|
13
14
|
has_attached_file :alternative_format
|
14
15
|
|
@@ -20,11 +21,11 @@ class Presentation < ActiveRecord::Base
|
|
20
21
|
|
21
22
|
|
22
23
|
def index_path
|
23
|
-
File.join(UNPACKED_DIRNAME, INDEX_FILENAME)
|
24
|
+
File.join(path_without_upload_base_dir, UNPACKED_DIRNAME, INDEX_FILENAME)
|
24
25
|
end
|
25
26
|
|
26
|
-
def
|
27
|
-
some_asset.blank? ? index_path : File.join(UNPACKED_DIRNAME, *some_asset)
|
27
|
+
def x_accel_redirect_path_to(some_asset)
|
28
|
+
some_asset.blank? ? index_path : File.join(path_without_upload_base_dir, UNPACKED_DIRNAME, *some_asset)
|
28
29
|
end
|
29
30
|
|
30
31
|
def permalink
|
@@ -34,4 +35,9 @@ class Presentation < ActiveRecord::Base
|
|
34
35
|
def to_s
|
35
36
|
title
|
36
37
|
end
|
38
|
+
|
39
|
+
def path_without_upload_base_dir
|
40
|
+
File.dirname(contents.path.sub(/#{UPLOAD_BASE_DIR}/, ''))
|
41
|
+
end
|
42
|
+
private :path_without_upload_base_dir
|
37
43
|
end
|
@@ -32,7 +32,7 @@ class ContributorTasks < Rake::TaskLib
|
|
32
32
|
puts "#####################"
|
33
33
|
puts "For the twitters"
|
34
34
|
puts "#####################"
|
35
|
-
puts "[ANN] chili_presentations v#{ChiliPresentations::VERSION} released. Changes:
|
35
|
+
puts "[ANN] chili_presentations v#{ChiliPresentations::VERSION} released. Changes: http://bit.ly/chili_presentation_changes, Repo: http://bit.ly/chili_presentations #chiliproject"
|
36
36
|
puts "#####################"
|
37
37
|
|
38
38
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|