diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index dde7828c5..d3317e99e 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -18,7 +18,7 @@ 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_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 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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a5f291c7b..47f50a05f 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/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 diff --git a/app/views/attachments/_attachment.json.jbuilder b/app/views/attachments/_attachment.json.jbuilder index 25d7aecd0..a8ad0a286 100644 --- a/app/views/attachments/_attachment.json.jbuilder +++ b/app/views/attachments/_attachment.json.jbuilder @@ -13,5 +13,3 @@ json.downloads_count attachment.downloads_count json.created_on attachment.created_on json.is_pdf attachment.is_pdf? json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment) - -# json.url download_url(attachment) unless attachment.locked?(@is_member) 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| 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