From 0efc59e580f815a6b239aa9f95140b40ee980da5 Mon Sep 17 00:00:00 2001 From: XuCheng642 <287102909@qq.com> Date: Thu, 13 Jul 2017 15:05:10 +0800 Subject: [PATCH 01/93] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=20=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 636 ++-- app/views/layouts/base_management.html.erb | 132 +- app/views/managements/departments.html.erb | 0 config/application.rb | 204 +- config/routes.rb | 3649 ++++++++++---------- 5 files changed, 2314 insertions(+), 2307 deletions(-) create mode 100644 app/views/managements/departments.html.erb diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 2a51da85c..f2a621d66 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1,316 +1,320 @@ -# encoding: utf-8 -class ManagementsController < ApplicationController - before_filter :require_admin - layout 'base_management' - include ManagementsHelper - include SortHelper - include UsersHelper - include ApplicationHelper - - # 0 全部;1 活动的; 2 已注册; 3 锁定 - def users - status = params[:user_status].nil? ? 0 : params[:user_status].to_i - condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition] - if 0 == status - if params[:research_condition] == "phone" && params[:research_contents].blank? - @users = User.order("created_on desc").all - else - @users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("created_on desc").all - end - else - if params[:research_condition] == "phone" && params[:research_contents].blank? - @users = User.where(:status => status).order("created_on desc").all - else - @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("created_on desc").all - end - end - - @users_count = @users.count - @limit = 20 - @is_remote = true - @users_pages = Paginator.new @users_count, @limit, params['page'] || 1 - @offset ||= @users_pages.offset - @users = paginateHelper @users, @limit - - respond_to do |format| - format.html - format.js - end - end - - def shixuns - sx_status = params[:status].blank? ? [0, 1, 2, 3] : params[:status].to_i # 搜索实训的状态 - keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/实训名搜索 - search = params[:search] # 搜索的字 - @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] # 排序 - if "u_name" == keyword - # 如果用户搜索为空,不用遍历user表,直接查找所有实训, 有搜索时才查找user - if search.blank? - @shixuns = Shixun.where(:status => sx_status).order("created_at #{@sx_order}") - else - user_id = User.where("concat(lastname, firstname) like '%#{search}%'") - @shixuns = Shixun.where(:user_id => user_id, :status => sx_status).order("created_at #{@sx_order}") - end - else - @shixuns = Shixun.where("name like '%#{search}%'").where(:status => sx_status).order("created_at #{@sx_order}") - end - @edit_sx_num = Shixun.where(:status => 0).count - @audit_sx_num = Shixun.where(:status => 1).count - @publish_sx_num =Shixun.where(:status => 2).count - @close_sx_num = Shixun.where(:status => 3).count - - @shixuns_count = @shixuns.count - limit = 20 - @shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1 - @offset ||= @shixuns_pages.offset - @shixuns = paginateHelper @shixuns, limit - respond_to do |format| - format.js - format.html - end - end - - def users_trial - @menu_type = 6 - @users = User.where(:status => 1).order("created_on desc").all - @users_count = @users.count - @limit = 20 - @is_remote = true - @users_pages = Paginator.new @users_count, @limit, params['page'] || 1 - @offset ||= @users_pages.offset - @users = paginateHelper @users, @limit - - end - - def search_user - -=begin - auth = ApplyUserAuthentication.where(:status => params[:authentication]) - auth_id = auth.blank? ? User.where(:status => 1).id : "(" + auth.map{|a| a.user_id }.join(",") + ")" -=end - - if params[:member_ids] && params[:trial_whether] == "trial_agree" - params[:member_ids].each do |member| - aUser = ApplyAction.where(:user_id => member, :container_type => "TrialAuthorization") - if aUser.blank? - ApplyAction.create(:user_id => member, :container_type => "TrialAuthorization", :status => 1) - else - aUser.update_all(:status => 1) - end - end - elsif params[:member_ids] && params[:trial_whether] == "trial_cancel" - ApplyAction.where(:user_id => params[:member_ids], :container_type => "TrialAuthorization").update_all(:status => 2) - end - - if params[:member_ids] && (params[:occupation] == "occupation_agree" || params[:realname] == "realname_agree") - User.where(:id => params[:member_ids]).update_all(:authentication => true) - elsif params[:member_ids] && (params[:occupation] == "occupation_agree" || params[:realname] == "realname_cancel") - User.where(:id => params[:member_ids]).update_all(:authentication => false) - end - - if params[:trial] == "-1" - apply = ApplyAction.where(:container_type => "TrialAuthorization") - apply_id = apply.blank? ? -1 : "(" + apply.map{|a| a.user_id}.join(",") + ")" - apply_user_id = User.where("id not in #{apply_id} and status = 1").all - apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0] - elsif params[:trial] == "-2" - apply_user_id = User.where(:status => 1).all - apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0] - else - apply = ApplyAction.where(:status => params[:trial]) - apply_user_id = apply.blank? ? [-1] : apply.map{|a| a.user_id}.split(",")[0] - end - - if params[:school] == "" - s_user_id = User.where(:status => 1).all - s_user_id = s_user_id.blank? ? [-1] : s_user_id.map{|s| s.id}.split(",")[0] - else - school = School.where("name like '%#{params[:school]}%'") - school_id = school.blank? ? -1 : school.map{|s| s.id }.split(",")[0] - usr = UserExtensions.where(:school_id => school_id) - s_user_id = usr.blank? ? [-1] : usr.map{|u| u.user_id}.split(",")[0] - end - - if params[:department] == "" - d_user_id = User.where(:status => 1).all - d_user_id = d_user_id.blank? ? [-1] : d_user_id.map{|d| d.id}.split(",")[0] - else - department = Department.where("name like '%#{params[:department]}%'").all - dep_id = department.blank? ? -1 : department.map{|d| d.id}.split(",") - usr = UserExtensions.where(:department_id => dep_id) - d_user_id = usr.blank? ? [-1] : usr.map{|u| u.user_id}.split(",")[0] - end - - user_id = s_user_id & d_user_id & apply_user_id - - if params[:research_condition] == "name" - @users = User.where(:id => user_id).where("concat(lastname, firstname) like '%#{params[:research_contents]}%'").order("created_on desc") - elsif params[:research_condition] == "email" - @users = User.where(:id => user_id).where("mail like '%#{params[:research_contents]}%'").order("created_on desc") - elsif params[:research_condition] == "phone" - if params[:research_contents].blank? - @users = User.where(:id => user_id).order("created_on desc") - else - @users = User.where(:id => user_id).where("phone like '%#{params[:research_contents]}%'").order("created_on desc") - end - - end - - @users_count = @users.count - @limit = 20 - @is_remote = true - @users_pages = Paginator.new @users_count, @limit, params['page'] || 1 - @offset ||= @users_pages.offset - @users = paginateHelper @users, @limit - - respond_to do |format| - format.js - end - end - - def update_webssh - webssh = params[:status] == "true" ? true : false - @shixuns = Shixun.find(params[:shixun_id]) - @shixuns.update_column(:webssh, webssh) - respond_to do |format| - format.js - end - end - - def affirm_cancel_auth - user_id = params[:users] - end - - - def trial_authorization - @menu_type = 9 - search = params[:search] - @status = trial_authorization_status(params[:status]) - # @status = (params[:status].blank? || params[:status] == "0") ? 0 : [1,2] - if search.blank? - @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status).includes(:user) - else - user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'") - @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status, :user_id => user_id).includes(:user) - end - - @autu_count = @authorizations.count - @limit = 15 - @is_remote = true - @autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1 - @offset ||= @autu_pages.offset - @authorizations = paginateHelper @authorizations, @limit - end - - # 批量授权 - def batch_authorization - - end - - # params[:type] 1:拒绝 0:同意 - # authentication 会有一个初始值,不同的值代表不同的权限 - # REDO: 后面权限改了后,一并要改 - def trial_authorization_operation - apply_action = ApplyAction.find(params[:apply_id]) - type = params[:type] - search = params[:search] - if type == "0" - authentication_user = AuthenticationsUsers.where(:user_id => apply_action.user_id).first - if authentication_user.blank? - AuthenticationsUsers.create(:user_id => apply_action.user_id, :authentication_id => 1) - end - end - apply_action.update_attributes(:status => (params[:type] == "1" ? 2 : 1), :reason => params[:reject_reason], :dealer_id => User.current.id) - user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'") - @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user) - respond_to do |format| - format.js - end - end - - def index - - end - - # copy from admin - def identity_authentication - @menu_type = 9 - @type = trial_authorization_status(params[:type]) - type = params[:type] || 0 # 存在type 就用type 没有就为 0 - user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{params[:name]}%'") - @unapproved_user = ApplyUserAuthentication.where(:status => @type, :user_id => user_id).order("updated_at desc") - respond_to do |format| - format.html - format.js - end - end - - # 拒绝身份认证 - # copy from admin - def reject_authentication - apply_user = ApplyUserAuthentication.find(params[:apply_id]) - reason = apply_user.update_attributes(:status => 2, :remarks => params[:reject_reason]) - render :json => {success: reason} - end - - # 统一身份认证 - # copy from admin - def agree_authentication - apply_user = ApplyUserAuthentication.find(params[:apply_id]) - user = User.find(apply_user.user_id) - apply_user.update_attribute(:status, 1) - user.update_attribute(:authentication, true) - @unapproved_user = ApplyUserAuthentication.where(:status => 0).order("updated_at desc") - respond_to do |format| - format.js - end - end - - def shixun_authorization - @type = trial_authorization_status params[:type] - @authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type).order("created_at desc") - search = params[:search] - unless search.blank? - @authorizations = @authorizations.where(:container_id => Shixun.where(:id => @authorizations.map(&:container_id)).where("name like '%#{search}%'").map(&:id)).order("created_at desc") - end - - @authorizations_count = @authorizations.count - @limit = 15 - @is_remote = true - @authorizations_pages = Paginator.new @authorizations_count, @limit, params['page'] || 1 - @offset ||= @authorizations_pages.offset - @authorizations = paginateHelper @authorizations, @limit - respond_to do |format| - format.js - format.html - end - end - - def deal_shixun_authorization - apply_action = ApplyAction.find(params[:apply_id]) - type = params[:type].to_i - shixun = Shixun.find apply_action.container_id - if type == 0 - shixun.update_column('status', 0) - apply_action.update_attributes(:status => 2, :reason => params[:reject_reason], :dealer_id => User.current.id) - notes = "您所在团队提交的项目实训发布申请:#{shixun.name},审核未通过。
原因:#{params[:reject_reason]}" - shixun.shixun_members.each do |member| - JournalsForMessage.create(:jour_id => member.user_id, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0) - end - else - shixun.update_column('status', 2) - apply_action.update_attributes(:status => 1, :dealer_id => User.current.id) - shixun_modify_status_without_publish shixun, 1 - end - @authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => 0) - @authorizations_count = @authorizations.count - @limit = 15 - @is_remote = true - @authorizations_pages = Paginator.new @authorizations_count, @limit, params['page'] || 1 - @offset ||= @authorizations_pages.offset - @authorizations = paginateHelper @authorizations, @limit - respond_to do |format| - format.js - end - end -end +# encoding: utf-8 +class ManagementsController < ApplicationController + before_filter :require_admin + layout 'base_management' + include ManagementsHelper + include SortHelper + include UsersHelper + include ApplicationHelper + + def departments + + end + + # 0 全部;1 活动的; 2 已注册; 3 锁定 + def users + status = params[:user_status].nil? ? 0 : params[:user_status].to_i + condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition] + if 0 == status + if params[:research_condition] == "phone" && params[:research_contents].blank? + @users = User.order("created_on desc").all + else + @users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("created_on desc").all + end + else + if params[:research_condition] == "phone" && params[:research_contents].blank? + @users = User.where(:status => status).order("created_on desc").all + else + @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("created_on desc").all + end + end + + @users_count = @users.count + @limit = 20 + @is_remote = true + @users_pages = Paginator.new @users_count, @limit, params['page'] || 1 + @offset ||= @users_pages.offset + @users = paginateHelper @users, @limit + + respond_to do |format| + format.html + format.js + end + end + + def shixuns + sx_status = params[:status].blank? ? [0, 1, 2, 3] : params[:status].to_i # 搜索实训的状态 + keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/实训名搜索 + search = params[:search] # 搜索的字 + @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] # 排序 + if "u_name" == keyword + # 如果用户搜索为空,不用遍历user表,直接查找所有实训, 有搜索时才查找user + if search.blank? + @shixuns = Shixun.where(:status => sx_status).order("created_at #{@sx_order}") + else + user_id = User.where("concat(lastname, firstname) like '%#{search}%'") + @shixuns = Shixun.where(:user_id => user_id, :status => sx_status).order("created_at #{@sx_order}") + end + else + @shixuns = Shixun.where("name like '%#{search}%'").where(:status => sx_status).order("created_at #{@sx_order}") + end + @edit_sx_num = Shixun.where(:status => 0).count + @audit_sx_num = Shixun.where(:status => 1).count + @publish_sx_num =Shixun.where(:status => 2).count + @close_sx_num = Shixun.where(:status => 3).count + + @shixuns_count = @shixuns.count + limit = 20 + @shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1 + @offset ||= @shixuns_pages.offset + @shixuns = paginateHelper @shixuns, limit + respond_to do |format| + format.js + format.html + end + end + + def users_trial + @menu_type = 6 + @users = User.where(:status => 1).order("created_on desc").all + @users_count = @users.count + @limit = 20 + @is_remote = true + @users_pages = Paginator.new @users_count, @limit, params['page'] || 1 + @offset ||= @users_pages.offset + @users = paginateHelper @users, @limit + + end + + def search_user + +=begin + auth = ApplyUserAuthentication.where(:status => params[:authentication]) + auth_id = auth.blank? ? User.where(:status => 1).id : "(" + auth.map{|a| a.user_id }.join(",") + ")" +=end + + if params[:member_ids] && params[:trial_whether] == "trial_agree" + params[:member_ids].each do |member| + aUser = ApplyAction.where(:user_id => member, :container_type => "TrialAuthorization") + if aUser.blank? + ApplyAction.create(:user_id => member, :container_type => "TrialAuthorization", :status => 1) + else + aUser.update_all(:status => 1) + end + end + elsif params[:member_ids] && params[:trial_whether] == "trial_cancel" + ApplyAction.where(:user_id => params[:member_ids], :container_type => "TrialAuthorization").update_all(:status => 2) + end + + if params[:member_ids] && (params[:occupation] == "occupation_agree" || params[:realname] == "realname_agree") + User.where(:id => params[:member_ids]).update_all(:authentication => true) + elsif params[:member_ids] && (params[:occupation] == "occupation_agree" || params[:realname] == "realname_cancel") + User.where(:id => params[:member_ids]).update_all(:authentication => false) + end + + if params[:trial] == "-1" + apply = ApplyAction.where(:container_type => "TrialAuthorization") + apply_id = apply.blank? ? -1 : "(" + apply.map{|a| a.user_id}.join(",") + ")" + apply_user_id = User.where("id not in #{apply_id} and status = 1").all + apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0] + elsif params[:trial] == "-2" + apply_user_id = User.where(:status => 1).all + apply_user_id = apply_user_id.blank? ? [-1] : apply_user_id.map{|a| a.id}.split(",")[0] + else + apply = ApplyAction.where(:status => params[:trial]) + apply_user_id = apply.blank? ? [-1] : apply.map{|a| a.user_id}.split(",")[0] + end + + if params[:school] == "" + s_user_id = User.where(:status => 1).all + s_user_id = s_user_id.blank? ? [-1] : s_user_id.map{|s| s.id}.split(",")[0] + else + school = School.where("name like '%#{params[:school]}%'") + school_id = school.blank? ? -1 : school.map{|s| s.id }.split(",")[0] + usr = UserExtensions.where(:school_id => school_id) + s_user_id = usr.blank? ? [-1] : usr.map{|u| u.user_id}.split(",")[0] + end + + if params[:department] == "" + d_user_id = User.where(:status => 1).all + d_user_id = d_user_id.blank? ? [-1] : d_user_id.map{|d| d.id}.split(",")[0] + else + department = Department.where("name like '%#{params[:department]}%'").all + dep_id = department.blank? ? -1 : department.map{|d| d.id}.split(",") + usr = UserExtensions.where(:department_id => dep_id) + d_user_id = usr.blank? ? [-1] : usr.map{|u| u.user_id}.split(",")[0] + end + + user_id = s_user_id & d_user_id & apply_user_id + + if params[:research_condition] == "name" + @users = User.where(:id => user_id).where("concat(lastname, firstname) like '%#{params[:research_contents]}%'").order("created_on desc") + elsif params[:research_condition] == "email" + @users = User.where(:id => user_id).where("mail like '%#{params[:research_contents]}%'").order("created_on desc") + elsif params[:research_condition] == "phone" + if params[:research_contents].blank? + @users = User.where(:id => user_id).order("created_on desc") + else + @users = User.where(:id => user_id).where("phone like '%#{params[:research_contents]}%'").order("created_on desc") + end + + end + + @users_count = @users.count + @limit = 20 + @is_remote = true + @users_pages = Paginator.new @users_count, @limit, params['page'] || 1 + @offset ||= @users_pages.offset + @users = paginateHelper @users, @limit + + respond_to do |format| + format.js + end + end + + def update_webssh + webssh = params[:status] == "true" ? true : false + @shixuns = Shixun.find(params[:shixun_id]) + @shixuns.update_column(:webssh, webssh) + respond_to do |format| + format.js + end + end + + def affirm_cancel_auth + user_id = params[:users] + end + + + def trial_authorization + @menu_type = 9 + search = params[:search] + @status = trial_authorization_status(params[:status]) + # @status = (params[:status].blank? || params[:status] == "0") ? 0 : [1,2] + if search.blank? + @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status).includes(:user) + else + user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'") + @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status, :user_id => user_id).includes(:user) + end + + @autu_count = @authorizations.count + @limit = 15 + @is_remote = true + @autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1 + @offset ||= @autu_pages.offset + @authorizations = paginateHelper @authorizations, @limit + end + + # 批量授权 + def batch_authorization + + end + + # params[:type] 1:拒绝 0:同意 + # authentication 会有一个初始值,不同的值代表不同的权限 + # REDO: 后面权限改了后,一并要改 + def trial_authorization_operation + apply_action = ApplyAction.find(params[:apply_id]) + type = params[:type] + search = params[:search] + if type == "0" + authentication_user = AuthenticationsUsers.where(:user_id => apply_action.user_id).first + if authentication_user.blank? + AuthenticationsUsers.create(:user_id => apply_action.user_id, :authentication_id => 1) + end + end + apply_action.update_attributes(:status => (params[:type] == "1" ? 2 : 1), :reason => params[:reject_reason], :dealer_id => User.current.id) + user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'") + @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user) + respond_to do |format| + format.js + end + end + + def index + + end + + # copy from admin + def identity_authentication + @menu_type = 9 + @type = trial_authorization_status(params[:type]) + type = params[:type] || 0 # 存在type 就用type 没有就为 0 + user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{params[:name]}%'") + @unapproved_user = ApplyUserAuthentication.where(:status => @type, :user_id => user_id).order("updated_at desc") + respond_to do |format| + format.html + format.js + end + end + + # 拒绝身份认证 + # copy from admin + def reject_authentication + apply_user = ApplyUserAuthentication.find(params[:apply_id]) + reason = apply_user.update_attributes(:status => 2, :remarks => params[:reject_reason]) + render :json => {success: reason} + end + + # 统一身份认证 + # copy from admin + def agree_authentication + apply_user = ApplyUserAuthentication.find(params[:apply_id]) + user = User.find(apply_user.user_id) + apply_user.update_attribute(:status, 1) + user.update_attribute(:authentication, true) + @unapproved_user = ApplyUserAuthentication.where(:status => 0).order("updated_at desc") + respond_to do |format| + format.js + end + end + + def shixun_authorization + @type = trial_authorization_status params[:type] + @authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type).order("created_at desc") + search = params[:search] + unless search.blank? + @authorizations = @authorizations.where(:container_id => Shixun.where(:id => @authorizations.map(&:container_id)).where("name like '%#{search}%'").map(&:id)).order("created_at desc") + end + + @authorizations_count = @authorizations.count + @limit = 15 + @is_remote = true + @authorizations_pages = Paginator.new @authorizations_count, @limit, params['page'] || 1 + @offset ||= @authorizations_pages.offset + @authorizations = paginateHelper @authorizations, @limit + respond_to do |format| + format.js + format.html + end + end + + def deal_shixun_authorization + apply_action = ApplyAction.find(params[:apply_id]) + type = params[:type].to_i + shixun = Shixun.find apply_action.container_id + if type == 0 + shixun.update_column('status', 0) + apply_action.update_attributes(:status => 2, :reason => params[:reject_reason], :dealer_id => User.current.id) + notes = "您所在团队提交的项目实训发布申请:#{shixun.name},审核未通过。
原因:#{params[:reject_reason]}" + shixun.shixun_members.each do |member| + JournalsForMessage.create(:jour_id => member.user_id, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0) + end + else + shixun.update_column('status', 2) + apply_action.update_attributes(:status => 1, :dealer_id => User.current.id) + shixun_modify_status_without_publish shixun, 1 + end + @authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => 0) + @authorizations_count = @authorizations.count + @limit = 15 + @is_remote = true + @authorizations_pages = Paginator.new @authorizations_count, @limit, params['page'] || 1 + @offset ||= @authorizations_pages.offset + @authorizations = paginateHelper @authorizations, @limit + respond_to do |format| + format.js + end + end +end diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index ed3988cdf..65653d717 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -1,65 +1,67 @@ - - - - - <%= h html_title %> - - - <%= csrf_meta_tag %> - <%= favicon %> - <%= javascript_heads %> - <%= heads_for_theme %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/edu-common', 'css/edu-public', 'css/font-awesome', 'css/edu-popup', 'css/magic-check', "css/edu-admin" %> - <%= javascript_include_tag "edu/application",'edu/base_edu', 'baiduTemplate', 'jquery.datetimepicker.js', "edu/management" %> - <%= call_hook :view_layouts_base_html_head %> - <%= yield :header_tags -%> - - -
-
- <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %> -
-
-
-
    -
  • 主页
  • -
  • 课堂+
  • -
  • - <%= link_to "实训+", shixuns_managements_path, :class => "edu-admin-nav-a" %> -
  • -
  • 竞赛+
  • -
  • 单位
  • -
  • 用户 -
      -
    • <%= link_to "用户列表", users_managements_path %>
    • -
    • <%= link_to "试用授权列表", users_trial_managements_path %>
    • -
    -
  • -
  • 消息
  • -
  • 留言
  • -
  • 审批 -
      -
    • <%= link_to "身份认证", :controller => "managements", :action => "identity_authentication" %>
    • -
    • <%= link_to "试用授权", :controller => "managements", :action => "trial_authorization" %>
    • -
    • <%= link_to '实训发布', shixun_authorization_managements_path %>
    • -
    -
  • -
  • 工程认证+
  • -
  • 其它
  • -
- <%= render_flash_messages %> - <%= yield %> - <%= call_hook :view_layouts_base_content %> -
-
-
-
- <%= render :partial => 'layouts/footer' %> -
-
- - - - + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= javascript_heads %> + <%= heads_for_theme %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/edu-common', 'css/edu-public', 'css/font-awesome', 'css/edu-popup', 'css/magic-check', "css/edu-admin" %> + <%= javascript_include_tag "edu/application",'edu/base_edu', 'baiduTemplate', 'jquery.datetimepicker.js', "edu/management" %> + <%= call_hook :view_layouts_base_html_head %> + <%= yield :header_tags -%> + + +
+
+ <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %> +
+
+
+
    +
  • 主页
  • +
  • 课堂+
  • +
  • + <%= link_to "实训+", shixuns_managements_path, :class => "edu-admin-nav-a" %> +
  • +
  • 竞赛+
  • +
  • + <%= link_to "单位", departments_managements_path, :class => "edu-admin-nav-a" %> +
  • +
  • 用户 +
      +
    • <%= link_to "用户列表", users_managements_path %>
    • +
    • <%= link_to "试用授权列表", users_trial_managements_path %>
    • +
    +
  • +
  • 消息
  • +
  • 留言
  • +
  • 审批 +
      +
    • <%= link_to "身份认证", :controller => "managements", :action => "identity_authentication" %>
    • +
    • <%= link_to "试用授权", :controller => "managements", :action => "trial_authorization" %>
    • +
    • <%= link_to '实训发布', shixun_authorization_managements_path %>
    • +
    +
  • +
  • 工程认证+
  • +
  • 其它
  • +
+ <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
+
+
+
+ <%= render :partial => 'layouts/footer' %> +
+
+ + + + diff --git a/app/views/managements/departments.html.erb b/app/views/managements/departments.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/config/application.rb b/config/application.rb index 88c6a43df..df2c8d893 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,102 +1,102 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' -require 'sprockets/railtie' -require 'elasticsearch/model' - -if defined?(Bundler) - # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) - # If you want your assets lazily compiled in production, use this line - # Bundler.require(:default, :assets, Rails.env) -end - -module RedmineApp - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - #verifier if email is real - - - config.generators do |g| - g.test_framework :rspec, - fixtures: true, - view_specs: false, - helper_specs: false, - routing_specs: false, - controller_specs: true, - request_specs: false - g.fixture_replacement :factory_girl, dir: "spec/factories" - end - # Custom directories with classes and modules you want to be autoloadable. - config.autoload_paths += %W(#{config.root}/lib) - config.autoload_paths += %w(#{RAILS_ROOT}/app/sweepers) - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - config.active_record.observers = :journals_for_message_observer, :issue_observer, :journal_observer, :wiki_content_observer - - config.active_record.store_full_sti_class = true - config.active_record.default_timezone = :local - config.time_zone = 'Beijing' - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - config.i18n.default_locale = :zh - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - #disable [deprecated] I18n.enforce_available_locales will default to true in the future. - # If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false - # to avoid this message. - I18n.config.enforce_available_locales = false - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # Enable the asset pipeline - config.assets.enabled = false - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' - config.assets.digest = true - - config.action_mailer.perform_deliveries = false - - # Do not include all helpers - config.action_controller.include_all_helpers = false - - config.action_view.sanitized_allowed_tags = 'div', 'p', 'span', 'img', 'embed' - - config.middleware.use Rack::Cors do - allow do - origins '*' - # location of your API - resource '/api/*', :headers => :any, :methods => [:get, :post, :options, :put] - end - end - - - config.wechat_srcs = ['app.js','others/factory.js','others/filter.js', 'controllers/*.js', 'directives/*.js', 'others/routes.js'] - - config.before_initialize do - config.middleware.use ::ResponseIp - end - - config.after_initialize do - end - - if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) - instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb')) - end - - end -end +require File.expand_path('../boot', __FILE__) + +require 'rails/all' +require 'sprockets/railtie' +require 'elasticsearch/model' + +if defined?(Bundler) + # If you precompile assets before deploying to production, use this line + Bundler.require(*Rails.groups(:assets => %w(development test))) + # If you want your assets lazily compiled in production, use this line + # Bundler.require(:default, :assets, Rails.env) +end + +module RedmineApp + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + #verifier if email is real + + + config.generators do |g| + g.test_framework :rspec, + fixtures: true, + view_specs: false, + helper_specs: false, + routing_specs: false, + controller_specs: true, + request_specs: false + g.fixture_replacement :factory_girl, dir: "spec/factories" + end + # Custom directories with classes and modules you want to be autoloadable. + config.autoload_paths += %W(#{config.root}/lib) + config.autoload_paths += %w(#{RAILS_ROOT}/app/sweepers) + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + config.active_record.observers = :journals_for_message_observer, :issue_observer, :journal_observer, :wiki_content_observer + + config.active_record.store_full_sti_class = true + config.active_record.default_timezone = :local + config.time_zone = 'Beijing' + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + config.i18n.default_locale = :zh + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + #disable [deprecated] I18n.enforce_available_locales will default to true in the future. + # If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false + # to avoid this message. + # I18n.config.enforce_available_locales = false + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable the asset pipeline + config.assets.enabled = false + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + config.assets.digest = true + + config.action_mailer.perform_deliveries = false + + # Do not include all helpers + config.action_controller.include_all_helpers = false + + config.action_view.sanitized_allowed_tags = 'div', 'p', 'span', 'img', 'embed' + + config.middleware.use Rack::Cors do + allow do + origins '*' + # location of your API + resource '/api/*', :headers => :any, :methods => [:get, :post, :options, :put] + end + end + + + config.wechat_srcs = ['app.js','others/factory.js','others/filter.js', 'controllers/*.js', 'directives/*.js', 'others/routes.js'] + + config.before_initialize do + config.middleware.use ::ResponseIp + end + + config.after_initialize do + end + + if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) + instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb')) + end + + end +end diff --git a/config/routes.rb b/config/routes.rb index 1d2717517..a763e7d05 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,1824 +1,1825 @@ -# Redmine - project management software -# Copyright (C) 2006-2013 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write tobthe Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# modified by longjun -# 统一route风格 -# match 'path', :to => 'controller#action' -# 如果 path = controller#action 则 match 'path' -# Example: -# match 'welcome/course', :to => 'welcome#course' 变成 -# match 'welcome/cource' -# 所有的 act: :act 变成 :act => :act -# Example: :via => :get ====> :via => :get - -RedmineApp::Application.routes.draw do - mount Mobile::API => '/api' - - resources :mark_down do - - end - - resources :subjects do - member do - - end - - collection do - get 'create_subject' - get 'new_subject' - end - end - - resources :shixuns do - member do - get 'game_webssh' - get 'shixun_test' - get 'delete_shixun_test' - get 'statistics' - get 'propaedeutics' - post 'update_propaedeutics' - get 'collaborators' - delete 'collaborators_delete' - match 'add_collaborators', :via => [:get, :post] - post 'shixun_members_added' - get 'shixun_monitor' - get 'autocompletion' - get 'shixun_exec' - post 'add_script' - post 'shixun_members' - get 'settings(/:tab)', :action => 'settings', :as => 'settings' - get 'shixun_job_create' - get 'shixun_job_update' - get 'rep_tree_changes', :action => 'rep_tree_changes', :as => 'rep_tree_changes' - match 'publish', :via => [:get, :post] - get 'apply_publish' - get 'cancel_publish' - get 'close' - get 'operation' - get 'entry_edit' - match 'entry_update' - end - collection do - get 'shixun_courses' - match 'search', :via => [:get, :post] - end - - resources :challenges do - member do - match 'challenge_build', :via => [:get, :post] - match 'game_build_result', :via => [:get, :post] - get 'index_up' - get 'index_down' - end - end - - resources :repositories, :shallow => true, :except => [:index, :show] do - member do - match 'committers', :via => [:get, :post] - end - end - end - - resources :myshixuns do - member do - match 'myshixun_reset', :via => [:get, :post] - get 'open_webssh' - get 'close_webssh' - end - collection do - match 'training_task_status', :via => [:get, :post] - end - resources :games, :path => "stages" do - member do - match 'game_build', :via => [:get, :post] - match 'next_step', :via => [:get, :post] - match 'reset_original_code', :via => [:get, :post] - match 'reset_new_code', :via => [:get, :post] - get 'entry' - get 'outputs_show' - get 'game_status' - get 'change_status' - post 'file_update' - get 'file_edit' - get 'answer' - get 'minus_score' - get 'refresh_game_list' - get 'waiting_info' - end - end - end - - resources :managements do - collection do - match 'shixuns', :via => [:get, :post] - get 'approve' - get 'trial_authorization', :as => 'trial_authorization' - get 'shixun_authorization' - get 'deal_shixun_authorization' - get 'batch_authorization', :as => 'batch_authorization' - match 'search_user', :via => [:get, :post] - match 'affirm_cancel_auth', :via => [:get, :post] - get 'identity_authentication', :as => 'identity_authentication' - match 'trial_authorization_operation', :as => 'trial_authorization_operation' - get 'reject_authentication' - get 'agree_authentication' - match 'users', :via => [:get, :post] - get 'users_trial' - match 'users_authorization_agree' - match 'users_authorization_cancel' - get 'update_webssh' - end - end - # Enable Grack support - # mount Trustie::Grack.new, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post] - - constraints(Subdomain.new) do - get '/', to: 'organizations#show' - end - - constraints(Subdomain.new(sub: true)) do - get '/:sub_dir_name', to: 'fake#fake' - end - - resources :shield_wechat_messages do - collection do - delete 'show_messages' - end - end - resources :shield_activities do - collection do - delete 'show_acts' - end - end - resources :organizations do - resource :files do - member do - - end - collection do - - end - end - resources :org_document_comments do - member do - - end - collection do - - end - end - member do - get 'edit' - get 'setting'#, :action => 'settings', :as => 'settings' - get 'clear_org_avatar_temp' - put 'set_homepage' - put 'cancel_homepage' - get 'members' - get 'more_org_submains' - get 'more_org_projects' - get 'more_org_courses' - get 'search_courses' - get 'teachers' - get 'students' - get 'projects' - get 'courses' - get 'acts' - post 'join_course_menu' - post 'join_courses' - get 'search_projects' - post 'join_project_menu' - post 'join_projects' - post 'logout' - post 'apply_subdomain' - get 'org_resources_subfield' - get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_org_subfield' - end - collection do - get 'check_uniq' - get 'check_uniq_domain' - get 'autocomplete_search' - post 'hide_org_subfield' - post 'show_org_subfield' - post 'set_excellent_teacher' - post 'set_excellent_student' - post 'reset_excellent_teacher' - post 'reset_excellent_student' - post 'agree_apply_subdomain' - post 'refused_apply_subdomain' - post 'update_field_by_admin' - post 'reset_update_field_by_admin' - end - end - - - - - resources :org_member do - member do - - end - collection do - get 'org_member_autocomplete' - get 'org_member_paging' - get 'deleteOrgMember' - end - end - - resources :org_subfields do - resources :files, :only => [:index, :new, :create] do - collection do - match "getattachtype", :via => [:get, :post] - match "search_files_in_subfield",:via => [:post,:get] - match "searchone4reload",:via => [:post,:get] - match "search_org_subfield_tag_attachment", :via => [:post,:get] - match "subfield_upload_file", :via => :post - end - member do - match "quote_resource_show_org_subfield", :via => [:get] - get "update_file_description" - post "edit_file_description" - end - end - - resources :sub_domains, :only => [:index, :new, :create, :show, :update, :destroy] do - resources :sub_document_comments, :only => [:index, :new, :create, :show, :update, :destroy, :edit] do - member do - post 'add_reply' - get 'quote' - post 'reply' - post 'add_reply_in_doc' - delete 'delete_reply' - match 'edit' - end - collection do - end - end - - collection do - end - member do - match 'domain_update_sub_dir', :via => [:put] - match 'domain_update_priority', :via => [:put] - match 'domain_update_status', :via => [:post] - post 'hide_sub_domain' - post 'show_sub_domain' - end - end - - member do - match 'update_sub_dir', :via => [:put] - match 'update_priority', :via => [:put] - match 'update_status', :via => [:post] - end - resource :boards - end - - resources :org_document_comments do - member do - post 'add_reply' - get 'quote' - post 'reply' - post 'add_reply_in_doc' - delete 'delete_reply' - end - collection do - - end - end - - resources :org_projects do - member do - - end - collection do - - end - end - - resources :org_courses do - member do - - end - collection do - - end - end - #match '/organizations/:organization_id/org_document_comments/new', :to => 'org_document_comments#new', :as => 'new_org_documents', :via => [:get, :post] - #match '/organizations/:organization_id/org_document_comments/create', :to => 'org_document_comments#create', :as => 'create_org_documents', :via => [:post] - resources :homework_users - resources :no_uses - delete 'no_uses', :to => 'no_uses#delete' - match 'site_search', :to => 'users#site_search', :as => 'site_search', :via => [:get, :post, :put] - resources :apply_project_masters - delete 'apply_project_masters', :to => 'apply_project_masters#delete' - - resources :comments do - member do - post 'reply' - get 'quote' - end - end - # resources :organization, :except => [:show] do - # - # end - - resources :school, :except => [:show] do - collection do - get 'apply_add_school' - get 'search_repeat_schoolname' - end - - member do - get 'upload_logo' - post 'upload' - get 'edit_apply_name' - get 'edit_apply_address' - get 'edit_apply_province' - end - end - - resources :department do - collection do - post 'search_repeat_departmentname' - post 'apply_add_department' - post 'on_search' - end - - member do - - end - end - - resources :homework_attach do - collection do - get 'get_homework_member_list' - match 'addjours', :via => [:get, :post] - match 'add_jour_reply', :via => [:get,:post] - match 'destroy_jour', :via => [:get,:post] - match 'comprehensive_evaluation_jour', :via => [:get,:post] - get 'get_not_batch_homework' - get 'get_batch_homeworks' - get 'get_homeworks' - get 'get_homework_jours' - get 'get_student_batch_homework' - get 'get_my_homework' - end - member do - match 'add_homework_users', :via => [:get,:post] - match 'destory_homework_users', :via => [:get,:post] - get 'praise_homework' - end - end - - resources :poll do - member do - get 'statistics_result' - post 'commit_answer' - post 'create_poll_question' - post 'commit_poll' - get 'publish_poll' - get 'save_poll' - get 'republish_poll' - get 'poll_result' - get 'close_poll' - get 'export_poll' - get 'import_poll' - post 'update_question_num' - end - collection do - delete 'delete_poll_question' - post 'update_poll_question' - get 'other_poll' - post 'import_other_poll' - end - end - - #show、index、new、create、edit、update、destroy路由自动生成 - resources :exercise do - member do #生成路径为 /exercise/:id/方法名 - get 'statistics_result' - get 'student_exercise_list' - get 'export_exercise' - get 'publish_exercise' - get 'republish_exercise' - get 'show_student_result' - post 'create_exercise_question' - post 'commit_answer' - get 'commit_exercise' - post 'update_question_num' - post 'send_to_course' - get 'get_student_uncomplete_question' - post 'edit_question_score' - end - - collection do #生成路径为 /exercise/方法名 - get 'delete_exercise_question' - post 'update_exercise_question' - get 'other_exercise' - post 'import_other_exercise' - get 'search_exercises' - get 'search_courses' - end - end - - resources :homework_common, :except => [:show]do - member do - get 'start_anonymous_comment' - get 'stop_anonymous_comment' - get 'alert_anonymous_comment' - get 'alert_forbidden_anonymous_comment' - get 'alert_open_student_works' - get 'open_student_works' - get 'start_evaluation_set' - get 'score_rule_set' - post 'set_evaluation_attr' - get 'alert_score_open_modal' - post 'set_score_open' - get 'add_to_homework_bank' - get 'publish_homework' - get 'setting' - post 'homework_setting' - get 'set_public' - end - - collection do - match 'shixuns' - post 'next_step' - post 'programing_test' - end - end - - - resources :homework_bank do - member do - get 'set_public' - end - - collection do - match 'shixuns' - post 'destroy_all' - match 'choose_user_course' - post 'send_h_bank_to_course' - end - end - - resources :student_work do - member do - post 'add_score' - post 'revise_attachment' - get 'retry_work' - get 'add_comments_to_work' - get 'praise_student_work' - get 'forbidden_anonymous_comment' - get 'hide_score_detail' - get 'destroy_score' - end - collection do - post 'add_score_reply' - post 'student_work_project' - post 'change_project' - get 'new_student_work_project' - get 'search_user_projects' - get 'search_course_students' - get 'cancel_relate_project' - get 'delete_work' - get 'destroy_score_reply' - get 'student_work_absence_penalty' - get 'absence_penalty_list' - get 'evaluation_list' - # post 'set_program_score' - post 'program_test_ex' - post 'code_repeattest' - post 'last_codecomparetime' - post 'set_score_rule' - get 'work_canrepeat' - get 'get_user_infor' - post 'add_group_member' - post 'appeal_anonymous_score' - get 'alert_appeal_box' - get 'delete_score_comment' - get 'deal_appeal_score' - get 'relate_myshixun' - end - end - - resources :open_source_projects do - collection do - match 'search', :via => [:get, :post] - match 'remove_condition', :via => [:get, :post] - match 'allbug', :via => [:get, :post] - end - resources :relative_memos - member do - match 'master_apply', :via => [:get, :post] - match 'accept_master_apply', :via => [:get, :post] - match 'refuse_master_apply', :via => [:get, :post] - match 'showmemo', :via => [:get, :post] - match 'showbug', :via => [:get, :post] - end - end - - - mount SeemsRateable::Engine => '/rateable', :as => :rateable - - namespace :zipdown do - match 'assort' - match 'download_user_homework', :as => :download_user_homework - match 'download' - end - namespace :test do - match 'courselist' - match 'zip' - match 'mailer' - match 'view_office' - end - ##new added by linchun #以发布应用的形式参与竞赛 - resources :softapplications do - - collection do - match 'new_message', :via => :get - match 'search', :via => [:get, :post] - end - member do - match 'create_message' , :via => :post - end - end - - # ## new added by linchun #新竞赛相关 - # resources :contests, only: [:index] do - # resources :contestnotifications do - # # get 'preview', on: :collection - # resources :notificationcomments - # end - # - # collection do - # match 'new_contest' , :via => :get - # match 'join_in_contest' , :via => :post - # match 'unjoin_in_contest' , :via => :delete - # match 'create_contest' , :via => :post - # match 'new_join' , :via => :post - # match 'new' , :via => :post - # end - # member do - # delete 'destroy_contest' - # match 'add_softapplication' - # match 'update_contest' , :via => [:put] - # match 'show_contest' , :via => [:get, :post] - # match 'show_project' , :via => :get - # match 'show_softapplication' , :via => :get - # match 'show_attendingcontest' , :via => :get - # #match 'show_notification' , :via => :get - # match 'show_participator' , :via => :get - # match 'set_reward_project' , :via => [:get, :post] - # match 'set_reward_softapplication' , :via => [:get, :post] - # match 'add' , :via => [:get, :post] - # match 'add_softapplication' , :via => [:get, :post] - # match 'create' , :via => :post - # match 'settings' , :via => [:get, :post] - # match 'show_contest_user' - # get 'watcherlist', :action=> 'watcherlist' - # end - # end - - match '/news/preview', :to => 'previews#news', :as => 'preview_news', :via => [:get, :post, :put] - match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] - match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put] - match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put] - - resources :stores do - collection do - match 'search', :via => [:get, :post] - get 'lost_file' - end - end - - resources :forums do - collection do - match 'search_forum', :via => [:get, :post] - match 'check_forum_name',:via => [:get] - end - member do - post 'create_memo' - post 'create_feedback' - post 'mail_feedback' - post 'update_memo_description' - match 'search_memo', :via => [:get, :post] - match 'delete_forum_tag',:via =>[:get] - match 'add_forum_tag',:via=>[:get] - end - resources :memos do - collection do - get "quote" - end - member do - get "change_sticky" - end - end - end - - resources :cooperation do - collection do - - end - end - - resources :shares - - #added by william - get "tags/index" - - get "tags/show" - - get "praise_tread/praise_plus" - get "praise_tread/praise_minus" - - get "praise_tread/tread_plus" - #end - - root :to => 'welcome#index', :as => 'home' - # added by longjun - match 'welcome/contest', :via => :get - # end longjun - - #added by nie - match '/projects/search', :via => [:get, :post] - match '/users/search', :via => [:get, :post] - #end - - # 消息相关路由 - resources :system_messages do - collection do - post 'create', :as => 'system_messages' - get 'index', :as => 'index' - end - end - # match 'system_messages/index', to: 'system_messages#index', :via => :get, :as => 'system_messages' - - match 'account/heartbeat', to: 'account#heartbeat', :via => :get - match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post] - match 'user_join', :to => 'account#user_join', :as => 'user_join', :via => [:get, :post] - match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post] - match 'agreement',:to => 'account#agreement',:as => 'agreement',:via=>[:get] - match 'about_us',:to=>'account#about_us',:as=>'about_us',:via=>[:get] - match 'account/register',:to=>'account#register', :via => [:get, :post], :as => 'register' - match 'account/lost_password', :via => [:get, :post], :as => 'lost_password' - match 'account/activate', :via => :get - match 'account/valid_ajax', :via => :get - match 'account/valid_psd', :via => :post - match 'account/valid_register_user', :via => :get - match 'account/valid_verification_code', :via => :get - match 'account/get_verification_code', :via => :get - match 'account/change_email', :via => :get - match 'account/wechat_bind', :via => [:get, :post] - match 'account/reset_psd', :via => [:get, :post] - match 'account/email_valid', :to => 'account#email_valid', :via => :get - match 'account/resendmail', :to => 'account#resendmail', :via=> :get, :as => 'resendmail' - match 'account/avatar', :to => 'account#avatar', :via => :get, :as => "avatar_account" - match 'account/authentication', :to => 'account#authentication', :via => :get, :as => "authentication_account" - match 'account/apply_trail', :to => 'account#apply_trail', :via => :get, :as => "apply_trail_account" - match 'account/user_auth', :to => 'account#user_auth', :via => :get, :as => "user_auth_account" - match 'account/security_settings', :to => 'account#security_settings', :via => :get, :as => "security_settings" - match 'account/change_psd', :to => 'account#change_psd', :via => :get, :as => "change_psd" - match 'account/change_or_bind', :to => 'account#change_or_bind', :via => :get, :as => "change_or_bind" - match 'account/bind_email_or_phone', :to => 'account#bind_email_or_phone', :via => :post, :as => "bind_email_or_phone" - match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post - match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] - - #激活邮箱反馈问题 - match 'users/:id/leave_email_activation_message', :to => 'words#leave_email_activation_message', :via => :post, :as => "leave_email_activation_message" - - # boards - match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message' - match 'boards/:id/join_to_org_subfields', :to => 'boards#join_to_org_subfields' - match 'boards/:id/update_position', :to => 'boards#update_position', :via => :post - match 'boards/:id/update_boards_position', :to => 'boards#update_boards_position', :via => :post - match 'boards/:id/update_name', :to => 'boards#update_name', :via => :put - match 'boards/:id/update_boards_name', :to => 'boards#update_boards_name', :via => :put - get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' - match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] - get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit',:as=>'edit_board_message' - - post 'boards/:board_id/topics/preview', :to => 'messages#preview', :as => 'preview_board_message' - post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' - post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' - post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy',:as=>'delete_board_message' - match 'messages/join_org_subfield', :to => 'messages#join_org_subfield' - match 'messages/get_subfield_on_click_org', :to => 'messages#get_subfield_on_click_org' - match 'messages/join_org_subfields', :to => 'messages#join_org_subfields' - # boards end - - # Misc issue routes. TODO: move into resources - match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' - match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu', :via => [:get, :post] - match '/issues/changes', :to => 'journals#index', :as => 'issue_changes', :via => :get - match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue' - - match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get - match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post] - match '/journals/destroy/:id', :to => 'journals#destroy', :id => /\d+/, :via => [:get, :post] - - get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt' - get '/issues/gantt', :to => 'gantts#show' - - get '/projects/:project_id/issues/calendar', :to => 'calendars#show', :as => 'project_calendar' - get '/issues/calendar', :to => 'calendars#show' - - get 'projects/:id/issues/statistics', :to => 'issues#statistics', :as => 'project_issues_statistics' - get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report' - get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details' - post '/users/:id/user_activities', :to => 'users#show', :as => "user_activities" - match 'projects/:project_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_course_news' - match 'projects/:project_id/news/new', :to => 'news#new', :via => [:get, :post] - - post '/courses/:id/course_activity', :to => 'courses#show', :as => 'course_activity' - get '/boards/:id/boards_topic', :to =>'boards#show', :as => 'boards_topic' - match 'courses/:course_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_course_news' - match 'courses/:course_id/news/new', :to => 'news#new', :via => [:get, :post] - match 'contests/:contest_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_contest_news' - match 'contests/:contest_id/news/new', :to => 'news#new', :via => [:get, :post] - match 'users/:user_id/homepage/articles/:id', :to => 'article_homepages#show', :as => "user_homepage_show" - - match 'users/:id/courses', :to => 'users#course_community', :as => "user_course_community" - match 'users/:id/projects', :to => 'users#project_community', :as => "user_project_community" - match 'users/:id/contests', :to => 'users#contest_community', :as => "user_contest_community" - - scope ":username" do - resources :posts - end - -# added by cxt - resources :contest_members do - collection do - get 'contest_member_autocomplete' - end - - member do - - end - end - - # added by cxt - resources :contestant_works do - collection do - post 'student_work_project' - get 'new_student_work_project' - get 'cancel_relate_project' - get 'delete_work' - get 'search_contest_students' - end - - member do - get 'retry_work' - post 'add_score' - end - end - - # added by cxt - resources :works do - collection do - - end - - member do - get 'alert_score_open_modal' - post 'set_score_open' - get 'open_contestant_works' - get 'score_rule_set' - post 'set_score_rule' - end - end - - # added by cxt - resources :contests do - collection do - get 'join_contest' - get 'set_contest_attribute' - post 'join_contest_multi_role' - end - - member do - match 'settings' , :via => [:get, :post] - get 'feedback', :action => 'feedback', :as => 'contest_feedback' - get 'dealwith_apply_request' - get 'contest_activities' - get 'private_or_public' - get "switch_role" - get 'set_invite_code_halt' - get 'renew' - get 'member' - get 'export_all_members' - get 'feedback' - end - - resources :boards - resource :files do - member do - - end - collection do - - end - end - resources :news, :except => [:show, :edit, :update, :destroy] - end - - #added by young - resources :users do - collection do - match "tag_saveEx" , :via => [:get, :post] - post "user_new_homework" - get 'new_user_commit_homework' - get 'reply_to' - get 'reply_to_comment' - get 'show_all_replies' - get 'user_messages_unviewed' - post "user_commit_homework" - post 'user_select_homework' - post 'check_homework' - get 'all_journals' - get 'user_archive_courses' - post 'reply_detail' - get 'user_show_course_list' - end - - member do - get 'shixuns', :to => 'users#shixuns' - get 'user_myshixuns', :to => 'users#user_myshixuns' - match 'user_projects_index', :to => 'users#user_projects_index', :via => :get - match 'user_projects', :to => 'users#user_projects', :via => :get - match 'user_activities', :to => 'users#user_activities', :via => :get, :as => "user_activities" - # match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" - match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info' - match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang - match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang - match 'user_courses', :to => 'users#user_courses', :via => :get - match 'user_courses4show', :to => 'users#user_courses4show', :via => :get - match 'user_projects4show', :to => 'users#user_projects4show', :via => :get - match 'user_contests4show', :to => 'users#user_contests4show', :via => :get - match 'user_course_activities', :to => 'users#user_course_activities', :via => :get - match 'user_project_activities', :to => 'users#user_project_activities', :via => :get - match 'user_feedback4show', :to => 'users#user_feedback4show', :via => :get - match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get - match 'apply_for_homework', :to => 'users#apply_for_homework', :via => :post - match 'apply_homework', :to => 'users#apply_homework', :via => :get - match 'user_homeworks', :to => 'users#user_homeworks', :via => :get - match 'my_homeworks', :to => 'users#my_homeworks', :via => :get - match 'student_homeworks', :to => 'users#student_homeworks', :via => :get - get 'apply_resource' - get 'user_import_homeworks' - get 'user_search_homeworks' - get 'choose_user_course' - get 'user_import_resource' - match 'watch_projects', :to => 'users#watch_projects', :via => :get - get 'update_message_viewed' - get 'change_user_email' - # - # added by bai - match 'show_score', :to => 'users#show_score', :via => :get - match 'topic_score_index', :to => 'users#topic_score_index', :via => [:get, :post] - match 'project_score_index', :to => 'users#project_score_index', :via => :get - match 'activity_score_index', :to => 'users#activity_score_index', :via => :get - match 'influence_score_index', :to => 'users#influence_score_index', :via => :get - match 'score_index', :to => 'users#score_index', :via => :get - - match 'show_new_score', :to => 'users#show_new_score', :via => :get - match 'topic_new_score_index', :to => 'users#topic_new_score_index', :via => [:get, :post] - match 'project_new_score_index', :to => 'users#project_new_score_index', :via => :get - match 'activity_new_score_index', :to => 'users#activity_new_score_index', :via => :get - match 'influence_new_score_index', :to => 'users#influence_new_score_index', :via => :get - match 'score_new_index', :to => 'users#score_new_index', :via => :get - match 'update_score', :to => 'users#update_score', :via => [:get,:post] - - match 'show_projects_score', :to => 'projects#show_projects_score', :via => [:get, :post] - match 'issue_score_index', :to => 'projects#issue_score_index', :via => [:get, :post] - match 'news_score_index', :to => 'projects#news_score_index', :via => [:get, :post] - match 'file_score_index', :to => 'projects#file_score_index', :via => [:get, :post] - match 'code_submit_score_index', :to => 'projects#code_submit_score_index', :via => [:get, :post] - match 'projects_topic_score_index', :to => 'projects#projects_topic_score_index', :via => [:get, :post] - match 'user_act_issue_assign_to', :to => 'users#user_act_issue_assign_to', :via => [:get, :post] - - #addby yk - match 'user_courselist', :to => 'users#user_courselist', :via => :get, :as => "user_courselist" - match 'user_projectlist', :to => 'users#user_projectlist', :via => :get, :as => "user_projectlist" - match 'user_contestlist', :to => 'users#user_contestlist', :via => :get, :as => "user_contestlist" - - match 'sort_syllabus_list', :to => 'users#sort_syllabus_list', :via => :get, :as => "sort_syllabus_list" - match 'sort_project_list', :to => 'users#sort_project_list', :via => :get, :as => "sort_project_list" - - post 'edit_brief_introduction' - get "user_resource" - match "user_issues", :to => 'users#user_issues', :via => [:get, :post], :as => "user_issues" - match "user_manage_issues", :to => 'users#user_manage_issues', :via => [:get, :post], :as => "user_manage_issues" - match "user_receive_issues", :to => 'users#user_receive_issues', :via => [:get, :post], :as => "user_receive_issues" - match "user_manage_homeworks", :to => 'users#user_manage_homeworks', :via => [:get, :post], :as => "user_manage_homeworks" - match "user_receive_homeworks", :to =>'users#user_receive_homeworks', :via => [:get, :post], :as => "user_receive_homeworks" - get "import_resources" - get "import_resources_search" - post "import_into_container" - get "resource_search" - post "user_resource_create" - post "user_resource_delete" - get "search_user_course" - post "send_homework_to_course" - post "add_exist_file_to_course" - post "add_exist_file_to_project" - post 'add_exist_file_to_org' - post 'share_news_to_course' - post 'share_news_to_project' - post 'share_news_to_org' - post 'share_message_to_course' - post 'share_message_to_project' - post 'share_message_to_org' - get 'resource_preview' - get 'rename_resource' - get 'search_user_project' - get 'user_resource_type' - get 'user_ref_resource_search' - post 'import_resources_to_homework' - get 'dealwith_apply_request' - get 'dealwith_apply_homework' - get 'deal_with_apply_resource' - get 'store_selected_resource' - get 'user_organizations' - get 'search_user_orgs' - get 'search_user_org' #for send resource - get 'user_homework_type' - get 'user_ref_homework_search' - get 'show_homework_detail' - post 'apply_for_homework' - post 'apply_for_resource' - match 'manage_or_receive_homeworks', :to => 'users#manage_or_receive_homeworks', :via => :get - get 'search_m_r_homeworks' - get 'expand_courses' - get 'cancel_or_collect' - get 'homepage' - get 'unsolved_issues_list' - get 'unfinished_homework_list' - get 'unfinished_poll_list' - get 'unfinished_test_list' - get 'anonymous_evaluation_list' - get 'unapproval_applied_list' - # end - end - #resources :blogs - resources :blogs do - resources :blog_comments do - member do - post 'reply' - get 'quote' - end - end - end - - resources :homepages do - resources :article_homepages do - member do - end - end - end - end - resources :blog_comments do - collection do - get :search - end - end - resource :homepages do - member do - post 'set_homepage' - post 'cancel_homepage' - end - collection do - - end - end - resources :article_homepages do - member do - end - end - match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback" - match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get - #消息 - match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get, :as => "user_message" - match 'users/:id/user_system_messages', :to => 'users#user_system_messages', :via => :get, :as => "user_system_messages" - match 'set_homepage', :to => 'blogs#set_homepage', :via => :post - match 'cancel_homepage', :to => 'blogs#cancel_homepage', :via => :post - #match 'users/:id/user_messages/:homework', :to => 'users#user_messages_homework', :via => :get, :as => "user_message_homewrok" - - - - #end - match 'my/account', :via => [:get, :post] - match 'my/account/destroy', :to => 'my#destroy', :via => [:get, :post] - match 'my/page', :via => :get - match 'my', :to => 'my#index', :via => :get # Redirects to my/page - match 'my/reset_rss_key', :via => :post - match 'my/reset_api_key', :via => :post - match 'my/password', :via => [:get, :post] - match 'my/page_layout', :via => :get - match 'my/add_block', :via => :post - match 'my/remove_block', :via => :post - match 'my/order_blocks', :via => :post - match 'my/change_mail_notification', via: :get - match 'my/save_user_avatar', :to => 'my#save_user_avatar', :via => [:get, :post] - match 'my/clear_user_avatar_temp', :to => 'my#clear_user_avatar_temp', :via => [:get, :post] - - get 'my/page2', :to => 'my#page2', :as => "my_page2" - - resources :users - match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership' - match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete - match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' - ################# added by william - match 'users/tag_save', :via => :post, :as => 'tag' - match 'users/tag_saveEx', :via => [:get, :post] - #get 'users/:id/user_organizations', :to => 'users#user_organizations', :as => 'user_organizations' - post 'watchers/watch', :to => 'watchers#watch', :as => 'watch' - delete 'watchers/watch', :to => 'watchers#unwatch' - get 'watchers/new', :to => 'watchers#new' - post 'watchers', :to => 'watchers#create' - post 'watchers/append', :to => 'watchers#append' - delete 'watchers', :to => 'watchers#destroy' - get 'watchers/autocomplete_for_user', :to => 'watchers#autocomplete_for_user' - # Specific routes for issue watchers API - post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue' - delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue' - - post 'applied_project/applied_join', :to => 'applied_project#applied_join_project', :as => 'applied_join_project' - post 'applied_project/applied_project_info', :to => 'applied_project#applied_project_info', :as => 'applied_project_info' - delete 'applied_project/applied', :to => 'applied_project#unapplied_join_project', :as => 'unapplied_join_project' - - resources :projects do - member do - match 'change_project_type', :via => [:get, :post] - get 'settings(/:tab)', :action => 'settings', :as => 'settings' - #by young - get 'member', :to => 'projects#member', :as => 'member' - match 'project_watcherlist', :to => 'projects#project_watcherlist', :as => 'project_watcherlist' - match 'store_mine', :to => 'projects#store_mine', :as => 'store_mine' - match 'enshrine', :to => 'projects#enshrine', :as => 'enshrine' - match 'member_forked', :to => 'projects#member_forked', :as => 'member_forked' - get 'file', :action => 'file', :as => 'file' - get 'statistics', :action => 'statistics', :as => 'statistics' - get 'repository_tree_changes', :action => 'repository_tree_changes', :as => 'repository_tree_changes' - get 'destroy_repository', :action => 'destroy_repository', :as => 'destroy_repository' - - get 'feedback', :action => 'feedback', :as => 'project_feedback' - get 'watcherlist', :action=> 'watcherlist' - - # get 'invite_members', :action=> 'invite_members' - get 'invite_members_by_mail', :action=> 'invite_members_by_mail' - # get 'dts_repos', :aciton => 'dts_repos' - get 'send_mail_to_member', :action => 'send_mail_to_member' - match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" - #end - - post 'add_script' - post 'modules' - post 'archive' - post 'unarchive' - post 'close' - post 'reopen' - get 'training_project_execute' - get 'training_project_update' - get 'training_project_extend' - get 'task_execute' - get 'forked_pop' - get 'training_chiled_project_exec' - get 'delete_member_pop', :to => 'projects#delete_member_pop', :via => :get, :as => "delete_member_pop" - get 'search_public_orgs_not_in_project' - match 'copy', :via => [:get, :post] - match 'set_public_or_private', :via => [:post] - end - - collection do - get 'project_home' - match 'join_project', :via => [:get, :post] - match 'training_task_status', :via => [:get, :post] - end - - #by young - match '/member', :to => 'projects#member', :as => 'member', :via => :get - match '/file', :to => 'projects#file', :as => 'file', :via => :get - match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get - match '/watcherlist', :to=>'projects#watcherlist', :as => 'watcherlist', :via => :get #add by huang - resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do - collection do - get 'autocomplete' - get 'appliedproject' - post 'allow_to_join_project' - get 'refused_allow_to_join_project' - end - end - - resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] - - get 'issues/:copy_from/copy', :to => 'issues#new', :as => 'copy_issue' - resources :issues, :only => [:index, :new, :create] do - resources :time_entries, :controller => 'timelog' do - collection do - get 'report' - end - end - end - # issue form update - match 'issues/update_form', :to => 'issues#update_form', :via => [:put, :post], :as => 'issue_form' - - resources :files, :only => [:index, :new, :create] do - collection do - match "getattachtype", :via => [:get, :post] - match "search_project",:via => [:post,:get] - match "searchone4reload",:via => [:post,:get] - match "search_tag_attachment", :via => [:post,:get] - end - member do - match "quote_resource_show", :via => [:get] - get "file_hidden" - get "update_file_description" - post "edit_file_description" - end - end - - resources :training_tasks do - collection do - - end - member do - post 'add_journal' - get 'delete_journal' - get 'reply' - post 'add_reply' - end - end - - resources :pull_requests do - collection do - end - member do - get 'accept_pull_request' - get 'pull_request_commits' - get 'pull_request_changes' - get 'update_pull_request' - get 'pull_request_comments' - post 'create_pull_request_comment' - end - end - - resources :quality_analysis, :only => [:index, :create, :edit, :update, :delete] do - collection do - end - member do - match 'update_jenkins_job' - match 'edit' - match 'delete' - match 'create' - get 'error_list' - end - end - # resources :files, :only => [:index, :new, :create] do - # member do - # match "quote_resource_show_project",:via => [:get] - # end - # collection do - # match "getattachtype" , :via => [:get, :post] - # match "search_project",:via => [:post,:get] - # #match 'getattachtype/:attachtype', :to => 'files#getattachtype', :via => [:get, :post] - # end - # end - - - resources :versions, :except => [:index, :show, :edit, :update, :destroy] do - collection do - put 'close_completed' - get 'judge_version_title' - end - end - get 'versions.:format', :to => 'versions#index' - get 'roadmap', :to => 'versions#index', :format => false - get 'versions', :to => 'versions#index' - - resources :news, :except => [:show, :edit, :update, :destroy] - resources :time_entries, :controller => 'timelog' do - get 'report', :on => :collection - end - resources :queries, :only => [:new, :create] - resources :issue_categories, :shallow => true - resources :documents, :except => [:show, :edit, :update, :destroy] - resources :boards - resources :repositories, :shallow => true, :except => [:index, :show] do - member do - match 'committers', :via => [:get, :post] - end - end - resources :repositories, :except => [:index, :show] do - member do - get 'newrepo', :via => [:get, :post] - put 'to_gitlab' - # get 'create', :via=>[:get, :post] - end - end - - match 'wiki/index', :via => :get - resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do - member do - get 'rename' - post 'rename' - get 'history' - get 'diff' - match 'preview', :via => [:post, :put] - post 'protect' - post 'add_attachment' - end - collection do - get 'export' - get 'date_index' - end - end - match 'wiki', :to => 'wiki#show', :via => :get - get 'wiki/:id/:version', :to => 'wiki#show', :constraints => {:version => /\d+/} - delete 'wiki/:id/:version', :to => 'wiki#destroy_version' - get 'wiki/:id/:version/annotate', :to => 'wiki#annotate' - get 'wiki/:id/:version/diff', :to => 'wiki#diff' - end - - resources :issues do - collection do - match 'bulk_edit', :via => [:get, :post] - post 'bulk_update' - get 'issue_commits' - get 'commit_for_issue' - get 'issue_commit_delete' - end - member do - post 'add_journal' - post 'add_journal_in_org' - get 'delete_journal' - get 'reply' - post 'add_reply' - end - resources :time_entries, :controller => 'timelog' do - collection do - get 'report' - end - end - resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] - end - match '/issues', :to => 'issues#destroy', :via => :delete - - resources :queries, :except => [:show] - - resources :training_tasks do - member do - post 'complete_training_task' - post 'add_reply' - post 'add_journal' - post 'add_journal_in_org' - get 'delete_journal' - get 'reply' - end - collection do - end - end - - resources :news, :only => [:index, :show, :edit, :update, :destroy] - - match '/news/:id/comments', :to => 'comments#create', :via => :post - #match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete - delete '/news/:id/comments/:comment_id', :to => 'comments#destroy', as: :delete_news_comments - - resources :versions, :only => [:show, :edit, :update, :destroy] do - post 'status_by', :on => :member - end - - resources :documents, :only => [:show, :edit, :update, :destroy] do - post 'add_attachment', :on => :member - end - - match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post] - - resources :time_entries, :controller => 'timelog', :except => :destroy do - collection do - get 'report' - get 'bulk_edit' - post 'bulk_update' - end - end - match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ - # TODO: delete /time_entries for bulk deletion - match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete - - get 'projects/:id/activity', :to => 'activities#index' - get 'projects/:id/activity.:format', :to => 'activities#index' - get 'activity', :to => 'activities#index' - - # repositories routes - get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats', :as => "stats_repository_project" - get 'projects/:id/repository/:repository_id/quality_analysis', :to => 'repositories#quality_analysis', :as => "quality_analysis" - get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' - - get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', :to => 'repositories#changes' - # shixun - get 'shixuns/:id/repository/:repository_id/commits(/*path(.:ext))', :to => 'repositories#commits' - get 'shixuns/:id/repository/:repository_id/commits/:changeset_id', :to => 'repositories#commits' - - get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' - get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' - post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' - delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' - get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' - get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', - :controller => 'repositories', - :format => false, - :constraints => { - :action => /(browse|show|entry|raw|annotate|diff|commit_diff)/, - :rev => /[a-z0-9\.\-_]+/ - } - - get 'projects/:id/repository/statistics', :to => 'repositories#stats' - get 'projects/:id/repository/quality_analysis', :to => 'repositories#quality_analysis' - - get 'projects/:id/repository/graph', :to => 'repositories#graph' - - get 'projects/:id/repository/changes(/*path(.:ext))', :to => 'repositories#changes' - - get 'projects/:id/repository/forked', :to => 'repositories#forked' - get 'projects/:id/repository/training_task_execute', :to => 'repositories#training_task_execute' - get 'projects/:id/repository/tree_head_message', :to => 'repositories#tree_head_message', :as => "tree_head_message" - get 'projects/:id/repository/export_rep_static', :to => 'repositories#export_rep_static' - get 'projects/:id/repository/project_archive', :to => 'repositories#project_archive', :as => 'project_archive' - get 'projects/:id/repository/revisions', :to => 'repositories#revisions' - get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' - get 'projects/:id/repository/revision', :to => 'repositories#revision' - post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' - delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' - get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', - :controller => 'repositories', - :format => false, - :constraints => { - :action => /(browse|show|entry|raw|annotate|diff|commit_diff)/, - :rev => /[a-z0-9\.\-_]+/ - } - get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', - :controller => 'repositories', - :action => /(browse|show|entry|raw|changes|annotate|diff|commit_diff)/ - get 'projects/:id/repository/:action(/*path(.:ext))', - :controller => 'repositories', - :action => /(browse|show|entry|raw|changes|annotate|diff|commit_diff)/ - - get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil - # shixun - get 'shixuns/:id/repository/:repository_id', :to => 'repositories#shixun_show', :path => nil - get 'shixuns/:id/repository/:repository_id/:rev/:action(/*path(.:ext))', - :controller => 'repositories', - :format => false, - :constraints => { - :action => /(browse|shixun_show|shixun_entry|raw|annotate|diff|commit_diff)/, - :rev => /[a-z0-9\.\-_]+/ - } - - # myshixun - get 'myshixuns/:myshixun_id/games/:id/:rev/:action(/*path(.:ext))', - :controller => 'games', - :format => false, - :constraints => { - :action => /(browse|show|entry)/, - :rev => /[a-z0-9\.\-_]+/ - } - - get 'projects/:id/repository', :to => 'repositories#show', :path => nil - get 'projects/:id/exit', :to => 'projects#exit_project', :as => 'exit_cur_project' - - # additional routes for having the file name at the end of url - get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment' - get 'attachments/attachment_versions/:id',:to=>'attachments#attachment_versions',:as=>'attachments_versions' - get 'attachments/attachment_versions_delete/:id',:to=>'attachments#attachment_versions_delete',:as=>'attachment_versions_delete' - get 'attachments/attachment_history_download/:id',:to=>'attachments#attachment_history_download',:as=>'attachment_history_download' - post 'attachments/upload_attachment_version',:to=>'attachments#upload_attachment_version',:as=>'upload_attachment_version' - get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment' - get 'attachments/download_resource/:id/:filename', :to => 'attachments#download_resource', :id => /\d+/, :filename => /.*/, :as => 'download_resource_attachment' - get 'attachments/download_history/:id/:filename', :to => 'attachments#download_history', :id => /\d+/, :filename => /.*/, :as => 'download_history_attachment' - get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/, :as => 'download_attachment' - get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail' - get 'attachments/autocomplete' - get 'attachments/update_attachment_publish_time/:id',:to=>'attachments#update_attachment_publish_time',:as=>'update_attachment_publish_time' - match 'attachments/autocomplete', :to => 'attachments#autocomplete', :via => [:post] - post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation' - post 'attachments/relationfiles', to: 'attachments#add_exist_file_to_projects', as: 'attach_relations' - post 'attachments/courserelationfile', to: 'attachments#add_exist_file_to_course', as: 'course_attach_relation' - post 'attachments/courserelationfiles', to: 'attachments#add_exist_file_to_courses', as: 'course_attach_relations' - match 'attachments/add_exist_file_to_org_subfield' - get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/ - resources :attachments, :only => [:show, :destroy] do - collection do - match "updateType" , :via => [:get, :post] - match "updateFileDense" , :via => [:get, :post] - match "update_file_dense", :via => [:post] - match "renderTag" , :via => [:get, :post] - match 'delete_softapplications', :via => [:get, :post] - end - end - resources :groups do - member do - get 'autocomplete_for_user' - end - end - - match 'groups/:id/users', :to => 'groups#add_users', :id => /\d+/, :via => :post, :as => 'group_users' - match 'groups/:id/users/:user_id', :to => 'groups#remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' - match 'groups/destroy_membership/:id', :to => 'groups#destroy_membership', :id => /\d+/, :via => :post - match 'groups/edit_membership/:id', :to => 'groups#edit_membership', :id => /\d+/, :via => :post - - resources :trackers, :except => :show do - collection do - match 'fields', :via => [:get, :post] - end - end - resources :issue_statuses, :except => :show do - collection do - post 'update_issue_done_ratio' - end - end - resources :custom_fields, :except => :show - resources :roles do - collection do - match 'permissions', :via => [:get, :post] - end - end - resources :web_footer_companies, :except => :show - resources :enumerations, :except => :show - match 'enumerations/:type', :to => 'enumerations#index', :via => :get - - get 'projects/:id/search', :controller => 'search', :action => 'index' - get 'search', :controller => 'search', :action => 'index' - - match 'mail_handler', :to => 'mail_handler#index', :via => :post - match 'mail_handler/cancel/:id', :to => 'mail_handler#cancel_mail_notify',:via => :get - - match 'admin', :to => 'admin#index', :via => :get - match 'admin/projects', :via => :get - match 'admin/export_rep_static_users', :via => :get - get 'admin/courses', as: :all_courses - get 'admin/syllabuses', as: :all_syllabuses - get 'admin/contests', :via => :get - get 'admin/non_syllabus_courses', as: :non_syllabus_courses - post 'admin/update_course_name' - post 'admin/update_syllabus_title' - get 'admin/excellent_courses', as: :excellent_courses - get 'admin/shixuns', as: :admin_shixuns - get 'admin/shixun_authentication', as: :admin_shixun_authentication - get 'admin/excellent_all_courses', as: :excellent_all_courses - match 'admin/set_excellent_course/:id', :to => 'admin#set_excellent_course' - match 'admin/cancel_excellent_course/:id', :to => 'admin#cancel_excellent_course' - get 'admin/course_resource_list' - get 'admin/project_resource_list' - match 'admin/users', :via => :get - match 'admin/messages', :via => :get - match 'admin/first_page_made', as: :first_page_made - match 'admin/course_page_made', as: :course_page_made - match 'admin/contest_page_made', as: :contest_page_made - match 'admin/web_footer_made', as: :web_footer_made - match 'admin/enterprise_page_made', as: :enterprise_page_made - match 'admin/mobile_version', as: :mobile_version - match 'admin/create_version', as: :create_version - match 'admin/search', :via => [:get, :post] - match 'admin/plugins', :via => :get - match 'admin/info', :via => :get - match 'admin/test_email', :via => :get - match 'admin/default_configuration', :via => :post - get 'admin/organization' - get 'admin/schools' - get 'admin/applied_schools', as: :unapplied_schools - get 'admin/has_applied_schools', as: :applied_schools - get 'admin/approve_applied_schools' - post 'admin/edit_applied_schools' - get 'admin/all_schools' - get 'admin/apply_shcool_sort', as: :apply_shcool_sort - delete 'admin/delete_applied_schools' - get 'admin/applied_departments', as: :unapplied_departments - get 'admin/has_applied_departments', as: :applied_departments - get 'admin/approve_applied_departments' - delete 'admin/delete_applied_departments' - - get 'admin/leave_messages' - match 'admin/messages_list', as: :messages_list - match 'admin/project_messages', as: :project_messages - match'admin/course_messages', as: :course_messages - get 'admin/notices' - match 'admin/latest_login_users', as: :latest_login_users - match 'admin/latest_login_teachers', as: :latest_login_teachers - get 'admin/homework' - get 'admin/apply_for_homework' - get 'admin/code_work_tests' - post 'admin/select_course_syllabus' - post 'admin/create_syllabus' - get 'admin/identity_authentication' - get 'admin/reject_authentication' - get 'admin/agree_authentication' - - resources :auth_sources do - member do - get 'test_connection', :as => 'try_connection' - end - collection do - get 'autocomplete_for_new_user' - end - end - - match 'courses/search' - match '/contests/search', :via => [:get, :post] - - #课程大纲路由设置 - resources :syllabuses do - member do - match 'syllabus_courselist', :to => 'syllabuses#syllabus_courselist', :via => :get, :as => 'syllabus_courselist' - get 'edit_syllabus_eng_name' - get 'edit_syllabus_title' - post 'update_base_info' - get 'delete_syllabus' - get 'delete_des' - get 'members' - post 'update_des' - get 'edit_ref' - post 'update_ref' - get 'add_sy_member_alert' - post 'search_not_sy_member' - get 'syllabus_homeworks' - get 'syllabus_resources' - match "choose_user_course", :via => [:post, :get] - post 'send_resources_to_course' - post 'send_homeworks_to_course' - post 'send_r_and_h_to_course' - end - - collection do - get 'get_discipline_categories' - get 'get_first_level_disciplines' - post 'regex_syllabus_name' - end - end - - resources :syllabus_member do - member do - post 'update_rank' - end - - collection do - get 'syl_member_autocomplete' - post 'change_manager' - get 'change_manager_alert' - end - end - - # add by nwb - # 课程路由设置 - resources :courses do - member do - get 'settings(/:tab)', :action => 'settings', :as => 'settings' - get 'search_member', :action => 'search_member' - get 'file', :action => 'file', :as => 'file' - get 'feedback', :action => 'feedback', :as => 'course_feedback' - get 'code_repeat', :action => 'code_repeat', :as => 'code_repeat' - get 'member', :controller => 'courses', :action => 'member', :as => 'member' - get 'group_member', :controller => 'courses', :action => 'group_member', :as => 'group_member' - get 'export_course_member_excel',:controller => 'courses',:action => 'export_course_member_excel' - get 'member_score', :to => 'courses#member_score' - post 'finishcourse' - post 'restartcourse' - match "renew", :to => 'courses#renew', :via => [:post, :get], :as =>'renew' - match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get] - match "searchgroupmembers", :via => [:post, :get] - match 'member_score_sort', :via => [:get] - match "updategroupname", :via => [:post, :get] - match "addgroups", :via => [:post, :get] - match 'deletegroup', :via => [:delete] - match 'show_member_score', :via => [:get] - match 'show_member_act_score', :via => [:get] - match 'valid_ajax', :to => 'courses#valid_ajax', :via => :get - post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group' - get 'copy_course' - get 'private_or_public' - match 'course_activity', :to => 'courses#course_activity', :via => :get, :as => "course_activity" - get 'course_outline' - post 'search_course_outline' - post 'set_course_outline' - post 'teacher_assign_group' - get 'syllabus' - get 'search_public_orgs_not_in_course' - get "homework_search" - get "show_comparecode" - get "course_statistics" - get "switch_role" - get 'search_not_group_member' - post 'add_members' - get 'search_course_teacher_list' - post 'change_manager' - get 'delete_member' - get 'archive_course' - get 'set_invite_code_halt' - get 'open_or_close_os_interface' - get 'choose_group_allow' - match 'search_not_teachers', :via => [:get, :post] - match 'search_not_students', :via => [:get, :post] - get 'all_student_list' - get 'no_group_student_list' - get 'has_group_student_list' - post 'choose_course_group' - match 'update_position', :via => [:get, :post] - end - collection do - match 'join_private_courses', :via => [:get, :post] - post "join_course_multi_role" - get 'unjoin_group' - end - - match '/member', :to => 'courses#member', :as => 'member', :via => :get - resources :boards - resources :files, :only => [:index, :new, :create] do - collection do - match "getattachtype", :via => [:get, :post] - match "search",:via => [:post,:get] - match "searchone4reload",:via => [:post,:get] - match "search_tag_attachment", :via => [:post,:get] - end - member do - match "quote_resource_show", :via => [:get] - get "file_hidden" - post "republish_file" - get "update_file_description" - post "edit_file_description" - end - end - resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do - collection do - get 'autocomplete' - get 'appliedproject' - end - end - resources :news, :except => [:show, :edit, :update, :destroy] - # resources :boards do - # member do - # match 'boards_topic', :to => 'boards#boards_topic', :via => :get, :as => "boards_topic" - # end - # end - match '/homework', :to => 'courses#homework', :as => 'homework', :via => :get - resources :activity_notifys do - collection do - match 'chang_read_flag', :via => :get - end - end - - end # end of resources :courses - match 'courses/:id/feedback', :to => 'courses#feedback', :via => :get, :as => 'course_feedback' - match '/courses/search', :via => [:get, :post] - match 'words/:id/leave_course_message', :to => 'words#leave_course_message', :as => "leave_course_message" - - - match 'workflows', :to => 'workflows#index', :via => :get - match 'workflows/edit', :via => [:get, :post] - match 'workflows/permissions', :via => [:get, :post] - match 'workflows/copy', :via => [:get, :post] - match 'settings', :controller => 'settings', :action => 'index', :via => :get - match 'settings/edit', :via => [:get, :post] - match 'settings/plugin/:id', :to => 'settings#plugin', :via => [:get, :post], :as => 'plugin_settings' - match 'settings/hidden_non_project', :via => [:get, :post] - match 'settings/hidden_courses', :via => [:get, :post] - - match 'sys/projects', :via => :get - match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post - match 'sys/fetch_changesets', :via => :get - - match 'uploads', :to => 'attachments#upload', :via => :post - match 'upload_with_markdown', :to => 'attachments#upload_with_markdown', :via => :post - # Added by Tao - match 'upload_avatar', :to => 'avatar#upload', :via => :post - match 'delete_avatar', :to => 'avatar#delete_image',:via => :post - # Endof Tao's code - get 'robots.txt', :to => 'welcome#robots' - ##############测试留言功能 fq - post 'words/new', :to => 'words#new' - post 'words/create', :to => 'words#create' - post 'words/append', :to => 'words#append' - post 'words/create_reply', :to => 'words#create_reply' - delete 'words/destroy', :to => 'words#destroy' - delete 'words/destroyJournal', :to => 'words#destroyJournal' - get 'words/more', :to => 'words#more' - get 'words/back', :to=> 'words#back' - get 'words/destroyJournal', :to => 'words#destroyJournal' - match 'words/add_project_respond', :to => 'words#add_project_respond' - match 'words/:id/leave_project_message', :to => 'words#leave_project_message' - match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback' - match 'project/:id/share', :to => 'projects#share', :as => 'share_show' #share - post 'words/:id/leave_user_message', :to => 'words#leave_user_message', :as => "leave_user_message" - post 'words/:id/leave_contest_message', :to => 'words#leave_contest_message', :as => "leave_contest_message" - post 'words/:id/leave_syllabus_message', :to => 'words#leave_syllabus_message', :as => "leave_syllabus_message" - post 'words/:id/leave_homework_message', :to => 'words#leave_homework_message', :as => "leave_homework_message" - post 'words/:id/reply_to_homework', :to => 'words#reply_to_homework', :as => "reply_to_homework" - post 'words/:id/leave_contest_work_message', :to => 'words#leave_contest_work_message', :as => "leave_contest_work_message" - post 'words/:id/reply_to_contest_work', :to => 'words#reply_to_contest_work', :as => "reply_to_contest_work" - post 'words/:id/reply_to_syllabus', :to => 'words#reply_to_syllabus', :as => "reply_to_syllabus" - - post 'join_in/join', :to => 'courses#join', :as => 'join' - delete 'join_in/join', :to => 'courses#unjoin' - post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group' - - delete 'attachment/:id', :to => 'attachments#delete_homework' - match 'new_join', :to => 'courses#new_join', :as => 'try_join' - match 'new_join_group', :to => 'courses#new_join_group', :as => 'try_join_group' - match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post - - ######################## - ##added by wen########## - #######confusing######## - get 'welcome/search', to: 'welcome#search' - get 'school/index', to: 'school#index' - get 'school/:school_id', to: 'welcome#course', :as => 'school_course_list' - post 'school/get_options/:province', :to => 'school#get_options' - get 'school/get_options/:province', :to => 'school#get_options' - - post 'school/get_province', :to => 'school#get_province' - get 'school/get_province', :to => 'school#get_province' - - post 'school/get_schoollist/:province', :to => 'school#get_schoollist' - get 'school/get_schoollist/:province', :to => 'school#get_schoollist' - - post 'school/search_school/', :to => 'school#search_school' - get 'school/search_school/', :to => 'school#search_school' - - post 'school/on_search' - post 'school/add_school' - ######added by nie - match 'tags/show_projects_tags' - ########### added by liuping - match 'tags/add_tag', :as=>"add_tag" - match 'tags/delete_tag', :as=>"add_tag" - match 'tags/show_all' - match 'parise_tread/praise_plus', :as=>"praise" - match 'parise_tread/tread_plus', :as=>"tread" - match 'tags/delete' - match 'tags/remove_tag', :as=>"remove_tag" - match 'tags/remove_tag_new', :as=>"remove_tag_new" - match 'tags/tag_save', :as => "save_tag" - match 'tags/update_tag_name',:as => "update_tag_name" - match 'tags/update_project_tag_name',:as => "update_project_tag_name" - match 'tags/update_org_subfield_tag_name' - - match 'words/add_brief_introdution' - - ##added by lizanle 日志查看路由 - match 'system_log/index' - match 'system_log/access_analysis' - match 'system_log/time_analysis' - match "/system_log" ,:to => 'system_log#index' - match 'system_log/clear' - get 'upload_files_menu', :to => 'files#upload_files_menu' - get '/manual/feedback', to:redirect("http://forge.trustie.net/forums/1/memos/1168") - ##ended by lizanle - - resources :git_callback do - collection do - post 'post_update' - end - end - - resources :at - resource :wechat, only:[:show, :create] do - collection do - get :login - get :user_activities - post :bind - post :get_bind - post :is_bind - get :auth - get :auth_callback - end - end - - resource :sso, only: [:show, :create] - - get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_subfield_without_id' - - Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| - file = File.join(plugin_dir, "config/routes.rb") - if File.exists?(file) - begin - instance_eval File.read(file) - rescue Exception => e - puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." - exit 1 - end - end - end -end +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write tobthe Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# modified by longjun +# 统一route风格 +# match 'path', :to => 'controller#action' +# 如果 path = controller#action 则 match 'path' +# Example: +# match 'welcome/course', :to => 'welcome#course' 变成 +# match 'welcome/cource' +# 所有的 act: :act 变成 :act => :act +# Example: :via => :get ====> :via => :get + +RedmineApp::Application.routes.draw do + mount Mobile::API => '/api' + + resources :mark_down do + + end + + resources :subjects do + member do + + end + + collection do + get 'create_subject' + get 'new_subject' + end + end + + resources :shixuns do + member do + get 'game_webssh' + get 'shixun_test' + get 'delete_shixun_test' + get 'statistics' + get 'propaedeutics' + post 'update_propaedeutics' + get 'collaborators' + delete 'collaborators_delete' + match 'add_collaborators', :via => [:get, :post] + post 'shixun_members_added' + get 'shixun_monitor' + get 'autocompletion' + get 'shixun_exec' + post 'add_script' + post 'shixun_members' + get 'settings(/:tab)', :action => 'settings', :as => 'settings' + get 'shixun_job_create' + get 'shixun_job_update' + get 'rep_tree_changes', :action => 'rep_tree_changes', :as => 'rep_tree_changes' + match 'publish', :via => [:get, :post] + get 'apply_publish' + get 'cancel_publish' + get 'close' + get 'operation' + get 'entry_edit' + match 'entry_update' + end + collection do + get 'shixun_courses' + match 'search', :via => [:get, :post] + end + + resources :challenges do + member do + match 'challenge_build', :via => [:get, :post] + match 'game_build_result', :via => [:get, :post] + get 'index_up' + get 'index_down' + end + end + + resources :repositories, :shallow => true, :except => [:index, :show] do + member do + match 'committers', :via => [:get, :post] + end + end + end + + resources :myshixuns do + member do + match 'myshixun_reset', :via => [:get, :post] + get 'open_webssh' + get 'close_webssh' + end + collection do + match 'training_task_status', :via => [:get, :post] + end + resources :games, :path => "stages" do + member do + match 'game_build', :via => [:get, :post] + match 'next_step', :via => [:get, :post] + match 'reset_original_code', :via => [:get, :post] + match 'reset_new_code', :via => [:get, :post] + get 'entry' + get 'outputs_show' + get 'game_status' + get 'change_status' + post 'file_update' + get 'file_edit' + get 'answer' + get 'minus_score' + get 'refresh_game_list' + get 'waiting_info' + end + end + end + + resources :managements do + collection do + match 'shixuns', :via => [:get, :post] + get 'approve' + get 'trial_authorization', :as => 'trial_authorization' + get 'shixun_authorization' + get 'deal_shixun_authorization' + get 'batch_authorization', :as => 'batch_authorization' + match 'search_user', :via => [:get, :post] + match 'affirm_cancel_auth', :via => [:get, :post] + get 'identity_authentication', :as => 'identity_authentication' + match 'trial_authorization_operation', :as => 'trial_authorization_operation' + get 'reject_authentication' + get 'agree_authentication' + match 'users', :via => [:get, :post] + get 'users_trial' + match 'users_authorization_agree' + match 'users_authorization_cancel' + get 'update_webssh' + get 'departments' + end + end + # Enable Grack support + # mount Trustie::Grack.new, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post] + + constraints(Subdomain.new) do + get '/', to: 'organizations#show' + end + + constraints(Subdomain.new(sub: true)) do + get '/:sub_dir_name', to: 'fake#fake' + end + + resources :shield_wechat_messages do + collection do + delete 'show_messages' + end + end + resources :shield_activities do + collection do + delete 'show_acts' + end + end + resources :organizations do + resource :files do + member do + + end + collection do + + end + end + resources :org_document_comments do + member do + + end + collection do + + end + end + member do + get 'edit' + get 'setting'#, :action => 'settings', :as => 'settings' + get 'clear_org_avatar_temp' + put 'set_homepage' + put 'cancel_homepage' + get 'members' + get 'more_org_submains' + get 'more_org_projects' + get 'more_org_courses' + get 'search_courses' + get 'teachers' + get 'students' + get 'projects' + get 'courses' + get 'acts' + post 'join_course_menu' + post 'join_courses' + get 'search_projects' + post 'join_project_menu' + post 'join_projects' + post 'logout' + post 'apply_subdomain' + get 'org_resources_subfield' + get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_org_subfield' + end + collection do + get 'check_uniq' + get 'check_uniq_domain' + get 'autocomplete_search' + post 'hide_org_subfield' + post 'show_org_subfield' + post 'set_excellent_teacher' + post 'set_excellent_student' + post 'reset_excellent_teacher' + post 'reset_excellent_student' + post 'agree_apply_subdomain' + post 'refused_apply_subdomain' + post 'update_field_by_admin' + post 'reset_update_field_by_admin' + end + end + + + + + resources :org_member do + member do + + end + collection do + get 'org_member_autocomplete' + get 'org_member_paging' + get 'deleteOrgMember' + end + end + + resources :org_subfields do + resources :files, :only => [:index, :new, :create] do + collection do + match "getattachtype", :via => [:get, :post] + match "search_files_in_subfield",:via => [:post,:get] + match "searchone4reload",:via => [:post,:get] + match "search_org_subfield_tag_attachment", :via => [:post,:get] + match "subfield_upload_file", :via => :post + end + member do + match "quote_resource_show_org_subfield", :via => [:get] + get "update_file_description" + post "edit_file_description" + end + end + + resources :sub_domains, :only => [:index, :new, :create, :show, :update, :destroy] do + resources :sub_document_comments, :only => [:index, :new, :create, :show, :update, :destroy, :edit] do + member do + post 'add_reply' + get 'quote' + post 'reply' + post 'add_reply_in_doc' + delete 'delete_reply' + match 'edit' + end + collection do + end + end + + collection do + end + member do + match 'domain_update_sub_dir', :via => [:put] + match 'domain_update_priority', :via => [:put] + match 'domain_update_status', :via => [:post] + post 'hide_sub_domain' + post 'show_sub_domain' + end + end + + member do + match 'update_sub_dir', :via => [:put] + match 'update_priority', :via => [:put] + match 'update_status', :via => [:post] + end + resource :boards + end + + resources :org_document_comments do + member do + post 'add_reply' + get 'quote' + post 'reply' + post 'add_reply_in_doc' + delete 'delete_reply' + end + collection do + + end + end + + resources :org_projects do + member do + + end + collection do + + end + end + + resources :org_courses do + member do + + end + collection do + + end + end + #match '/organizations/:organization_id/org_document_comments/new', :to => 'org_document_comments#new', :as => 'new_org_documents', :via => [:get, :post] + #match '/organizations/:organization_id/org_document_comments/create', :to => 'org_document_comments#create', :as => 'create_org_documents', :via => [:post] + resources :homework_users + resources :no_uses + delete 'no_uses', :to => 'no_uses#delete' + match 'site_search', :to => 'users#site_search', :as => 'site_search', :via => [:get, :post, :put] + resources :apply_project_masters + delete 'apply_project_masters', :to => 'apply_project_masters#delete' + + resources :comments do + member do + post 'reply' + get 'quote' + end + end + # resources :organization, :except => [:show] do + # + # end + + resources :school, :except => [:show] do + collection do + get 'apply_add_school' + get 'search_repeat_schoolname' + end + + member do + get 'upload_logo' + post 'upload' + get 'edit_apply_name' + get 'edit_apply_address' + get 'edit_apply_province' + end + end + + resources :department do + collection do + post 'search_repeat_departmentname' + post 'apply_add_department' + post 'on_search' + end + + member do + + end + end + + resources :homework_attach do + collection do + get 'get_homework_member_list' + match 'addjours', :via => [:get, :post] + match 'add_jour_reply', :via => [:get,:post] + match 'destroy_jour', :via => [:get,:post] + match 'comprehensive_evaluation_jour', :via => [:get,:post] + get 'get_not_batch_homework' + get 'get_batch_homeworks' + get 'get_homeworks' + get 'get_homework_jours' + get 'get_student_batch_homework' + get 'get_my_homework' + end + member do + match 'add_homework_users', :via => [:get,:post] + match 'destory_homework_users', :via => [:get,:post] + get 'praise_homework' + end + end + + resources :poll do + member do + get 'statistics_result' + post 'commit_answer' + post 'create_poll_question' + post 'commit_poll' + get 'publish_poll' + get 'save_poll' + get 'republish_poll' + get 'poll_result' + get 'close_poll' + get 'export_poll' + get 'import_poll' + post 'update_question_num' + end + collection do + delete 'delete_poll_question' + post 'update_poll_question' + get 'other_poll' + post 'import_other_poll' + end + end + + #show、index、new、create、edit、update、destroy路由自动生成 + resources :exercise do + member do #生成路径为 /exercise/:id/方法名 + get 'statistics_result' + get 'student_exercise_list' + get 'export_exercise' + get 'publish_exercise' + get 'republish_exercise' + get 'show_student_result' + post 'create_exercise_question' + post 'commit_answer' + get 'commit_exercise' + post 'update_question_num' + post 'send_to_course' + get 'get_student_uncomplete_question' + post 'edit_question_score' + end + + collection do #生成路径为 /exercise/方法名 + get 'delete_exercise_question' + post 'update_exercise_question' + get 'other_exercise' + post 'import_other_exercise' + get 'search_exercises' + get 'search_courses' + end + end + + resources :homework_common, :except => [:show]do + member do + get 'start_anonymous_comment' + get 'stop_anonymous_comment' + get 'alert_anonymous_comment' + get 'alert_forbidden_anonymous_comment' + get 'alert_open_student_works' + get 'open_student_works' + get 'start_evaluation_set' + get 'score_rule_set' + post 'set_evaluation_attr' + get 'alert_score_open_modal' + post 'set_score_open' + get 'add_to_homework_bank' + get 'publish_homework' + get 'setting' + post 'homework_setting' + get 'set_public' + end + + collection do + match 'shixuns' + post 'next_step' + post 'programing_test' + end + end + + + resources :homework_bank do + member do + get 'set_public' + end + + collection do + match 'shixuns' + post 'destroy_all' + match 'choose_user_course' + post 'send_h_bank_to_course' + end + end + + resources :student_work do + member do + post 'add_score' + post 'revise_attachment' + get 'retry_work' + get 'add_comments_to_work' + get 'praise_student_work' + get 'forbidden_anonymous_comment' + get 'hide_score_detail' + get 'destroy_score' + end + collection do + post 'add_score_reply' + post 'student_work_project' + post 'change_project' + get 'new_student_work_project' + get 'search_user_projects' + get 'search_course_students' + get 'cancel_relate_project' + get 'delete_work' + get 'destroy_score_reply' + get 'student_work_absence_penalty' + get 'absence_penalty_list' + get 'evaluation_list' + # post 'set_program_score' + post 'program_test_ex' + post 'code_repeattest' + post 'last_codecomparetime' + post 'set_score_rule' + get 'work_canrepeat' + get 'get_user_infor' + post 'add_group_member' + post 'appeal_anonymous_score' + get 'alert_appeal_box' + get 'delete_score_comment' + get 'deal_appeal_score' + get 'relate_myshixun' + end + end + + resources :open_source_projects do + collection do + match 'search', :via => [:get, :post] + match 'remove_condition', :via => [:get, :post] + match 'allbug', :via => [:get, :post] + end + resources :relative_memos + member do + match 'master_apply', :via => [:get, :post] + match 'accept_master_apply', :via => [:get, :post] + match 'refuse_master_apply', :via => [:get, :post] + match 'showmemo', :via => [:get, :post] + match 'showbug', :via => [:get, :post] + end + end + + + mount SeemsRateable::Engine => '/rateable', :as => :rateable + + namespace :zipdown do + match 'assort' + match 'download_user_homework', :as => :download_user_homework + match 'download' + end + namespace :test do + match 'courselist' + match 'zip' + match 'mailer' + match 'view_office' + end + ##new added by linchun #以发布应用的形式参与竞赛 + resources :softapplications do + + collection do + match 'new_message', :via => :get + match 'search', :via => [:get, :post] + end + member do + match 'create_message' , :via => :post + end + end + + # ## new added by linchun #新竞赛相关 + # resources :contests, only: [:index] do + # resources :contestnotifications do + # # get 'preview', on: :collection + # resources :notificationcomments + # end + # + # collection do + # match 'new_contest' , :via => :get + # match 'join_in_contest' , :via => :post + # match 'unjoin_in_contest' , :via => :delete + # match 'create_contest' , :via => :post + # match 'new_join' , :via => :post + # match 'new' , :via => :post + # end + # member do + # delete 'destroy_contest' + # match 'add_softapplication' + # match 'update_contest' , :via => [:put] + # match 'show_contest' , :via => [:get, :post] + # match 'show_project' , :via => :get + # match 'show_softapplication' , :via => :get + # match 'show_attendingcontest' , :via => :get + # #match 'show_notification' , :via => :get + # match 'show_participator' , :via => :get + # match 'set_reward_project' , :via => [:get, :post] + # match 'set_reward_softapplication' , :via => [:get, :post] + # match 'add' , :via => [:get, :post] + # match 'add_softapplication' , :via => [:get, :post] + # match 'create' , :via => :post + # match 'settings' , :via => [:get, :post] + # match 'show_contest_user' + # get 'watcherlist', :action=> 'watcherlist' + # end + # end + + match '/news/preview', :to => 'previews#news', :as => 'preview_news', :via => [:get, :post, :put] + match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] + match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put] + match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put] + + resources :stores do + collection do + match 'search', :via => [:get, :post] + get 'lost_file' + end + end + + resources :forums do + collection do + match 'search_forum', :via => [:get, :post] + match 'check_forum_name',:via => [:get] + end + member do + post 'create_memo' + post 'create_feedback' + post 'mail_feedback' + post 'update_memo_description' + match 'search_memo', :via => [:get, :post] + match 'delete_forum_tag',:via =>[:get] + match 'add_forum_tag',:via=>[:get] + end + resources :memos do + collection do + get "quote" + end + member do + get "change_sticky" + end + end + end + + resources :cooperation do + collection do + + end + end + + resources :shares + + #added by william + get "tags/index" + + get "tags/show" + + get "praise_tread/praise_plus" + get "praise_tread/praise_minus" + + get "praise_tread/tread_plus" + #end + + root :to => 'welcome#index', :as => 'home' + # added by longjun + match 'welcome/contest', :via => :get + # end longjun + + #added by nie + match '/projects/search', :via => [:get, :post] + match '/users/search', :via => [:get, :post] + #end + + # 消息相关路由 + resources :system_messages do + collection do + post 'create', :as => 'system_messages' + get 'index', :as => 'index' + end + end + # match 'system_messages/index', to: 'system_messages#index', :via => :get, :as => 'system_messages' + + match 'account/heartbeat', to: 'account#heartbeat', :via => :get + match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post] + match 'user_join', :to => 'account#user_join', :as => 'user_join', :via => [:get, :post] + match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post] + match 'agreement',:to => 'account#agreement',:as => 'agreement',:via=>[:get] + match 'about_us',:to=>'account#about_us',:as=>'about_us',:via=>[:get] + match 'account/register',:to=>'account#register', :via => [:get, :post], :as => 'register' + match 'account/lost_password', :via => [:get, :post], :as => 'lost_password' + match 'account/activate', :via => :get + match 'account/valid_ajax', :via => :get + match 'account/valid_psd', :via => :post + match 'account/valid_register_user', :via => :get + match 'account/valid_verification_code', :via => :get + match 'account/get_verification_code', :via => :get + match 'account/change_email', :via => :get + match 'account/wechat_bind', :via => [:get, :post] + match 'account/reset_psd', :via => [:get, :post] + match 'account/email_valid', :to => 'account#email_valid', :via => :get + match 'account/resendmail', :to => 'account#resendmail', :via=> :get, :as => 'resendmail' + match 'account/avatar', :to => 'account#avatar', :via => :get, :as => "avatar_account" + match 'account/authentication', :to => 'account#authentication', :via => :get, :as => "authentication_account" + match 'account/apply_trail', :to => 'account#apply_trail', :via => :get, :as => "apply_trail_account" + match 'account/user_auth', :to => 'account#user_auth', :via => :get, :as => "user_auth_account" + match 'account/security_settings', :to => 'account#security_settings', :via => :get, :as => "security_settings" + match 'account/change_psd', :to => 'account#change_psd', :via => :get, :as => "change_psd" + match 'account/change_or_bind', :to => 'account#change_or_bind', :via => :get, :as => "change_or_bind" + match 'account/bind_email_or_phone', :to => 'account#bind_email_or_phone', :via => :post, :as => "bind_email_or_phone" + match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post + match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] + + #激活邮箱反馈问题 + match 'users/:id/leave_email_activation_message', :to => 'words#leave_email_activation_message', :via => :post, :as => "leave_email_activation_message" + + # boards + match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message' + match 'boards/:id/join_to_org_subfields', :to => 'boards#join_to_org_subfields' + match 'boards/:id/update_position', :to => 'boards#update_position', :via => :post + match 'boards/:id/update_boards_position', :to => 'boards#update_boards_position', :via => :post + match 'boards/:id/update_name', :to => 'boards#update_name', :via => :put + match 'boards/:id/update_boards_name', :to => 'boards#update_boards_name', :via => :put + get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' + match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] + get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit',:as=>'edit_board_message' + + post 'boards/:board_id/topics/preview', :to => 'messages#preview', :as => 'preview_board_message' + post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' + post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' + post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy',:as=>'delete_board_message' + match 'messages/join_org_subfield', :to => 'messages#join_org_subfield' + match 'messages/get_subfield_on_click_org', :to => 'messages#get_subfield_on_click_org' + match 'messages/join_org_subfields', :to => 'messages#join_org_subfields' + # boards end + + # Misc issue routes. TODO: move into resources + match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' + match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu', :via => [:get, :post] + match '/issues/changes', :to => 'journals#index', :as => 'issue_changes', :via => :get + match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue' + + match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get + match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post] + match '/journals/destroy/:id', :to => 'journals#destroy', :id => /\d+/, :via => [:get, :post] + + get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt' + get '/issues/gantt', :to => 'gantts#show' + + get '/projects/:project_id/issues/calendar', :to => 'calendars#show', :as => 'project_calendar' + get '/issues/calendar', :to => 'calendars#show' + + get 'projects/:id/issues/statistics', :to => 'issues#statistics', :as => 'project_issues_statistics' + get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report' + get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details' + post '/users/:id/user_activities', :to => 'users#show', :as => "user_activities" + match 'projects/:project_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_course_news' + match 'projects/:project_id/news/new', :to => 'news#new', :via => [:get, :post] + + post '/courses/:id/course_activity', :to => 'courses#show', :as => 'course_activity' + get '/boards/:id/boards_topic', :to =>'boards#show', :as => 'boards_topic' + match 'courses/:course_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_course_news' + match 'courses/:course_id/news/new', :to => 'news#new', :via => [:get, :post] + match 'contests/:contest_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_contest_news' + match 'contests/:contest_id/news/new', :to => 'news#new', :via => [:get, :post] + match 'users/:user_id/homepage/articles/:id', :to => 'article_homepages#show', :as => "user_homepage_show" + + match 'users/:id/courses', :to => 'users#course_community', :as => "user_course_community" + match 'users/:id/projects', :to => 'users#project_community', :as => "user_project_community" + match 'users/:id/contests', :to => 'users#contest_community', :as => "user_contest_community" + + scope ":username" do + resources :posts + end + +# added by cxt + resources :contest_members do + collection do + get 'contest_member_autocomplete' + end + + member do + + end + end + + # added by cxt + resources :contestant_works do + collection do + post 'student_work_project' + get 'new_student_work_project' + get 'cancel_relate_project' + get 'delete_work' + get 'search_contest_students' + end + + member do + get 'retry_work' + post 'add_score' + end + end + + # added by cxt + resources :works do + collection do + + end + + member do + get 'alert_score_open_modal' + post 'set_score_open' + get 'open_contestant_works' + get 'score_rule_set' + post 'set_score_rule' + end + end + + # added by cxt + resources :contests do + collection do + get 'join_contest' + get 'set_contest_attribute' + post 'join_contest_multi_role' + end + + member do + match 'settings' , :via => [:get, :post] + get 'feedback', :action => 'feedback', :as => 'contest_feedback' + get 'dealwith_apply_request' + get 'contest_activities' + get 'private_or_public' + get "switch_role" + get 'set_invite_code_halt' + get 'renew' + get 'member' + get 'export_all_members' + get 'feedback' + end + + resources :boards + resource :files do + member do + + end + collection do + + end + end + resources :news, :except => [:show, :edit, :update, :destroy] + end + + #added by young + resources :users do + collection do + match "tag_saveEx" , :via => [:get, :post] + post "user_new_homework" + get 'new_user_commit_homework' + get 'reply_to' + get 'reply_to_comment' + get 'show_all_replies' + get 'user_messages_unviewed' + post "user_commit_homework" + post 'user_select_homework' + post 'check_homework' + get 'all_journals' + get 'user_archive_courses' + post 'reply_detail' + get 'user_show_course_list' + end + + member do + get 'shixuns', :to => 'users#shixuns' + get 'user_myshixuns', :to => 'users#user_myshixuns' + match 'user_projects_index', :to => 'users#user_projects_index', :via => :get + match 'user_projects', :to => 'users#user_projects', :via => :get + match 'user_activities', :to => 'users#user_activities', :via => :get, :as => "user_activities" + # match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" + match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info' + match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang + match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang + match 'user_courses', :to => 'users#user_courses', :via => :get + match 'user_courses4show', :to => 'users#user_courses4show', :via => :get + match 'user_projects4show', :to => 'users#user_projects4show', :via => :get + match 'user_contests4show', :to => 'users#user_contests4show', :via => :get + match 'user_course_activities', :to => 'users#user_course_activities', :via => :get + match 'user_project_activities', :to => 'users#user_project_activities', :via => :get + match 'user_feedback4show', :to => 'users#user_feedback4show', :via => :get + match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get + match 'apply_for_homework', :to => 'users#apply_for_homework', :via => :post + match 'apply_homework', :to => 'users#apply_homework', :via => :get + match 'user_homeworks', :to => 'users#user_homeworks', :via => :get + match 'my_homeworks', :to => 'users#my_homeworks', :via => :get + match 'student_homeworks', :to => 'users#student_homeworks', :via => :get + get 'apply_resource' + get 'user_import_homeworks' + get 'user_search_homeworks' + get 'choose_user_course' + get 'user_import_resource' + match 'watch_projects', :to => 'users#watch_projects', :via => :get + get 'update_message_viewed' + get 'change_user_email' + # + # added by bai + match 'show_score', :to => 'users#show_score', :via => :get + match 'topic_score_index', :to => 'users#topic_score_index', :via => [:get, :post] + match 'project_score_index', :to => 'users#project_score_index', :via => :get + match 'activity_score_index', :to => 'users#activity_score_index', :via => :get + match 'influence_score_index', :to => 'users#influence_score_index', :via => :get + match 'score_index', :to => 'users#score_index', :via => :get + + match 'show_new_score', :to => 'users#show_new_score', :via => :get + match 'topic_new_score_index', :to => 'users#topic_new_score_index', :via => [:get, :post] + match 'project_new_score_index', :to => 'users#project_new_score_index', :via => :get + match 'activity_new_score_index', :to => 'users#activity_new_score_index', :via => :get + match 'influence_new_score_index', :to => 'users#influence_new_score_index', :via => :get + match 'score_new_index', :to => 'users#score_new_index', :via => :get + match 'update_score', :to => 'users#update_score', :via => [:get,:post] + + match 'show_projects_score', :to => 'projects#show_projects_score', :via => [:get, :post] + match 'issue_score_index', :to => 'projects#issue_score_index', :via => [:get, :post] + match 'news_score_index', :to => 'projects#news_score_index', :via => [:get, :post] + match 'file_score_index', :to => 'projects#file_score_index', :via => [:get, :post] + match 'code_submit_score_index', :to => 'projects#code_submit_score_index', :via => [:get, :post] + match 'projects_topic_score_index', :to => 'projects#projects_topic_score_index', :via => [:get, :post] + match 'user_act_issue_assign_to', :to => 'users#user_act_issue_assign_to', :via => [:get, :post] + + #addby yk + match 'user_courselist', :to => 'users#user_courselist', :via => :get, :as => "user_courselist" + match 'user_projectlist', :to => 'users#user_projectlist', :via => :get, :as => "user_projectlist" + match 'user_contestlist', :to => 'users#user_contestlist', :via => :get, :as => "user_contestlist" + + match 'sort_syllabus_list', :to => 'users#sort_syllabus_list', :via => :get, :as => "sort_syllabus_list" + match 'sort_project_list', :to => 'users#sort_project_list', :via => :get, :as => "sort_project_list" + + post 'edit_brief_introduction' + get "user_resource" + match "user_issues", :to => 'users#user_issues', :via => [:get, :post], :as => "user_issues" + match "user_manage_issues", :to => 'users#user_manage_issues', :via => [:get, :post], :as => "user_manage_issues" + match "user_receive_issues", :to => 'users#user_receive_issues', :via => [:get, :post], :as => "user_receive_issues" + match "user_manage_homeworks", :to => 'users#user_manage_homeworks', :via => [:get, :post], :as => "user_manage_homeworks" + match "user_receive_homeworks", :to =>'users#user_receive_homeworks', :via => [:get, :post], :as => "user_receive_homeworks" + get "import_resources" + get "import_resources_search" + post "import_into_container" + get "resource_search" + post "user_resource_create" + post "user_resource_delete" + get "search_user_course" + post "send_homework_to_course" + post "add_exist_file_to_course" + post "add_exist_file_to_project" + post 'add_exist_file_to_org' + post 'share_news_to_course' + post 'share_news_to_project' + post 'share_news_to_org' + post 'share_message_to_course' + post 'share_message_to_project' + post 'share_message_to_org' + get 'resource_preview' + get 'rename_resource' + get 'search_user_project' + get 'user_resource_type' + get 'user_ref_resource_search' + post 'import_resources_to_homework' + get 'dealwith_apply_request' + get 'dealwith_apply_homework' + get 'deal_with_apply_resource' + get 'store_selected_resource' + get 'user_organizations' + get 'search_user_orgs' + get 'search_user_org' #for send resource + get 'user_homework_type' + get 'user_ref_homework_search' + get 'show_homework_detail' + post 'apply_for_homework' + post 'apply_for_resource' + match 'manage_or_receive_homeworks', :to => 'users#manage_or_receive_homeworks', :via => :get + get 'search_m_r_homeworks' + get 'expand_courses' + get 'cancel_or_collect' + get 'homepage' + get 'unsolved_issues_list' + get 'unfinished_homework_list' + get 'unfinished_poll_list' + get 'unfinished_test_list' + get 'anonymous_evaluation_list' + get 'unapproval_applied_list' + # end + end + #resources :blogs + resources :blogs do + resources :blog_comments do + member do + post 'reply' + get 'quote' + end + end + end + + resources :homepages do + resources :article_homepages do + member do + end + end + end + end + resources :blog_comments do + collection do + get :search + end + end + resource :homepages do + member do + post 'set_homepage' + post 'cancel_homepage' + end + collection do + + end + end + resources :article_homepages do + member do + end + end + match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback" + match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get + #消息 + match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get, :as => "user_message" + match 'users/:id/user_system_messages', :to => 'users#user_system_messages', :via => :get, :as => "user_system_messages" + match 'set_homepage', :to => 'blogs#set_homepage', :via => :post + match 'cancel_homepage', :to => 'blogs#cancel_homepage', :via => :post + #match 'users/:id/user_messages/:homework', :to => 'users#user_messages_homework', :via => :get, :as => "user_message_homewrok" + + + + #end + match 'my/account', :via => [:get, :post] + match 'my/account/destroy', :to => 'my#destroy', :via => [:get, :post] + match 'my/page', :via => :get + match 'my', :to => 'my#index', :via => :get # Redirects to my/page + match 'my/reset_rss_key', :via => :post + match 'my/reset_api_key', :via => :post + match 'my/password', :via => [:get, :post] + match 'my/page_layout', :via => :get + match 'my/add_block', :via => :post + match 'my/remove_block', :via => :post + match 'my/order_blocks', :via => :post + match 'my/change_mail_notification', via: :get + match 'my/save_user_avatar', :to => 'my#save_user_avatar', :via => [:get, :post] + match 'my/clear_user_avatar_temp', :to => 'my#clear_user_avatar_temp', :via => [:get, :post] + + get 'my/page2', :to => 'my#page2', :as => "my_page2" + + resources :users + match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership' + match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete + match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' + ################# added by william + match 'users/tag_save', :via => :post, :as => 'tag' + match 'users/tag_saveEx', :via => [:get, :post] + #get 'users/:id/user_organizations', :to => 'users#user_organizations', :as => 'user_organizations' + post 'watchers/watch', :to => 'watchers#watch', :as => 'watch' + delete 'watchers/watch', :to => 'watchers#unwatch' + get 'watchers/new', :to => 'watchers#new' + post 'watchers', :to => 'watchers#create' + post 'watchers/append', :to => 'watchers#append' + delete 'watchers', :to => 'watchers#destroy' + get 'watchers/autocomplete_for_user', :to => 'watchers#autocomplete_for_user' + # Specific routes for issue watchers API + post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue' + delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue' + + post 'applied_project/applied_join', :to => 'applied_project#applied_join_project', :as => 'applied_join_project' + post 'applied_project/applied_project_info', :to => 'applied_project#applied_project_info', :as => 'applied_project_info' + delete 'applied_project/applied', :to => 'applied_project#unapplied_join_project', :as => 'unapplied_join_project' + + resources :projects do + member do + match 'change_project_type', :via => [:get, :post] + get 'settings(/:tab)', :action => 'settings', :as => 'settings' + #by young + get 'member', :to => 'projects#member', :as => 'member' + match 'project_watcherlist', :to => 'projects#project_watcherlist', :as => 'project_watcherlist' + match 'store_mine', :to => 'projects#store_mine', :as => 'store_mine' + match 'enshrine', :to => 'projects#enshrine', :as => 'enshrine' + match 'member_forked', :to => 'projects#member_forked', :as => 'member_forked' + get 'file', :action => 'file', :as => 'file' + get 'statistics', :action => 'statistics', :as => 'statistics' + get 'repository_tree_changes', :action => 'repository_tree_changes', :as => 'repository_tree_changes' + get 'destroy_repository', :action => 'destroy_repository', :as => 'destroy_repository' + + get 'feedback', :action => 'feedback', :as => 'project_feedback' + get 'watcherlist', :action=> 'watcherlist' + + # get 'invite_members', :action=> 'invite_members' + get 'invite_members_by_mail', :action=> 'invite_members_by_mail' + # get 'dts_repos', :aciton => 'dts_repos' + get 'send_mail_to_member', :action => 'send_mail_to_member' + match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" + #end + + post 'add_script' + post 'modules' + post 'archive' + post 'unarchive' + post 'close' + post 'reopen' + get 'training_project_execute' + get 'training_project_update' + get 'training_project_extend' + get 'task_execute' + get 'forked_pop' + get 'training_chiled_project_exec' + get 'delete_member_pop', :to => 'projects#delete_member_pop', :via => :get, :as => "delete_member_pop" + get 'search_public_orgs_not_in_project' + match 'copy', :via => [:get, :post] + match 'set_public_or_private', :via => [:post] + end + + collection do + get 'project_home' + match 'join_project', :via => [:get, :post] + match 'training_task_status', :via => [:get, :post] + end + + #by young + match '/member', :to => 'projects#member', :as => 'member', :via => :get + match '/file', :to => 'projects#file', :as => 'file', :via => :get + match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get + match '/watcherlist', :to=>'projects#watcherlist', :as => 'watcherlist', :via => :get #add by huang + resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do + collection do + get 'autocomplete' + get 'appliedproject' + post 'allow_to_join_project' + get 'refused_allow_to_join_project' + end + end + + resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] + + get 'issues/:copy_from/copy', :to => 'issues#new', :as => 'copy_issue' + resources :issues, :only => [:index, :new, :create] do + resources :time_entries, :controller => 'timelog' do + collection do + get 'report' + end + end + end + # issue form update + match 'issues/update_form', :to => 'issues#update_form', :via => [:put, :post], :as => 'issue_form' + + resources :files, :only => [:index, :new, :create] do + collection do + match "getattachtype", :via => [:get, :post] + match "search_project",:via => [:post,:get] + match "searchone4reload",:via => [:post,:get] + match "search_tag_attachment", :via => [:post,:get] + end + member do + match "quote_resource_show", :via => [:get] + get "file_hidden" + get "update_file_description" + post "edit_file_description" + end + end + + resources :training_tasks do + collection do + + end + member do + post 'add_journal' + get 'delete_journal' + get 'reply' + post 'add_reply' + end + end + + resources :pull_requests do + collection do + end + member do + get 'accept_pull_request' + get 'pull_request_commits' + get 'pull_request_changes' + get 'update_pull_request' + get 'pull_request_comments' + post 'create_pull_request_comment' + end + end + + resources :quality_analysis, :only => [:index, :create, :edit, :update, :delete] do + collection do + end + member do + match 'update_jenkins_job' + match 'edit' + match 'delete' + match 'create' + get 'error_list' + end + end + # resources :files, :only => [:index, :new, :create] do + # member do + # match "quote_resource_show_project",:via => [:get] + # end + # collection do + # match "getattachtype" , :via => [:get, :post] + # match "search_project",:via => [:post,:get] + # #match 'getattachtype/:attachtype', :to => 'files#getattachtype', :via => [:get, :post] + # end + # end + + + resources :versions, :except => [:index, :show, :edit, :update, :destroy] do + collection do + put 'close_completed' + get 'judge_version_title' + end + end + get 'versions.:format', :to => 'versions#index' + get 'roadmap', :to => 'versions#index', :format => false + get 'versions', :to => 'versions#index' + + resources :news, :except => [:show, :edit, :update, :destroy] + resources :time_entries, :controller => 'timelog' do + get 'report', :on => :collection + end + resources :queries, :only => [:new, :create] + resources :issue_categories, :shallow => true + resources :documents, :except => [:show, :edit, :update, :destroy] + resources :boards + resources :repositories, :shallow => true, :except => [:index, :show] do + member do + match 'committers', :via => [:get, :post] + end + end + resources :repositories, :except => [:index, :show] do + member do + get 'newrepo', :via => [:get, :post] + put 'to_gitlab' + # get 'create', :via=>[:get, :post] + end + end + + match 'wiki/index', :via => :get + resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do + member do + get 'rename' + post 'rename' + get 'history' + get 'diff' + match 'preview', :via => [:post, :put] + post 'protect' + post 'add_attachment' + end + collection do + get 'export' + get 'date_index' + end + end + match 'wiki', :to => 'wiki#show', :via => :get + get 'wiki/:id/:version', :to => 'wiki#show', :constraints => {:version => /\d+/} + delete 'wiki/:id/:version', :to => 'wiki#destroy_version' + get 'wiki/:id/:version/annotate', :to => 'wiki#annotate' + get 'wiki/:id/:version/diff', :to => 'wiki#diff' + end + + resources :issues do + collection do + match 'bulk_edit', :via => [:get, :post] + post 'bulk_update' + get 'issue_commits' + get 'commit_for_issue' + get 'issue_commit_delete' + end + member do + post 'add_journal' + post 'add_journal_in_org' + get 'delete_journal' + get 'reply' + post 'add_reply' + end + resources :time_entries, :controller => 'timelog' do + collection do + get 'report' + end + end + resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] + end + match '/issues', :to => 'issues#destroy', :via => :delete + + resources :queries, :except => [:show] + + resources :training_tasks do + member do + post 'complete_training_task' + post 'add_reply' + post 'add_journal' + post 'add_journal_in_org' + get 'delete_journal' + get 'reply' + end + collection do + end + end + + resources :news, :only => [:index, :show, :edit, :update, :destroy] + + match '/news/:id/comments', :to => 'comments#create', :via => :post + #match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete + delete '/news/:id/comments/:comment_id', :to => 'comments#destroy', as: :delete_news_comments + + resources :versions, :only => [:show, :edit, :update, :destroy] do + post 'status_by', :on => :member + end + + resources :documents, :only => [:show, :edit, :update, :destroy] do + post 'add_attachment', :on => :member + end + + match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post] + + resources :time_entries, :controller => 'timelog', :except => :destroy do + collection do + get 'report' + get 'bulk_edit' + post 'bulk_update' + end + end + match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ + # TODO: delete /time_entries for bulk deletion + match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete + + get 'projects/:id/activity', :to => 'activities#index' + get 'projects/:id/activity.:format', :to => 'activities#index' + get 'activity', :to => 'activities#index' + + # repositories routes + get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats', :as => "stats_repository_project" + get 'projects/:id/repository/:repository_id/quality_analysis', :to => 'repositories#quality_analysis', :as => "quality_analysis" + get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' + + get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', :to => 'repositories#changes' + # shixun + get 'shixuns/:id/repository/:repository_id/commits(/*path(.:ext))', :to => 'repositories#commits' + get 'shixuns/:id/repository/:repository_id/commits/:changeset_id', :to => 'repositories#commits' + + get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' + get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' + post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' + delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' + get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' + get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', + :controller => 'repositories', + :format => false, + :constraints => { + :action => /(browse|show|entry|raw|annotate|diff|commit_diff)/, + :rev => /[a-z0-9\.\-_]+/ + } + + get 'projects/:id/repository/statistics', :to => 'repositories#stats' + get 'projects/:id/repository/quality_analysis', :to => 'repositories#quality_analysis' + + get 'projects/:id/repository/graph', :to => 'repositories#graph' + + get 'projects/:id/repository/changes(/*path(.:ext))', :to => 'repositories#changes' + + get 'projects/:id/repository/forked', :to => 'repositories#forked' + get 'projects/:id/repository/training_task_execute', :to => 'repositories#training_task_execute' + get 'projects/:id/repository/tree_head_message', :to => 'repositories#tree_head_message', :as => "tree_head_message" + get 'projects/:id/repository/export_rep_static', :to => 'repositories#export_rep_static' + get 'projects/:id/repository/project_archive', :to => 'repositories#project_archive', :as => 'project_archive' + get 'projects/:id/repository/revisions', :to => 'repositories#revisions' + get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' + get 'projects/:id/repository/revision', :to => 'repositories#revision' + post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' + delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' + get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', + :controller => 'repositories', + :format => false, + :constraints => { + :action => /(browse|show|entry|raw|annotate|diff|commit_diff)/, + :rev => /[a-z0-9\.\-_]+/ + } + get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', + :controller => 'repositories', + :action => /(browse|show|entry|raw|changes|annotate|diff|commit_diff)/ + get 'projects/:id/repository/:action(/*path(.:ext))', + :controller => 'repositories', + :action => /(browse|show|entry|raw|changes|annotate|diff|commit_diff)/ + + get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil + # shixun + get 'shixuns/:id/repository/:repository_id', :to => 'repositories#shixun_show', :path => nil + get 'shixuns/:id/repository/:repository_id/:rev/:action(/*path(.:ext))', + :controller => 'repositories', + :format => false, + :constraints => { + :action => /(browse|shixun_show|shixun_entry|raw|annotate|diff|commit_diff)/, + :rev => /[a-z0-9\.\-_]+/ + } + + # myshixun + get 'myshixuns/:myshixun_id/games/:id/:rev/:action(/*path(.:ext))', + :controller => 'games', + :format => false, + :constraints => { + :action => /(browse|show|entry)/, + :rev => /[a-z0-9\.\-_]+/ + } + + get 'projects/:id/repository', :to => 'repositories#show', :path => nil + get 'projects/:id/exit', :to => 'projects#exit_project', :as => 'exit_cur_project' + + # additional routes for having the file name at the end of url + get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment' + get 'attachments/attachment_versions/:id',:to=>'attachments#attachment_versions',:as=>'attachments_versions' + get 'attachments/attachment_versions_delete/:id',:to=>'attachments#attachment_versions_delete',:as=>'attachment_versions_delete' + get 'attachments/attachment_history_download/:id',:to=>'attachments#attachment_history_download',:as=>'attachment_history_download' + post 'attachments/upload_attachment_version',:to=>'attachments#upload_attachment_version',:as=>'upload_attachment_version' + get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment' + get 'attachments/download_resource/:id/:filename', :to => 'attachments#download_resource', :id => /\d+/, :filename => /.*/, :as => 'download_resource_attachment' + get 'attachments/download_history/:id/:filename', :to => 'attachments#download_history', :id => /\d+/, :filename => /.*/, :as => 'download_history_attachment' + get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/, :as => 'download_attachment' + get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail' + get 'attachments/autocomplete' + get 'attachments/update_attachment_publish_time/:id',:to=>'attachments#update_attachment_publish_time',:as=>'update_attachment_publish_time' + match 'attachments/autocomplete', :to => 'attachments#autocomplete', :via => [:post] + post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation' + post 'attachments/relationfiles', to: 'attachments#add_exist_file_to_projects', as: 'attach_relations' + post 'attachments/courserelationfile', to: 'attachments#add_exist_file_to_course', as: 'course_attach_relation' + post 'attachments/courserelationfiles', to: 'attachments#add_exist_file_to_courses', as: 'course_attach_relations' + match 'attachments/add_exist_file_to_org_subfield' + get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/ + resources :attachments, :only => [:show, :destroy] do + collection do + match "updateType" , :via => [:get, :post] + match "updateFileDense" , :via => [:get, :post] + match "update_file_dense", :via => [:post] + match "renderTag" , :via => [:get, :post] + match 'delete_softapplications', :via => [:get, :post] + end + end + resources :groups do + member do + get 'autocomplete_for_user' + end + end + + match 'groups/:id/users', :to => 'groups#add_users', :id => /\d+/, :via => :post, :as => 'group_users' + match 'groups/:id/users/:user_id', :to => 'groups#remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' + match 'groups/destroy_membership/:id', :to => 'groups#destroy_membership', :id => /\d+/, :via => :post + match 'groups/edit_membership/:id', :to => 'groups#edit_membership', :id => /\d+/, :via => :post + + resources :trackers, :except => :show do + collection do + match 'fields', :via => [:get, :post] + end + end + resources :issue_statuses, :except => :show do + collection do + post 'update_issue_done_ratio' + end + end + resources :custom_fields, :except => :show + resources :roles do + collection do + match 'permissions', :via => [:get, :post] + end + end + resources :web_footer_companies, :except => :show + resources :enumerations, :except => :show + match 'enumerations/:type', :to => 'enumerations#index', :via => :get + + get 'projects/:id/search', :controller => 'search', :action => 'index' + get 'search', :controller => 'search', :action => 'index' + + match 'mail_handler', :to => 'mail_handler#index', :via => :post + match 'mail_handler/cancel/:id', :to => 'mail_handler#cancel_mail_notify',:via => :get + + match 'admin', :to => 'admin#index', :via => :get + match 'admin/projects', :via => :get + match 'admin/export_rep_static_users', :via => :get + get 'admin/courses', as: :all_courses + get 'admin/syllabuses', as: :all_syllabuses + get 'admin/contests', :via => :get + get 'admin/non_syllabus_courses', as: :non_syllabus_courses + post 'admin/update_course_name' + post 'admin/update_syllabus_title' + get 'admin/excellent_courses', as: :excellent_courses + get 'admin/shixuns', as: :admin_shixuns + get 'admin/shixun_authentication', as: :admin_shixun_authentication + get 'admin/excellent_all_courses', as: :excellent_all_courses + match 'admin/set_excellent_course/:id', :to => 'admin#set_excellent_course' + match 'admin/cancel_excellent_course/:id', :to => 'admin#cancel_excellent_course' + get 'admin/course_resource_list' + get 'admin/project_resource_list' + match 'admin/users', :via => :get + match 'admin/messages', :via => :get + match 'admin/first_page_made', as: :first_page_made + match 'admin/course_page_made', as: :course_page_made + match 'admin/contest_page_made', as: :contest_page_made + match 'admin/web_footer_made', as: :web_footer_made + match 'admin/enterprise_page_made', as: :enterprise_page_made + match 'admin/mobile_version', as: :mobile_version + match 'admin/create_version', as: :create_version + match 'admin/search', :via => [:get, :post] + match 'admin/plugins', :via => :get + match 'admin/info', :via => :get + match 'admin/test_email', :via => :get + match 'admin/default_configuration', :via => :post + get 'admin/organization' + get 'admin/schools' + get 'admin/applied_schools', as: :unapplied_schools + get 'admin/has_applied_schools', as: :applied_schools + get 'admin/approve_applied_schools' + post 'admin/edit_applied_schools' + get 'admin/all_schools' + get 'admin/apply_shcool_sort', as: :apply_shcool_sort + delete 'admin/delete_applied_schools' + get 'admin/applied_departments', as: :unapplied_departments + get 'admin/has_applied_departments', as: :applied_departments + get 'admin/approve_applied_departments' + delete 'admin/delete_applied_departments' + + get 'admin/leave_messages' + match 'admin/messages_list', as: :messages_list + match 'admin/project_messages', as: :project_messages + match'admin/course_messages', as: :course_messages + get 'admin/notices' + match 'admin/latest_login_users', as: :latest_login_users + match 'admin/latest_login_teachers', as: :latest_login_teachers + get 'admin/homework' + get 'admin/apply_for_homework' + get 'admin/code_work_tests' + post 'admin/select_course_syllabus' + post 'admin/create_syllabus' + get 'admin/identity_authentication' + get 'admin/reject_authentication' + get 'admin/agree_authentication' + + resources :auth_sources do + member do + get 'test_connection', :as => 'try_connection' + end + collection do + get 'autocomplete_for_new_user' + end + end + + match 'courses/search' + match '/contests/search', :via => [:get, :post] + + #课程大纲路由设置 + resources :syllabuses do + member do + match 'syllabus_courselist', :to => 'syllabuses#syllabus_courselist', :via => :get, :as => 'syllabus_courselist' + get 'edit_syllabus_eng_name' + get 'edit_syllabus_title' + post 'update_base_info' + get 'delete_syllabus' + get 'delete_des' + get 'members' + post 'update_des' + get 'edit_ref' + post 'update_ref' + get 'add_sy_member_alert' + post 'search_not_sy_member' + get 'syllabus_homeworks' + get 'syllabus_resources' + match "choose_user_course", :via => [:post, :get] + post 'send_resources_to_course' + post 'send_homeworks_to_course' + post 'send_r_and_h_to_course' + end + + collection do + get 'get_discipline_categories' + get 'get_first_level_disciplines' + post 'regex_syllabus_name' + end + end + + resources :syllabus_member do + member do + post 'update_rank' + end + + collection do + get 'syl_member_autocomplete' + post 'change_manager' + get 'change_manager_alert' + end + end + + # add by nwb + # 课程路由设置 + resources :courses do + member do + get 'settings(/:tab)', :action => 'settings', :as => 'settings' + get 'search_member', :action => 'search_member' + get 'file', :action => 'file', :as => 'file' + get 'feedback', :action => 'feedback', :as => 'course_feedback' + get 'code_repeat', :action => 'code_repeat', :as => 'code_repeat' + get 'member', :controller => 'courses', :action => 'member', :as => 'member' + get 'group_member', :controller => 'courses', :action => 'group_member', :as => 'group_member' + get 'export_course_member_excel',:controller => 'courses',:action => 'export_course_member_excel' + get 'member_score', :to => 'courses#member_score' + post 'finishcourse' + post 'restartcourse' + match "renew", :to => 'courses#renew', :via => [:post, :get], :as =>'renew' + match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get] + match "searchgroupmembers", :via => [:post, :get] + match 'member_score_sort', :via => [:get] + match "updategroupname", :via => [:post, :get] + match "addgroups", :via => [:post, :get] + match 'deletegroup', :via => [:delete] + match 'show_member_score', :via => [:get] + match 'show_member_act_score', :via => [:get] + match 'valid_ajax', :to => 'courses#valid_ajax', :via => :get + post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group' + get 'copy_course' + get 'private_or_public' + match 'course_activity', :to => 'courses#course_activity', :via => :get, :as => "course_activity" + get 'course_outline' + post 'search_course_outline' + post 'set_course_outline' + post 'teacher_assign_group' + get 'syllabus' + get 'search_public_orgs_not_in_course' + get "homework_search" + get "show_comparecode" + get "course_statistics" + get "switch_role" + get 'search_not_group_member' + post 'add_members' + get 'search_course_teacher_list' + post 'change_manager' + get 'delete_member' + get 'archive_course' + get 'set_invite_code_halt' + get 'open_or_close_os_interface' + get 'choose_group_allow' + match 'search_not_teachers', :via => [:get, :post] + match 'search_not_students', :via => [:get, :post] + get 'all_student_list' + get 'no_group_student_list' + get 'has_group_student_list' + post 'choose_course_group' + match 'update_position', :via => [:get, :post] + end + collection do + match 'join_private_courses', :via => [:get, :post] + post "join_course_multi_role" + get 'unjoin_group' + end + + match '/member', :to => 'courses#member', :as => 'member', :via => :get + resources :boards + resources :files, :only => [:index, :new, :create] do + collection do + match "getattachtype", :via => [:get, :post] + match "search",:via => [:post,:get] + match "searchone4reload",:via => [:post,:get] + match "search_tag_attachment", :via => [:post,:get] + end + member do + match "quote_resource_show", :via => [:get] + get "file_hidden" + post "republish_file" + get "update_file_description" + post "edit_file_description" + end + end + resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do + collection do + get 'autocomplete' + get 'appliedproject' + end + end + resources :news, :except => [:show, :edit, :update, :destroy] + # resources :boards do + # member do + # match 'boards_topic', :to => 'boards#boards_topic', :via => :get, :as => "boards_topic" + # end + # end + match '/homework', :to => 'courses#homework', :as => 'homework', :via => :get + resources :activity_notifys do + collection do + match 'chang_read_flag', :via => :get + end + end + + end # end of resources :courses + match 'courses/:id/feedback', :to => 'courses#feedback', :via => :get, :as => 'course_feedback' + match '/courses/search', :via => [:get, :post] + match 'words/:id/leave_course_message', :to => 'words#leave_course_message', :as => "leave_course_message" + + + match 'workflows', :to => 'workflows#index', :via => :get + match 'workflows/edit', :via => [:get, :post] + match 'workflows/permissions', :via => [:get, :post] + match 'workflows/copy', :via => [:get, :post] + match 'settings', :controller => 'settings', :action => 'index', :via => :get + match 'settings/edit', :via => [:get, :post] + match 'settings/plugin/:id', :to => 'settings#plugin', :via => [:get, :post], :as => 'plugin_settings' + match 'settings/hidden_non_project', :via => [:get, :post] + match 'settings/hidden_courses', :via => [:get, :post] + + match 'sys/projects', :via => :get + match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post + match 'sys/fetch_changesets', :via => :get + + match 'uploads', :to => 'attachments#upload', :via => :post + match 'upload_with_markdown', :to => 'attachments#upload_with_markdown', :via => :post + # Added by Tao + match 'upload_avatar', :to => 'avatar#upload', :via => :post + match 'delete_avatar', :to => 'avatar#delete_image',:via => :post + # Endof Tao's code + get 'robots.txt', :to => 'welcome#robots' + ##############测试留言功能 fq + post 'words/new', :to => 'words#new' + post 'words/create', :to => 'words#create' + post 'words/append', :to => 'words#append' + post 'words/create_reply', :to => 'words#create_reply' + delete 'words/destroy', :to => 'words#destroy' + delete 'words/destroyJournal', :to => 'words#destroyJournal' + get 'words/more', :to => 'words#more' + get 'words/back', :to=> 'words#back' + get 'words/destroyJournal', :to => 'words#destroyJournal' + match 'words/add_project_respond', :to => 'words#add_project_respond' + match 'words/:id/leave_project_message', :to => 'words#leave_project_message' + match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback' + match 'project/:id/share', :to => 'projects#share', :as => 'share_show' #share + post 'words/:id/leave_user_message', :to => 'words#leave_user_message', :as => "leave_user_message" + post 'words/:id/leave_contest_message', :to => 'words#leave_contest_message', :as => "leave_contest_message" + post 'words/:id/leave_syllabus_message', :to => 'words#leave_syllabus_message', :as => "leave_syllabus_message" + post 'words/:id/leave_homework_message', :to => 'words#leave_homework_message', :as => "leave_homework_message" + post 'words/:id/reply_to_homework', :to => 'words#reply_to_homework', :as => "reply_to_homework" + post 'words/:id/leave_contest_work_message', :to => 'words#leave_contest_work_message', :as => "leave_contest_work_message" + post 'words/:id/reply_to_contest_work', :to => 'words#reply_to_contest_work', :as => "reply_to_contest_work" + post 'words/:id/reply_to_syllabus', :to => 'words#reply_to_syllabus', :as => "reply_to_syllabus" + + post 'join_in/join', :to => 'courses#join', :as => 'join' + delete 'join_in/join', :to => 'courses#unjoin' + post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group' + + delete 'attachment/:id', :to => 'attachments#delete_homework' + match 'new_join', :to => 'courses#new_join', :as => 'try_join' + match 'new_join_group', :to => 'courses#new_join_group', :as => 'try_join_group' + match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post + + ######################## + ##added by wen########## + #######confusing######## + get 'welcome/search', to: 'welcome#search' + get 'school/index', to: 'school#index' + get 'school/:school_id', to: 'welcome#course', :as => 'school_course_list' + post 'school/get_options/:province', :to => 'school#get_options' + get 'school/get_options/:province', :to => 'school#get_options' + + post 'school/get_province', :to => 'school#get_province' + get 'school/get_province', :to => 'school#get_province' + + post 'school/get_schoollist/:province', :to => 'school#get_schoollist' + get 'school/get_schoollist/:province', :to => 'school#get_schoollist' + + post 'school/search_school/', :to => 'school#search_school' + get 'school/search_school/', :to => 'school#search_school' + + post 'school/on_search' + post 'school/add_school' + ######added by nie + match 'tags/show_projects_tags' + ########### added by liuping + match 'tags/add_tag', :as=>"add_tag" + match 'tags/delete_tag', :as=>"add_tag" + match 'tags/show_all' + match 'parise_tread/praise_plus', :as=>"praise" + match 'parise_tread/tread_plus', :as=>"tread" + match 'tags/delete' + match 'tags/remove_tag', :as=>"remove_tag" + match 'tags/remove_tag_new', :as=>"remove_tag_new" + match 'tags/tag_save', :as => "save_tag" + match 'tags/update_tag_name',:as => "update_tag_name" + match 'tags/update_project_tag_name',:as => "update_project_tag_name" + match 'tags/update_org_subfield_tag_name' + + match 'words/add_brief_introdution' + + ##added by lizanle 日志查看路由 + match 'system_log/index' + match 'system_log/access_analysis' + match 'system_log/time_analysis' + match "/system_log" ,:to => 'system_log#index' + match 'system_log/clear' + get 'upload_files_menu', :to => 'files#upload_files_menu' + get '/manual/feedback', to:redirect("http://forge.trustie.net/forums/1/memos/1168") + ##ended by lizanle + + resources :git_callback do + collection do + post 'post_update' + end + end + + resources :at + resource :wechat, only:[:show, :create] do + collection do + get :login + get :user_activities + post :bind + post :get_bind + post :is_bind + get :auth + get :auth_callback + end + end + + resource :sso, only: [:show, :create] + + get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_subfield_without_id' + + Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| + file = File.join(plugin_dir, "config/routes.rb") + if File.exists?(file) + begin + instance_eval File.read(file) + rescue Exception => e + puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." + exit 1 + end + end + end +end From bbf694b5bbf9eef4a5af8179aba50efe2b5c7b3d Mon Sep 17 00:00:00 2001 From: XuCheng642 <287102909@qq.com> Date: Fri, 14 Jul 2017 15:22:35 +0800 Subject: [PATCH 02/93] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E9=83=A8=E9=97=A8=E7=9B=B8=E5=85=B3=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 8 ++ app/views/layouts/base_management.html.erb | 9 +- app/views/managements/depart.html.erb | 74 ++++++++++ app/views/managements/departments.html.erb | 76 +++++++++++ .../managements/departments_part.html.erb | 101 ++++++++++++++ app/views/managements/shixuns.html.erb | 128 +++++++++--------- app/views/managements/unit.html.erb | 93 +++++++++++++ config/routes.rb | 3 + public/stylesheets/css/edu-admin.css | 16 ++- 9 files changed, 441 insertions(+), 67 deletions(-) create mode 100644 app/views/managements/depart.html.erb create mode 100644 app/views/managements/departments_part.html.erb create mode 100644 app/views/managements/unit.html.erb diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index f2a621d66..1c0f8d9d4 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -10,7 +10,15 @@ class ManagementsController < ApplicationController def departments end + def departments_part + end + def depart + + end + def unit + + end # 0 全部;1 活动的; 2 已注册; 3 锁定 def users status = params[:user_status].nil? ? 0 : params[:user_status].to_i diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index 65653d717..8b0cf8ad7 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -28,8 +28,11 @@ <%= link_to "实训+", shixuns_managements_path, :class => "edu-admin-nav-a" %>
  • 竞赛+
  • -
  • - <%= link_to "单位", departments_managements_path, :class => "edu-admin-nav-a" %> +
  • 单位 +
  • 用户
  • 工程认证+
  • diff --git a/app/views/managements/depart.html.erb b/app/views/managements/depart.html.erb new file mode 100644 index 000000000..c40d2ba34 --- /dev/null +++ b/app/views/managements/depart.html.erb @@ -0,0 +1,74 @@ +
    + + 搜索 + 清除 + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    序号部门名称单位名称创建于
    1计算机学院中国科学近代物理研究所2018-02-02 10:02 修改
    1计算机学院中国科学近代物理研究所2018-02-02 10:02 修改
    1计算机学院中国科学近代物理研究所2018-02-02 10:02 修改
    + diff --git a/app/views/managements/departments.html.erb b/app/views/managements/departments.html.erb index e69de29bb..1dd1573e2 100644 --- a/app/views/managements/departments.html.erb +++ b/app/views/managements/departments.html.erb @@ -0,0 +1,76 @@ +
    + + 创建 + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    序号部门名称用户数已认证职业创建于
    1计算机学院20032018-02-02 10:02 修改
    1计算机学院20032018-02-02 10:02 修改
    1计算机学院20032018-02-02 10:02 修改
    + diff --git a/app/views/managements/departments_part.html.erb b/app/views/managements/departments_part.html.erb new file mode 100644 index 000000000..714fe141e --- /dev/null +++ b/app/views/managements/departments_part.html.erb @@ -0,0 +1,101 @@ +
    + + 新建单位 + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    序号单位名称地区详细地址用户数部门数创建于
    1中国科学院近代物理研究所北京市海淀区湖北省武汉市武汉纺织大学322018-02-02 10:02 修改
    1中国科学院近代物理研究所北京市海淀区湖北省武汉市武汉纺织大学322018-02-02 10:02 修改
    1中国科学院近代物理研究所北京市海淀区湖北省武汉市武汉纺织大学322018-02-02 10:02 修改
    1中国科学院近代物理研究所北京市海淀区湖北省武汉市武汉纺织大学322018-02-02 10:02 修改
    + diff --git a/app/views/managements/shixuns.html.erb b/app/views/managements/shixuns.html.erb index d72709279..cc9a48ec3 100644 --- a/app/views/managements/shixuns.html.erb +++ b/app/views/managements/shixuns.html.erb @@ -1,64 +1,64 @@ - -
    - <%= form_tag(url_for(shixuns_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %> -
    - - - -
  • - 搜索 - 清除 -
  • - <% end %> -
    -
    - <%= render :partial => "managements/shixun_list" %> -
    -
    - + +
    + <%= form_tag(url_for(shixuns_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %> +
    + + + +
  • + 搜索 + 清除 +
  • + <% end %> +
    +
    + <%= render :partial => "managements/shixun_list" %> +
    +
    + diff --git a/app/views/managements/unit.html.erb b/app/views/managements/unit.html.erb new file mode 100644 index 000000000..7c13594d3 --- /dev/null +++ b/app/views/managements/unit.html.erb @@ -0,0 +1,93 @@ +
    + + 搜索 + 清除 + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    序号单位名称地区详细地址申请者创建于
    1山西省云城市临猗县白沙空间省会花园小区178号山西省运城市山西省云城市临猗县白沙空间省会花园小区178号胡莎莎2018-02-02 10:02 修改
    1山西省云城市临猗县白沙空间省会花园小区178号山西省运城市山西省云城市临猗县白沙空间省会花园小区178号胡莎莎2018-02-02 10:02 修改
    1山西省云城市临猗县白的空间省会花园小区178号山西省运城市山西省云城市临猗县的空间省会花园小区178号胡莎莎2018-02-02 10:02 修改
    1山西省云城市临猗县白沙空间省会花园小区178号山西省运城市山西省云城市临猗县的空间省会花园小区178号胡莎莎2018-02-02 10:02 修改
    + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index a763e7d05..0414b18cc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -142,6 +142,9 @@ RedmineApp::Application.routes.draw do match 'users_authorization_cancel' get 'update_webssh' get 'departments' + get 'departments_part' + get 'depart' + get 'unit' end end # Enable Grack support diff --git a/public/stylesheets/css/edu-admin.css b/public/stylesheets/css/edu-admin.css index d0ef32e90..56dad83b8 100644 --- a/public/stylesheets/css/edu-admin.css +++ b/public/stylesheets/css/edu-admin.css @@ -123,4 +123,18 @@ a:hover.edu-admin-nav-a,.active a.edu-admin-nav-a{color: #5faee3;} .edu-dropdown-menu p{height: 35px;line-height: 35px;} .ex_container{margin-bottom: 20px;} -.table_Name_text{text-align: left;display: block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;height: 39px;width: 370px;line-height: 39px;-webkit-box-orient: vertical;} \ No newline at end of file +.table_Name_text{text-align: left;display: block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;height: 39px;width: 370px;line-height: 39px;-webkit-box-orient: vertical;} + +/*管理员单位列表页面*/ +.id{ width: 9%;} +.number,.job_num,.editor,.c_time{ width: 15%;} +.part{ width: 30%;} +.r6{margin-right: 65px} +/*管理员单位列表部门页面*/ +.xlogo,.xeditor{width: 7%} +.xadd,.xpart{width: 24%;overflow: hidden;} +.eud-pointer{width: 10%} +.xregion{width: 9%;vertical-align: top;padding-top: 4px} +.xuser-num,.xpart-num{width: 5%} +.mt10{margin-top: 10px} +.edu-txt-left{ text-align: left;} \ No newline at end of file From a8fc640b2ee98439dc2896b2c4121c45bce0dcda Mon Sep 17 00:00:00 2001 From: XuCheng642 <287102909@qq.com> Date: Tue, 18 Jul 2017 14:45:23 +0800 Subject: [PATCH 03/93] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=AE=9E=E8=AE=AD=E8=AF=BE=E5=A0=82=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 78 +++---- app/controllers/managements_controller.rb | 151 +++++++------ app/views/layouts/base_management.html.erb | 38 +++- .../class_publish_shixuns.html.erb | 55 +++++ .../class_shixun_authorization.html.erb | 140 ++++++++++++ app/views/managements/class_shixuns.html.erb | 79 +++++++ app/views/managements/classroom.html.erb | 93 ++++++++ app/views/managements/classroom_classment.erb | 116 ++++++++++ app/views/managements/depart.html.erb | 63 +++--- app/views/managements/departments.html.erb | 64 +++--- .../managements/departments_part.html.erb | 111 +++++----- .../managements/shixun_authorization.html.erb | 206 +++++++++--------- app/views/managements/unit.html.erb | 82 ++++--- config/routes.rb | 33 +-- public/stylesheets/css/edu-admin.css | 19 +- 15 files changed, 927 insertions(+), 401 deletions(-) create mode 100644 app/views/managements/class_publish_shixuns.html.erb create mode 100644 app/views/managements/class_shixun_authorization.html.erb create mode 100644 app/views/managements/class_shixuns.html.erb create mode 100644 app/views/managements/classroom.html.erb create mode 100644 app/views/managements/classroom_classment.erb diff --git a/.gitignore b/.gitignore index bb4b68554..1b56839ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,39 +1,39 @@ -*.swp -/.project -/.idea -/.bundle -*.swp -/config/database.yml -/config/configuration.yml -/config/additional_environment.rb -/config/oneapm.yml -/config/environments/production.rb - - -/files/* -/log/* -/public/tmp/* -/tmp/* -/public/cache/* -/config/newrelic.yml -/public/images/avatars/* -/db/schema.rb -/Gemfile.lock -/lib/plugins/acts_as_versioned/test/debug.log -.rbenv-gemsets -.DS_Store -public/api_doc/ -/.metadata -vendor/cache -/files -/public/images/avatars -/public/files -/tags -/config/initializers/gitlab_config.rb -1234567 -public/javascripts/wechat/node_modules/ -.ruby-version -.access_token -tmux*.log -config/wechat.yml -config/oneapm.yml +*.swp +/.project +/.idea/* +/.bundle +*.swp +/config/database.yml +/config/configuration.yml +/config/additional_environment.rb +/config/oneapm.yml +/config/environments/production.rb + + +/files/* +/log/* +/public/tmp/* +/tmp/* +/public/cache/* +/config/newrelic.yml +/public/images/avatars/* +/db/schema.rb +/Gemfile.lock +/lib/plugins/acts_as_versioned/test/debug.log +.rbenv-gemsets +.DS_Store +public/api_doc/ +/.metadata +vendor/cache +/files +/public/images/avatars +/public/files +/tags +/config/initializers/gitlab_config.rb +1234567 +public/javascripts/wechat/node_modules/ +.ruby-version +.access_token +tmux*.log +config/wechat.yml +config/oneapm.yml diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index a04216052..afcf13d41 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -18,6 +18,21 @@ class ManagementsController < ApplicationController end def unit + end + def classroom + + end + def classroom_classment + + end + def class_shixuns + + end + def class_publish_shixuns + + end + def class_shixun_authorization + end # 0 全部;1 活动的; 2 已注册; 3 锁定 def users @@ -51,7 +66,7 @@ class ManagementsController < ApplicationController end def shixuns - @menu_type = 3 + @menu_type = 3 sx_status = params[:status].blank? ? [0, 1, 2, 3] : params[:status].to_i # 搜索实训的状态 keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/实训名搜索 search = params[:search] # 搜索的字 @@ -83,73 +98,73 @@ class ManagementsController < ApplicationController end end - # 已发布的实训 - def publish_shixuns - @menu_type = 3 - @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] # 排序 - search = params[:search] # 搜索字 - keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/实训名搜索 - close = params[:close] # 关闭实训,参数是实训的Id - unless close.blank? - Shixun.find(close).update_attribute(:status, 3) - end - if "u_name" == keyword - # 如果用户搜索为空,不用遍历user表,直接查找所有实训, 有搜索时才查找user - if search.blank? - @shixuns = Shixun.where(:status => 2).order("created_at #{@sx_order}") - else - user_id = User.where("concat(lastname, firstname) like '%#{search}%'") - @shixuns = Shixun.where(:user_id => user_id, :status => 2).order("created_at #{@sx_order}") - end - else - @shixuns = Shixun.where("name like '%#{search}%'").where(:status => 2).order("created_at #{@sx_order}") - end - @shixuns_count = @shixuns.count - limit = 20 - @shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1 - @offset ||= @shixuns_pages.offset - @shixuns = paginateHelper @shixuns, limit - - respond_to do |format| - format.js - format.html - end - end - - # 已关闭的实训 - def close_shixuns - @menu_type = 3 - @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] # 排序 - search = params[:search] # 搜索字 - keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/实训名搜索 - reopen = params[:reopen] # 从新开启实训,参数是实训的Id - - unless reopen.blank? - Shixun.find(reopen).update_attribute(:status, 2) - end - if "u_name" == keyword - # 如果用户搜索为空,不用遍历user表,直接查找所有实训, 有搜索时才查找user - if search.blank? - @shixuns = Shixun.where(:status => 3).order("updated_at #{@sx_order}") - else - user_id = User.where("concat(lastname, firstname) like '%#{search}%'") - @shixuns = Shixun.where(:user_id => user_id, :status => 3).order("updated_at #{@sx_order}") - end - else - @shixuns = Shixun.where("name like '%#{search}%'").where(:status => 3).order("updated_at #{@sx_order}") - end - @shixuns_count = @shixuns.count - limit = 20 - @shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1 - @offset ||= @shixuns_pages.offset - @shixuns = paginateHelper @shixuns, limit - - respond_to do |format| - format.js - format.html - end - end - + # 已发布的实训 + def publish_shixuns + @menu_type = 3 + @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] # 排序 + search = params[:search] # 搜索字 + keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/实训名搜索 + close = params[:close] # 关闭实训,参数是实训的Id + unless close.blank? + Shixun.find(close).update_attribute(:status, 3) + end + if "u_name" == keyword + # 如果用户搜索为空,不用遍历user表,直接查找所有实训, 有搜索时才查找user + if search.blank? + @shixuns = Shixun.where(:status => 2).order("created_at #{@sx_order}") + else + user_id = User.where("concat(lastname, firstname) like '%#{search}%'") + @shixuns = Shixun.where(:user_id => user_id, :status => 2).order("created_at #{@sx_order}") + end + else + @shixuns = Shixun.where("name like '%#{search}%'").where(:status => 2).order("created_at #{@sx_order}") + end + @shixuns_count = @shixuns.count + limit = 20 + @shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1 + @offset ||= @shixuns_pages.offset + @shixuns = paginateHelper @shixuns, limit + + respond_to do |format| + format.js + format.html + end + end + + # 已关闭的实训 + def close_shixuns + @menu_type = 3 + @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] # 排序 + search = params[:search] # 搜索字 + keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/实训名搜索 + reopen = params[:reopen] # 从新开启实训,参数是实训的Id + + unless reopen.blank? + Shixun.find(reopen).update_attribute(:status, 2) + end + if "u_name" == keyword + # 如果用户搜索为空,不用遍历user表,直接查找所有实训, 有搜索时才查找user + if search.blank? + @shixuns = Shixun.where(:status => 3).order("updated_at #{@sx_order}") + else + user_id = User.where("concat(lastname, firstname) like '%#{search}%'") + @shixuns = Shixun.where(:user_id => user_id, :status => 3).order("updated_at #{@sx_order}") + end + else + @shixuns = Shixun.where("name like '%#{search}%'").where(:status => 3).order("updated_at #{@sx_order}") + end + @shixuns_count = @shixuns.count + limit = 20 + @shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1 + @offset ||= @shixuns_pages.offset + @shixuns = paginateHelper @shixuns, limit + + respond_to do |format| + format.js + format.html + end + end + def users_trial @menu_type = 6 @users = User.where(:status => 1).order("created_on desc").all diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index ffdf4ef1e..a4f42abc7 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -21,22 +21,37 @@
    +

    + 胡莎莎 > 班级列表 +

    + - - - - - + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - +
    序号部门名称单位名称创建于序号部门名称单位名称创建于
    1计算机学院中国科学近代物理研究所2018-02-02 10:02 修改
    1计算机学院中国科学近代物理研究所2018-02-02 10:02 修改
    1计算机学院中国科学近代物理研究所2018-02-02 10:02批准   删除   修改
    1计算机学院中国科学近代物理研究所2018-02-02 10:02批准   删除   修改
    1计算机学院中国科学近代物理研究所2018-02-02 10:02批准   删除   修改
    1计算机学院中国科学近代物理研究所2018-02-02 10:02批准   删除   修改
    1计算机学院中国科学近代物理研究所2018-02-02 10:02 修改
    \ No newline at end of file diff --git a/app/views/managements/unit.html.erb b/app/views/managements/unit.html.erb index 7c13594d3..589f9cd0b 100644 --- a/app/views/managements/unit.html.erb +++ b/app/views/managements/unit.html.erb @@ -34,51 +34,47 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    序号单位名称地区详细地址申请者创建于
    1山西省云城市临猗县白沙空间省会花园小区178号山西省运城市山西省云城市临猗县白沙空间省会花园小区178号胡莎莎2018-02-02 10:02 修改
    1山西省云城市临猗县白沙空间省会花园小区178号山西省运城市山西省云城市临猗县白沙空间省会花园小区178号胡莎莎2018-02-02 10:02 修改
    1山西省云城市临猗县白的空间省会花园小区178号山西省运城市山西省云城市临猗县的空间省会花园小区178号胡莎莎2018-02-02 10:02 修改
    1山西省云城市临猗县白沙空间省会花园小区178号山西省运城市山西省云城市临猗县的空间省会花园小区178号胡莎莎2018-02-02 10:02 修改序号单位名称地区详细地址申请者创建于
    1山西省云城市临猗县白沙空间省会花园小区178号山西省运城市山西省云城市临猗县的空间省会花园小区178号胡莎莎2018-02-02 10:02批准   删除   修改
    1山西省云城市临猗县白沙空间省会花园小区178号山西省运城市山西省云城市临猗县的空间省会花园小区178号胡莎莎2018-02-02 10:02批准   删除   修改
    1山西省云城市临猗县白沙空间省会花园小区178号山西省运城市山西省云城市临猗县的空间省会花园小区178号胡莎莎2018-02-02 10:02批准   删除   修改
    \ No newline at end of file diff --git a/app/views/managements/class_shixuns.html.erb b/app/views/managements/class_shixuns.html.erb index 5189eb078..39a493d4c 100644 --- a/app/views/managements/class_shixuns.html.erb +++ b/app/views/managements/class_shixuns.html.erb @@ -35,40 +35,19 @@ - - 1 - C语言课程实训 - 5 - 8 - 编辑中 - 国防科技大学 - 黄井泉 - 2015-03-02 11:38 - 删除 - - - 2 - C语言课程实训 - 5 - 8 - 编辑中 - 国防科技大学 - 黄井泉 - 2015-03-02 11:38 - 删除 - - - 3 - C语言课程实训 - 5 - 8 - 编辑中 - 国防科技大学 - 黄井泉 - 2015-03-02 11:38 - 删除 - - + <% @c_shixuns.each do |c_shixun| %> + + 1 + <%= c_shixun.name %> + <%= c_shixun.stages.count %> + <%= c_shixun.stage_shixuns.count %> + <%= c_shixun.status == 0 ? "编辑中" : (c_shixun.status == 1 ? "审核中" : "发布") %> + <%= c_shixun.user.try(:my_workplace) %> + <%= c_shixun.user.try(:show_name) %> + <%= format_time c_shixun.created_at %> + 删除 + + <% end %> diff --git a/app/views/managements/classroom.html.erb b/app/views/managements/classroom.html.erb index 17e0d65bc..5204f2922 100644 --- a/app/views/managements/classroom.html.erb +++ b/app/views/managements/classroom.html.erb @@ -50,44 +50,39 @@ ID 层级 - 学科门类 - 一级学科 - 专业名称 - 课程/班级名称 - 创建者 + 学科门类 + 一级学科 + 专业名称 + 课程/班级名称 + 创建者 创建于 课堂模版 - - 1 - 专科 - 公共管理与服务大类 - 公共事业类 - 公共事业管理 - 人力资源管理 - 黄井泉 - 2015-03-02 11:38 - + <% @syllabus.each do |syllabus| %> + + <%= syllabus.id %> + + 工学 + 计算机科学与应用 + 软件工程 + <%= render :partial => 'admin/rename_syllabus_title', :locals => {:syllabus => syllabus} %> + <%= link_to syllabus.user.show_name, user_path(syllabus.user) %> + <%= format_date(syllabus.created_at) %> + - - - 1 - 专科 - 公共管理与服务大类 - 公共事业类 - 公共事业管理 - 人力资源管理 - 黄井泉 - 2015-03-02 11:38 - - - - - + + <% end %> - +
    +
    +
      + <%= pagination_links_full @syllabus_pages, @syllabus_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %> +
    +
    +
    +
    diff --git a/app/views/managements/classroom_classment.erb b/app/views/managements/classroom_classment.erb index b15a193b1..4da6d6fcf 100644 --- a/app/views/managements/classroom_classment.erb +++ b/app/views/managements/classroom_classment.erb @@ -34,83 +34,41 @@ 私有 模版 状态 - 创建者单位 - 创建者 + 创建者单位 + 创建者 动态时间 首页显示 - - 1 - 人力资源开发与管理2016级C班 - 18 - 18 - 18 - 18 - √ - - 正在进行 - 国防科技大学 - 黄井泉 - 2015-03-02 11:38 - + <% @syllabus.each do |syllabus| %> + + <%= syllabus.id %> + 人力资源开发与管理2016级C班 + 18 + 18 + 18 + 18 + √ + + 正在进行 + 国防科技大学 + <%= link_to syllabus.user.show_name, user_path(syllabus.user) %> + <%= format_date(syllabus.created_at) %> + -