This commit is contained in:
chenyh 2021-11-22 13:30:50 +08:00
parent 6dc07de1be
commit 503e9229c5
25 changed files with 255 additions and 500 deletions

View File

@ -14,7 +14,6 @@ gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5' gem 'jbuilder', '~> 2.5'
gem 'groupdate', '~> 4.1.0' gem 'groupdate', '~> 4.1.0'
gem 'chartkick' gem 'chartkick'
# gem 'grape', '~> 0.9.0'
gem 'grape-entity', '~> 0.7.1' gem 'grape-entity', '~> 0.7.1'
gem 'kaminari', '~> 1.1', '>= 1.1.1' gem 'kaminari', '~> 1.1', '>= 1.1.1'
@ -48,7 +47,7 @@ gem 'redcarpet', '~> 3.4'
gem 'rqrcode', '~> 0.10.1' gem 'rqrcode', '~> 0.10.1'
gem 'rqrcode_png' gem 'rqrcode_png'
gem 'acts_as_tree', '~> 2.9', '>= 2.9.1'
gem 'acts-as-taggable-on', '~> 6.0' gem 'acts-as-taggable-on', '~> 6.0'
# a tree structure # a tree structure
@ -129,4 +128,3 @@ gem 'request_store'
gem 'harmonious_dictionary', '~> 0.0.1' gem 'harmonious_dictionary', '~> 0.0.1'
gem 'parallel', '~> 1.19', '>= 1.19.1' gem 'parallel', '~> 1.19', '>= 1.19.1'

View File

@ -57,8 +57,6 @@ GEM
activerecord (>= 5.0, < 6.1) activerecord (>= 5.0, < 6.1)
acts_as_list (0.9.19) acts_as_list (0.9.19)
activerecord (>= 3.0) activerecord (>= 3.0)
acts_as_tree (2.9.1)
activerecord (>= 3.0.0)
addressable (2.7.0) addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
ancestry (3.0.7) ancestry (3.0.7)
@ -438,7 +436,6 @@ DEPENDENCIES
active_decorator active_decorator
acts-as-taggable-on (~> 6.0) acts-as-taggable-on (~> 6.0)
acts_as_list acts_as_list
acts_as_tree (~> 2.9, >= 2.9.1)
ancestry ancestry
awesome_print awesome_print
axlsx (~> 3.0.0.pre) axlsx (~> 3.0.0.pre)

View File

@ -136,36 +136,5 @@
background: #fff; background: #fff;
} }
.mt-10{margin-top: 10px;} .mt-10{margin-top: 10px;}
.nav_blueline_status{
list-style-type: none;
padding: 0;
margin: 0;
li {
padding: 0px 15px;
border-radius: 15px;
border: 1px solid #CDCDCD;
height: 30px;
line-height: 30px;
float: left;
margin-right: 30px;
a {
color: #CDCDCD!important;
display: block;
}
};
li.active {
border: 1px solid #4CACFF;
a {
color: #4CACFF!important;
}
}
}
.fr{float: right;}
.width240 {
width: 240px;
}
.mr15{margin-right: 15px;}
.mt2{margin-top: 2px;}
} }

View File

@ -43,30 +43,4 @@ class Admins::BaseController < ApplicationController
def setup_laboratory def setup_laboratory
Laboratory.current = Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1) Laboratory.current = Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1)
end end
def up_and_down(opr,current_target,position,model_name)
modal_target = model_name.capitalize.classify.constantize
if model_name == "forum_section" #只有root才能移动
modal_target = modal_target.roots
end
if opr.to_s == "up"
last_target = modal_target.where("position > ?",position)&.first
if last_target.present?
current_target.update_attribute(:position, last_target.position)
last_target.update_attribute(:position, position) # 重新获取当前问题的位置
return 0
else
return -1
end
elsif opr.to_s == "down"
next_target = modal_target.where("position < ?",position)&.last
if next_target.present?
current_target.update_attribute(:position, next_target.position)
next_target.update_attribute(:position, position)
return 0
else
return -1
end
end
end
end end

View File

@ -45,7 +45,7 @@ class AttachmentsController < ApplicationController
uid_logger("#########################file_params####{params["#{params[:file_param_name]}"]}") uid_logger("#########################file_params####{params["#{params[:file_param_name]}"]}")
raise "未上传文件" unless upload_file raise "未上传文件" unless upload_file
folder = file_storage_directory folder = edu_setting('attachment_folder')
raise "存储目录未定义" unless folder.present? raise "存储目录未定义" unless folder.present?
month_folder = current_month_folder month_folder = current_month_folder
@ -92,44 +92,6 @@ class AttachmentsController < ApplicationController
end end
end end
#后台上传图片
def upload_images
upload_file = params["file"] || params["#{params[:file_param_name]}"]# 这里的file_param_name是为了方便其他插件名称
raise "未上传文件" unless upload_file
folder = edu_setting('attachment_folder')
raise "存储目录未定义" unless folder.present?
month_folder = current_month_folder
save_path = File.join(folder, month_folder)
ext = SecureRandom.urlsafe_base64
local_path, digest = file_save_to_local(save_path, upload_file.tempfile, ext)
content_type = upload_file.content_type.presence || 'application/octet-stream'
disk_filename = local_path[save_path.size + 1, local_path.size]
@attachment = Attachment.where(disk_filename: disk_filename,author_id: current_user.id).first
if @attachment.blank?
@attachment = Attachment.new
@attachment.filename = upload_file.original_filename
@attachment.disk_filename = disk_filename
@attachment.filesize = upload_file.tempfile.size
@attachment.content_type = content_type
@attachment.digest = digest
@attachment.author_id = current_user.id
@attachment.disk_directory = month_folder
@attachment.save!
@status = 1
else
@status = -1
end
respond_to do |format|
format.js
end
end
def destroy def destroy
begin begin
@file_path = absolute_path(local_path(@file)) @file_path = absolute_path(local_path(@file))

View File

@ -39,7 +39,7 @@ module LaboratoryHelper
new_course: "https://www.trustie.net/courses/new", new_course: "https://www.trustie.net/courses/new",
edit_account: "https://www.trustie.net/my/account", edit_account: "https://www.trustie.net/my/account",
my_courses: "https://www.trustie.net/users/#{current_user.try(:login)}/user_courselist", my_courses: "https://www.trustie.net/users/#{current_user.try(:login)}/user_courselist",
my_projects: "https://forgeplus.trustie.net/users/#{current_user.try(:login)}/projects", my_projects: "/users/#{current_user.try(:login)}/projects",
my_organ: "https://www.trustie.net/users/#{current_user.try(:login)}/user_organizations", my_organ: "https://www.trustie.net/users/#{current_user.try(:login)}/user_organizations",
default_url: "https://www.trustie.net/", default_url: "https://www.trustie.net/",
tiding_url: "https://www.trustie.net/users/#{current_user.try(:login)}/user_messages", tiding_url: "https://www.trustie.net/users/#{current_user.try(:login)}/user_messages",

View File

@ -1,5 +1,4 @@
class UsersController < ApplicationController class UsersController < ApplicationController
include ApplicationHelper
before_action :load_user, only: [:show, :homepage_info, :sync_token, :sync_gitea_pwd, :projects, :watch_users, :fan_users] before_action :load_user, only: [:show, :homepage_info, :sync_token, :sync_gitea_pwd, :projects, :watch_users, :fan_users]
before_action :check_user_exist, only: [:show, :homepage_info,:projects, :watch_users, :fan_users] before_action :check_user_exist, only: [:show, :homepage_info,:projects, :watch_users, :fan_users]
@ -67,7 +66,7 @@ class UsersController < ApplicationController
def attachment_show def attachment_show
file_name = params[:file_name] file_name = params[:file_name]
path = params[:path] || file_storage_directory path = params[:path] || edu_setting('attachment_folder')
send_file "#{path}/#{file_name}", :filename => "#{file_name}", send_file "#{path}/#{file_name}", :filename => "#{file_name}",
:type => 'game', :type => 'game',
:disposition => 'attachment' #inline can open in browser :disposition => 'attachment' #inline can open in browser

View File

@ -141,7 +141,6 @@ module ApplicationHelper
# 用户图像url如果不存在的话source为匿名用户即默认使用匿名用户图像 # 用户图像url如果不存在的话source为匿名用户即默认使用匿名用户图像
def url_to_avatar(source) def url_to_avatar(source)
return "" if source&.id.blank?
if File.exist?(disk_filename(source&.class, source&.id)) if File.exist?(disk_filename(source&.class, source&.id))
ctime = File.ctime(disk_filename(source.class, source.id)).to_i ctime = File.ctime(disk_filename(source.class, source.id)).to_i
if source.class.to_s == 'User' if source.class.to_s == 'User'
@ -323,15 +322,7 @@ module ApplicationHelper
end end
def absolute_path(file_path) def absolute_path(file_path)
file_root_directory + File.join(edu_setting('attachment_folder'), file_path) File.join(edu_setting('attachment_folder'), file_path)
end
def file_root_directory
Rails.root.to_s
end
def file_storage_directory
file_root_directory + edu_setting('attachment_folder')
end end
def local_path(file) def local_path(file)

View File

@ -4,19 +4,14 @@ module Watchable
included do included do
has_many :watchers, as: :watchable, dependent: :destroy has_many :watchers, as: :watchable, dependent: :destroy
has_many :watcher_users, through: :watchers, source: :user, validate: false has_many :watcher_users, through: :watchers, source: :user, validate: false
scope :watched_by, -> (user_id) { includes(:watchers).where(watchers: { user_id: user_id }) } scope :watched_by, -> (user_id) { includes(:watchers).where(watchers: { user_id: user_id }) }
attr_reader :watcher_ids, :watcher_user_ids
end end
def watched?(watchable) def watched?(watchable)
watchable.watchers.exists?(user: self) watchable.watchers.exists?(user: self)
end end
def watched_by?(user)
watcher_users.exists?(id: user.id)
# !!(user && self.watcher_user_ids && self.watcher_user_ids.detect {|uid| uid == user.id })
end
def watch!(watchable) def watch!(watchable)
watchable.watchers.create!(user: self, created_at: Time.current) watchable.watchers.create!(user: self, created_at: Time.current)
end end

View File

@ -14,10 +14,6 @@ class PraiseTread < ApplicationRecord
end end
end end
def self.is_user_praise(target_id,target_type, target_user_id)
where(:praise_tread_object_id => target_id, :praise_tread_object_type => target_type, :user_id => target_user_id, :praise_or_tread => 1)
end
def self.find_object_by_type_and_id(id, type) def self.find_object_by_type_and_id(id, type)
type.constantize find_by_id id type.constantize find_by_id id
end end

View File

@ -54,7 +54,6 @@ class User < ApplicationRecord
has_one :qq_open_user, class_name: 'OpenUsers::QQ' has_one :qq_open_user, class_name: 'OpenUsers::QQ'
accepts_nested_attributes_for :user_extension, update_only: true accepts_nested_attributes_for :user_extension, update_only: true
has_many :fork_users, dependent: :destroy has_many :fork_users, dependent: :destroy
has_many :block_users, :dependent => :destroy
has_many :versions has_many :versions
has_many :issue_times, :dependent => :destroy has_many :issue_times, :dependent => :destroy
@ -73,7 +72,7 @@ class User < ApplicationRecord
has_many :be_watchers, foreign_key: :user_id, dependent: :destroy # 我的关注 has_many :be_watchers, foreign_key: :user_id, dependent: :destroy # 我的关注
has_many :be_watcher_users, through: :be_watchers, dependent: :destroy # 我关注的用户 has_many :be_watcher_users, through: :be_watchers, dependent: :destroy # 我关注的用户
# has_many :watchers, as: :watchable, dependent: :destroy has_many :watchers, as: :watchable, dependent: :destroy
# 认证 # 认证
has_many :apply_user_authentication has_many :apply_user_authentication
@ -82,15 +81,6 @@ class User < ApplicationRecord
has_many :apply_actions, dependent: :destroy has_many :apply_actions, dependent: :destroy
has_many :trail_auth_apply_actions, -> { where(container_type: 'TrialAuthorization') }, class_name: 'ApplyAction' has_many :trail_auth_apply_actions, -> { where(container_type: 'TrialAuthorization') }, class_name: 'ApplyAction'
#用户是否禁言
has_many :banned_forums, :dependent => :destroy
has_many :apply_forums, :dependent => :destroy
has_many :memos , :foreign_key => 'author_id'
#论坛的板块内容,及版主
has_many :forum_moderators, :dependent => :destroy
has_many :forum_sections, :dependent => :destroy
# has_many :attendances # has_many :attendances
# 项目 # 项目
@ -321,10 +311,6 @@ class User < ApplicationRecord
status == STATUS_LOCKED status == STATUS_LOCKED
end end
def self.admin_users
where(admin: true)
end
def activate def activate
self.status = STATUS_ACTIVE self.status = STATUS_ACTIVE
end end
@ -584,10 +570,6 @@ class User < ApplicationRecord
end end
end end
def blocked_for(user_id)
block_users.where(block_user_id: user_id).exists?
end
def salt_password(clear_password) def salt_password(clear_password)
self.salt = User.generate_salt self.salt = User.generate_salt
self.hashed_password = User.hash_password("#{salt}#{User.hash_password clear_password}") self.hashed_password = User.hash_password("#{salt}#{User.hash_password clear_password}")

View File

@ -66,7 +66,7 @@ class Projects::ApplyJoinService < ApplicationService
return if owner.phone.blank? return if owner.phone.blank?
Educoder::Sms.send(mobile: owner.phone, send_type:'applied_project_info', Educoder::Sms.send(mobile: owner.phone, send_type:'applied_project_info',
user_name: owner.show_real_name, name: project.name) user_name: owner.show_name, name: project.name)
rescue Exception => ex rescue Exception => ex
Rails.logger.error("发送短信失败 => #{ex.message}") Rails.logger.error("发送短信失败 => #{ex.message}")
end end

View File

@ -19,19 +19,29 @@
<li><%= sidebar_item(admins_users_path, '用户列表', icon: 'user', controller: 'admins-users') %></li> <li><%= sidebar_item(admins_users_path, '用户列表', icon: 'user', controller: 'admins-users') %></li>
<% end %> <% end %>
</li> </li>
<li> <li>
<%= sidebar_item_group('#memos-submenu', '交流论坛', icon: 'columns') do %> <%= sidebar_item_group('#projects-submenu', '开源项目', icon: 'database') do %>
<li><%= sidebar_item(admins_memos_path, '帖子', icon: 'columns', controller: 'admins-memos') %></li> <li><%= sidebar_item(admins_projects_path, '项目列表', icon: 'database', controller: 'admins-projects') %></li>
<li><%= sidebar_item(admins_apply_destroy_index_path, '申请删帖', icon: 'trash', controller: 'admins-apply_destroy') %></li> <li><%= sidebar_item(admins_project_languages_path, '项目语言', icon: 'language', controller: 'admins-project_languages') %></li>
<li><%= sidebar_item(admins_memo_reply_lists_path, '回复', icon: 'mail-reply-all', controller: 'admins-memo_reply_lists') %></li> <li><%= sidebar_item(admins_project_categories_path, '分类列表', icon: 'sitemap', controller: 'admins-project_categories') %></li>
<li><%= sidebar_item(admins_forum_sections_path, '版块配置', icon: 'tags', controller: 'admins-forum_sections') %></li> <li><%= sidebar_item(admins_project_licenses_path, '开源许可证', icon: 'file-text-o', controller: 'admins-project_licenses') %></li>
<li><%= sidebar_item(admins_banned_users_path, '禁言列表', icon: 'ban', controller: 'admins-banned_users') %></li> <li><%= sidebar_item(admins_project_ignores_path, '忽略文件', icon: 'git', controller: 'admins-project_ignores') %></li>
<li><%= sidebar_item(admins_forum_applies_path, '版主审批', icon: 'check-square-o', controller: 'admins-forum_applies') %></li>
<% end %> <% end %>
</li> </li>
<li><%= sidebar_item(admins_laboratories_path, '云上实验室', icon: 'cloud', controller: 'admins-laboratories') %></li> <li><%= sidebar_item(admins_laboratories_path, '云上实验室', icon: 'cloud', controller: 'admins-laboratories') %></li>
<li> <li>
<%= sidebar_item('/admins/sidekiq', '定时任务', icon: 'bell', controller: 'root') %> <%= sidebar_item_group('#setting-submenu', '网站建设', icon: 'cogs') do %>
<li><%= sidebar_item(edit_admins_about_path, '关于我们', icon: 'smile-o', controller: 'admins-abouts') %></li>
<li><%= sidebar_item(edit_admins_contact_us_path, '联系我们', icon: 'commenting-o', controller: 'admins-contact_us') %></li>
<li><%= sidebar_item(admins_cooperatives_path, '合作伙伴', icon: 'handshake-o', controller: 'admins-cooperatives') %></li>
<li><%= sidebar_item(edit_admins_agreement_path, '服务协议', icon: 'file-text-o', controller: 'admins-agreements') %></li>
<li><%= sidebar_item(edit_admins_help_center_path, '帮助中心', icon: 'question-circle-o', controller: 'admins-help_centers') %></li>
<% end %>
</li>
<li>
<%= sidebar_item('/admins/sidekiq', '定时任务', icon: 'bell', controller: 'root') %>
</li> </li>
<li><%= sidebar_item('/', '返回主站', icon: 'sign-out', controller: 'root') %></li> <li><%= sidebar_item('/', '返回主站', icon: 'sign-out', controller: 'root') %></li>
</ul> </ul>

View File

@ -16,10 +16,10 @@ json.setting do
# #
# json.footer setting.footer || default_setting.footer # json.footer setting.footer || default_setting.footer
# #
# json.main_site current_laboratory.main_site?
# end # end
nav_bar = default_setting.navbar nav_bar = default_setting.navbar
# if User.current.logged? # if User.current.logged?
# nav_bar[2]["link"] = "https://forgeplus.trustie.net/users/#{current_user.login}/projects" # nav_bar[2]["link"] = "https://forgeplus.trustie.net/users/#{current_user.login}/projects"
# nav_bar[2]["hidden"] = false # nav_bar[2]["hidden"] = false

View File

@ -40,7 +40,7 @@ module Educoderplus
allow do allow do
origins '*' origins '*'
# location of your api # location of your api
resource '/*', :headers => :any, :methods => [:get, :post, :delete, :options, :put, :patch] resource '/*', :headers => :any, :methods => [:get, :post, :delete, :options, :put]
end end
end end
end end

View File

@ -2,7 +2,7 @@ Rails.application.routes.draw do
require 'sidekiq/web' require 'sidekiq/web'
require 'admin_constraint' require 'admin_constraint'
# mount Mobile::API => '/api'
# mount Sidekiq::Web => '/sidekiq', :constraints => AdminConstraint.new # mount Sidekiq::Web => '/sidekiq', :constraints => AdminConstraint.new
# Serve websocket cable requests in-process # Serve websocket cable requests in-process
@ -11,8 +11,7 @@ Rails.application.routes.draw do
get 'attachments/entries/get_file', to: 'attachments#get_file' get 'attachments/entries/get_file', to: 'attachments#get_file'
get 'attachments/download/:id', to: 'attachments#show' get 'attachments/download/:id', to: 'attachments#show'
get 'attachments/download/:id/:filename', to: 'attachments#show' get 'attachments/download/:id/:filename', to: 'attachments#show'
post 'attachments/upload_images', to: 'attachments#upload_images'
# get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment'
get 'auth/qq/callback', to: 'oauth/qq#create' get 'auth/qq/callback', to: 'oauth/qq#create'
get 'auth/failure', to: 'oauth/base#auth_failure' get 'auth/failure', to: 'oauth/base#auth_failure'
get 'auth/cas/callback', to: 'oauth/cas#create' get 'auth/cas/callback', to: 'oauth/cas#create'
@ -24,66 +23,15 @@ Rails.application.routes.draw do
resources :edu_settings resources :edu_settings
scope '/api' do scope '/api' do
# match 'upload_avatar', :to => 'avatars#upload', :via => :post resources :sync_forge, only: [:create] do
# match 'delete_avatar', :to => 'avatars#delete_image',:via => :post
get 'users/:login/user_info', to: 'customers#show'
post 'users/:login/edit_brief', to: 'customers#edit_brief'
get 'my_memos/:login/memos', to: 'my_memos#index'
get 'my_memos/:login/my_interested', to: 'my_memos#my_interested'
get 'my_memos/:login/replies_memos', to: 'my_memos#replies_memos'
get 'my_memos/:login/recommend_memos', to: 'my_memos#recommend_memos'
get 'forum_sections/:id/deal_applies/:apply_id', to: 'forum_sections#deal_applies'
get 'forum_sections/:id/destroy_moderator/:moderator_id', to: 'forum_sections#destroy_moderator'
post "/forum_sections/:id/destroy_moderator/:moderator_id", to: "forum_sections#destroy_moderator"
resources :forum_sections, only: [:index, :create] do
collection do collection do
get :select_sections post :sync_users
post :rename post :sync_range_projects
post :destroy_forum
end
member do
post :user_apply
post :edit_notice
get :forum_section_header
get :order_forums
get :search_users
post :add_users
get :managements
get :applied_forums
get :unchecked_memos
get :unchecked_replies
get :checked_memos
end end
end end
get 'memos/forum_memos/:id', to: 'memos#forum_memos' resources :composes do
get 'memos/forum_memos_head/:id', to: 'memos#forum_memos_head' resources :compose_projects, only: [:create, :destroy]
get 'memos/forum_memos_right/:id', to: 'memos#forum_memos_right'
post 'forum_memos/:id/is_watch', to: 'memos#is_watch'
resources :memos, only: [:index, :create, :edit, :update, :show, :destroy] do
member do
get :related_memos
post :watch_memo
get :hidden
post :watch_memo
post :memo_hidden
post :reply
get :set_top_or_down
post :is_fine
post :banned_user
get :more_reply
post :confirm_delete
post :plus
end
end end
# resources :sync_forge, only: [:create] do
# collection do
# post :sync_users
# post :sync_range_projects
# end
# end
# resources :composes do
# resources :compose_projects, only: [:create, :destroy]
# end
resources :attachments do resources :attachments do
member do member do
post :preview_attachment post :preview_attachment
@ -96,31 +44,31 @@ Rails.application.routes.draw do
get 'home/search' get 'home/search'
get 'main/first_stamp' get 'main/first_stamp'
# get 'search', to: 'searchs#index' get 'search', to: 'searchs#index'
# put 'commons/hidden', to: 'commons#hidden' put 'commons/hidden', to: 'commons#hidden'
# put 'commons/unhidden', to: 'commons#unhidden' put 'commons/unhidden', to: 'commons#unhidden'
# delete 'commons/delete', to: 'commons#delete' delete 'commons/delete', to: 'commons#delete'
# resources :issues, except: [:index, :new,:create, :update, :edit, :destroy] do resources :issues, except: [:index, :new,:create, :update, :edit, :destroy] do
# resources :journals, only: [:index, :create, :destroy, :edit, :update] do resources :journals, only: [:index, :create, :destroy, :edit, :update] do
# member do member do
# get :get_children_journals get :get_children_journals
# end end
# end end
# resources :issue_times, only: [:create] do resources :issue_times, only: [:create] do
# collection do collection do
# post :end_work post :end_work
# end end
# end end
# resources :issue_depends, only: [:create, :destroy] resources :issue_depends, only: [:create, :destroy]
# end end
# resources :project_categories, only: [:index, :show] do resources :project_categories, only: [:index, :show] do
# get :group_list, on: :collection get :group_list, on: :collection
# end end
# resources :project_languages, only: [:index, :show] resources :project_languages, only: [:index, :show]
# resources :ignores, only: [:index, :show] resources :ignores, only: [:index, :show]
# resources :licenses, only: [:index, :show] resources :licenses, only: [:index, :show]
resources :watchers, only: [:index] do resources :watchers, only: [:index] do
collection do collection do
@ -129,24 +77,23 @@ Rails.application.routes.draw do
get :check_watch get :check_watch
end end
end end
# resources :projects do resources :projects do
# resources :praise_tread, only: [:index] do resources :praise_tread, only: [:index] do
# collection do collection do
# post :like post :like
# delete :unlike delete :unlike
# get :check_like get :check_like
# end end
# end end
# collection do collection do
# post :migrate post :migrate
# get :group_type_list get :group_type_list
# get :recommend get :recommend
# end end
# end end
resources :accounts do resources :accounts do
collection do collection do
post :login post :login
post :register post :register
@ -219,7 +166,7 @@ Rails.application.routes.draw do
end end
end end
# resources :users_for_private_messages, only: [:index] resources :users_for_private_messages, only: [:index]
resources :files, only: [:index, :show, :update] do resources :files, only: [:index, :show, :update] do
collection do collection do
@ -238,9 +185,9 @@ Rails.application.routes.draw do
end end
end end
# namespace :wechats do namespace :wechats do
# resource :js_sdk_signature, only: [:create] resource :js_sdk_signature, only: [:create]
# end end
resource :template, only: [:show] resource :template, only: [:show]
resource :setting, only: [:show] resource :setting, only: [:show]
@ -251,190 +198,190 @@ Rails.application.routes.draw do
resources :hot_keywords, only: [:index] resources :hot_keywords, only: [:index]
# namespace :weapps do namespace :weapps do
# resource :home, only: [:show] resource :home, only: [:show]
# resource :session, only: [:create] resource :session, only: [:create]
# resource :register, only: [:create] resource :register, only: [:create]
# resource :verification_code, only: [:create] resource :verification_code, only: [:create]
# resource :code_session, only: [:create] resource :code_session, only: [:create]
# resource :verify, only: [:create] resource :verify, only: [:create]
# resource :check_account, only: [:create] resource :check_account, only: [:create]
# resource :unbind_accounts, only: [:show, :destroy] resource :unbind_accounts, only: [:show, :destroy]
# resources :searchs, only: [:index] resources :searchs, only: [:index]
# resources :course_stickies, only: [:create] do resources :course_stickies, only: [:create] do
# post :cancel_sticky, on: :collection post :cancel_sticky, on: :collection
# end end
# resources :shixun_lists, only: [:index] resources :shixun_lists, only: [:index]
# resources :subjects, path: :paths, only: [:index, :create, :update, :edit, :show] resources :subjects, path: :paths, only: [:index, :create, :update, :edit, :show]
# resources :challenges do resources :challenges do
# get :is_play, on: :member get :is_play, on: :member
# end end
# resources :courses, only: [:create, :update, :edit, :show] do resources :courses, only: [:create, :update, :edit, :show] do
# member do member do
# get :shixun_homework_category get :shixun_homework_category
# get :teachers get :teachers
# get :students get :students
# get :course_groups get :course_groups
# get :basic_info get :basic_info
# get :course_activities get :course_activities
# post :change_member_roles post :change_member_roles
# delete :delete_course_teachers delete :delete_course_teachers
# delete :delete_course_students delete :delete_course_students
# end end
# collection do collection do
# get :check_invite_code get :check_invite_code
# end end
# end end
# end end
# Project Area START # Project Area START
# scope "/:owner/:repo" do scope "/:owner/:repo" do
# scope do scope do
# get( get(
# '/activity', '/activity',
# to: 'project_trends#index', to: 'project_trends#index',
# as: :project_activity as: :project_activity
# ) )
# end end
# resource :projects, path: '/', except: [:show, :edit] do resource :projects, path: '/', except: [:show, :edit] do
# member do member do
# get :branches get :branches
# get :simple get :simple
# get :watchers, to: 'projects#watch_users' get :watchers, to: 'projects#watch_users'
# get :stargazers, to: 'projects#praise_users' get :stargazers, to: 'projects#praise_users'
# get :members, to: 'projects#fork_users' get :members, to: 'projects#fork_users'
# match :about, :via => [:get, :put, :post] match :about, :via => [:get, :put, :post]
# end end
# end end
# resource :repositories, path: '/', only: [:show, :create, :edit] do resource :repositories, path: '/', only: [:show, :create, :edit] do
# member do member do
# get :archive get :archive
# get :top_counts get :top_counts
# get :entries get :entries
# match :sub_entries, :via => [:get, :put] match :sub_entries, :via => [:get, :put]
# get :commits get :commits
# get :tags get :tags
# post :create_file post :create_file
# put :update_file put :update_file
# delete :delete_file delete :delete_file
# post :repo_hook post :repo_hook
# post :sync_mirror post :sync_mirror
# get :top_counts get :top_counts
# get 'commits/:sha', to: 'repositories#commit', as: 'commit' get 'commits/:sha', to: 'repositories#commit', as: 'commit'
# end end
# end end
# resources :issues do resources :issues do
# collection do collection do
# get :commit_issues get :commit_issues
# get :index_chosen get :index_chosen
# post :clean post :clean
# post :series_update post :series_update
# end end
# member do member do
# post :copy post :copy
# post :close_issue post :close_issue
# post :lock_issue post :lock_issue
# end end
# end end
# resources :pull_requests, :path => :pulls, except: [:destroy] do resources :pull_requests, :path => :pulls, except: [:destroy] do
# member do member do
# post :pr_merge post :pr_merge
# # post :check_merge # post :check_merge
# post :refuse_merge post :refuse_merge
# end end
# collection do collection do
# post :check_can_merge post :check_can_merge
# get :create_merge_infos get :create_merge_infos
# get :get_branches get :get_branches
# end end
# end end
# resources :versions, :path => :milestones do resources :versions, :path => :milestones do
# member do member do
# post :update_status post :update_status
# end end
# end end
# resources :members, :path => :collaborators, only: [:index, :create] do resources :members, :path => :collaborators, only: [:index, :create] do
# collection do collection do
# delete :remove delete :remove
# put :change_role put :change_role
# end end
# end end
# resources :hooks resources :hooks
# resources :forks, only: [:create] resources :forks, only: [:create]
# resources :project_trends, :path => :activity, only: [:index, :create] resources :project_trends, :path => :activity, only: [:index, :create]
# resources :issue_tags, :path => :labels, only: [:create, :edit, :update, :destroy, :index] resources :issue_tags, :path => :labels, only: [:create, :edit, :update, :destroy, :index]
# resources :version_releases, :path => :releases, only: [:index,:new, :create, :edit, :update, :destroy] resources :version_releases, :path => :releases, only: [:index,:new, :create, :edit, :update, :destroy]
# scope module: :projects do scope module: :projects do
# scope do scope do
# get( get(
# '/blob/*id/diff', '/blob/*id/diff',
# to: 'blob#diff', to: 'blob#diff',
# constraints: { id: /.+/, format: false }, constraints: { id: /.+/, format: false },
# as: :blob_diff as: :blob_diff
# ) )
# get( get(
# '/blob/*id', '/blob/*id',
# to: 'blob#show', to: 'blob#show',
# constraints: { id: /.+/, format: false }, constraints: { id: /.+/, format: false },
# as: :blob as: :blob
# ) )
# delete( delete(
# '/blob/*id', '/blob/*id',
# to: 'blob#destroy', to: 'blob#destroy',
# constraints: { id: /.+/, format: false } constraints: { id: /.+/, format: false }
# ) )
# put( put(
# '/blob/*id', '/blob/*id',
# to: 'blob#update', to: 'blob#update',
# constraints: { id: /.+/, format: false } constraints: { id: /.+/, format: false }
# ) )
# post( post(
# '/blob/*id', '/blob/*id',
# to: 'blob#create', to: 'blob#create',
# constraints: { id: /.+/, format: false } constraints: { id: /.+/, format: false }
# ) )
# end end
# scope do scope do
# get( get(
# '/raw/*id', '/raw/*id',
# to: 'raw#show', to: 'raw#show',
# constraints: { id: /.+/, format: /(html|js)/ }, constraints: { id: /.+/, format: /(html|js)/ },
# as: :raw as: :raw
# ) )
# end end
# scope do scope do
# get( get(
# '/blame/*id', '/blame/*id',
# to: 'blame#show', to: 'blame#show',
# constraints: { id: /.+/, format: /(html|js)/ }, constraints: { id: /.+/, format: /(html|js)/ },
# as: :blame as: :blame
# ) )
# end end
# scope do scope do
# get( get(
# '/tree/*id', '/tree/*id',
# to: 'tree#show', to: 'tree#show',
# constraints: { id: /.+/, format: /(html|js)/ }, constraints: { id: /.+/, format: /(html|js)/ },
# as: :tree as: :tree
# ) )
# end end
# end end
# end end
# Project Area END # Project Area END
end end
@ -450,47 +397,6 @@ Rails.application.routes.draw do
resources :project_categories resources :project_categories
resources :project_licenses resources :project_licenses
resources :project_ignores resources :project_ignores
resources :banned_users, only: [:index] do
collection do
post :confirm_banned
end
end
resources :apply_destroy, only: :index do
collection do
post :confirm_apply_destroy
end
end
resources :memo_reply_lists, only: :index
resources :memos, only: :index do
collection do
post 'memo_homepage_show'
post 'memo_hidden'
delete 'delete_memo'
end
end
resources :forum_applies do
member do
post :confirm_apply
end
end
# resources :banned_users, only: :index do
# member do
# post :confirm_banned
# end
# end
resources :forum_sections do
member do
get "order_forums"
post "recommend_forums"
post 'move'
end
resources :forum_moderators do
collection do
post "search_user"
end
end
end
resources :major_informations, only: [:index] resources :major_informations, only: [:index]
resources :ec_templates, only: [:index, :destroy] do resources :ec_templates, only: [:index, :destroy] do
collection do collection do
@ -741,30 +647,6 @@ Rails.application.routes.draw do
end end
end end
resources :forums, only: [:index, :new, :edit, :show] do
member do
get "detail"
end
collection do
match '/manage/:id/', :to => 'forums#manage', :via => :get
match '/theme/:id/', :to => 'forums#theme', :via => :get
resources :plates, only: [:show, :index] do
get 'all'
get 'is_fine'
get 'my_memos'
get 'my_topics'
end
resources :categories do
collection do
get 'all', :via => [:get, :post]
get 'guide', :via => [:get, :post]
get 'techShare'
get 'shixun_discuss'
end
end
end
end
#git 认证回调 #git 认证回调
match 'gitauth/*url', to: 'gits#auth', via: :all match 'gitauth/*url', to: 'gits#auth', via: :all

File diff suppressed because one or more lines are too long