Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts: db/schema.rb
This commit is contained in:
commit
a3cbcdad51
69
ReadMe.txt
69
ReadMe.txt
|
@ -1,7 +1,7 @@
|
||||||
===================================[2014-04-09]=================================
|
===================================[2014-04-09]=================================
|
||||||
kw: 域名, 二级域名, subdomain, forge, course, contest
|
kw: 域名, 二级域名, subdomain, forge, course, contest
|
||||||
域名跳转(forge/course/contest)这几个设置在settings.yml中
|
域名跳转(forge/course/contest)这几个设置在settings.yml中
|
||||||
但是跳转在development模式下会导致无法开发
|
但是跳转在development模式下会导致无法开发
|
||||||
|
|
||||||
app/models/setting.rb :165
|
app/models/setting.rb :165
|
||||||
# fixed domain url in development. tantantan's bug
|
# fixed domain url in development. tantantan's bug
|
||||||
|
@ -10,56 +10,63 @@ app/models/setting.rb :165
|
||||||
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
程序部分链接中制定了subdomain参数,使链接在二级域名中来回跳转。
|
程序部分链接中制定了subdomain参数,使链接在二级域名中来回跳转。
|
||||||
为了开发方便,使之功能在development模式下失效。
|
为了开发方便,使之功能在development模式下失效。
|
||||||
|
|
||||||
|
|
||||||
===================================[2014-04-09]=================================
|
===================================[2014-04-09]=================================
|
||||||
kw: 菜单, 导航栏, layout
|
kw: 菜单, 导航栏, layout
|
||||||
网页上方的导航条没有用Redmine::MenuManager
|
网页上方的导航条没有用Redmine::MenuManager
|
||||||
MenuManager的样式无法定制,菜单显示条件if中的proc执行行为没有了解
|
MenuManager的样式无法定制,菜单显示条件if中的proc执行行为没有了解
|
||||||
|
|
||||||
#导航栏匹配域名显示和改变
|
#导航栏匹配域名显示和改变
|
||||||
app\helper\application_helper.rb
|
app\helper\application_helper.rb
|
||||||
render_dynamic_nav 方法中,利用变量,可以设置在layout中具体显示哪些条目
|
render_dynamic_nav 方法中,利用变量,可以设置在layout中具体显示哪些条目
|
||||||
|
|
||||||
app\views\layouts\_base_header.html.erb
|
app\views\layouts\_base_header.html.erb
|
||||||
需要显示的条目,由具体的实例变量设置(在各个layout中)
|
需要显示的条目,由具体的实例变量设置(在各个layout中)
|
||||||
|
|
||||||
|
|
||||||
===================================[2014-04-09]=================================
|
===================================[2014-04-09]=================================
|
||||||
kw: home_path, 首页, 跳转, 二级域名, welcome
|
kw: home_path, 首页, 跳转, 二级域名, welcome
|
||||||
#首页根据域名匹配进入不同的页面
|
#首页根据域名匹配进入不同的页面
|
||||||
app\controller\welcome_controller.rb
|
app\controller\welcome_controller.rb
|
||||||
#entry_select 放射设置二级域名所显示的首页
|
#entry_select 放射设置二级域名所显示的首页
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===================================[2014-06-06]=================================
|
===================================[2014-06-06]=================================
|
||||||
kw: user_scores
|
kw: user_scores
|
||||||
user_scores表结构有问题,需要运行
|
user_scores表结构有问题,需要运行
|
||||||
bundle exec rake db:migrate:down VERSION=20140410021724
|
bundle exec rake db:migrate:down VERSION=20140410021724
|
||||||
bundle exec rake db:migrate:up VERSION=20140410021724
|
bundle exec rake db:migrate:up VERSION=20140410021724
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===================================[2014-07-08]=================================
|
===================================[2014-07-08]=================================
|
||||||
kw: CKEditor, 富文本, 编辑器
|
kw: CKEditor, 富文本, 编辑器
|
||||||
CKEditor插件加载方法
|
CKEditor插件加载方法
|
||||||
1.把插件文件夹拷入plugins文件夹,确保文件夹名为redmine_ckeditor
|
1.把插件文件夹拷入plugins文件夹,确保文件夹名为redmine_ckeditor
|
||||||
2.运行 bundle install --without development test
|
2.运行 bundle install --without development test
|
||||||
3.运行 rake redmine:plugins:migrate RAILS_ENV=production
|
3.运行 rake redmine:plugins:migrate RAILS_ENV=production
|
||||||
4.启动服务器
|
4.启动服务器
|
||||||
5.配置CKEditor插件(Administration > Plugins > Configure)
|
5.配置CKEditor插件(Administration > Plugins > Configure)
|
||||||
6.把文本格式 (Administration > Settings > General > Text formatting)改为CKEditor
|
6.把文本格式 (Administration > Settings > General > Text formatting)改为CKEditor
|
||||||
注意:一定要先配置CKEditor插件再见文本格式更改,不然,数据库不会生成对应记录,会报错。。
|
注意:一定要先配置CKEditor插件再见文本格式更改,不然,数据库不会生成对应记录,会报错。。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
===================================[2014-07-19]=================================
|
===================================[2014-07-19]=================================
|
||||||
kw: 首页, 定制, forge, course, contest, 排序
|
kw: 首页, 定制, forge, course, contest, 排序
|
||||||
若遇到首页定制报错问题请尝试如下操作
|
若遇到首页定制报错问题请尝试如下操作
|
||||||
如果运行迁移文件有报错与‘sort_type’相关 先运行 bundle exec rake db:migrate:down version=20140716021202 bundle exec rake db:migrate:up version=20140716021202
|
如果运行迁移文件有报错与‘sort_type’相关
|
||||||
在按如下步骤执行,未报与之相关的则直接按如下步骤执行
|
先运行 bundle exec rake db:migrate:down version=20140716021202 bundle exec rake db:migrate:up version=20140716021202
|
||||||
1.运行 bundle exec rake db:migrate:down version=20140719080032
|
在按如下步骤执行,未报与之相关的则直接按如下步骤执行
|
||||||
2.运行 bundle exec rake db:migrate:up version=20140719080032
|
1.运行 bundle exec rake db:migrate:down version=20140719080032
|
||||||
|
2.运行 bundle exec rake db:migrate:up version=20140719080032
|
||||||
|
===================================[2014-07-30]=================================
|
||||||
|
kw: 首页, 定制, forge, course, contest, 排序,image_width
|
||||||
|
|
||||||
|
undefined image_width 问题
|
||||||
|
bundle exec rake db:migrate:down version=20140725062302
|
||||||
|
bundle exec rake db:migrate:up version=20140725062302
|
||||||
|
|
|
@ -154,6 +154,7 @@ class AdminController < ApplicationController
|
||||||
@first_page.image_height = params[:image_height]
|
@first_page.image_height = params[:image_height]
|
||||||
@first_page.sort_type = params[:sort_type]
|
@first_page.sort_type = params[:sort_type]
|
||||||
@first_page.show_course = params[:show_course]
|
@first_page.show_course = params[:show_course]
|
||||||
|
@first_page.show_contest = params[:show_contest]
|
||||||
if @first_page.save
|
if @first_page.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
flash[:notice] = l(:notice_successful_update)
|
flash[:notice] = l(:notice_successful_update)
|
||||||
|
|
|
@ -41,6 +41,7 @@ class ApplicationController < ActionController::Base
|
||||||
cookies.delete(autologin_cookie_name)
|
cookies.delete(autologin_cookie_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before_filter :find_first_page
|
||||||
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
|
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
|
||||||
before_filter :user_agent
|
before_filter :user_agent
|
||||||
|
|
||||||
|
@ -720,4 +721,11 @@ class ApplicationController < ActionController::Base
|
||||||
raise RuntimeError, 'unknow type, Please input you type into this helper.'
|
raise RuntimeError, 'unknow type, Please input you type into this helper.'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#查找首页相关信息
|
||||||
|
def find_first_page
|
||||||
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
|
@show_course = @first_page.show_course
|
||||||
|
@show_contest = @first_page.show_contest
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,9 @@ class BidsController < ApplicationController
|
||||||
menu_item :project, :only => [:show_project,:show_results, :new_submit_homework]
|
menu_item :project, :only => [:show_project,:show_results, :new_submit_homework]
|
||||||
menu_item :homework_respond, :only => :homework_respond
|
menu_item :homework_respond, :only => :homework_respond
|
||||||
menu_item :homework_statistics, :only => :homework_statistics
|
menu_item :homework_statistics, :only => :homework_statistics
|
||||||
|
|
||||||
|
before_filter :can_show_course,only: []
|
||||||
|
before_filter :can_show_contest,only: []
|
||||||
#Ended by young
|
#Ended by young
|
||||||
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:delete,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
|
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:delete,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
|
||||||
:show_course, :show_courseEx,:show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
|
:show_course, :show_courseEx,:show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
|
||||||
|
@ -983,5 +986,21 @@ class BidsController < ApplicationController
|
||||||
render_403 unless currentUser.member_of_course?(@bid.courses.first)
|
render_403 unless currentUser.member_of_course?(@bid.courses.first)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#验证是否显示课程
|
||||||
|
def can_show_course
|
||||||
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
|
if @first_page.show_course == 2
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#验证是否显示竞赛
|
||||||
|
def can_show_contest
|
||||||
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
|
if @first_page.show_contest == 2
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ class ContestsController < ApplicationController
|
||||||
menu_item :application, :only => :show_softapplication
|
menu_item :application, :only => :show_softapplication
|
||||||
menu_item :attendingcontests, :only => :show_attendingcontest
|
menu_item :attendingcontests, :only => :show_attendingcontest
|
||||||
menu_item :contestnotifications, :only => :index
|
menu_item :contestnotifications, :only => :index
|
||||||
|
|
||||||
|
before_filter :can_show_contest,except: []
|
||||||
before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :index, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward,
|
before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :index, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward,
|
||||||
:show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
|
:show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
|
||||||
|
|
||||||
|
@ -645,5 +647,13 @@ end
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#验证是否显示竞赛
|
||||||
|
def can_show_contest
|
||||||
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
|
if @first_page.show_contest == 2
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ class CoursesController < ApplicationController
|
||||||
menu_item l(:label_sort_by_active), :only => :index
|
menu_item l(:label_sort_by_active), :only => :index
|
||||||
menu_item l(:label_sort_by_influence), :only => :index
|
menu_item l(:label_sort_by_influence), :only => :index
|
||||||
|
|
||||||
|
before_filter :can_show_course, :except => []
|
||||||
before_filter :find_course, :except => [ :index, :search,:list, :new,:join,:unjoin, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches]
|
before_filter :find_course, :except => [ :index, :search,:list, :new,:join,:unjoin, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches]
|
||||||
before_filter :authorize_course, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course]
|
before_filter :authorize_course, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course]
|
||||||
before_filter :authorize_course_global, :only => [:view_homework_attaches, :new,:create]
|
before_filter :authorize_course_global, :only => [:view_homework_attaches, :new,:create]
|
||||||
|
@ -494,7 +495,7 @@ class CoursesController < ApplicationController
|
||||||
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
|
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
|
||||||
render :layout => 'base_courses'
|
render :layout => 'base_courses'
|
||||||
else
|
else
|
||||||
render_404
|
render_403
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -711,7 +712,13 @@ class CoursesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#验证是否显示课程
|
||||||
|
def can_show_course
|
||||||
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
|
if @first_page.show_course == 2
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ class HomeworkAttachController < ApplicationController
|
||||||
layout "course_base"
|
layout "course_base"
|
||||||
include CoursesHelper
|
include CoursesHelper
|
||||||
###############################
|
###############################
|
||||||
|
before_filter :can_show_course,except: []
|
||||||
#判断当前角色权限时需先找到当前操作的project
|
#判断当前角色权限时需先找到当前操作的project
|
||||||
before_filter :find_course_by_bid_id, :only => [:new]
|
before_filter :find_course_by_bid_id, :only => [:new]
|
||||||
before_filter :find_course_by_hoemwork_id, :only => [:edit,:update,:destroy,:show,:add_homework_users,:destory_homework_users]
|
before_filter :find_course_by_hoemwork_id, :only => [:edit,:update,:destroy,:show,:add_homework_users,:destory_homework_users]
|
||||||
|
@ -352,5 +353,13 @@ class HomeworkAttachController < ApplicationController
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#验证是否显示课程
|
||||||
|
def can_show_course
|
||||||
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
|
if @first_page.show_course == 2
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
#Ended by young
|
#Ended by young
|
||||||
|
|
||||||
|
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
|
||||||
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
|
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
|
||||||
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||||
|
@ -796,4 +796,12 @@ class UsersController < ApplicationController
|
||||||
document_num(@user)
|
document_num(@user)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#验证是否显示课程
|
||||||
|
def can_show_course
|
||||||
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
|
if @first_page.show_course == 2
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,13 +18,14 @@
|
||||||
class WelcomeController < ApplicationController
|
class WelcomeController < ApplicationController
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include WelcomeHelper
|
include WelcomeHelper
|
||||||
|
|
||||||
caches_action :robots
|
caches_action :robots
|
||||||
# before_filter :fake, :only => [:index, :course]
|
# before_filter :fake, :only => [:index, :course]
|
||||||
before_filter :entry_select, :only => [:index]
|
before_filter :entry_select, :only => [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@first_page = FirstPage.where("page_type = 'project'").first
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
@show_course = @first_page.show_course
|
#@show_course = @first_page.show_course
|
||||||
if @first_page.nil? || @first_page.sort_type.nil?
|
if @first_page.nil? || @first_page.sort_type.nil?
|
||||||
@projects = find_miracle_project(10, 3,"grade desc")
|
@projects = find_miracle_project(10, 3,"grade desc")
|
||||||
else
|
else
|
||||||
|
@ -147,16 +148,27 @@ class WelcomeController < ApplicationController
|
||||||
private
|
private
|
||||||
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
||||||
def entry_select
|
def entry_select
|
||||||
|
@first_page = FirstPage.where("page_type = 'project'").first
|
||||||
url = request.original_url
|
url = request.original_url
|
||||||
if url.include?("course.trustie.net")
|
if url.include?(Setting.host_course)
|
||||||
|
if @first_page.show_course == 1
|
||||||
course
|
course
|
||||||
render :course
|
render :course
|
||||||
|
else
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
elsif url.include?("contest.trustie.net")
|
elsif url.include?(Setting.host_contest)
|
||||||
|
if @first_page.show_contest == 1
|
||||||
contest
|
contest
|
||||||
render :contest
|
render :contest
|
||||||
|
else
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
elsif url.include?("user.trustie.net")
|
elsif url.include?(Setting.host_user)
|
||||||
redirect_to(:controller => "users", :action => "index")
|
redirect_to(:controller => "users", :action => "index")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1738,18 +1738,18 @@ module ApplicationHelper
|
||||||
|
|
||||||
#@nav_dispaly_project_label
|
#@nav_dispaly_project_label
|
||||||
nav_list = Array.new
|
nav_list = Array.new
|
||||||
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label
|
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1
|
||||||
nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label
|
nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label && @show_course == 1
|
||||||
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label
|
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1
|
||||||
|
|
||||||
nav_list.push(main_project_link) if @nav_dispaly_main_project_label
|
nav_list.push(main_project_link) if @nav_dispaly_main_project_label
|
||||||
nav_list.push(main_course_link) if @nav_dispaly_main_course_label
|
nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1
|
||||||
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label
|
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1
|
||||||
|
|
||||||
nav_list.push(courses_link) if @nav_dispaly_course_label
|
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1
|
||||||
nav_list.push(projects_link) if @nav_dispaly_project_label
|
nav_list.push(projects_link) if @nav_dispaly_project_label
|
||||||
nav_list.push(users_link) if @nav_dispaly_user_label
|
nav_list.push(users_link) if @nav_dispaly_user_label
|
||||||
nav_list.push(contest_link) if @nav_dispaly_contest_label
|
nav_list.push(contest_link) if @nav_dispaly_contest_label && @show_contest == 1
|
||||||
nav_list.push(bids_link) if @nav_dispaly_bid_label
|
nav_list.push(bids_link) if @nav_dispaly_bid_label
|
||||||
nav_list.push(forum_link) if @nav_dispaly_forum_label
|
nav_list.push(forum_link) if @nav_dispaly_forum_label
|
||||||
nav_list.push(stores_link) if @nav_dispaly_store_all_label
|
nav_list.push(stores_link) if @nav_dispaly_store_all_label
|
||||||
|
|
|
@ -34,6 +34,13 @@
|
||||||
<option value="2" <%= "selected=selected" if @first_page.show_course == 2 %>><%= l(:general_text_no) %></option>
|
<option value="2" <%= "selected=selected" if @first_page.show_course == 2 %>><%= l(:general_text_no) %></option>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
|
<p style="margin-left:60px;padding-right: 20px;">
|
||||||
|
<label for='title'> <%= l(:label_show_contest) %>:</label>
|
||||||
|
<select name="show_contest" id="show_contest" style="font-size:small;width:497px;margin-left:10px;display: inline">
|
||||||
|
<option value="1" <%= "selected=selected" if @first_page.show_contest == 1 %>><%= l(:general_text_yes) %></option>
|
||||||
|
<option value="2" <%= "selected=selected" if @first_page.show_contest == 2 %>><%= l(:general_text_no) %></option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
<p style="margin-left:60px;padding-right: 20px;">
|
<p style="margin-left:60px;padding-right: 20px;">
|
||||||
<label for='sort_type' style="vertical-align: top"> <%= l(:label_sort_type)%>:</label>
|
<label for='sort_type' style="vertical-align: top"> <%= l(:label_sort_type)%>:</label>
|
||||||
<select name="sort_type" id="sort_type" style="font-size:small;width:497px;margin-left:80px;">
|
<select name="sort_type" id="sort_type" style="font-size:small;width:497px;margin-left:80px;">
|
||||||
|
|
|
@ -31,12 +31,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!--modified by huang-->
|
<!--modified by huang-->
|
||||||
<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
|
<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
|
||||||
<span>
|
<span class="contextual-borad">
|
||||||
<%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add',
|
|
||||||
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="contextual-borad">
|
|
||||||
<%= link_to(
|
<%= link_to(
|
||||||
image_tag('edit.png')+l(:label_forum_edit),
|
image_tag('edit.png')+l(:label_forum_edit),
|
||||||
{:action => 'edit', :id => @forum},
|
{:action => 'edit', :id => @forum},
|
||||||
|
@ -50,5 +45,11 @@
|
||||||
:data => {:confirm => l(:text_are_you_sure)},
|
:data => {:confirm => l(:text_are_you_sure)},
|
||||||
:title => l(:button_delete)
|
:title => l(:button_delete)
|
||||||
) if @forum.destroyable_by?(User.current) %>
|
) if @forum.destroyable_by?(User.current) %>
|
||||||
</div>
|
</span>
|
||||||
|
<span>
|
||||||
|
<%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add',
|
||||||
|
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
|
||||||
<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %>
|
<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %>
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;" class="loggedas_li">
|
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;" class="loggedas_li">
|
||||||
<%=link_to_user(User.current)%>
|
<%=link_to_user(User.current)%>
|
||||||
<ul class="sub_menu">
|
<ul class="sub_menu">
|
||||||
<% if @show_course.nil? || @show_course != 2 %>
|
<% if @show_course == 1 %>
|
||||||
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
|
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
|
||||||
<% hasCourse=true%>
|
<% hasCourse=true%>
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<% when 'Bid' %>
|
<% when 'Bid' %>
|
||||||
<tr>
|
<tr>
|
||||||
<% if act.reward_type ==3 %>
|
<% if act.reward_type == 3 && @show_course == 1%>
|
||||||
<% if e.user == User.current %>
|
<% if e.user == User.current %>
|
||||||
<td colspan="2" valign="top">
|
<td colspan="2" valign="top">
|
||||||
<strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
<strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||||
|
@ -299,7 +299,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<% when 'Contest' %>
|
<% when 'Contest' %>
|
||||||
<tr>
|
<tr>
|
||||||
<% if e.user == User.current %>
|
<% if e.user == User.current && @show_contest == 1%>
|
||||||
<td colspan="2" valign="top">
|
<td colspan="2" valign="top">
|
||||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %>
|
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
|
|
||||||
<h1></h1>
|
<h1></h1>
|
||||||
<% find_all_new_hot_course(9, @school_id).map do |course| %>
|
<% find_all_new_hot_course(9, @school_id).map do |course| %>
|
||||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
|
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
|
||||||
<div class='avatar'>
|
<div class='avatar'>
|
||||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -120,9 +120,9 @@
|
||||||
<%#=course.try(:teacher).try(:name)%>
|
<%#=course.try(:teacher).try(:name)%>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
<div class='desc_item text_nowrap'>
|
||||||
[<%= get_course_term course %>]
|
[<%= get_course_term course %>]
|
||||||
<%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||||
(<%= "#{studentCount(course)}人" %>)
|
(<%= "#{studentCount(course)}人" %>)
|
||||||
<% files_count = course.attachments.count.to_s %>
|
<% files_count = course.attachments.count.to_s %>
|
||||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||||
|
@ -148,7 +148,7 @@
|
||||||
<ul class="d-p-projectlist">
|
<ul class="d-p-projectlist">
|
||||||
<% school_course.map do |course| %>
|
<% school_course.map do |course| %>
|
||||||
<% if course.school%>
|
<% if course.school%>
|
||||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
|
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
|
||||||
<div class='avatar'>
|
<div class='avatar'>
|
||||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -161,9 +161,9 @@
|
||||||
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
|
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
<div class='desc_item text_nowrap'>
|
||||||
[<%= get_course_term course %>]
|
[<%= get_course_term course %>]
|
||||||
<%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||||
(<%= "#{studentCount(course)}人" %>)
|
(<%= "#{studentCount(course)}人" %>)
|
||||||
<% files_count = course.attachments.count.to_s %>
|
<% files_count = course.attachments.count.to_s %>
|
||||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<% find_all_new_hot_course(9 - school_course.count, @school_id).map do |course| %>
|
<% find_all_new_hot_course(9 - school_course.count, @school_id).map do |course| %>
|
||||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
|
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
|
||||||
<div class='avatar'>
|
<div class='avatar'>
|
||||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -206,10 +206,10 @@
|
||||||
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
|
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
<div class='desc_item text_nowrap'>
|
||||||
[<%= get_course_term course %>]
|
[<%= get_course_term course %>]
|
||||||
<%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||||
<%= "#{studentCount(course)}人" %> )
|
(<%= "#{studentCount(course)}人" %> )
|
||||||
<% files_count = course.attachments.count.to_i.to_s %>
|
<% files_count = course.attachments.count.to_i.to_s %>
|
||||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -582,6 +582,7 @@ zh:
|
||||||
label_contest_notification_title: 竞赛通知标题
|
label_contest_notification_title: 竞赛通知标题
|
||||||
label_contest_notification_content: 竞赛通知内容
|
label_contest_notification_content: 竞赛通知内容
|
||||||
label_show_course: 显示课程
|
label_show_course: 显示课程
|
||||||
|
label_show_contest: 显示竞赛
|
||||||
#by young
|
#by young
|
||||||
label_requirement: 需求
|
label_requirement: 需求
|
||||||
label_new_course: 课程列表
|
label_new_course: 课程列表
|
||||||
|
|
|
@ -75,6 +75,10 @@ host_course:
|
||||||
default: course.trustie.net
|
default: course.trustie.net
|
||||||
host_contest:
|
host_contest:
|
||||||
default: contest.trustie.net
|
default: contest.trustie.net
|
||||||
|
host_user:
|
||||||
|
default: user.trustie.net
|
||||||
|
host_repository:
|
||||||
|
default: repository.trustie.net
|
||||||
protocol:
|
protocol:
|
||||||
default: http
|
default: http
|
||||||
feeds_limit:
|
feeds_limit:
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class FirstPageAddContestColumn < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column("first_pages","show_contest",:integer,default: 1)
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20140730024419) do
|
ActiveRecord::Schema.define(:version => 20140730021521) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -272,7 +272,7 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
|
||||||
t.integer "contest_id"
|
t.integer "contest_id"
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.string "summary"
|
t.string "summary"
|
||||||
t.text "description"
|
t.string "description"
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.integer "notificationcomments_count"
|
t.integer "notificationcomments_count"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
|
@ -426,6 +426,7 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
|
||||||
t.integer "image_width", :default => 107
|
t.integer "image_width", :default => 107
|
||||||
t.integer "image_height", :default => 63
|
t.integer "image_height", :default => 63
|
||||||
t.integer "show_course", :default => 1
|
t.integer "show_course", :default => 1
|
||||||
|
t.integer "show_contest", :default => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "forums", :force => true do |t|
|
create_table "forums", :force => true do |t|
|
||||||
|
@ -847,7 +848,7 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
|
||||||
t.integer "osp_id"
|
t.integer "osp_id"
|
||||||
t.integer "parent_id"
|
t.integer "parent_id"
|
||||||
t.string "subject", :null => false
|
t.string "subject", :null => false
|
||||||
t.text "content", :limit => 16777215, :null => false
|
t.text "content", :null => false
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.integer "replies_count", :default => 0
|
t.integer "replies_count", :default => 0
|
||||||
t.integer "last_reply_id"
|
t.integer "last_reply_id"
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||||
|
---
|
||||||
|
biding_project_001:
|
||||||
|
id: 1
|
||||||
|
project_id: -1
|
||||||
|
bid_id: 1
|
||||||
|
|
||||||
|
#biding_project_002:
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||||
|
---
|
||||||
|
homework_001:
|
||||||
|
id: 1
|
||||||
|
author_id: 20
|
||||||
|
budget: "0"
|
||||||
|
commit: 3
|
||||||
|
deadline: "2014-05-30"
|
||||||
|
description: ""
|
||||||
|
homework_type: 1
|
||||||
|
is_evaluation:
|
||||||
|
name: "course_001_homework_001"
|
||||||
|
parent_id:
|
||||||
|
password:
|
||||||
|
proportion: 60
|
||||||
|
reward_type: 3 # 作业
|
||||||
|
updated_on: 2014-05-23 08:15:28
|
||||||
|
created_on: 2014-05-23 08:15:28
|
||||||
|
homework_002:
|
||||||
|
id: 2
|
||||||
|
author_id: 20
|
||||||
|
budget: "0"
|
||||||
|
commit: 3
|
||||||
|
deadline: "2014-05-30"
|
||||||
|
description: ""
|
||||||
|
homework_type: 1
|
||||||
|
is_evaluation:
|
||||||
|
name: "course_001_homework_002"
|
||||||
|
parent_id:
|
||||||
|
password:
|
||||||
|
proportion: 60
|
||||||
|
reward_type: 3 # 作业
|
||||||
|
updated_on: 2014-05-23 08:15:28
|
||||||
|
created_on: 2014-05-23 08:15:28
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||||
|
---
|
||||||
|
homework_for_courses_001:
|
||||||
|
id: 1
|
||||||
|
course_id: 1
|
||||||
|
bid_id: 1
|
||||||
|
homework_for_courses_002:
|
||||||
|
id: 2
|
||||||
|
course_id: 1
|
||||||
|
bid_id: 2
|
|
@ -28,6 +28,38 @@ jfm_002:
|
||||||
m_reply_count:
|
m_reply_count:
|
||||||
m_reply_id:
|
m_reply_id:
|
||||||
is_comprehensive_evaluation:
|
is_comprehensive_evaluation:
|
||||||
|
jfm_003:
|
||||||
|
# Course one's jfm
|
||||||
|
id: 3
|
||||||
|
jour_id: 1
|
||||||
|
jour_type: Course
|
||||||
|
user_id: 2
|
||||||
|
notes:
|
||||||
|
status:
|
||||||
|
reply_id: 0
|
||||||
|
created_on: 2014-07-16 15:27:2
|
||||||
|
updated_on: 2014-07-16 15:27:2
|
||||||
|
m_parent_id:
|
||||||
|
is_readed:
|
||||||
|
m_reply_count:
|
||||||
|
m_reply_id:
|
||||||
|
is_comprehensive_evaluation:
|
||||||
|
jfm_004:
|
||||||
|
# Course one's jfm
|
||||||
|
id: 4
|
||||||
|
jour_id: 1
|
||||||
|
jour_type: Course
|
||||||
|
user_id: 25
|
||||||
|
notes: course_001的留言by_user_025
|
||||||
|
status:
|
||||||
|
reply_id: 0
|
||||||
|
created_on: 2014-07-16 15:27:2
|
||||||
|
updated_on: 2014-07-16 15:27:2
|
||||||
|
m_parent_id:
|
||||||
|
is_readed:
|
||||||
|
m_reply_count:
|
||||||
|
m_reply_id:
|
||||||
|
is_comprehensive_evaluation:
|
||||||
jfm_045:
|
jfm_045:
|
||||||
id: 45
|
id: 45
|
||||||
jour_id: 2
|
jour_id: 2
|
||||||
|
|
|
@ -6,6 +6,9 @@ class CoursesControllerTest < ActionController::TestCase
|
||||||
:course_statuses,
|
:course_statuses,
|
||||||
:users,
|
:users,
|
||||||
:user_extensions,
|
:user_extensions,
|
||||||
|
:bids,
|
||||||
|
:homework_for_courses,
|
||||||
|
:journals_for_messages,
|
||||||
:schools,
|
:schools,
|
||||||
:roles,
|
:roles,
|
||||||
:members,
|
:members,
|
||||||
|
@ -88,6 +91,52 @@ class CoursesControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
assert_response :forbidden
|
assert_response :forbidden
|
||||||
end
|
end
|
||||||
|
test ':homework get by non-member is access' do
|
||||||
|
get :homework, {id: 1}
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
test ':feedback Get by non-member is access' do
|
||||||
|
get :feedback, {id: 1}
|
||||||
|
assert_response :success
|
||||||
|
# 检测留言是否在其中以及不报错
|
||||||
|
jfms = JournalsForMessage.where(jour_type: 'Course', jour_id: 1, m_parent_id: nil).reorder('id DESC')
|
||||||
|
jfms.take(5).each do |j|
|
||||||
|
assert_select "li#word_li_#{j.id}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
test ':homework get by non-member' do
|
||||||
|
get :homework, {id: 1}
|
||||||
|
assert_response :success
|
||||||
|
course = Course.find(1)
|
||||||
|
assert course.homeworks.any?
|
||||||
|
course.homeworks.each do |homework|
|
||||||
|
assert_select '.bid_path', homework.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
test ':new_homework by no user should not new_homework course_001' do
|
||||||
|
get :new_homework, {id: 1}
|
||||||
|
assert_response 403
|
||||||
|
end
|
||||||
|
test ':new_homework by loged & allowed user should get new_homework course_001' do
|
||||||
|
user_id = 25
|
||||||
|
member = Member.create(user_id: user_id, project_id: -1, course_id: 1, roles: [Role.last])
|
||||||
|
MemberRole.create(member_id: member.id, role_id: 3)
|
||||||
|
@request.session[:user_id] = user_id
|
||||||
|
get :new_homework, {id: 1}
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'new_homework'
|
||||||
|
end
|
||||||
|
|
||||||
|
test ':member by ano' do
|
||||||
|
get :member, {id: 1}
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'member'
|
||||||
|
assert assigns(:members).any?
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# test "#index by non-admin user with view_time_entries permission should show overall spent time link" do
|
# test "#index by non-admin user with view_time_entries permission should show overall spent time link" do
|
||||||
# @request.session[:user_id] = 3
|
# @request.session[:user_id] = 3
|
||||||
|
|
Loading…
Reference in New Issue