Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts: db/schema.rb
This commit is contained in:
commit
a3cbcdad51
137
ReadMe.txt
137
ReadMe.txt
|
@ -1,65 +1,72 @@
|
|||
===================================[2014-04-09]=================================
|
||||
kw: 域名, 二级域名, subdomain, forge, course, contest
|
||||
域名跳转(forge/course/contest)这几个设置在settings.yml中
|
||||
但是跳转在development模式下会导致无法开发
|
||||
|
||||
app/models/setting.rb :165
|
||||
# fixed domain url in development. tantantan's bug
|
||||
if Rails.env.development?
|
||||
methods.map do |m|
|
||||
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
||||
end
|
||||
end
|
||||
程序部分链接中制定了subdomain参数,使链接在二级域名中来回跳转。
|
||||
为了开发方便,使之功能在development模式下失效。
|
||||
|
||||
|
||||
===================================[2014-04-09]=================================
|
||||
kw: 菜单, 导航栏, layout
|
||||
网页上方的导航条没有用Redmine::MenuManager
|
||||
MenuManager的样式无法定制,菜单显示条件if中的proc执行行为没有了解
|
||||
|
||||
#导航栏匹配域名显示和改变
|
||||
app\helper\application_helper.rb
|
||||
render_dynamic_nav 方法中,利用变量,可以设置在layout中具体显示哪些条目
|
||||
|
||||
app\views\layouts\_base_header.html.erb
|
||||
需要显示的条目,由具体的实例变量设置(在各个layout中)
|
||||
|
||||
|
||||
===================================[2014-04-09]=================================
|
||||
kw: home_path, 首页, 跳转, 二级域名, welcome
|
||||
#首页根据域名匹配进入不同的页面
|
||||
app\controller\welcome_controller.rb
|
||||
#entry_select 放射设置二级域名所显示的首页
|
||||
|
||||
|
||||
|
||||
===================================[2014-06-06]=================================
|
||||
kw: user_scores
|
||||
user_scores表结构有问题,需要运行
|
||||
bundle exec rake db:migrate:down VERSION=20140410021724
|
||||
bundle exec rake db:migrate:up VERSION=20140410021724
|
||||
|
||||
|
||||
|
||||
===================================[2014-07-08]=================================
|
||||
kw: CKEditor, 富文本, 编辑器
|
||||
CKEditor插件加载方法
|
||||
1.把插件文件夹拷入plugins文件夹,确保文件夹名为redmine_ckeditor
|
||||
2.运行 bundle install --without development test
|
||||
3.运行 rake redmine:plugins:migrate RAILS_ENV=production
|
||||
4.启动服务器
|
||||
5.配置CKEditor插件(Administration > Plugins > Configure)
|
||||
6.把文本格式 (Administration > Settings > General > Text formatting)改为CKEditor
|
||||
注意:一定要先配置CKEditor插件再见文本格式更改,不然,数据库不会生成对应记录,会报错。。
|
||||
|
||||
|
||||
|
||||
===================================[2014-07-19]=================================
|
||||
kw: 首页, 定制, forge, course, contest, 排序
|
||||
若遇到首页定制报错问题请尝试如下操作
|
||||
如果运行迁移文件有报错与‘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
|
||||
===================================[2014-04-09]=================================
|
||||
kw: 域名, 二级域名, subdomain, forge, course, contest
|
||||
域名跳转(forge/course/contest)这几个设置在settings.yml中
|
||||
但是跳转在development模式下会导致无法开发
|
||||
|
||||
app/models/setting.rb :165
|
||||
# fixed domain url in development. tantantan's bug
|
||||
if Rails.env.development?
|
||||
methods.map do |m|
|
||||
define_singleton_method m do; nil; end if m.to_s =~ /([a-zA-Z]+_domain)$/
|
||||
end
|
||||
end
|
||||
程序部分链接中制定了subdomain参数,使链接在二级域名中来回跳转。
|
||||
为了开发方便,使之功能在development模式下失效。
|
||||
|
||||
|
||||
===================================[2014-04-09]=================================
|
||||
kw: 菜单, 导航栏, layout
|
||||
网页上方的导航条没有用Redmine::MenuManager
|
||||
MenuManager的样式无法定制,菜单显示条件if中的proc执行行为没有了解
|
||||
|
||||
#导航栏匹配域名显示和改变
|
||||
app\helper\application_helper.rb
|
||||
render_dynamic_nav 方法中,利用变量,可以设置在layout中具体显示哪些条目
|
||||
|
||||
app\views\layouts\_base_header.html.erb
|
||||
需要显示的条目,由具体的实例变量设置(在各个layout中)
|
||||
|
||||
|
||||
===================================[2014-04-09]=================================
|
||||
kw: home_path, 首页, 跳转, 二级域名, welcome
|
||||
#首页根据域名匹配进入不同的页面
|
||||
app\controller\welcome_controller.rb
|
||||
#entry_select 放射设置二级域名所显示的首页
|
||||
|
||||
|
||||
|
||||
===================================[2014-06-06]=================================
|
||||
kw: user_scores
|
||||
user_scores表结构有问题,需要运行
|
||||
bundle exec rake db:migrate:down VERSION=20140410021724
|
||||
bundle exec rake db:migrate:up VERSION=20140410021724
|
||||
|
||||
|
||||
|
||||
===================================[2014-07-08]=================================
|
||||
kw: CKEditor, 富文本, 编辑器
|
||||
CKEditor插件加载方法
|
||||
1.把插件文件夹拷入plugins文件夹,确保文件夹名为redmine_ckeditor
|
||||
2.运行 bundle install --without development test
|
||||
3.运行 rake redmine:plugins:migrate RAILS_ENV=production
|
||||
4.启动服务器
|
||||
5.配置CKEditor插件(Administration > Plugins > Configure)
|
||||
6.把文本格式 (Administration > Settings > General > Text formatting)改为CKEditor
|
||||
注意:一定要先配置CKEditor插件再见文本格式更改,不然,数据库不会生成对应记录,会报错。。
|
||||
|
||||
|
||||
|
||||
===================================[2014-07-19]=================================
|
||||
kw: 首页, 定制, forge, course, contest, 排序
|
||||
若遇到首页定制报错问题请尝试如下操作
|
||||
如果运行迁移文件有报错与‘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
|
||||
===================================[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.sort_type = params[:sort_type]
|
||||
@first_page.show_course = params[:show_course]
|
||||
@first_page.show_contest = params[:show_contest]
|
||||
if @first_page.save
|
||||
respond_to do |format|
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
|
|
|
@ -41,6 +41,7 @@ class ApplicationController < ActionController::Base
|
|||
cookies.delete(autologin_cookie_name)
|
||||
end
|
||||
|
||||
before_filter :find_first_page
|
||||
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
|
||||
before_filter :user_agent
|
||||
|
||||
|
@ -720,4 +721,11 @@ class ApplicationController < ActionController::Base
|
|||
raise RuntimeError, 'unknow type, Please input you type into this helper.'
|
||||
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
|
||||
|
|
|
@ -7,6 +7,9 @@ class BidsController < ApplicationController
|
|||
menu_item :project, :only => [:show_project,:show_results, :new_submit_homework]
|
||||
menu_item :homework_respond, :only => :homework_respond
|
||||
menu_item :homework_statistics, :only => :homework_statistics
|
||||
|
||||
before_filter :can_show_course,only: []
|
||||
before_filter :can_show_contest,only: []
|
||||
#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,
|
||||
: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)
|
||||
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
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ class ContestsController < ApplicationController
|
|||
menu_item :application, :only => :show_softapplication
|
||||
menu_item :attendingcontests, :only => :show_attendingcontest
|
||||
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,
|
||||
:show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
|
||||
|
||||
|
@ -645,5 +647,13 @@ end
|
|||
render_404
|
||||
end
|
||||
|
||||
#验证是否显示竞赛
|
||||
def can_show_contest
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
if @first_page.show_contest == 2
|
||||
render_404
|
||||
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_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 :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]
|
||||
|
@ -494,7 +495,7 @@ class CoursesController < ApplicationController
|
|||
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
|
||||
render :layout => 'base_courses'
|
||||
else
|
||||
render_404
|
||||
render_403
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -711,7 +712,13 @@ class CoursesController < ApplicationController
|
|||
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"
|
||||
include CoursesHelper
|
||||
###############################
|
||||
before_filter :can_show_course,except: []
|
||||
#判断当前角色权限时需先找到当前操作的project
|
||||
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]
|
||||
|
@ -352,5 +353,13 @@ class HomeworkAttachController < ApplicationController
|
|||
}
|
||||
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
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class UsersController < ApplicationController
|
|||
|
||||
#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,
|
||||
: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,
|
||||
|
@ -796,4 +796,12 @@ class UsersController < ApplicationController
|
|||
document_num(@user)
|
||||
|
||||
end
|
||||
|
||||
#验证是否显示课程
|
||||
def can_show_course
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
if @first_page.show_course == 2
|
||||
render_404
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,13 +18,14 @@
|
|||
class WelcomeController < ApplicationController
|
||||
include ApplicationHelper
|
||||
include WelcomeHelper
|
||||
|
||||
caches_action :robots
|
||||
# before_filter :fake, :only => [:index, :course]
|
||||
before_filter :entry_select, :only => [:index]
|
||||
|
||||
def index
|
||||
@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?
|
||||
@projects = find_miracle_project(10, 3,"grade desc")
|
||||
else
|
||||
|
@ -147,16 +148,27 @@ class WelcomeController < ApplicationController
|
|||
private
|
||||
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
||||
def entry_select
|
||||
@first_page = FirstPage.where("page_type = 'project'").first
|
||||
url = request.original_url
|
||||
if url.include?("course.trustie.net")
|
||||
course
|
||||
render :course
|
||||
if url.include?(Setting.host_course)
|
||||
if @first_page.show_course == 1
|
||||
course
|
||||
render :course
|
||||
else
|
||||
render_404
|
||||
end
|
||||
|
||||
return 0
|
||||
elsif url.include?("contest.trustie.net")
|
||||
contest
|
||||
render :contest
|
||||
elsif url.include?(Setting.host_contest)
|
||||
if @first_page.show_contest == 1
|
||||
contest
|
||||
render :contest
|
||||
else
|
||||
render_404
|
||||
end
|
||||
|
||||
return 0
|
||||
elsif url.include?("user.trustie.net")
|
||||
elsif url.include?(Setting.host_user)
|
||||
redirect_to(:controller => "users", :action => "index")
|
||||
end
|
||||
|
||||
|
|
|
@ -1738,18 +1738,18 @@ module ApplicationHelper
|
|||
|
||||
#@nav_dispaly_project_label
|
||||
nav_list = Array.new
|
||||
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label
|
||||
nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label
|
||||
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_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 && @show_course == 1
|
||||
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_course_link) if @nav_dispaly_main_course_label
|
||||
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_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 && @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(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(forum_link) if @nav_dispaly_forum_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>
|
||||
</select>
|
||||
</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;">
|
||||
<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;">
|
||||
|
|
|
@ -31,24 +31,25 @@
|
|||
</div>
|
||||
<!--modified by huang-->
|
||||
<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
|
||||
<span class="contextual-borad">
|
||||
<%= link_to(
|
||||
image_tag('edit.png')+l(:label_forum_edit),
|
||||
{:action => 'edit', :id => @forum},
|
||||
:method => 'get',
|
||||
:title => l(:button_edit)
|
||||
) if @forum.editable_by?(User.current) %>
|
||||
<%= link_to(
|
||||
image_tag('delete.png')+'删除讨论区',
|
||||
{:action => 'destroy', :id => @forum},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if @forum.destroyable_by?(User.current) %>
|
||||
</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>
|
||||
|
||||
<div class="contextual-borad">
|
||||
<%= link_to(
|
||||
image_tag('edit.png')+l(:label_forum_edit),
|
||||
{:action => 'edit', :id => @forum},
|
||||
:method => 'get',
|
||||
:title => l(:button_edit)
|
||||
) if @forum.editable_by?(User.current) %>
|
||||
<%= link_to(
|
||||
image_tag('delete.png')+'删除讨论区',
|
||||
{:action => 'destroy', :id => @forum},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if @forum.destroyable_by?(User.current) %>
|
||||
</div>
|
||||
|
||||
<%= 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">
|
||||
<%=link_to_user(User.current)%>
|
||||
<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) -%>
|
||||
<% hasCourse=true%>
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
</tr>
|
||||
<% when 'Bid' %>
|
||||
<tr>
|
||||
<% if act.reward_type ==3 %>
|
||||
<% if act.reward_type == 3 && @show_course == 1%>
|
||||
<% if e.user == User.current %>
|
||||
<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) %>
|
||||
|
@ -299,7 +299,7 @@
|
|||
</tr>
|
||||
<% when 'Contest' %>
|
||||
<tr>
|
||||
<% if e.user == User.current %>
|
||||
<% if e.user == User.current && @show_contest == 1%>
|
||||
<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} %>
|
||||
</td>
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
|
||||
<h1></h1>
|
||||
<% 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'>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
|
@ -120,9 +120,9 @@
|
|||
<%#=course.try(:teacher).try(:name)%>
|
||||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
<div class='desc_item text_nowrap'>
|
||||
[<%= 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)}人" %>)
|
||||
<% files_count = course.attachments.count.to_s %>
|
||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||
|
@ -148,7 +148,7 @@
|
|||
<ul class="d-p-projectlist">
|
||||
<% school_course.map do |course| %>
|
||||
<% 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'>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
|
@ -161,9 +161,9 @@
|
|||
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
|
||||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
<div class='desc_item text_nowrap'>
|
||||
[<%= 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)}人" %>)
|
||||
<% files_count = course.attachments.count.to_s %>
|
||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||
|
@ -188,7 +188,7 @@
|
|||
</p>
|
||||
</li>
|
||||
<% 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'>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
|
@ -206,10 +206,10 @@
|
|||
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
|
||||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
<div class='desc_item text_nowrap'>
|
||||
[<%= get_course_term course %>]
|
||||
<%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
<%= "#{studentCount(course)}人" %> )
|
||||
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
(<%= "#{studentCount(course)}人" %> )
|
||||
<% files_count = course.attachments.count.to_i.to_s %>
|
||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||
</div>
|
||||
|
|
|
@ -582,6 +582,7 @@ zh:
|
|||
label_contest_notification_title: 竞赛通知标题
|
||||
label_contest_notification_content: 竞赛通知内容
|
||||
label_show_course: 显示课程
|
||||
label_show_contest: 显示竞赛
|
||||
#by young
|
||||
label_requirement: 需求
|
||||
label_new_course: 课程列表
|
||||
|
|
|
@ -75,6 +75,10 @@ host_course:
|
|||
default: course.trustie.net
|
||||
host_contest:
|
||||
default: contest.trustie.net
|
||||
host_user:
|
||||
default: user.trustie.net
|
||||
host_repository:
|
||||
default: repository.trustie.net
|
||||
protocol:
|
||||
default: http
|
||||
feeds_limit:
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class FirstPageAddContestColumn < ActiveRecord::Migration
|
||||
def change
|
||||
add_column("first_pages","show_contest",:integer,default: 1)
|
||||
end
|
||||
end
|
25
db/schema.rb
25
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# 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|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -272,7 +272,7 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
|
|||
t.integer "contest_id"
|
||||
t.string "title"
|
||||
t.string "summary"
|
||||
t.text "description"
|
||||
t.string "description"
|
||||
t.integer "author_id"
|
||||
t.integer "notificationcomments_count"
|
||||
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_height", :default => 63
|
||||
t.integer "show_course", :default => 1
|
||||
t.integer "show_contest", :default => 1
|
||||
end
|
||||
|
||||
create_table "forums", :force => true do |t|
|
||||
|
@ -846,18 +847,18 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
|
|||
create_table "relative_memos", :force => true do |t|
|
||||
t.integer "osp_id"
|
||||
t.integer "parent_id"
|
||||
t.string "subject", :null => false
|
||||
t.text "content", :limit => 16777215, :null => false
|
||||
t.string "subject", :null => false
|
||||
t.text "content", :null => false
|
||||
t.integer "author_id"
|
||||
t.integer "replies_count", :default => 0
|
||||
t.integer "replies_count", :default => 0
|
||||
t.integer "last_reply_id"
|
||||
t.boolean "lock", :default => false
|
||||
t.boolean "sticky", :default => false
|
||||
t.boolean "is_quote", :default => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "viewed_count_crawl", :default => 0
|
||||
t.integer "viewed_count_local", :default => 0
|
||||
t.boolean "lock", :default => false
|
||||
t.boolean "sticky", :default => false
|
||||
t.boolean "is_quote", :default => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "viewed_count_crawl", :default => 0
|
||||
t.integer "viewed_count_local", :default => 0
|
||||
t.string "url"
|
||||
t.string "username"
|
||||
t.string "userhomeurl"
|
||||
|
|
|
@ -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_id:
|
||||
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:
|
||||
id: 45
|
||||
jour_id: 2
|
||||
|
|
|
@ -6,6 +6,9 @@ class CoursesControllerTest < ActionController::TestCase
|
|||
:course_statuses,
|
||||
:users,
|
||||
:user_extensions,
|
||||
:bids,
|
||||
:homework_for_courses,
|
||||
:journals_for_messages,
|
||||
:schools,
|
||||
:roles,
|
||||
:members,
|
||||
|
@ -88,6 +91,52 @@ class CoursesControllerTest < ActionController::TestCase
|
|||
|
||||
assert_response :forbidden
|
||||
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
|
||||
# @request.session[:user_id] = 3
|
||||
|
|
Loading…
Reference in New Issue