rails_wangeditor 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78a8c3bf30330b9aee4417c1e3ee7b5f52144ac7
4
- data.tar.gz: 9fc740643188b8c31e58861c12c347712302dacf
3
+ metadata.gz: faf94367c7b9d3a5feb3b066ca3fa9c297ef3ae3
4
+ data.tar.gz: 81a9351dfcd8616d448b0b312bc0651c47e363c6
5
5
  SHA512:
6
- metadata.gz: 6d6f16313c28ec69e8e66407d44c1c9cbda85adc1b8b7f366c64f2cd4555b089d1519dff746c0f0ffcf34cdef43f1627b1243ebcef4aa9529719c0195742904e
7
- data.tar.gz: 1943f184750f70c8f339288de431b58564defa74cc51194bff815f55bc4a1e5504800111586eb68d5b7babca84f9543776abff60d1fdeacac340740d29daa487
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
- render :text => @asset.asset.url
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
- render :text => ({:error => 0, :url => uploader.url}.to_json)
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
@@ -1,6 +1,5 @@
1
1
  Rails.application.routes.draw do
2
2
  namespace :wangeditor do
3
3
  post "/upload" => "assets#create"
4
- get "/filemanager" => "assets#list"
5
4
  end
6
5
  end
@@ -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
@@ -1,4 +1,4 @@
1
1
  module RailsWangeditor
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_wangeditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubycat