From 5493ca53304d4cf1963c35cee5bdf6103d7596a0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 17 Aug 2019 13:48:00 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=8E=A8=E8=8D=90=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 3 ++- app/views/attachments/_attachment.json.jbuilder | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 099d45406..142ca6d75 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -52,7 +52,8 @@ module ApplicationHelper shixun_id = shixun_id.blank? ? -1 : shixun_id.join(",") Shixun.select([:id, :name, :user_id, :challenges_count, :myshixuns_count, :trainee, :identifier]).where("id - in(#{shixun_id}) or homepage_show =1").unhidden.order("myshixuns_count desc, homepage_show asc").limit(3) + in(#{shixun_id})").unhidden.order("homepage_show asc, myshixuns_count desc").limit(3) + end # 相关推荐 diff --git a/app/views/attachments/_attachment.json.jbuilder b/app/views/attachments/_attachment.json.jbuilder index 01a7f4163..52f16c549 100644 --- a/app/views/attachments/_attachment.json.jbuilder +++ b/app/views/attachments/_attachment.json.jbuilder @@ -10,4 +10,4 @@ json.quotes attachment.quotes_count json.description attachment.description json.downloads_count attachment.downloads_count json.created_on attachment.created_on -json.url download_url(attachment) unless attachment.locked?(@is_member) +json.url download_url(attachment) From e8dcb166756861f64edd9f5a487d60eb1b804bcd Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Sat, 17 Aug 2019 13:56:14 +0800 Subject: [PATCH 2/7] =?UTF-8?q?pdf=20=E9=A2=84=E8=A7=88=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index dde7828c5..7617270a8 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -18,7 +18,8 @@ class AttachmentsController < ApplicationController pdf_attachment = params[:disposition] || "attachment" if pdf_attachment == "inline" - render pdf: absolute_path(local_path(@file)), filename: @file.filename, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream' + send_data absolute_path(local_path(@file)),filename: @file.filename, disposition: 'inline',type: 'application/pdf' + # render pdf: absolute_path(local_path(@file)), filename: @file.filename, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream' else send_file(absolute_path(local_path(@file)), filename: @file.filename,stream:false, type: @file.content_type.presence || 'application/octet-stream') end From 476689314bcec5f32665fcd412de3bba975d3ed1 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Sat, 17 Aug 2019 14:00:18 +0800 Subject: [PATCH 3/7] xxx --- app/controllers/attachments_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 7617270a8..d3317e99e 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -18,8 +18,7 @@ class AttachmentsController < ApplicationController pdf_attachment = params[:disposition] || "attachment" if pdf_attachment == "inline" - send_data absolute_path(local_path(@file)),filename: @file.filename, disposition: 'inline',type: 'application/pdf' - # render pdf: absolute_path(local_path(@file)), filename: @file.filename, disposition: 'inline', type: @file.content_type.presence || 'application/octet-stream' + send_file absolute_path(local_path(@file)),filename: @file.filename, disposition: 'inline',type: 'application/pdf' else send_file(absolute_path(local_path(@file)), filename: @file.filename,stream:false, type: @file.content_type.presence || 'application/octet-stream') end From 3c1d30a133a7e56090612b7473e1e613ed720622 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Sat, 17 Aug 2019 14:03:18 +0800 Subject: [PATCH 4/7] video feature: add account check to api --- app/controllers/users/video_auths_controller.rb | 2 +- app/controllers/users/videos_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users/video_auths_controller.rb b/app/controllers/users/video_auths_controller.rb index 0eec4dffb..a7d41bce5 100644 --- a/app/controllers/users/video_auths_controller.rb +++ b/app/controllers/users/video_auths_controller.rb @@ -1,5 +1,5 @@ class Users::VideoAuthsController < Users::BaseController - before_action :private_user_resources!, :require_auth_teacher! + before_action :private_user_resources!, :check_account, :require_auth_teacher! def create result = Videos::CreateAuthService.call(observed_user, create_params) diff --git a/app/controllers/users/videos_controller.rb b/app/controllers/users/videos_controller.rb index 1df726c0c..0ad3f87d6 100644 --- a/app/controllers/users/videos_controller.rb +++ b/app/controllers/users/videos_controller.rb @@ -1,5 +1,5 @@ class Users::VideosController < Users::BaseController - before_action :private_user_resources!, :require_auth_teacher! + before_action :private_user_resources!, :check_account, :require_auth_teacher! helper_method :current_video From e7a96f8ad10c931e23d9c1d6e7d692aa2d67e795 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 17 Aug 2019 14:12:55 +0800 Subject: [PATCH 5/7] sort --- public/react/src/common/TextUtil.js | 7 ++++++- public/react/src/common/educoder.js | 2 +- public/react/src/modules/courses/members/teacherList.js | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js index 4482f8607..4c83131f1 100644 --- a/public/react/src/common/TextUtil.js +++ b/public/react/src/common/TextUtil.js @@ -70,4 +70,9 @@ export function appendFileSizeToUploadFileAll(fileList) { return item }) } -export const uploadNameSizeSeperator = '  ' \ No newline at end of file +export const uploadNameSizeSeperator = '  ' + +export const sortDirections = ["ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", + "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", + "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", + "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", ] \ No newline at end of file diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index ca1596c54..88f8e1210 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -17,7 +17,7 @@ export { updatePageParams as updatePageParams } from './RouterUti export { bytesToSize as bytesToSize } from './UnitUtil'; export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension, - downloadFile } from './TextUtil' + downloadFile, sortDirections } from './TextUtil' export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil' diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index c509cb057..06dbe74a8 100644 --- a/public/react/src/modules/courses/members/teacherList.js +++ b/public/react/src/modules/courses/members/teacherList.js @@ -8,7 +8,7 @@ import Titlesearchsection from '../common/titleSearch/TitleSearchSection' import ColorCountText from '../common/titleSearch/ColorCountText' import update from 'immutability-helper' -import { WordsBtn, ConditionToolTip, on, off ,trigger} from 'educoder' +import { WordsBtn, ConditionToolTip, on, off ,trigger, sortDirections } from 'educoder' import axios from 'axios' @@ -63,6 +63,7 @@ function buildColumns(that) { width: 120, key: 'name', sorter: showSorter, + sortDirections: sortDirections, sortOrder: sortedInfo.columnKey === 'name' && sortedInfo.order, render: (name, record) => { return Date: Sat, 17 Aug 2019 14:27:08 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/subjects/show.json.jbuilder | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/subjects/show.json.jbuilder b/app/views/subjects/show.json.jbuilder index 93fa105a6..ec76b5a2d 100644 --- a/app/views/subjects/show.json.jbuilder +++ b/app/views/subjects/show.json.jbuilder @@ -11,6 +11,7 @@ json.allow_statistics @is_manager json.allow_send @user.logged? json.allow_visit @subject.status > 1 || @is_manager json.allow_add_member @is_manager +json.is_creator @is_creator if @subject.excellent json.courses @courses do |course| From e17d636ba509c7ce06771ad0fbe057e90de2bf21 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 17 Aug 2019 14:29:17 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 2cd515261..449a86e8b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -268,7 +268,7 @@ class User < ApplicationRecord # 实训路径管理员 def creator_of_subject?(subject) - subject.user_id == id + subject.user_id == id || admin? end # 实训路径:合作者、admin