rails_wangeditor 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/app/controllers/wangeditor/assets_controller.rb +10 -2
- data/config/routes.rb +0 -1
- data/lib/rails_wangeditor/helper.rb +6 -1
- data/lib/rails_wangeditor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faf94367c7b9d3a5feb3b066ca3fa9c297ef3ae3
|
4
|
+
data.tar.gz: 81a9351dfcd8616d448b0b312bc0651c47e363c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18c72b8656e57be5b98e580ac2cf94ea9e2abb22672a9e98a06b38ebf92f8b92f0aed303f55a6935cf7f9434df7f486b93ecd49eb7b2e4befd7d0cead446936f
|
7
|
+
data.tar.gz: 12f6c0b33e03541488b695883291e31ce0b44e03b26d3c59a6d65a311e12aedff9badd6735d451c13be57c7f02f353b8aa0954ecb660a7997c8157a7bae42c54
|
@@ -14,7 +14,11 @@ class Wangeditor::AssetsController < ApplicationController
|
|
14
14
|
logger.warn '=====Warning: the owner have not been created, "delete uploaded files automatically" will not work. ====' if defined?(logger) && @asset.owner_id == 0
|
15
15
|
@asset.asset_type = @dir
|
16
16
|
if @asset.save
|
17
|
-
|
17
|
+
url = @asset.asset.url
|
18
|
+
if ENV['RAILS_RELATIVE_URL_ROOT']
|
19
|
+
url = ENV['RAILS_RELATIVE_URL_ROOT'] + url
|
20
|
+
end
|
21
|
+
render :text => url
|
18
22
|
else
|
19
23
|
show_error(@asset.errors.full_messages)
|
20
24
|
end
|
@@ -25,7 +29,11 @@ class Wangeditor::AssetsController < ApplicationController
|
|
25
29
|
begin
|
26
30
|
uploader = "Wangeditor::#{@dir.camelize}Uploader".constantize.new
|
27
31
|
uploader.store!(@imgFile)
|
28
|
-
|
32
|
+
url = uploader.url
|
33
|
+
if ENV['RAILS_RELATIVE_URL_ROOT']
|
34
|
+
url = ENV['RAILS_RELATIVE_URL_ROOT'] + url
|
35
|
+
end
|
36
|
+
render :text => url
|
29
37
|
rescue CarrierWave::UploadError => e
|
30
38
|
show_error(e.message)
|
31
39
|
rescue Exception => e
|
data/config/routes.rb
CHANGED
@@ -44,7 +44,12 @@ module RailsWangeditor
|
|
44
44
|
|
45
45
|
def main_app_root_url
|
46
46
|
begin
|
47
|
-
main_app.root_url.slice(0, main_app.root_url.rindex(main_app.root_path))
|
47
|
+
main_app_root_url = main_app.root_url.slice(0, main_app.root_url.rindex(main_app.root_path))
|
48
|
+
if ENV['RAILS_RELATIVE_URL_ROOT']
|
49
|
+
main_app_root_url += ENV['RAILS_RELATIVE_URL_ROOT'] + "/"
|
50
|
+
else
|
51
|
+
main_app_root_url += "/"
|
52
|
+
end
|
48
53
|
rescue
|
49
54
|
'/'
|
50
55
|
end
|