From 115a316e8088597ff6653fd051590f5ff2cea69e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 22 Jul 2019 23:38:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=84=E5=8A=A0=E4=B8=8B=E8=BD=BD=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 6 +++--- app/helpers/application_helper.rb | 2 +- app/views/libraries/_form.html.erb | 2 +- app/views/libraries/_library_list.html.erb | 2 +- app/views/managements/_training_item.html.erb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index e41e2a43..46be2ef4 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -359,7 +359,7 @@ class AttachmentsController < ApplicationController saved = @attachment.save respond_to do |format| format.js - format.json { render json: { attachment_id: @attachment.id, url: download_attachment_path(@attachment.id) } } + format.json { render json: { attachment_id: @attachment.id, url: "/api/attachments/#{@attachment.id}"} } format.api { if saved render :action => 'upload', :status => :created @@ -380,7 +380,7 @@ class AttachmentsController < ApplicationController render json: { success: saved ? 1 : 0, # | 1, // 0 表示上传失败,1 表示上传成功 message: "上传信息:#{ @attachment.errors.full_messages.join(',') }", - url: download_attachment_path(@attachment.id), # 上传成功时才返回 + url: "/api/attachments/#{@attachment.id}", # 上传成功时才返回 attachment_id: @attachment.id } end @@ -413,7 +413,7 @@ class AttachmentsController < ApplicationController render json: { success: saved ? 1 : 0, # | 1, // 0 表示上传失败,1 表示上传成功 message: "上传失败:#{ @attachment.errors.full_messages.join(',') }", - url: download_attachment_path(@attachment.id) # 上传成功时才返回 + url: "/api/attachments/#{@attachment.id}" # 上传成功时才返回 } end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6bd9bc21..aac2a843 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5691,7 +5691,7 @@ end def download_named_attachment_url_without_domain(id, filename, option={}) attachment_id = (Attachment === id ? id.id : id) # Setting.protocol + "://" + Setting.host_name + "/attachments/download/" + attachment_id.to_s + "/" + filename - Setting.protocol + "://" + Setting.host_name + "/attachments/" + attachment_id.to_s + "/api/attachments/" + attachment_id.to_s end def named_attachment_url_without_domain(id, filename, option={}) diff --git a/app/views/libraries/_form.html.erb b/app/views/libraries/_form.html.erb index c71bc7c1..c5bb2ecd 100644 --- a/app/views/libraries/_form.html.erb +++ b/app/views/libraries/_form.html.erb @@ -73,7 +73,7 @@
diff --git a/app/views/managements/_training_item.html.erb b/app/views/managements/_training_item.html.erb index ceb1f055..50e856fa 100644 --- a/app/views/managements/_training_item.html.erb +++ b/app/views/managements/_training_item.html.erb @@ -8,7 +8,7 @@