merge
This commit is contained in:
commit
1ff6372d61
|
@ -23,6 +23,12 @@ class AccountController < ApplicationController
|
|||
skip_before_filter :check_if_login_required
|
||||
# Login request and validation
|
||||
def login
|
||||
if params[:type] == "activated"
|
||||
@message = l(:notice_account_activated)
|
||||
elsif params[:type] == "expired"
|
||||
@message = l(:notice_account_expired)
|
||||
end
|
||||
|
||||
if request.get?
|
||||
@login = params[:login] || true
|
||||
if User.current.logged?
|
||||
|
@ -144,8 +150,9 @@ class AccountController < ApplicationController
|
|||
when '1'
|
||||
#register_by_email_activation(@user)
|
||||
unless @user.new_record?
|
||||
flash[:notice] = l(:notice_account_register_done)
|
||||
render action: 'email_valid', locals: {:mail => @user.mail}
|
||||
redirect_to account_email_valid_path(:mail => @user.mail, :user_id => @user.id)
|
||||
# flash[:notice] = l(:notice_account_register_done)
|
||||
# render action: 'email_valid', locals: {:mail => @user.mail}
|
||||
end
|
||||
when '3'
|
||||
#register_automatically(@user)
|
||||
|
@ -200,7 +207,8 @@ class AccountController < ApplicationController
|
|||
def activate
|
||||
(redirect_to(signin_path); return) unless Setting.self_registration? && params[:token].present?
|
||||
token = Token.find_token('register', params[:token].to_s)
|
||||
(redirect_to(signin_path); return) unless token and !token.expired?
|
||||
type = l(:notice_account_expired) if (token && token.expired?)
|
||||
(redirect_to(signin_path(:type => "expired")); return) unless token and !token.expired?
|
||||
user = token.user
|
||||
(redirect_to(signin_path); return) unless user.registered?
|
||||
user.activate
|
||||
|
@ -208,7 +216,7 @@ class AccountController < ApplicationController
|
|||
token.destroy
|
||||
flash[:notice] = l(:notice_account_activated)
|
||||
end
|
||||
redirect_to signin_url
|
||||
redirect_to signin_url(:type => "activated")
|
||||
end
|
||||
|
||||
def api_register login,password,email
|
||||
|
@ -244,8 +252,18 @@ class AccountController < ApplicationController
|
|||
end
|
||||
|
||||
def email_valid
|
||||
|
||||
begin
|
||||
@mail_type = params[:mail].split("@")[1]
|
||||
@user = User.find(params[:user_id])
|
||||
rescue
|
||||
return render_404
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { render :layout => "base_mail"}
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def resendmail
|
||||
result = {:status=>1, :email=>""}
|
||||
user = User.find(params[:user]) if params[:user]
|
||||
|
|
|
@ -500,6 +500,10 @@ class ApplicationController < ActionController::Base
|
|||
#<23><>ȡ<EFBFBD>γ<EFBFBD>
|
||||
def find_course
|
||||
@course= Course.find(params[:id])
|
||||
if @course.is_delete == 1 and !User.current.admin?
|
||||
render_404
|
||||
return
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@ class BoardsController < ApplicationController
|
|||
#modify by nwb
|
||||
@flag = params[:flag] || false
|
||||
if @project
|
||||
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin?
|
||||
if !@project.is_public? && !User.current.member_of?(@project) && !User.current.admin? && !User.current.allowed_to?(:view_messages, @project)
|
||||
render_403
|
||||
else
|
||||
@boards = @project.boards.includes(:last_message => :author).all
|
||||
|
@ -67,6 +67,30 @@ class BoardsController < ApplicationController
|
|||
else
|
||||
render_403
|
||||
end
|
||||
elsif @contest
|
||||
if (User.current.admin? || @contest.is_public || (!@contest.is_public && User.current.member_of_contest?(@contest)))
|
||||
@boards = @contest.boards.includes(:last_message => :author).all
|
||||
if @contest.boards.empty?
|
||||
@board = @contest.boards.build
|
||||
@board.name = " #{l(:label_board_contest) }"
|
||||
@board.description = @contest.name.to_s
|
||||
@board.project_id = -1
|
||||
@board.course_id = -1
|
||||
if @board.save
|
||||
@boards = @contest.boards.includes(:last_message => :author).all
|
||||
end
|
||||
end
|
||||
if params[:board_id]
|
||||
@board = Board.find params[:board_id].to_i
|
||||
else
|
||||
unless @contest.boards.where("parent_id is NULL").empty?
|
||||
@board = @contest.boards.where("parent_id is NULL").first
|
||||
end
|
||||
end
|
||||
show and return
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -116,6 +140,25 @@ class BoardsController < ApplicationController
|
|||
else
|
||||
@topics = [];
|
||||
end
|
||||
elsif @contest
|
||||
if (@board)
|
||||
@topic_count = @board.topics.count();
|
||||
@topic_pages = 0 #(params[:page] ? params[:page].to_i + 1 : 0) *10
|
||||
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) #{sort_type}").offset(@topic_pages).includes(:last_reply).preload(:author, {:last_reply => :author}).all();
|
||||
else
|
||||
@board = @contest.boards.build
|
||||
@board.name = " #{l(:label_board_contest) }"#self.name
|
||||
@board.description = @contest.name.to_s
|
||||
@board.project_id = -1
|
||||
@board.course_id = -1
|
||||
if @board.save
|
||||
@topic_count = @board.topics.count();
|
||||
@topic_pages = 0 #(params[:page] ? params[:page].to_i + 1 : 0) *10
|
||||
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) #{sort_type}").offset(@topic_pages).includes(:last_reply).preload(:author, {:last_reply => :author}).all();
|
||||
else
|
||||
@topics = []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#根据 赞+回复数排序
|
||||
|
@ -162,6 +205,10 @@ class BoardsController < ApplicationController
|
|||
@left_nav_type = 2
|
||||
@params=params
|
||||
render :action => 'show', :layout => 'base_courses'
|
||||
elsif @contest
|
||||
@left_nav_type = 4
|
||||
@params=params
|
||||
render :action => 'show', :layout => 'base_contests'
|
||||
end
|
||||
}
|
||||
format.atom {
|
||||
|
@ -296,6 +343,8 @@ private
|
|||
@board = @project.boards.find(params[:id]) if params[:id]
|
||||
elsif @course
|
||||
@board = @course.boards.find(params[:id]) if params[:id]
|
||||
elsif @contest
|
||||
@board = @contest.boards.find(params[:id]) if params[:id]
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
|
|
|
@ -38,7 +38,7 @@ class ContestMembersController < ApplicationController
|
|||
#status = 0 表示给学生发,status = 1表示给老师发
|
||||
course_join = ContestMessage.new(:user_id =>user_id, :contest_message_id=>User.current.id,:contest_id => @contest.id,:contest_message_type=>"JoinContest", :content => role_ids, :viewed => false, :status => 0)
|
||||
course_join.save
|
||||
ContestMessage.create(:user_id => User.current.id, :contest_message_id => user_id, :contest_message_id => @contest.id, :contest_message_type => "JoinContest",:content => role_ids, :viewed => false, :status => 1)
|
||||
#ContestMessage.create(:user_id => User.current.id, :contest_message_id => user_id, :contest_message_id => @contest.id, :contest_message_type => "JoinContest",:content => role_ids, :viewed => false, :status => 1)
|
||||
end
|
||||
end
|
||||
@contest.contest_members << members
|
||||
|
|
|
@ -15,13 +15,17 @@ class ContestantWorksController < ApplicationController
|
|||
|
||||
def new
|
||||
#更新消息
|
||||
noEvaluation = @contestwork.contest_messages.where("user_id =? and viewed =?", User.current.id, 0)
|
||||
noEvaluation.update_all(:viewed => true)
|
||||
if @contestwork.work_status == 1
|
||||
noEvaluation = @contestwork.contest_messages.where("user_id =? and viewed =?", User.current.id, 0)
|
||||
noEvaluation.update_all(:viewed => true)
|
||||
|
||||
@user = User.current
|
||||
@student_work = ContestantWork.new
|
||||
respond_to do |format|
|
||||
format.html{ render :layout => "base_contests"}
|
||||
@user = User.current
|
||||
@student_work = ContestantWork.new
|
||||
respond_to do |format|
|
||||
format.html{ render :layout => "base_contests"}
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -93,11 +97,11 @@ class ContestantWorksController < ApplicationController
|
|||
def show
|
||||
#@score = student_work_score @work,User.current
|
||||
@is_teacher = User.current.admin_of_contest?(@contest) || User.current.judge_of_contest?(@contest) || User.current.admin?
|
||||
# if @homework.homework_detail_manual.comment_status == 2 && !@is_teacher && @work.user != User.current
|
||||
# @student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
|
||||
# else
|
||||
# @student_work_scores = student_work_score_record(@work)
|
||||
# end
|
||||
if @contestwork.work_status == 3 && User.current.judge_of_contest?(@contest) && @contestwork.online_evaluation
|
||||
@student_work_scores = @work.contestant_work_scores.where("user_id = #{User.current.id} and reviewer_role = 2").order("updated_at desc")
|
||||
else
|
||||
@student_work_scores = contestant_work_score_record(@work)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -362,6 +366,54 @@ class ContestantWorksController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def add_score
|
||||
@is_last = params[:is_last] == "true"
|
||||
@is_teacher = User.current.admin_of_contest?(@contest) || User.current.judge_of_contest?(@contest) || User.current.admin?
|
||||
#老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分
|
||||
render_403 and return unless User.current.judge_of_contest?(@contest) && @contestwork.work_status == 3
|
||||
@is_last_a = @work.contestant_work_scores.empty?
|
||||
@new_score = ContestantWorkScore.new
|
||||
@new_score.score = params[:score].to_i
|
||||
@new_score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
|
||||
@new_score.user_id = User.current.id
|
||||
@new_score.contestant_work_id = @work.id
|
||||
@new_score.reviewer_role = 2
|
||||
|
||||
# if User.current.admin?
|
||||
# @new_score.reviewer_role = 1
|
||||
# else
|
||||
# role = User.current.members.where("course_id = ?",@course.id).first.roles.where("is_current = 1").first.name
|
||||
# @new_score.reviewer_role = get_role_by_name(role)
|
||||
# end
|
||||
# if @score
|
||||
# if @is_teacher
|
||||
# @is_new = true
|
||||
# @is_last_a = false
|
||||
# else
|
||||
# @is_new = false
|
||||
# end
|
||||
# else
|
||||
# @is_new = true
|
||||
# end
|
||||
|
||||
@new_score.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@new_score)
|
||||
|
||||
if @new_score.save
|
||||
@contestwork.update_column('updated_at', Time.now)
|
||||
update_contest_activity(@contestwork.class,@contestwork.id)
|
||||
update_user_activity(@contestwork.class,@contestwork.id)
|
||||
if @work.save
|
||||
@work = @contestwork.contestant_works.select("contestant_works.*,contestant_works.work_score as score").where(:id => @work.id).first
|
||||
@count = @contestwork.contestant_works.has_committed.count
|
||||
@student_work_scores = contestant_work_score_record @work
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def hsd_committed_work?(user, homework)
|
||||
sw = ContestantWork.where("user_id =? and work_id =?", user, homework).first
|
||||
|
|
|
@ -3,11 +3,13 @@ class ContestsController < ApplicationController
|
|||
|
||||
include ContestsHelper
|
||||
helper :contest_members
|
||||
helper :users
|
||||
|
||||
before_filter :find_contest, :only => [:show, :settings, :update, :contest_activities, :search_member, :private_or_public, :switch_role]
|
||||
before_filter :find_contest, :only => [:show, :settings, :update, :destroy, :contest_activities, :search_member, :private_or_public, :switch_role, :set_invite_code_halt, :renew]
|
||||
before_filter :is_logged, :only => [:index, :new, :create]
|
||||
before_filter :is_admin?, :only => [:settings]
|
||||
before_filter :is_admin?, :only => [:settings, :set_invite_code_halt, :destroy]
|
||||
before_filter :is_member?, :only => [:show, :contest_activities]
|
||||
|
||||
layout "base_contests"
|
||||
|
||||
def show
|
||||
|
@ -105,6 +107,10 @@ class ContestsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@contest.update_attributes(:is_delete => true)
|
||||
end
|
||||
|
||||
def private_or_public
|
||||
@contest.update_attributes(:is_public => !@contest.is_public)
|
||||
|
||||
|
@ -169,8 +175,12 @@ class ContestsController < ApplicationController
|
|||
end
|
||||
case params[:agree]
|
||||
when 'Y'
|
||||
member = ContestMember.new(:user_id => apply_user.id)
|
||||
Contest.find(applied_contest.contest_id).contest_members << member
|
||||
if ContestMember.where(:user_id => apply_user.id, :contest_id => applied_contest.contest_id).first.nil?
|
||||
member = ContestMember.new(:user_id => apply_user.id)
|
||||
Contest.find(applied_contest.contest_id).contest_members << member
|
||||
else
|
||||
member = ContestMember.where(:user_id => apply_user.id, :contest_id => applied_contest.contest_id).first
|
||||
end
|
||||
|
||||
contest_member_roles = member.contest_member_roles
|
||||
if integer_ids.include?(14) && integer_ids.include?(13)
|
||||
|
@ -181,8 +191,8 @@ class ContestsController < ApplicationController
|
|||
end
|
||||
|
||||
ContestMessage.create(:user_id => apply_user.id, :contest_id => applied_contest.contest_id, :viewed => false,:contest_message_id=>User.current.id,:content=>applied_contest.role,:contest_message_type=>'ContestRequestDealResult',:status=>1)
|
||||
applied_contest.applied_messages.update_all(:status => 1, :viewed => 1)
|
||||
@msg.update_attributes(:status => 1, :viewed => 1)
|
||||
applied_contest.applied_messages.update_all(:status => 1, :viewed => 1, :applied_user_id => User.current.id)
|
||||
@msg.update_attributes(:status => 1, :viewed => 1, :applied_user_id => User.current.id)
|
||||
applied_contest.update_attributes(:status => 1)
|
||||
if integer_ids.include?(15)
|
||||
ContestantForContest.create(:student_id => apply_user.id, :contest_id =>applied_contest.contest_id)
|
||||
|
@ -190,8 +200,8 @@ class ContestsController < ApplicationController
|
|||
|
||||
when 'N'
|
||||
ContestMessage.create(:user_id => apply_user.id, :contest_id => applied_contest.contest_id, :viewed => false,:contest_message_id=>User.current.id,:content=>applied_contest.role,:contest_message_type=>'ContestRequestDealResult',:status=>2)
|
||||
applied_contest.applied_messages.update_all(:status => 2, :viewed => 1)
|
||||
@msg.update_attributes(:status => 2, :viewed => 1)
|
||||
applied_contest.applied_messages.update_all(:status => 2, :viewed => 1, :applied_user_id => User.current.id)
|
||||
@msg.update_attributes(:status => 2, :viewed => 1, :applied_user_id => User.current.id)
|
||||
applied_contest.update_attributes(:status => 2)
|
||||
end
|
||||
respond_to do |format|
|
||||
|
@ -226,6 +236,23 @@ class ContestsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 邀请码停用/启用
|
||||
def set_invite_code_halt
|
||||
if User.current.admin_of_contest?(@contest) || User.current.admin?
|
||||
@contest.update_attribute('invite_code_halt', @contest.invite_code_halt == 0 ? 1 : 0)
|
||||
end
|
||||
end
|
||||
|
||||
# 恢复已删除的竞赛
|
||||
def renew
|
||||
if User.current.admin?
|
||||
@contest.update_attributes(:is_delete => false)
|
||||
redirect_to contest_path(@contest)
|
||||
else
|
||||
return 404
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_contest
|
||||
|
@ -234,6 +261,10 @@ class ContestsController < ApplicationController
|
|||
return
|
||||
end
|
||||
@contest = Contest.find(params[:id])
|
||||
if @contest.is_delete and !User.current.admin?
|
||||
render_404
|
||||
return
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
|
|
@ -49,8 +49,30 @@ class ForumsController < ApplicationController
|
|||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { redirect_to signin_path }
|
||||
end
|
||||
format.html { redirect_to signin_path }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def mail_feedback
|
||||
@user = User.where(:id => params[:user_id]).first
|
||||
unless @user.nil?
|
||||
cs = CommentService.new
|
||||
@memo, message = cs.create_feedback params, @user
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def forum_create_memo
|
||||
@memo = Memo.new
|
||||
@my_forums_count = Forum.where(:creator_id => User.current.id).count
|
||||
@my_memos_count = Memo.where(:author_id => User.current.id).count
|
||||
@forums = Forum.reorder("topic_count desc,updated_at desc")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render layout: 'base_new_forum'}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -96,35 +118,41 @@ class ForumsController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
order = ""
|
||||
@order_str = ""
|
||||
if(params[:reorder_complex])
|
||||
@type="reorder_complex"
|
||||
@str=params[:reorder_complex]
|
||||
@forums_all = Forum.reorder("topic_count #{params[:reorder_complex]},updated_at #{params[:reorder_complex]}")
|
||||
order = " last_replies_memos.created_at #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}"
|
||||
@order_str = "reorder_complex="+params[:reorder_complex]
|
||||
elsif(params[:reorder_popu])
|
||||
@type="reorder_popu"
|
||||
@str=params[:reorder_popu]
|
||||
@forums_all = Forum.reorder("topic_count #{params[:reorder_popu]}")
|
||||
order = "replies_count #{params[:reorder_popu]}"
|
||||
@order_str = "reorder_popu="+params[:reorder_popu]
|
||||
elsif(params[:reorder_time])
|
||||
@type="reorder_time"
|
||||
@str=params[:reorder_time]
|
||||
@forums_all = Forum.reorder("updated_at #{params[:reorder_time]}")
|
||||
order = "#{Memo.table_name}.updated_at #{params[:reorder_time]}"
|
||||
@order_str = "reorder_time="+params[:reorder_time]
|
||||
else
|
||||
params[:reorder_complex] = "desc"
|
||||
@type="reorder_complex"
|
||||
@str=params[:reorder_complex]
|
||||
@forums_all = Forum.reorder("topic_count desc,updated_at desc")
|
||||
order = "#{Memo.table_name}.updated_at desc"
|
||||
@order_str = "reorder_time=desc"
|
||||
end
|
||||
@forums_count = @forums_all.count
|
||||
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
||||
|
||||
@offset ||= @forums_pages.offset
|
||||
@forums = @forums_all.offset(@offset).limit(@limit).all
|
||||
#@forums = Forum.all
|
||||
@memo = Memo.new(:forum => @forum)
|
||||
@memos = Memo.where("parent_id is null")
|
||||
@topic_count = @memos.count
|
||||
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
|
||||
@memos = @memos.includes(:last_reply).
|
||||
limit(@topic_pages.per_page).
|
||||
offset(@topic_pages.offset).
|
||||
reorder(order).
|
||||
preload(:author, {:last_reply => :author}).
|
||||
all
|
||||
@forums = Forum.reorder("topic_count desc,updated_at desc")
|
||||
@my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count
|
||||
@my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count
|
||||
@errors = params[:errors]
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.js
|
||||
format.json { render json: @forums }
|
||||
format.html {
|
||||
render :layout => 'base_new_forum'
|
||||
}# show.html.erb
|
||||
format.json { render json: @forum }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -153,22 +181,21 @@ class ForumsController < ApplicationController
|
|||
@memo = Memo.new(:forum => @forum)
|
||||
@topic_count = @forum.topics.count
|
||||
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
|
||||
@memos = @forum.topics.
|
||||
# reorder("#{Memo.table_name}.sticky DESC").
|
||||
includes(:last_reply).
|
||||
@memos = @forum.topics.includes(:last_reply).
|
||||
limit(@topic_pages.per_page).
|
||||
offset(@topic_pages.offset).
|
||||
reorder(order).
|
||||
preload(:author, {:last_reply => :author}).
|
||||
all
|
||||
@memos
|
||||
@my_topic_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is null").count
|
||||
@my_replies_count = Memo.where("forum_id = #{@forum.id} and author_id = #{User.current.id} and parent_id is not null").count
|
||||
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and parent_id is null").count
|
||||
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and parent_id is not null").count
|
||||
@errors = params[:errors]
|
||||
# 推荐贴吧
|
||||
@forums = Forum.where("id !=?", @forum.id).reorder("topic_count desc,updated_at desc").first(3)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {
|
||||
render :layout => 'base_forums'
|
||||
render :layout => 'base_new_forum'
|
||||
}# show.html.erb
|
||||
format.json { render json: @forum }
|
||||
end
|
||||
|
@ -178,9 +205,9 @@ class ForumsController < ApplicationController
|
|||
# GET /forums/new.json
|
||||
def new
|
||||
@forum = Forum.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.js
|
||||
format.json { render json: @forum }
|
||||
end
|
||||
end
|
||||
|
@ -188,6 +215,10 @@ class ForumsController < ApplicationController
|
|||
# GET /forums/1/edit
|
||||
def edit
|
||||
@forum = Forum.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# POST /forums
|
||||
|
@ -200,18 +231,17 @@ class ForumsController < ApplicationController
|
|||
# Author lizanle
|
||||
# Description after save后需要进行资源记录的更新
|
||||
# owner_type = 2 对应的是 forum
|
||||
@save_flag=true
|
||||
@save_flag = true
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids ,@forum.id,OwnerTypeHelper::FORUM
|
||||
update_kindeditor_assets_owner ids, @forum.id, OwnerTypeHelper::FORUM
|
||||
end
|
||||
#end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.js{ redirect_to forums_path, notice: l(:label_forum_create_succ)}
|
||||
format.html { redirect_to @forum, notice: l(:label_forum_create_succ) }
|
||||
format.json { render json: @forum, status: :created, location: @forum }
|
||||
end
|
||||
|
||||
else
|
||||
@save_flag=false
|
||||
respond_to do |format|
|
||||
|
@ -227,15 +257,14 @@ class ForumsController < ApplicationController
|
|||
# PUT /forums/1.json
|
||||
def update
|
||||
@forum = Forum.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @forum.update_attributes(params[:forum])
|
||||
format.js {render :text=> true}
|
||||
format.js
|
||||
format.html { redirect_to @forum, notice: l(:label_forum_update_succ) }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
flash.now[:error] = "#{l :label_forum_update_fail}: #{@forum.errors.full_messages[0]}"
|
||||
format.js { render :text=> false}
|
||||
format.js
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @forum.errors, status: :unprocessable_entity }
|
||||
end
|
||||
|
@ -254,6 +283,19 @@ class ForumsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 更新贴吧描述
|
||||
def update_memo_description
|
||||
@forum = Forum.find(params[:id])
|
||||
if @forum.blank?
|
||||
result = { :result => false }
|
||||
else
|
||||
forum_decription = params[:forum][:description]
|
||||
@forum.update_attributes(:description => forum_decription )
|
||||
result = { :result => true }
|
||||
end
|
||||
render :json => result
|
||||
end
|
||||
|
||||
def search_forum
|
||||
# @forums = paginateHelper Forum.where("name LIKE '%#{params[:name]}%'")
|
||||
q = "%#{params[:name].strip}%"
|
||||
|
@ -296,15 +338,28 @@ class ForumsController < ApplicationController
|
|||
|
||||
#检查forum的名字
|
||||
def check_forum_name
|
||||
forum_name_exist = true
|
||||
if params[:forum_id]
|
||||
forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false
|
||||
else
|
||||
forum_name_exist = Forum.where("name = '#{params[:forum_name]}' ").count >= 1 ? true : false
|
||||
begin
|
||||
forum_name = params[:forum_name]
|
||||
if params[:forum_id]
|
||||
result = Forum.where("name = '#{forum_name}' and id != #{params[:forum_id]}").first.blank? ? {:result => true} : {:result => false}
|
||||
else
|
||||
result = Forum.where(:name => forum_name).first.blank? ? {:result => true} : {:result => false}
|
||||
end
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
render :text => forum_name_exist
|
||||
render :json => result
|
||||
# if params[:forum_id]
|
||||
# forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false
|
||||
# else
|
||||
# forum_name_exist = Forum.where("name = '#{params[:forum_name]}' ").count >= 1 ? true : false
|
||||
# end
|
||||
# render :text => forum_name_exist
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
#添加论坛tag
|
||||
def add_forum_tag
|
||||
@forum = Forum.find(params[:id])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class MemosController < ApplicationController
|
||||
default_search_scope :memos
|
||||
before_filter :find_forum, :only => [:new, :create, :preview]
|
||||
before_filter :find_forum, :only => [:new, :create, :preview, :update]
|
||||
before_filter :find_attachments, :only => [:preview]
|
||||
before_filter :find_memo, :except => [:new, :create, :preview]
|
||||
before_filter :authenticate_user_edit, :only => [:edit, :update]
|
||||
|
@ -29,32 +29,25 @@ class MemosController < ApplicationController
|
|||
|
||||
def new
|
||||
@memo = Memo.new
|
||||
@memo.forum_id = @forum.id
|
||||
|
||||
@my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count
|
||||
@my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count
|
||||
@forums = Forum.reorder("topic_count desc,updated_at desc")
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render action: :new ,layout: 'base'
|
||||
}
|
||||
format.js
|
||||
format.html {render layout: 'base_new_forum'}
|
||||
format.json { render json: @memo }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
if params[:quote].nil?
|
||||
@quote = ""
|
||||
else
|
||||
@quote = params[:quote]
|
||||
end
|
||||
|
||||
|
||||
|
||||
#unless params[:quote].nil?
|
||||
# @quote = params[:quote][:quote]
|
||||
#end
|
||||
|
||||
@memo = Memo.new(params[:memo])
|
||||
@memo.forum_id = params[:forum_id]
|
||||
@memo.forum_id = @forum.id
|
||||
@memo.author_id = User.current.id
|
||||
|
||||
if params[:memo][:parent_id]
|
||||
|
@ -78,24 +71,20 @@ class MemosController < ApplicationController
|
|||
asset.save
|
||||
end
|
||||
end
|
||||
#end
|
||||
format.js
|
||||
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
|
||||
format.json { render json: @memo, status: :created, location: @memo }
|
||||
format.js
|
||||
format.html {redirect_to back_memo_url}
|
||||
format.json { render json: @memo, status: :created, location: @memo }
|
||||
else
|
||||
flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
|
||||
format.js
|
||||
format.html { redirect_to( forum_path(Forum.find(params[:forum_id]),:errors=>@memo.errors.full_messages[0])) }
|
||||
format.json { render json: @memo.errors, status: :unprocessable_entity }
|
||||
#end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE)
|
||||
def show
|
||||
|
||||
# 更新贴吧帖子留言对应的memo_messages的viewed字段
|
||||
unless @memo.children.blank?
|
||||
@memo.children.each do |child|
|
||||
|
@ -143,27 +132,30 @@ class MemosController < ApplicationController
|
|||
|
||||
@memo_new = Memo.new
|
||||
|
||||
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count
|
||||
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count
|
||||
@my_topic_count = 0
|
||||
@my_replies_count = Memo.where(:parent_id => @memo.id).count
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout=> 'base_forums'}#:layout=> 'base_forums',
|
||||
format.html {render :layout => 'base_new_forum'}
|
||||
format.json { render json: @memo }
|
||||
format.xml { render xml: @memo }
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count
|
||||
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count
|
||||
@my_topic_count = 0
|
||||
@my_replies_count = Memo.where(:parent_id => @memo.id).count
|
||||
@forums = Forum.reorder("topic_count desc,updated_at desc")
|
||||
@replying = false
|
||||
respond_to do |format|
|
||||
format.html {render :layout=>'base_forums'}
|
||||
format.html {render :layout => 'base_new_forum'}
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
# 注意,如果不需要
|
||||
|
||||
@flag = false
|
||||
respond_to do |format|
|
||||
if( #@memo.update_column(:subject, params[:memo][:subject]) &&
|
||||
|
@ -173,10 +165,11 @@ class MemosController < ApplicationController
|
|||
@memo.update_column(:subject,params[:memo][:subject]) &&
|
||||
@memo.update_column(:updated_at,Time.now))
|
||||
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
|
||||
@memo.forum_id = @forum.id
|
||||
@flag = @memo.save
|
||||
# @memo.root.update_attribute(:updated_at, @memo.updated_at)
|
||||
format.js
|
||||
format.html {redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}"}
|
||||
format.html {redirect_to back_memo_url, notice: "#{l :label_memo_update_succ}"}
|
||||
else
|
||||
format.js
|
||||
format.html { render action: "edit" }
|
||||
|
@ -207,7 +200,9 @@ class MemosController < ApplicationController
|
|||
end
|
||||
|
||||
def find_forum
|
||||
@forum = Forum.find(params[:forum_id])
|
||||
forum_name = params[:forum_name].strip unless params[:forum_name].nil?
|
||||
@forum = forum_name ? Forum.find_by_name(forum_name) : Forum.find(params[:forum_id])
|
||||
# @forum = Forum.find(params[:forum_id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
nil
|
||||
|
|
|
@ -82,6 +82,13 @@ class MessagesController < ApplicationController
|
|||
format.js
|
||||
format.html {render :layout => 'base_projects'}
|
||||
end
|
||||
elsif @contest
|
||||
@left_nav_type = 4
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html { render :layout => 'base_contests' }
|
||||
end
|
||||
#render :action => "show", :layout => "base_courses"#by young
|
||||
else
|
||||
# @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
|
||||
# @replies = @topic.children.
|
||||
|
@ -94,7 +101,7 @@ class MessagesController < ApplicationController
|
|||
@organization = @org_subfield.organization
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'base_org'}
|
||||
format.html { render :layout => 'base_org' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -111,6 +118,8 @@ class MessagesController < ApplicationController
|
|||
is_public = @project.is_public
|
||||
elsif @course
|
||||
is_public = @course.is_public
|
||||
elsif @contest
|
||||
is_public = @contest.is_public
|
||||
end
|
||||
# 公开项目/课程上传的资源是公开的,私有项目上传的是私有的
|
||||
@message.save_attachments_containers(params[:attachments], User.current, is_public)
|
||||
|
@ -128,6 +137,8 @@ class MessagesController < ApplicationController
|
|||
redirect_to project_boards_path(@project)
|
||||
elsif @course
|
||||
redirect_to course_boards_path(@course, :board_id => @board.id)
|
||||
elsif @contest
|
||||
redirect_to contest_boards_path(@contest, :board_id => @board.id)
|
||||
end
|
||||
else
|
||||
redirect_to board_message_url(@board, @message)
|
||||
|
@ -138,9 +149,11 @@ class MessagesController < ApplicationController
|
|||
redirect_to project_boards_path(@project, :flag => true)
|
||||
elsif @course
|
||||
redirect_to course_boards_path(@course, :board_id => @board.id, :flag => true)
|
||||
elsif @contest
|
||||
redirect_to contest_boards_path(@contest, :board_id => @board.id, :flag => true)
|
||||
end
|
||||
else
|
||||
layout_file = @project ? 'base_projects' : 'base_courses'
|
||||
layout_file = @project ? 'base_projects' : (@course ? 'base_courses' : 'base_contests')
|
||||
render :action => 'new', :layout => layout_file
|
||||
end
|
||||
|
||||
|
@ -149,7 +162,7 @@ class MessagesController < ApplicationController
|
|||
@left_nav_type = 2
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
layout_file = @project ? 'base_projects' : 'base_courses'
|
||||
layout_file = @project ? 'base_projects' : (@course ? 'base_courses' : 'base_contests')
|
||||
render :layout => layout_file
|
||||
}
|
||||
end
|
||||
|
@ -187,6 +200,7 @@ class MessagesController < ApplicationController
|
|||
end
|
||||
|
||||
update_course_activity(@topic.class,@topic.id)
|
||||
update_contest_activity(@topic.class,@topic.id)
|
||||
update_user_activity(@topic.class,@topic.id)
|
||||
update_forge_activity(@topic.class,@topic.id)
|
||||
update_org_activity(@topic.class,@topic.id)
|
||||
|
@ -226,6 +240,8 @@ class MessagesController < ApplicationController
|
|||
(render_403; return false) unless @message.editable_by?(User.current)
|
||||
elsif @course
|
||||
(render_403; return false) unless @message.course_editable_by?(User.current)
|
||||
elsif @contest
|
||||
(render_403; return false) unless @message.contest_editable_by?(User.current)
|
||||
else
|
||||
(render_403; return false) unless @message.org_subfield_editable_by?(User.current)
|
||||
end
|
||||
|
@ -243,12 +259,16 @@ class MessagesController < ApplicationController
|
|||
redirect_to project_path(@project)
|
||||
elsif @course
|
||||
redirect_to course_activity_path(@course)
|
||||
elsif @contest
|
||||
redirect_to contest_activities_contest_path(@contest)
|
||||
end
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
||||
if @project
|
||||
redirect_to project_boards_path(@project)
|
||||
elsif @course
|
||||
redirect_to course_boards_path(@course)
|
||||
elsif @contest
|
||||
redirect_to contest_boards_path(@contest)
|
||||
end
|
||||
else
|
||||
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
|
||||
|
@ -265,6 +285,9 @@ class MessagesController < ApplicationController
|
|||
elsif @course
|
||||
@left_nav_type = 2
|
||||
layout_file = 'base_courses'
|
||||
elsif @contest
|
||||
@left_nav_type = 4
|
||||
layout_file = 'base_contests'
|
||||
elsif @org_subfield
|
||||
@organization = @org_subfield.organization
|
||||
layout_file = 'base_org'
|
||||
|
@ -292,6 +315,8 @@ class MessagesController < ApplicationController
|
|||
(render_403; return false) unless @message.destroyable_by?(User.current)
|
||||
elsif @course
|
||||
(render_403; return false) unless @message.course_destroyable_by?(User.current)
|
||||
elsif @contest
|
||||
(render_403; return false) unless @message.contest_destroyable_by?(User.current)
|
||||
else
|
||||
(render_403; return false) unless @message.org_subfield_editable_by?(User.current)
|
||||
end
|
||||
|
@ -322,6 +347,18 @@ class MessagesController < ApplicationController
|
|||
else
|
||||
redirect_to course_boards_path(@course)
|
||||
end
|
||||
elsif @contest
|
||||
if params[:is_course] && params[:is_course].to_i == 0
|
||||
redirect_to user_contest_community_path(User.current.id)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
|
||||
redirect_to contest_activities_contest_path(@contest)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
||||
redirect_to contest_boards_path(@contest)
|
||||
elsif @message.parent
|
||||
redirect_to board_message_url(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to contest_boards_path(@contest)
|
||||
end
|
||||
elsif @org_subfield
|
||||
if params[:is_board]
|
||||
redirect_to organization_path(:id => @org_subfield.organization_id, :org_subfield_id => @org_subfield.id)
|
||||
|
@ -400,8 +437,10 @@ class MessagesController < ApplicationController
|
|||
@board = Board.find(params[:board_id])
|
||||
if @board.project_id != -1 && @board.project_id != nil
|
||||
@project = @board.project
|
||||
elsif @board.course_id
|
||||
elsif @board.course_id && @board.course_id != -1
|
||||
@course = @board.course
|
||||
elsif @board.contest_id
|
||||
@contest = @board.contest
|
||||
else
|
||||
@org_subfield = @board.org_subfield
|
||||
@organization = @org_subfield
|
||||
|
|
|
@ -273,7 +273,7 @@ class NewsController < ApplicationController
|
|||
elsif @news.contest_id
|
||||
@contest = Contest.find(@news.contest_id)
|
||||
if @contest
|
||||
@left_nav_type = 4
|
||||
@left_nav_type = 5
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'base_contests'}
|
||||
|
|
|
@ -360,7 +360,7 @@ class PullRequestsController < ApplicationController
|
|||
:project_id => project_id,
|
||||
:forge_message_id => pull_request_id,
|
||||
:forge_message_type => "PullRequest",
|
||||
:viewed => true,
|
||||
:viewed => false,
|
||||
:status => status,
|
||||
:operate_user_id => User.current.id,
|
||||
)
|
||||
|
|
|
@ -35,11 +35,11 @@ class UsersController < ApplicationController
|
|||
|
||||
#
|
||||
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list,
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks,
|
||||
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
||||
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_receive_homeworks,
|
||||
:unapproval_applied_list, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,:user_contestlist,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,:user_contestlist, :user_manage_issues, :user_receive_issues,
|
||||
:user_courses4show,:user_projects4show,:user_contests4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
|
||||
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
|
||||
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community]
|
||||
|
@ -150,6 +150,98 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 我发布的issue
|
||||
def user_manage_issues
|
||||
@manage_issues = "我发布的Issue"
|
||||
# 排序(默认以更新时间降序)
|
||||
order = "updated_on desc"
|
||||
if params[:reorder_release_time]
|
||||
order = "created_on #{params[:reorder_release_time]}"
|
||||
elsif params[:reorder_turnover_time]
|
||||
order = "updated_on #{params[:reorder_turnover_time]}"
|
||||
end
|
||||
|
||||
@subject = params[:subject]
|
||||
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
|
||||
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
|
||||
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
|
||||
if @project_id.nil?
|
||||
@issues = Issue.where("author_id =? and subject like ?",
|
||||
@user.id, "%#{@subject}%").order(order)
|
||||
else
|
||||
@issues = Issue.where("author_id =? and project_id=? and subject like ?",
|
||||
@user.id, @project_id, "%#{@subject}%").order(order)
|
||||
end
|
||||
@issues_filter = Issue.where("author_id =?", @user.id).order('updated_on desc')
|
||||
@issue_open_count = Issue.where(:author_id => @user.id, :status_id => [1, 2, 3, 4, 6]).count
|
||||
@issue_close_count = Issue.where(:author_id => @user.id, :status_id => 5).count
|
||||
|
||||
# 导出excel的issues
|
||||
@excel_issues = @issues
|
||||
@issue_count = @issues.count
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
|
||||
@offset ||= @issue_pages.offset
|
||||
@issues = paginateHelper @issues, @limit
|
||||
# @issues.limit(@issue_pages.per_page).offset(@issue_pages.offset).reorder(order).all
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'static_base'}
|
||||
format.xls{
|
||||
filename = "我发布的_#{l(:label_issue_list_xls)}.xls"
|
||||
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
|
||||
}
|
||||
format.api
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 我收到的issue
|
||||
def user_receive_issues
|
||||
@receive_issues = "我收到的Issue"
|
||||
# 排序(默认以更新时间降序)
|
||||
order = "updated_on desc"
|
||||
if params[:reorder_release_time]
|
||||
order = "created_on #{params[:reorder_release_time]}"
|
||||
elsif params[:reorder_turnover_time]
|
||||
order = "updated_on #{params[:reorder_turnover_time]}"
|
||||
end
|
||||
|
||||
@subject = params[:subject]
|
||||
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
|
||||
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
|
||||
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
|
||||
if @project_id.nil?
|
||||
@issues = Issue.where("assigned_to_id =? and subject like ?",
|
||||
@user.id, "%#{@subject}%").order(order)
|
||||
else
|
||||
@issues = Issue.where("assigned_to_id =? and project_id=? and subject like ?",
|
||||
@user.id, @project_id, "%#{@subject}%").order(order)
|
||||
end
|
||||
@issues_filter = Issue.where("assigned_to_id =?", @user.id).order('updated_on desc')
|
||||
@issue_open_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 3, 4, 6]).count
|
||||
@issue_close_count = Issue.where(:assigned_to_id => @user.id, :status_id => 5).count
|
||||
|
||||
# 导出excel的issues
|
||||
@excel_issues = @issues
|
||||
@issue_count = @issues.count
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
|
||||
@offset ||= @issue_pages.offset
|
||||
@issues = paginateHelper @issues, @limit
|
||||
# @issues.limit(@issue_pages.per_page).offset(@issue_pages.offset).reorder(order).all
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'static_base'}
|
||||
format.xls{
|
||||
filename = "我发布的_#{l(:label_issue_list_xls)}.xls"
|
||||
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
|
||||
}
|
||||
format.api
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#展开所有回复
|
||||
def show_all_replies
|
||||
case params[:type]
|
||||
|
@ -362,7 +454,7 @@ class UsersController < ApplicationController
|
|||
messages.each do |message_all|
|
||||
# 未读的消息存放在数组
|
||||
mess = message_all.message
|
||||
if (message_all.message_type != "SystemMessage"&& !mess.nil? && (mess.viewed == 0 || !mess.viewed)) || (message_all.message_type == "SystemMessage"&& !mess.nil? && mess.created_at > onclick_time)
|
||||
if (message_all.message_type != "SystemMessage" && !mess.nil? && (mess.viewed == 0 || !mess.viewed)) || (message_all.message_type == "SystemMessage"&& !mess.nil? && mess.created_at > onclick_time)
|
||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
|
||||
@message_alls << mess
|
||||
end
|
||||
|
@ -1738,6 +1830,72 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 用户发布的作业
|
||||
def user_manage_homeworks
|
||||
@manage_homeworks = "我发布的作业"
|
||||
@order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc", 1
|
||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||
@type = @type.to_i
|
||||
tea_courses = @user.courses.visible.not_deleted.select{|course| @user.has_teacher_role(course)}
|
||||
tea_course_ids = tea_courses.empty? ? "(-1)" : "(" + tea_courses.map{|course| course.id}.join(',') + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{tea_course_ids}").order("#{@order} #{@b_sort}")
|
||||
if params[:property]
|
||||
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
||||
if params[:property] == "1"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
|
||||
elsif params[:property] == "2"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
|
||||
elsif params[:property] == "3"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
|
||||
end
|
||||
end
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@hw_count = @homeworks.count
|
||||
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
|
||||
@offset ||= @hw_pages.offset
|
||||
@homeworks = paginateHelper @homeworks,@limit
|
||||
@search = ""
|
||||
@property = params[:property]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'static_base'}
|
||||
end
|
||||
end
|
||||
|
||||
# 用户收到的作业
|
||||
def user_receive_homeworks
|
||||
@receive_homeworks = "我收到的作业"
|
||||
@order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc", 2
|
||||
@r_sort = @b_sort == "desc" ? "asc" : "desc"
|
||||
@type = @type.to_i
|
||||
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
||||
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
||||
if params[:property]
|
||||
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
||||
if params[:property] == "1"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
|
||||
elsif params[:property] == "2"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
|
||||
elsif params[:property] == "3"
|
||||
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
|
||||
end
|
||||
end
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@hw_count = @homeworks.count
|
||||
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
|
||||
@offset ||= @hw_pages.offset
|
||||
@homeworks = paginateHelper @homeworks,@limit
|
||||
@search = ""
|
||||
@property = params[:property]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'static_base'}
|
||||
end
|
||||
end
|
||||
|
||||
#我管理/收到的作业
|
||||
def manage_or_receive_homeworks
|
||||
@order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc",params[:type] || 1
|
||||
|
@ -4087,6 +4245,7 @@ class UsersController < ApplicationController
|
|||
# 用户竞赛列表
|
||||
def user_contestlist
|
||||
# 我创建的竞赛
|
||||
@contest_community = "竞赛"
|
||||
@my_contests = @user.contests.where(:user_id => @user.id).order("created_at desc")
|
||||
@my_contests_count = @my_contests.count
|
||||
# 我参与的竞赛
|
||||
|
|
|
@ -545,6 +545,8 @@ class WechatsController < ActionController::Base
|
|||
return openid
|
||||
end
|
||||
|
||||
## 能进来的就是已关注
|
||||
## 因为取消订阅的记录被删除了
|
||||
def user_binded?(openid)
|
||||
uw = UserWechat.where(openid: openid).first
|
||||
if uw && uw.bindtype == 0
|
||||
|
|
|
@ -2,8 +2,9 @@ class WorksController < ApplicationController
|
|||
|
||||
layout "base_contests"
|
||||
before_filter :find_contest, :only => [:index,:new,:create]
|
||||
before_filter :find_contestwork, :only => [:edit,:update,:destroy,:score_rule_set,:alert_open_student_works,:open_student_works,:set_score_open,:alert_score_open_modal]
|
||||
before_filter :admin_of_contest, :only => [:new, :create, :edit, :update, :destroy,:score_rule_set,:alert_open_student_works,:open_student_works]
|
||||
before_filter :find_contestwork, :only => [:edit,:update,:destroy,:score_rule_set,:open_contestant_works,:set_score_open,:alert_score_open_modal,
|
||||
:set_score_rule]
|
||||
before_filter :admin_of_contest, :only => [:new, :create, :edit, :update, :destroy,:score_rule_set,:open_contestant_works]
|
||||
before_filter :member_of_contest, :only => [:index]
|
||||
|
||||
def index
|
||||
|
@ -69,7 +70,14 @@ class WorksController < ApplicationController
|
|||
homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(homework)
|
||||
|
||||
homework.work_status = homework.publish_time > Date.today ? 0 : 1
|
||||
homework.work_status = homework.publish_time > Date.today ? 0 : (homework.end_time < Date.today ? 2 : 1)
|
||||
|
||||
work_detail_manual = WorkDetailManual.new
|
||||
|
||||
work_detail_manual.evaluation_start = homework.end_time + 7
|
||||
work_detail_manual.evaluation_end = work_detail_manual.evaluation_start + 7
|
||||
work_detail_manual.evaluation_num = 3
|
||||
homework.work_detail_manual = work_detail_manual
|
||||
|
||||
#分组作业
|
||||
if homework.work_type == 3
|
||||
|
@ -81,6 +89,7 @@ class WorksController < ApplicationController
|
|||
end
|
||||
|
||||
if homework.save
|
||||
work_detail_manual.save if work_detail_manual
|
||||
homework_detail_group.save if homework_detail_group
|
||||
redirect_to works_path(:contest => @contest.id)
|
||||
end
|
||||
|
@ -101,7 +110,14 @@ class WorksController < ApplicationController
|
|||
end
|
||||
param_end_time = Time.parse(params[:homework_common][:end_time]).strftime("%Y-%m-%d")
|
||||
homework_end_time = Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d")
|
||||
work_detail_manual = @contestwork.work_detail_manual
|
||||
if homework_end_time != param_end_time
|
||||
eval_start = work_detail_manual.evaluation_start
|
||||
if eval_start.nil? || (eval_start <= param_end_time && @contestwork.work_status <= 2)
|
||||
work_detail_manual.evaluation_start = @contestwork.end_time + 7
|
||||
work_detail_manual.evaluation_end = work_detail_manual.evaluation_start + 7
|
||||
end
|
||||
|
||||
if homework_end_time > param_end_time
|
||||
@contestwork.contestant_works.each do |st|
|
||||
if param_end_time < Time.parse(st.commit_time.to_s).strftime("%Y-%m-%d")
|
||||
|
@ -129,6 +145,8 @@ class WorksController < ApplicationController
|
|||
#status = false
|
||||
if @contestwork.publish_time <= Date.today && @contestwork.work_status == 0
|
||||
@contestwork.work_status = 1
|
||||
elsif @contestwork.end_time < Date.today && @contestwork.work_status == 1
|
||||
@contestwork.work_status = 2
|
||||
#status = true
|
||||
end
|
||||
|
||||
|
@ -146,6 +164,7 @@ class WorksController < ApplicationController
|
|||
|
||||
if @contestwork.save
|
||||
@homework_detail_group.save if @homework_detail_group
|
||||
work_detail_manual.save if work_detail_manual
|
||||
|
||||
@hw_status = params[:hw_status].to_i
|
||||
if @hw_status == 1
|
||||
|
@ -180,20 +199,80 @@ class WorksController < ApplicationController
|
|||
def destroy
|
||||
if @contestwork.destroy
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
format.js {
|
||||
@hw_status = params[:hw_status].to_i
|
||||
if @hw_status == 1
|
||||
redirect_to user_contest_community_path(User.current.id)
|
||||
elsif @hw_status == 2
|
||||
redirect_to contest_path(@contest.id)
|
||||
else
|
||||
redirect_to works_path(:contest => @contest.id)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def alert_score_open_modal
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@hw_status = params[:hw_status].to_i
|
||||
end
|
||||
|
||||
def set_score_open
|
||||
@contestwork.update_attribute('score_open', params[:score_open].to_i)
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@hw_status = params[:hw_status].to_i
|
||||
@is_teacher = User.current.admin? || User.current.admin_of_contest?(@contest)
|
||||
end
|
||||
|
||||
def open_contestant_works
|
||||
@contestwork.update_attributes(:is_open => !@contestwork.is_open)
|
||||
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@hw_status = params[:hw_status].to_i
|
||||
@is_teacher = User.current.admin? || User.current.admin_of_contest?(@contest)
|
||||
end
|
||||
|
||||
def score_rule_set
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@hw_status = params[:hw_status].to_i
|
||||
end
|
||||
|
||||
def set_score_rule
|
||||
# 未启动在线评审时才能更改评审参数
|
||||
if @contestwork.work_status < 3
|
||||
@contestwork.online_evaluation = params[:online_evaluation] ? 1 : 0
|
||||
|
||||
# 如果开启在线评审
|
||||
if params[:online_evaluation]
|
||||
work_detail_manual = @contestwork.work_detail_manual
|
||||
work_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
work_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
work_detail_manual.evaluation_num = params[:evaluation_limit].to_i == 1 ? params[:evaluation_num] : -1
|
||||
work_detail_manual.save
|
||||
end
|
||||
end
|
||||
|
||||
score_valid = params[:score_valid].to_i == 1 ? true : false
|
||||
if score_valid != @contestwork.score_valid
|
||||
@contestwork.score_valid = score_valid
|
||||
@contestwork.contestant_works.has_committed.each do |c_work|
|
||||
c_work.save
|
||||
end
|
||||
end
|
||||
@contestwork.save
|
||||
if params[:student_path] && params[:student_path] == "true"
|
||||
redirect_to contestant_works_path(:work => @contestwork.id)
|
||||
else
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@hw_status = params[:hw_status].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
#获取竞赛
|
||||
|
|
|
@ -37,6 +37,16 @@ module ApplicationHelper
|
|||
# super
|
||||
# end
|
||||
|
||||
# 公共分页
|
||||
def paginator_list objs, objs_count, limit, is_remote
|
||||
@is_remote = is_remote
|
||||
@objs_count = objs.count
|
||||
@obj_pages = Paginator.new @objs_count, limit, params['page'] || 1
|
||||
@offset ||= @obj_pages.offset
|
||||
@objs = paginateHelper @attachments,25
|
||||
end
|
||||
|
||||
|
||||
# 获取竞赛的管理人员
|
||||
def contest_managers contest
|
||||
contest.contest_members.select{|cm| cm.roles.to_s.include?("ContestManager")}
|
||||
|
@ -227,6 +237,16 @@ module ApplicationHelper
|
|||
xls_report.string
|
||||
end
|
||||
|
||||
# 用户资料是否完善
|
||||
def user_data_complete user
|
||||
user_extension = UserExtensions.where(:user_id => user.id).first
|
||||
data = true
|
||||
if user_extension.gender.nil? || user_extension.school_id.nil? || user.lastname.blank? || (user_extension.identity == 3 && user_extension.school_id.nil?)
|
||||
data = false
|
||||
end
|
||||
return data
|
||||
end
|
||||
|
||||
# 获取用户单位
|
||||
# 优先获取高校信息,如果改信息不存在则获取occupation
|
||||
def get_occupation_from_user user
|
||||
|
@ -1328,6 +1348,14 @@ module ApplicationHelper
|
|||
title << @course_community
|
||||
elsif !@contest_community.blank?
|
||||
title << @contest_community
|
||||
elsif !@manage_issues.blank?
|
||||
title << @manage_issues
|
||||
elsif !@receive_issues.blank?
|
||||
title << @receive_issues
|
||||
elsif !@manage_homeworks.blank?
|
||||
title << @manage_homeworks
|
||||
elsif !@receive_homeworks.blank?
|
||||
title << @receive_homeworks
|
||||
else
|
||||
title << @user.try(:realname)
|
||||
end
|
||||
|
@ -2900,6 +2928,20 @@ module ApplicationHelper
|
|||
@user_course_total = @my_joined_course_count + @my_course_count
|
||||
end
|
||||
|
||||
# 用户发布的作业数
|
||||
def user_manage_homework_count
|
||||
tea_courses = @user.courses.visible.not_deleted.select{|course| @user.has_teacher_role(course)}
|
||||
tea_course_ids = tea_courses.map{|course| course.id}
|
||||
@manage_homeworks = HomeworkCommon.where(:course_id => tea_course_ids).count
|
||||
end
|
||||
|
||||
# 用户收到的作业数
|
||||
def user_receive_homework_count
|
||||
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
|
||||
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").count
|
||||
end
|
||||
|
||||
# 用户发布的issue数
|
||||
def issues_author_is_self_count
|
||||
@issues = Issue.where( :author_id => @user.id )
|
||||
|
@ -3087,20 +3129,14 @@ module ApplicationHelper
|
|||
else #学生显示提交作品、修改作品等按钮
|
||||
work = cur_user_works_for_work homework
|
||||
project = cur_user_projects_for_work homework
|
||||
if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
if work.nil? && homework.work_status == 1
|
||||
if homework.work_type ==3 && project.nil? && homework.work_detail_group.base_on_project
|
||||
link_to "提交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
|
||||
else
|
||||
link_to "提交作品(#{count})", new_contestant_work_path(:work => homework.id),:class => 'c_blue'
|
||||
end
|
||||
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
|
||||
if homework.work_type ==3 && project.nil? && homework.work_detail_group.base_on_project
|
||||
link_to "补交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
|
||||
else
|
||||
link_to "补交作品(#{count})", new_contestant_work_path(:work => homework.id),:class => 'c_red'
|
||||
end
|
||||
else
|
||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
|
||||
if homework.work_status == 1 && work.user_id == User.current.id
|
||||
link_to "修改作品(#{count})", edit_contestant_work_path(work.id),:class => 'c_blue'
|
||||
else
|
||||
link_to "查看作品(#{count})", contestant_works_path(:work =>homework.id, :tab => 2), :class => 'c_blue', :title => "不可修改作品"
|
||||
|
@ -3948,6 +3984,8 @@ def get_cw_status contest_work
|
|||
else
|
||||
str += '<span class="red_homework_btn_cir ml5">作品补交中</span>'
|
||||
end
|
||||
elsif contest_work.work_status == 2
|
||||
str += '<span class="red_homework_btn_cir ml5">提交已截止</span>'
|
||||
end
|
||||
str
|
||||
end
|
||||
|
|
|
@ -13,4 +13,44 @@ module ContestantWorksHelper
|
|||
end
|
||||
str
|
||||
end
|
||||
|
||||
#成绩计算
|
||||
def set_final_score contestwork, contestant_work
|
||||
if contestwork.online_evaluation
|
||||
if contestwork.score_valid
|
||||
if ContestantWorkScore.find_by_sql("SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{contestant_work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id").count < 2
|
||||
judge_score = ContestantWorkScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{contestant_work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
||||
else
|
||||
judge_score = ContestantWorkScore.find_by_sql("SELECT (SUM(score)-MIN(score)-MAX(score))/(COUNT(score)-2) AS score FROM (SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{contestant_work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
||||
end
|
||||
@work.work_score = judge_score.first.score.try(:round, 2).to_f
|
||||
else
|
||||
judge_score = ContestantWorkScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{contestant_work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
||||
@work.work_score = judge_score.first.score.try(:round, 2).to_f
|
||||
end
|
||||
else
|
||||
contestant_work.work_score = nil
|
||||
end
|
||||
end
|
||||
|
||||
#获取学生作品的评分记录:同一个评委只显示最后一次评分
|
||||
def contestant_work_score_record work
|
||||
sql = "SELECT MAX(id) id FROM contestant_work_scores WHERE reviewer_role = 2 AND score IS NOT NULL AND contestant_work_id = #{work.id} GROUP BY user_id"
|
||||
tea_ts_ids = ContestantWorkScore.find_by_sql sql
|
||||
tea_ts_ids = tea_ts_ids.empty? ? "(-1)" : "(" + tea_ts_ids.map{|tea| tea.id}.join(",") + ")"
|
||||
scores = work.contestant_work_scores.where("score IS NULL or reviewer_role = 3 or id in #{tea_ts_ids}").order("updated_at desc")
|
||||
return scores
|
||||
end
|
||||
|
||||
#获取指定评分的角色
|
||||
def student_work_score_role score
|
||||
case score.reviewer_role
|
||||
when 1
|
||||
role = "管理员"
|
||||
when 2
|
||||
role = "评委"
|
||||
when 3
|
||||
role = "参赛者"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -130,7 +130,7 @@ module IssuesHelper
|
|||
end
|
||||
|
||||
def options_for_version_isuue_list(project)
|
||||
versions = Version.where(:project_id => project, :status => "open").map{|version| [version.name, version.id]}.unshift(["里程碑", 0])
|
||||
versions = Version.where(:project_id => project, :status => "open").order("created_on desc").map{|version| [version.name, version.id]}.unshift(["里程碑", 0])
|
||||
end
|
||||
|
||||
def render_issue_subject_with_tree(issue)
|
||||
|
|
|
@ -869,4 +869,20 @@ module UsersHelper
|
|||
end
|
||||
return user_ids
|
||||
end
|
||||
|
||||
# 获取竞赛申请者的角色
|
||||
def get_role_str role
|
||||
str = ""
|
||||
case role
|
||||
when 1
|
||||
str = "管理员"
|
||||
when 2
|
||||
str = "评委"
|
||||
when 3
|
||||
str = "参赛者"
|
||||
when 4
|
||||
str = "管理员、评委"
|
||||
end
|
||||
str
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class AppliedContest < ActiveRecord::Base
|
|||
has_many :applied_messages, :class_name => 'AppliedMessage', :as => :applied, :dependent => :destroy
|
||||
after_create :send_appliled_message
|
||||
|
||||
# 仅仅给项目管理人员发送消息
|
||||
# 仅仅给竞赛管理人员发送消息
|
||||
def send_appliled_message
|
||||
case self.role
|
||||
when '13'
|
||||
|
@ -17,11 +17,9 @@ class AppliedContest < ActiveRecord::Base
|
|||
role = 2
|
||||
when '15'
|
||||
role = 3
|
||||
else
|
||||
role = 4
|
||||
end
|
||||
contest_managers(self.contest).each do |member|
|
||||
self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => 0, :viewed => false, :applied_user_id => self.user_id, :role => role)
|
||||
self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => 0, :viewed => false, :role => role)
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -20,6 +20,7 @@ class Board < ActiveRecord::Base
|
|||
belongs_to :project,:touch => true
|
||||
belongs_to :course,:touch=>true
|
||||
belongs_to :org_subfield, :touch => true
|
||||
belongs_to :contest, :touch => true
|
||||
has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC"
|
||||
has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC"
|
||||
belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id
|
||||
|
@ -55,6 +56,8 @@ class Board < ActiveRecord::Base
|
|||
@valid_parents ||= project.boards - self_and_descendants
|
||||
elsif course
|
||||
@valid_parents ||= course.boards - self_and_descendants
|
||||
elsif contest
|
||||
@valid_parents ||= contest.boards - self_and_descendants
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ class Comment < ActiveRecord::Base
|
|||
# 课程/项目 消息
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
|
||||
has_many :contest_messages, :class_name => 'ContestMessage', :as => :contest_message, :dependent => :destroy
|
||||
#end
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
has_one :praise_tread_cache, as: :object, dependent: :destroy
|
||||
|
@ -54,12 +55,22 @@ class Comment < ActiveRecord::Base
|
|||
# ws.comment_template self.commented.author_id, "course_notice", self.id, "#{l(:label_notice_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||
# end
|
||||
end
|
||||
elsif self.commented.contest
|
||||
if self.author_id != self.commented.author_id
|
||||
self.contest_messages << ContestMessage.new(:user_id => self.commented.author_id, :contest_id => self.commented.contest.id, :viewed => false)
|
||||
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.commented.author_id} and shield_type='Course' and shield_id=#{self.commented.course.id}").count
|
||||
# if count == 0
|
||||
# content = strip_html self.comments.html_safe, 200
|
||||
# ws.comment_template self.commented.author_id, "course_notice", self.id, "#{l(:label_notice_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||
# end
|
||||
end
|
||||
else # 项目相关
|
||||
# if self.author_id != self.commented.author_id
|
||||
# self.forge_messages << ForgeMessage.new(:user_id => self.commented.author_id, :project_id => self.commented.project.id, :viewed => false)
|
||||
# #content = strip_html self.comments.html_safe, 200
|
||||
# #ws.comment_template self.commented.author_id, "blog_comment", self.id, "#{l(:label_news_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||
# end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ class Contest < ActiveRecord::Base
|
|||
has_many :users, :through => :members
|
||||
has_many :contestants, :class_name => 'ContestantForContest', :source => :user
|
||||
has_many :works
|
||||
has_many :contestant_work_projects, :dependent => :destroy
|
||||
has_many :boards, :dependent => :destroy, :order => "position ASC"
|
||||
|
||||
|
||||
has_many :news, :dependent => :destroy, :include => :author
|
||||
|
||||
|
@ -24,7 +27,7 @@ class Contest < ActiveRecord::Base
|
|||
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]*$/
|
||||
|
||||
before_destroy :delete_all_members
|
||||
#after_create :act_as_contest_activity
|
||||
after_create :create_board_sync
|
||||
|
||||
scope :visible, lambda {|*args| where(Contest.where("is_delete =?", 0).visible_condition(args.shift || User.current, *args)) }
|
||||
|
||||
|
@ -108,4 +111,19 @@ class Contest < ActiveRecord::Base
|
|||
end
|
||||
code
|
||||
end
|
||||
|
||||
# 创建竞赛讨论区
|
||||
def create_board_sync
|
||||
@board = self.boards.build
|
||||
#self.name=" #{l(:label_borad_course) }"
|
||||
@board.name = " #{l(:label_board_contest) }"#self.name
|
||||
@board.description = self.name.to_s
|
||||
@board.project_id = -1
|
||||
@board.course_id = -1
|
||||
if @board.save
|
||||
logger.debug "[Contest Model] ===> #{@board.to_json}"
|
||||
else
|
||||
logger.error "[Contest Model] ===> Auto create board when contest saved, because #{@board.full_messages}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class ContestantWork < ActiveRecord::Base
|
||||
include ContestantWorksHelper
|
||||
belongs_to :work
|
||||
belongs_to :user
|
||||
belongs_to :project
|
||||
|
@ -8,6 +9,9 @@ class ContestantWork < ActiveRecord::Base
|
|||
has_many :contestant_work_scores, :dependent => :destroy
|
||||
has_many :contest_messages, :class_name =>'ContestMessage', :as => :contest_message, :dependent => :destroy
|
||||
has_many :attachments, :dependent => :destroy
|
||||
has_many :contestant_work_evaluation_distributions
|
||||
|
||||
before_save :set_work_score
|
||||
|
||||
scope :has_committed, lambda{where("work_status != 0 and work_status != 3")}
|
||||
scope :no_copy, lambda{where("work_status != 3")}
|
||||
|
@ -20,4 +24,8 @@ class ContestantWork < ActiveRecord::Base
|
|||
self.contest_messages << ContestMessage.new(:user_id => self.user_id, :contest_id => self.work.contest_id, :viewed => false, :status => false)
|
||||
end
|
||||
end
|
||||
|
||||
def set_work_score
|
||||
set_final_score self.work,self
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class ContestantWorkEvaluationDistribution < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :contestant_work
|
||||
attr_accessible :user_id, :contestant_work_id
|
||||
end
|
|
@ -2,4 +2,6 @@ class ContestantWorkScore < ActiveRecord::Base
|
|||
belongs_to :contestant_work
|
||||
belongs_to :user
|
||||
attr_accessible :comment, :reviewer_role, :score, :contestant_work_id, :user_id
|
||||
|
||||
has_many :journals_for_messages
|
||||
end
|
||||
|
|
|
@ -848,6 +848,7 @@ class Mailer < ActionMailer::Base
|
|||
def register(token)
|
||||
set_language_if_valid(token.user.language)
|
||||
@token = token
|
||||
@login = token.user.try(:login)
|
||||
@url = url_for(:controller => 'account', :action => 'activate', :token => token.value)
|
||||
mail :to => token.user.mail,
|
||||
:subject => "#{Setting.mail_subject}"
|
||||
|
|
|
@ -203,7 +203,7 @@ class Memo < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def destroyable_by? user
|
||||
(user && self.author == user) || user.admin?
|
||||
(user && self.author == user) || user.admin? || self.forum.creator == user
|
||||
#self.author == user || user.admin?
|
||||
end
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class Message < ActiveRecord::Base
|
|||
# after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
|
||||
after_update :update_messages_board, :update_activity
|
||||
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score
|
||||
after_create :act_as_course_activity, :act_as_forge_activity, :act_as_student_score, act_as_at_message(:content, :author_id), :add_author_as_watcher, :reset_counters!, :add_boards_count, :act_as_system_message, :delay_message_send
|
||||
after_create :act_as_course_activity, :act_as_forge_activity, :act_as_contest_activity, :act_as_student_score, act_as_at_message(:content, :author_id), :add_author_as_watcher, :reset_counters!, :add_boards_count, :act_as_system_message, :delay_message_send
|
||||
#before_save :be_user_score
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
|
@ -103,8 +103,10 @@ class Message < ActiveRecord::Base
|
|||
:if => lambda {|message, user|
|
||||
if message.project
|
||||
user.allowed_to?(:edit_messages, message.project)
|
||||
else
|
||||
elsif message.course
|
||||
user.allowed_to?(:edit_messages, message.course)
|
||||
elsif message.contest
|
||||
user.admin_of_contest?(message.contest)
|
||||
end
|
||||
}
|
||||
|
||||
|
@ -188,6 +190,18 @@ class Message < ActiveRecord::Base
|
|||
board.course
|
||||
end
|
||||
|
||||
def contest
|
||||
board.contest
|
||||
end
|
||||
|
||||
def contest_editable_by?(usr)
|
||||
usr && usr.logged? && (usr.admin_of_contest?(contest) || self.author == usr || usr.admin?)
|
||||
end
|
||||
|
||||
def contest_destroyable_by?(usr)
|
||||
usr && usr.logged? && (usr.admin_of_contest?(contest) || self.author == usr || usr.admin?)
|
||||
end
|
||||
|
||||
def course_editable_by?(usr)
|
||||
usr && usr.logged? && (usr.allowed_to?(:edit_messages, course) || (self.author == usr && usr.allowed_to?(:edit_own_messages, course)))
|
||||
end
|
||||
|
@ -223,6 +237,7 @@ class Message < ActiveRecord::Base
|
|||
#动态的更新
|
||||
def update_activity
|
||||
update_course_activity(self.class, self.id)
|
||||
update_contest_activity(self.class, self.id)
|
||||
update_user_activity(self.class, self.id)
|
||||
update_forge_activity(self.class, self.id)
|
||||
update_org_activity(self.class, self.id)
|
||||
|
@ -269,6 +284,13 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
#竞赛动态公共表记录
|
||||
def act_as_contest_activity
|
||||
if self.contest && self.parent_id.nil?
|
||||
self.contest_acts << ContestActivity.new(:user_id => self.author_id,:contest_id => self.board.contest_id)
|
||||
end
|
||||
end
|
||||
|
||||
# 课程讨论区添加消息:
|
||||
# 老师发帖所有人都能收到消息
|
||||
# 学生发帖,有人回复则给该学生消息,没回复则不给其它人发送消息
|
||||
|
@ -324,6 +346,29 @@ class Message < ActiveRecord::Base
|
|||
# end
|
||||
end
|
||||
end
|
||||
elsif self.contest
|
||||
if self.parent_id.nil? # 主贴
|
||||
self.contest.contest_members.includes(:user).each do |m|
|
||||
if self.author.admin_of_contest?(self.contest) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
|
||||
#self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
|
||||
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course.id}").count
|
||||
# if count == 0
|
||||
# content = strip_html self.subject, 200
|
||||
# ws.topic_publish_template m.user_id, "course_discussion", self.id, "#{l(:label_course_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
|
||||
# end
|
||||
end
|
||||
end
|
||||
else # 回帖
|
||||
parent_author_id = Message.find(self.parent_id).author_id
|
||||
if parent_author_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
|
||||
self.contest_messages << ContestMessage.new(:user_id => parent_author_id, :contest_id => self.board.contest_id, :viewed => false)
|
||||
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{parent_author_id} and shield_type='Course' and shield_id=#{self.board.course_id}").count
|
||||
# if count == 0
|
||||
# content = strip_html self.content.html_safe, 200
|
||||
# ws.comment_template parent_author_id, "course_discussion", self.parent_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -346,6 +391,25 @@ class Message < ActiveRecord::Base
|
|||
self.delay.contain_messages_message(dm)
|
||||
end
|
||||
|
||||
end
|
||||
elsif self.contest
|
||||
if self.parent_id.nil? # 发帖
|
||||
dm = []
|
||||
self.contest.contest_members.includes(:user).each do |m|
|
||||
if self.author.admin_of_contest?(self.contest) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
|
||||
dm << {contest_message_type:'Message',contest_message_id:self.id, :user_id => m.user_id,
|
||||
:contest_id => self.board.contest_id, :viewed => false}
|
||||
if dm.size >= 30
|
||||
self.delay.contain_contest_messages_message(dm)
|
||||
dm.clear
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
unless dm.empty?
|
||||
self.delay.contain_contest_messages_message(dm)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -354,6 +418,10 @@ class Message < ActiveRecord::Base
|
|||
CourseMessage.create(vs)
|
||||
end
|
||||
|
||||
def contain_contest_messages_message vs
|
||||
ContestMessage.create(vs)
|
||||
end
|
||||
|
||||
#更新用户分数 -by zjc
|
||||
def be_user_score
|
||||
#新建message且无parent的为发帖
|
||||
|
|
|
@ -69,7 +69,7 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
after_create :act_as_course_activity, :add_author_as_watcher, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send
|
||||
after_create :act_as_course_activity, :add_author_as_watcher, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send, :act_as_contest_message
|
||||
after_update :update_activity
|
||||
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
|
||||
|
||||
|
@ -216,6 +216,16 @@ class News < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def act_as_contest_message
|
||||
if self.contest_id
|
||||
self.contest.contest_members.each do | m|
|
||||
if m.user_id != self.author_id
|
||||
self.contest_messages << ContestMessage.new(:user_id => m.user_id, :contest_id => self.contest_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delay_news_send
|
||||
if self.course
|
||||
|
||||
|
@ -242,7 +252,7 @@ class News < ActiveRecord::Base
|
|||
vs = []
|
||||
self.contest.contest_members.each do | m|
|
||||
if m.user_id != self.author_id
|
||||
vs << {course_message_type:'Contest',course_message_id:self.id, :user_id => m.user_id,
|
||||
vs << {contest_message_type:'Contest',contest_message_id:self.id, :user_id => m.user_id,
|
||||
:contest_id => self.contest_id, :viewed => false}
|
||||
|
||||
if vs.size >= 30
|
||||
|
|
|
@ -43,7 +43,8 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
has_many :student_work_projects,:dependent => :destroy
|
||||
has_many :student_work_projects, :dependent => :destroy
|
||||
has_many :contestant_work_projects, :dependent => :destroy
|
||||
has_many :student_works
|
||||
has_many :time_entry_activities
|
||||
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
|
||||
|
|
|
@ -80,12 +80,12 @@ class User < Principal
|
|||
|
||||
|
||||
#每日一报、一事一报、不报
|
||||
MAIL_NOTIFICATION_OPTIONS = [
|
||||
# MAIL_NOTIFICATION_OPTIONS = [
|
||||
#['week', :label_user_mail_option_week],
|
||||
# ['day', :label_user_mail_option_day],
|
||||
['all', :label_user_mail_option_all],
|
||||
['none', :label_user_mail_option_none]
|
||||
]
|
||||
# ['all', :label_user_mail_option_all],
|
||||
# ['none', :label_user_mail_option_none]
|
||||
# ]
|
||||
|
||||
has_many :homework_users
|
||||
has_many :homework_attaches, :through => :homework_users
|
||||
|
@ -244,7 +244,7 @@ class User < Principal
|
|||
validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true
|
||||
validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true
|
||||
validates_confirmation_of :password, :allow_nil => true
|
||||
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
|
||||
# validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
|
||||
validate :validate_password_length
|
||||
# validates_email_realness_of :mail
|
||||
before_create :set_mail_notification
|
||||
|
@ -1063,6 +1063,7 @@ class User < Principal
|
|||
# Admin users are authorized for anything else
|
||||
return true if admin?
|
||||
|
||||
# 课程:作品关联项目的老师也可以访问私有项目
|
||||
course_ids = context.student_work_projects.blank? ? "(-1)" : "(" + context.student_work_projects.map{|swp| swp.course_id}.join(",") + ")"
|
||||
courses = Course.where("id in #{course_ids}")
|
||||
courses.each do |course|
|
||||
|
@ -1070,6 +1071,16 @@ class User < Principal
|
|||
return true
|
||||
end
|
||||
end
|
||||
|
||||
# 竞赛:作品关联项目的管理员也可以访问私有项目
|
||||
contest_ids = context.contestant_work_projects.map{|swp| swp.contest_id}
|
||||
contests = Contest.where(:id => contest_ids)
|
||||
contests.each do |contest|
|
||||
if self.admin_of_contest?(contest)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
roles = roles_for_project(context)
|
||||
return false unless roles
|
||||
roles.any? {|role|
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
class Work < ActiveRecord::Base
|
||||
# work_status 0:未发布/挂起 1:提交中 2:提交截止 3:启动在线评审 4:评审结束
|
||||
belongs_to :user
|
||||
belongs_to :contest
|
||||
attr_accessible :description, :end_time, :is_delete, :is_open, :name, :publish_time, :score_open, :work_status, :work_type, :contest_id, :user_id
|
||||
include ApplicationHelper
|
||||
|
||||
has_one :work_detail_group, :dependent => :destroy
|
||||
has_one :work_detail_manual, :dependent => :destroy
|
||||
has_many :contestant_work_projects, :dependent => :destroy
|
||||
has_many :contestant_works, :dependent => :destroy, :conditions => "is_delete != 1"
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
|
@ -60,10 +62,8 @@ class Work < ActiveRecord::Base
|
|||
if self.work_status == 0
|
||||
self.contest_messages.destroy_all
|
||||
else
|
||||
self.contest.contest_members.each do |m|
|
||||
if m.user_id != self.user_id
|
||||
self.contest_messages << ContestMessage.new(:user_id => m.user_id, :contest_id => self.contest_id, :viewed => false)
|
||||
end
|
||||
self.contest.contestants.each do |m|
|
||||
self.contest_messages << ContestMessage.new(:user_id => m.student_id, :contest_id => self.contest_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
class WorkDetailManual < ActiveRecord::Base
|
||||
belongs_to :work
|
||||
attr_accessible :evaluation_end, :evaluation_num, :evaluation_start, :work_id
|
||||
end
|
|
@ -23,13 +23,18 @@ class ContestsService
|
|||
else
|
||||
if params[:invite_code].present?
|
||||
role_ids = params[:role]
|
||||
role_str = role_ids.join(",").to_s
|
||||
|
||||
#如果已经发送过消息了,那么就要给个提示
|
||||
if AppliedContest.where(:contest_id => contest.id, :user_id => current_user.id, :role => role_str, :status => 0).count != 0
|
||||
if AppliedContest.where(:contest_id => contest.id, :user_id => current_user.id, :status => 0).count != 0
|
||||
@state = 7
|
||||
else
|
||||
AppliedContest.create(:contest_id => contest.id, :user_id => current_user.id, :role => role_str, :status => 0)
|
||||
if role_ids.size == 1
|
||||
AppliedContest.create(:contest_id => contest.id, :user_id => current_user.id, :role => role_ids[0], :status => 0)
|
||||
else
|
||||
role_ids.each do |role_id|
|
||||
AppliedContest.create(:contest_id => contest.id, :user_id => current_user.id, :role => role_id, :status => 0)
|
||||
end
|
||||
end
|
||||
@state = 6
|
||||
end
|
||||
else
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
data: {user: user, text: $(".email_prompt_mes").val() },
|
||||
type: "POST",
|
||||
success: function (data) {
|
||||
var htmlvalue = "<div class='email_tancon'><h2 class='email_tan_title'>您的留言已发送</h2><p class='email_tan_p'>我们将尽快处理好,并通过邮件通知您。感谢您的反馈!</p></div>"
|
||||
var htmlvalue = "<div class='email_tancon'><h2 class='email_tan_title'>您的留言已发送</h2><p class='email_tan_p'>我们将尽快处理好并通知您。感谢您的反馈!</p></div>"
|
||||
pop_up_box(htmlvalue, 580, 30, 45);
|
||||
$(".email_prompt_mes").val("");
|
||||
}
|
||||
|
|
|
@ -1,16 +1,61 @@
|
|||
<title><%= l(:label_regiter_account)%></title>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><%= l(:label_regiter_account)%></title>
|
||||
<style type="text/css">
|
||||
#jihuo {
|
||||
background-image: url("/images/jingtanhao.JPG");
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<% email = @user.mail.split("@")[1] %>
|
||||
<div class="new_content">
|
||||
<div class="email_verify" style="width: 580px;">
|
||||
<p class="fb f18" style="color:green;"><i class="icon-ok mr5 f18"></i>注册成功!
|
||||
<span style=" color:#3b94d6; font-size:12px; font-weight:normal;">请在24小时内点击邮件中的链接来激活您的账号。</span></p>
|
||||
<p class="f14 mt30 mb5">请登录邮箱(<span class="c_red"><%= @mail_type %></span>)收取账号激活邮件。<br/>点击邮件中的激活链接,方可使用该账号
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://mail.<%= email %>" class="btn btn-blue" target="_blank"><%= l(:label_check_email)%></a>
|
||||
<%= link_to "<input class='btn btn-blue' type='button' id='btn' value='重新获取验证码' onclick='settime(this)' />".html_safe, { :controller => 'account', :action => 'resendmail', :user => @user}, :remote => true, :method => 'get' %>
|
||||
</p>
|
||||
|
||||
<ul class="email_prompt_txt mt30" style="width: 580px;">
|
||||
<p class="email_prompt_p">如果您一直收不到激活邮件,请按照以下步骤操作:</p>
|
||||
<li>1.请确认是否填写了正确的邮箱地址 </li>
|
||||
<li>2.请注意查看邮箱中的“订阅邮件”、“垃圾邮件”,可能Trustie的邮件被误杀了</li>
|
||||
<li>3.点击这里重新发送激活邮件</li>
|
||||
<li>4.如果您无法收到激活邮件,请直接给我们留言:</li>
|
||||
<div class="mt10 clearfix">
|
||||
<% get_memo %>
|
||||
<%= form_for(@new_memo, :url => mail_feedback_forum_path(@public_forum, :user_id => @user.id), :remote => true) do |f| %>
|
||||
<%= f.text_area :subject, :id => "subject", :class => "email_prompt_mes", :style => "width: 568px;", :placeholder => l(:label_feedback_tips) %>
|
||||
<%= f.hidden_field :content, :id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
|
||||
<span class="c_red fl" id="mail_valid_feedback_tip" style="display: none;">内容不能为空</span>
|
||||
<a href="javascript:void(0);" class="btn btn-blue fr" onclick="f_submit();">确定</a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function regex_mv_name()
|
||||
{
|
||||
var name = $.trim($("#subject").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#mail_valid_feedback_tip").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#mail_valid_feedback_tip").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function f_submit()
|
||||
{
|
||||
if(regex_mv_name()){
|
||||
alert("222");
|
||||
$("#new_memo").submit();
|
||||
}
|
||||
}
|
||||
|
||||
var countdown = 60;
|
||||
function settime(val) {
|
||||
if (countdown == 0) {
|
||||
|
@ -30,36 +75,51 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(function(){
|
||||
var u = navigator.userAgent;
|
||||
if((u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 ||u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1)){
|
||||
$("#scrollsidebar").css("display","none");
|
||||
return;
|
||||
}
|
||||
$(".closeSidebar, .hide-side-bar").click(function(){
|
||||
$(".show_btn").css("display","none");
|
||||
$("#scrollsidebar").css("display","none");
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#button1").click(function(){
|
||||
myTips("反馈成功","success");
|
||||
});
|
||||
|
||||
$("#scrollsidebar").fix({
|
||||
float: 'right', //default.left or right
|
||||
minStatue: cookieget('minStatue'),
|
||||
skin: 'green', //default.gray or blue
|
||||
durationTime: 600
|
||||
});
|
||||
|
||||
$("#subject").keydown(function(){
|
||||
alert("2222");
|
||||
var curLength=$("#subject").val().length;
|
||||
if(curLength>50){
|
||||
var num=$("#subject").val().substr(0,50);
|
||||
$("#subject").val(num);
|
||||
}
|
||||
else{
|
||||
$("#textCount").text(50-$("#subject").val().length)
|
||||
}
|
||||
}).keyup(function(){
|
||||
var curLength=$("#subject").val().length;
|
||||
if(curLength>50){
|
||||
var num=$("#subject").val().substr(0,50);
|
||||
$("#subject").val(num);
|
||||
}
|
||||
else{
|
||||
$("#textCount").text(50-$("#subject").val().length)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<div style="border: 1px solid #c0c0c0 ; width:100%; margin-top: 10px" >
|
||||
|
||||
<h3 style=" padding-bottom: 8px; margin-top:5px; border-bottom: 1px solid #c0c0c0;color:black; ">
|
||||
<span id = "jihuo" style=" margin-left: 4%;"></span><%= l(:label_email_valid)%></h3>
|
||||
|
||||
<div style="margin-left:auto; margin-right:auto">
|
||||
<center>
|
||||
<div >
|
||||
<h4 style="font-size: 18px;margin-top: 10px; padding-bottom: 10px;"><%= l(:notice_email_register_time) %></h4>
|
||||
<div class="to-email mb10" style="padding-bottom: 8px; font-size: 14px">
|
||||
<div class="to-email" style="padding-bottom:15px; font-size:14px; padding-top:10px;">
|
||||
<span ><%= l(:notice_email_arrival)%> : <%= @user.mail %></span>
|
||||
</div>
|
||||
<p>
|
||||
<a href="http://mail.<%= email %>" class="btn btn-blue" target="_blank"><%= l(:label_check_email)%></a>
|
||||
<%= link_to "<input class='btn btn-blue' type='button' id='btn' value='重新获取验证码' onclick='settime(this)' />".html_safe, { :controller => 'account', :action => 'resendmail', :user => @user}, :remote => true, :method => 'get' %>
|
||||
<!--<a href="<%#= resendmail_path(@user) %>" data-remote="true"><input class="btn btn-blue" type="button" id="btn" value="重新获取验证码" onclick="settime(this)" /></a>-->
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
|
@ -136,6 +136,9 @@
|
|||
<p>在这里,您的创新意识和创新潜力将得到充分发挥!目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。</p>
|
||||
</div>
|
||||
<div class="new_login_box fr mr45 mt100">
|
||||
<% if @message %>
|
||||
<p class="f14 mb5" style=" color:#fff;"><i class="icon-ok mr5"></i><%= h @message %></p>
|
||||
<% end %>
|
||||
<h2 class="new_login_h2">登录
|
||||
<a href="<%= register_url_without_domain %>" class="fr mt5">立即注册</a><div class="cl"></div>
|
||||
</h2>
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<div class = "cl"> </div>
|
||||
<div id="course-boardlist">
|
||||
<div class="listbox mt10" >
|
||||
<p class="list-h2">讨论区列表</p>
|
||||
<div class="category">
|
||||
<span class="grayTxt ">排序:</span>
|
||||
<%= link_to "时间", {:controller => 'boards', :action => 'index', :board_id =>@board.id, :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
|
||||
<% if @type.to_i == 1 %>
|
||||
<%= link_to "", {:controller => 'boards', :action => 'index', :board_id =>@board.id, :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
|
||||
<% end %>
|
||||
<%= link_to "人气", {:controller => 'boards', :action => 'index', :board_id =>@board.id, :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
|
||||
<% if @type.to_i == 2 %>
|
||||
<%= link_to "", {:controller => 'boards', :action => 'index', :board_id =>@board.id, :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="bloglistbox">
|
||||
<% if topics.any? %>
|
||||
<% topics.each do |activity| %>
|
||||
<div class="list-file">
|
||||
<div><span class="item_list fl"></span>
|
||||
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
|
||||
<%= link_to activity.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class => "list-title-normal fl" %>
|
||||
<% else %>
|
||||
<%= link_to activity.parent.subject.to_s.html_safe, User.current.logged? ? board_message_path(activity.board_id, activity) : signin_url_without_domain, :class => "list-title-normal f1" %>
|
||||
<% end %>
|
||||
<% if activity.sticky == 1 %>
|
||||
<span class="fl ml10 red-cir-btn">顶</span>
|
||||
<% end%>
|
||||
<% if activity.locked %>
|
||||
<span class="fl ml10 green-cir-btn" title="已锁定">锁</span>
|
||||
<% end %>
|
||||
<%# u = User.where("id=?",activity.author_id).first%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--<div class="massages-content ml15">-->
|
||||
<!--<%# if activity.parent_id.nil? %>-->
|
||||
<!--<% content = activity.content %>-->
|
||||
<!--<%# else %>-->
|
||||
<!--<%# content = activity.parent.content %>-->
|
||||
<!--<%# end %>-->
|
||||
<!--<p><%#=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>75, :maxwidth=>563} %></p>-->
|
||||
<!--</div>-->
|
||||
<div class="ml15 mt10">
|
||||
<span class="grayTxt mr15">
|
||||
发帖人:<%= link_to activity.author.show_name, user_path(activity.author), :class => "link-blue" %>
|
||||
</span>
|
||||
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
|
||||
<% all_comments = []%>
|
||||
<% count=Message.where("root_id = #{activity.id}").count %>
|
||||
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<ul class="wlist" id="pages" >
|
||||
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="icons_tishi"><img src="/images/sy/icons_smile.png" width="110" height="110" alt="" ></div>
|
||||
<p class="sy_tab_con_p">没有数据可以显示!</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
//如果右边的博客列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
$(function(){
|
||||
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-20;
|
||||
var rightHeight = $(".homepageRight").height();
|
||||
if (rightHeight < leftHeight){
|
||||
var diffHeight = leftHeight - rightHeight;
|
||||
var tmpHeight = $(".listbox").height()+diffHeight;
|
||||
$(".listbox").css("height",tmpHeight);
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,16 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
$("#message_subject").focus();
|
||||
});
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">
|
||||
编辑帖子
|
||||
</div>
|
||||
</div>
|
||||
<%= render :partial => 'boards/contest_new',
|
||||
:locals => {:f => f, :edit_mode => edit_mode, :topic => topic, :contest => contest} %>
|
||||
</div>
|
|
@ -0,0 +1,194 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
var first_click = true;
|
||||
function nh_check_field(params){
|
||||
var result=true;
|
||||
if(!regexTopicSubject()) {
|
||||
result=false;
|
||||
return result;
|
||||
}
|
||||
if(params.content!=undefined){
|
||||
if(params.content.isEmpty()){
|
||||
result=false;
|
||||
}
|
||||
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
||||
params.textarea.html(params.content.html());
|
||||
params.content.sync();
|
||||
if(params.content.isEmpty())
|
||||
{
|
||||
params.contentmsg.text("描述不能为空");
|
||||
params.contentmsg.css('color','#ff0000');
|
||||
result=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
params.contentmsg.text("填写正确");
|
||||
params.contentmsg.css('color','#008000');
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function init_homework_form(params){
|
||||
params.form.submit(function(){
|
||||
params.textarea.html(params.editor.html());
|
||||
params.editor.sync();
|
||||
var flag = false;
|
||||
if(params.form.attr('data-remote') != undefined ){
|
||||
flag = true
|
||||
}
|
||||
var is_checked = false;
|
||||
is_checked = nh_check_field({
|
||||
issubmit:true,
|
||||
content:params.editor,
|
||||
contentmsg:params.contentmsg,
|
||||
textarea:params.textarea
|
||||
});
|
||||
if(first_click && is_checked){
|
||||
if(flag){
|
||||
first_click = false;
|
||||
return true;
|
||||
}else{
|
||||
first_click = false;
|
||||
$(this)[0].submit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function init_homework_editor(params){
|
||||
params.textarea.removeAttr('placeholder');
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px",
|
||||
items : ['code','emoticons','fontname',
|
||||
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
|
||||
'formatblock', 'fontsize', '|','indent', 'outdent',
|
||||
'|','imagedirectupload','table', 'media', 'preview',"more"
|
||||
],
|
||||
afterChange:function(){//按键事件
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
//paramsHeight = params.kindutil.removeUnit(this.height);
|
||||
edit.iframe.height(150);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150));
|
||||
},
|
||||
afterCreate:function(){
|
||||
//init
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.iframe[0].scroll = 'no';
|
||||
body.style.overflowY = 'hidden';
|
||||
//reset height
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.html(params.textarea.innerHTML);
|
||||
//paramsHeight = params.kindutil.removeUnit(this.height);
|
||||
edit.iframe.height(150);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150));
|
||||
elocalStorage(message_content_editor,'topic_contest_<%=contest.id %>');
|
||||
}
|
||||
}).loadPlugin('paste');
|
||||
return editor;
|
||||
}
|
||||
KindEditor.ready(function(K){
|
||||
$("div[nhname='topic_form']").each(function(){
|
||||
var params = {};
|
||||
params.kindutil = K;
|
||||
params.div_form = $(this);
|
||||
params.form = $("form",params.div_form);
|
||||
if(params.form==undefined || params.form.length==0){
|
||||
return;
|
||||
}
|
||||
params.textarea = $("textarea[nhname='topic_textarea']",params.div_form);
|
||||
params.contentmsg = $("#message_content_span");
|
||||
params.submit_btn = $("#new_message_submit_btn");
|
||||
if(params.textarea.data('init') == undefined) {
|
||||
params.editor = init_homework_editor(params);
|
||||
message_content_editor = params.editor;
|
||||
init_homework_form(params);
|
||||
params.submit_btn.click(function () {
|
||||
params.form.submit();
|
||||
});
|
||||
params.textarea.data('init', 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<%= error_messages_for 'message' %>
|
||||
<div class="resources mt10">
|
||||
<div id="new_course_topic">
|
||||
<div class="homepagePostBrief c_grey">
|
||||
<div>
|
||||
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
|
||||
<p id="subjectmsg"></p>
|
||||
</div>
|
||||
<div id="topic_editor" style="display: none;">
|
||||
<%if User.current.member_of_contest?(contest) %>
|
||||
<div class="mt10">
|
||||
<% if User.current.id == contest.user_id %>
|
||||
<%= f.check_box :sticky, :value => topic.sticky %>
|
||||
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
|
||||
<%= f.check_box :locked, :value => topic.locked %>
|
||||
<%= label_tag 'message_locked', l(:label_board_locked) %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="mt10">
|
||||
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
|
||||
<%#= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:owner_id => topic.nil? ? 0: topic.id,
|
||||
:owner_type => OwnerTypeHelper::MESSAGE,
|
||||
:width => '100%',
|
||||
:height => 300,
|
||||
:minHeight=>300,
|
||||
:class => 'talk_text fl',
|
||||
:input_html => { :id => 'message_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 },
|
||||
at_id: topic.id, at_type: topic.class.to_s
|
||||
%>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='topic_textarea' name="message[content]"><%=topic.content %></textarea>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span"></p>
|
||||
<p id="e_tip" class="c_grey"></p>
|
||||
<p id="e_tips" class="c_grey"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
<div class="fl" id="topic_attachments">
|
||||
<%= render :partial => 'attachments/form_course', :locals => {:container => topic, :isReply => @isReply} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<%if !edit_mode %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_topic();">取消</a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<%#= render :partial => 'course_new_topic', :locals => {:f => f, :topic => @message} %>
|
||||
<!--<li>
|
||||
<div class="ml55 fl" nhname="toolbar_container"></div>
|
||||
<a href="javascript:void(0);" nhname="cancelbtn" class="grey_btn fr ml10"><%#= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0);" nhname="submitbtn" class="blue_btn fr " style="margin-left: 55px">
|
||||
<%#= l(:button_submit)%>
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
</li>-->
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,43 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
function reset_topic(){
|
||||
$("#message_subject").val("");
|
||||
$("#subjectmsg").text("");
|
||||
document.getElementById("message_sticky").checked=false;
|
||||
document.getElementById("message_locked").checked=false;
|
||||
$("#topic_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_course', :locals => {:container => Message.new, :isReply => @isReply})%>");
|
||||
message_content_editor.html("");
|
||||
$("#topic_editor").toggle();
|
||||
}
|
||||
<% if @is_new%>
|
||||
$(function(){
|
||||
$("#message_subject").focus();
|
||||
});
|
||||
<%end%>
|
||||
</script>
|
||||
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName break_word" style="width: 600px;">
|
||||
<%= @board.parent_id.nil? ? "竞赛讨论区" : "#{@board.name}" %>
|
||||
</div>
|
||||
|
||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.admin_of_contest?(@board.contest)) %>
|
||||
<%# if is_teacher %>
|
||||
<%#= link_to "添加子栏目", settings_course_path(@board.course.id,'boards'), :class => "link-blue fr mt5" %>
|
||||
<%# end %>
|
||||
</div>
|
||||
<div nhname="topic_form">
|
||||
<% if User.current.logged? %>
|
||||
<%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},
|
||||
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'contest_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :contest => @board.contest} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial=> 'contest_show_detail',:locals =>{:topics => @topics, :page => 0} %>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false) %>
|
||||
<%= javascript_include_tag "create_kindeditor" %>
|
||||
<% end %>
|
||||
|
||||
<% if @topics || topics %>
|
||||
<%= render :partial => 'boards/contest_boardlist', :locals => {:topics => @topics ? @topics: topics , :is_course => 1, :is_board=>1} %>
|
||||
<% end %>
|
|
@ -36,6 +36,8 @@
|
|||
<%= render :partial => 'project_show', locals: {:topics => @topics, :page => 0, project: @project} %>
|
||||
<% elsif @course %>
|
||||
<%= render :partial => 'course_show', :locals => {:topics => @topics, :page => 0, :course => @course} %>
|
||||
<% elsif @contest %>
|
||||
<%= render :partial => 'contest_show', :locals => {:topics => @topics, :page => 0, :contest => @contest} %>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<%if @contest%>
|
||||
<% if @create_member_error_messages%>
|
||||
alert("<%= @create_member_error_messages%>");
|
||||
notice_box("<%= @create_member_error_messages%>");
|
||||
//alert("<%= @create_member_error_messages%>");
|
||||
<% else %>
|
||||
$('#game-setting-content-2').html('<%= escape_javascript(render :partial => 'contests/members') %>');
|
||||
$("#admin_num").html("<%= contest_managers(@contest).count %>");
|
||||
$("#judge_num").html("<%= contest_judges(@contest).count %>");
|
||||
$("#contestant_num").html("<%= contest_contestants(@contest).count %>");
|
||||
alert("添加成功");
|
||||
notice_box("添加成功");
|
||||
//alert("添加成功");
|
||||
<% end%>
|
||||
hideOnLoad();
|
||||
<%end%>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
hideModal();
|
||||
$('#game-setting-content-2').html('<%= escape_javascript(render :partial => 'contests/members') %>');
|
||||
$("#admin_num").html("<%= contest_managers(@contest).count %>");
|
||||
$("#judge_num").html("<%= contest_judges(@contest).count %>");
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<%= form_for('new_form', :remote => true, :method => :post,:url => add_score_contestant_works_path(work.id),:id=>'add_score_'+work.id.to_s) do |f|%>
|
||||
<li >
|
||||
<span class="tit_fb"> 评价:</span>
|
||||
<%= f.text_area 'user_message', :class => 'hwork_ping_text', :id => 'score_comment_'+work.id.to_s, :placeholder => l(:text_caracters_maximum,:count=>500),:maxlength => 500 %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<p id="hint_message_<%=work.id %>" style="margin-left: 65px;"></p>
|
||||
<li >
|
||||
<span class="tit_fb mt2"> 评分:</span>
|
||||
<input type="number" name="score" id="score_<%= work.id%>" value="<%= (score.nil? || score.score.nil?) ? -1 : score.score%>" min="-1" max="100" size="4" data-units="dollars" />
|
||||
<span class="ml5">分</span>
|
||||
<span id="score_notice_span_<%= work.id%>" class="ml5 c_red" style="display: none;">未评分</span>
|
||||
<div class="cl"></div></li>
|
||||
<li >
|
||||
<span class="tit_fb"> 批阅结果:</span>
|
||||
<div>
|
||||
<%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<span class="c_red ml5" style="display: none;" id="none_notice_<%= work.id%>">评语、评分、批阅结果至少有一个不为空。</span>
|
||||
<a href="javascript:void(0);" id="work_submit_<%= work.id %>" class="blue_n_btn fr evaluation_submit" onclick="score_submit('<%=work.id %>');">提交</a>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end%>
|
||||
<script type="text/javascript">
|
||||
var first_click_score = true;
|
||||
function score_submit(id){
|
||||
if ($.trim($('#score_comment_'+id).val()) == "") {
|
||||
$('#hint_message_'+id).html("为了对参赛者的作品负责,请您务必填写评语");
|
||||
$("#hint_message_"+id).css('color','#ff0000');
|
||||
$("#score_comment_"+id).focus();
|
||||
} else if (parseFloat($("#score_"+id).val()) == -1) {
|
||||
$('#score_notice_span_'+id).html("请先评分");
|
||||
$('#score_notice_span_'+id).show();
|
||||
$("#score_"+id).focus();
|
||||
}
|
||||
else if(first_click_score) {
|
||||
first_click_score = false;
|
||||
$("#work_submit_"+id).parent().parent().submit();
|
||||
$('#about_hwork_'+id).html('');
|
||||
}
|
||||
}
|
||||
function submit_teacher_score(id){
|
||||
if (first_click_score) {
|
||||
first_click_score = false;
|
||||
$("#work_submit_"+id).parent().parent().submit();
|
||||
hideModal();
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -13,12 +13,12 @@
|
|||
<% my_work = cur_user_works_for_work @contestwork %>
|
||||
<% if !@is_teacher && !@is_judge && my_work.nil? && User.current.member_of_contest?(@contest) %>
|
||||
<span class="f12 c_red">您尚未提交作品</span>
|
||||
<% unless @contestwork.work_type == 3 && @contestwork.work_detail_group.base_on_project %>
|
||||
<% if @contestwork.work_status == 1 && (@contestwork.work_type != 3 ||(@contestwork.work_type == 3 && !@contestwork.work_detail_group.base_on_project)) %>
|
||||
<%=link_to "提交作品", new_contestant_work_path(:work => @contestwork.id),:class => 'blueCir ml5 f12' %>
|
||||
<% end %>
|
||||
<% elsif !@is_teacher && !@is_judge && my_work &&Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<% elsif !@is_teacher && !@is_judge && my_work && @contestwork.work_status > 1 && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">截止日期已过,已提交且不可修改</span>
|
||||
<% elsif !@is_teacher && !@is_judge && my_work &&Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<% elsif !@is_teacher && !@is_judge && my_work && @contestwork.work_status == 1 && !@stundet_works.empty?%>
|
||||
<% if @contestwork.work_type == 3 %>
|
||||
<span class="f12 c_red">组长已提交,组长还可修改</span>
|
||||
<% else %>
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<ul class="ping_box_ul <%= is_last ? '' : 'ping_line'%> fl">
|
||||
<% show_real_name = @is_teacher || score.user == User.current || score.reviewer_role != 3 %>
|
||||
<%= link_to image_tag(url_to_avatar(show_real_name ? score.user : ""), :width => "34", :height => "34"), show_real_name ? user_path(score.user) : "javascript:void(0)",:class => "ping_pic fl" %>
|
||||
<% show_real_score = @contestwork.score_open || @is_teacher || score.contestant_work.user == User.current || score.user == User.current %>
|
||||
<div class="pingBoxTit">
|
||||
<%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "linkBlue fl" %>
|
||||
<span class="ml5 fl">
|
||||
(<%= student_work_score_role score%>)
|
||||
</span>
|
||||
<% unless score.score.nil? %>
|
||||
<span class="ml20 fl">评分:</span>
|
||||
<a href="javascript:void(0);" class="c_orange fl" >
|
||||
<%= show_real_score ? score.score : "**" %>分
|
||||
</a>
|
||||
<% end %>
|
||||
<!--<a href="javascript:void(0);" class="fr linkBlue mr5" onclick="$('#add_score_reply_<%#= score.id%>').slideToggle();">回复</a>-->
|
||||
<span class="fr c_grey mr20">
|
||||
<%=format_time score.updated_at %>
|
||||
</span>
|
||||
<div class="cl mb5"></div>
|
||||
|
||||
<p class="break_word">
|
||||
<%= score.comment%>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
|
||||
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => score.attachments} %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<!--<div id="add_score_reply_<%#= score.id%>" class="undis">-->
|
||||
<!--<%#= render :partial => 'add_score_reply',:locals => {:score => score,:is_last => is_last}%>-->
|
||||
<!--</div>-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<!--<div id="replay_histroy_<%#= score.id%>">-->
|
||||
<!--<%# score.journals_for_messages.order("created_on desc").each do |jour|%>-->
|
||||
<!--<%# show_real_name = @is_teacher || score.reviewer_role != 3 || @contestwork.work_status != 3 %>-->
|
||||
<!--<%#= render :partial => 'jour_replay',:locals => {:jour => jour, :show_real_name => show_real_name || jour.user == User.current}%>-->
|
||||
<!--<%# end%>-->
|
||||
<!--</div>-->
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</ul>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<%student_work_scores.each do |student_score|%>
|
||||
<div id="work_score_<%= student_score.id%>">
|
||||
<%= render :partial => 'contestant_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
|
||||
</div>
|
||||
<% end%>
|
||||
<% if is_member_work && student_work_scores.empty? && !@is_teacher %>
|
||||
<p class="c_red" style="text-align: center">暂无评分</p>
|
||||
<% end %>
|
|
@ -15,7 +15,7 @@
|
|||
<%=format_time work.commit_time %>
|
||||
</li>
|
||||
|
||||
<% if work.user == User.current && Time.parse(@contestwork.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
|
||||
<% if work.user == User.current && @contestwork.work_status == 1 %>
|
||||
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
|
||||
<li class="fr" >
|
||||
<%= link_to("", contestant_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %>
|
||||
|
@ -76,7 +76,7 @@
|
|||
<div class="cl"></div>
|
||||
</li>
|
||||
<!--<li >-->
|
||||
<!--<%# if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>-->
|
||||
<!--<%# if @contestwork.online_evaluation && User.current.judge_of_contest?(@contestwork.contest) && @contestwork.work_status == 3 %>-->
|
||||
<!--<!– 老师 || 开启匿评状态 && 不是当前用户自己的作品 –>-->
|
||||
<!--<div id="add_student_score_<%#= work.id%>" class="mt10 evaluation">-->
|
||||
<!--<%#= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>-->
|
||||
|
@ -94,7 +94,7 @@
|
|||
<!--<ul>-->
|
||||
<!--<li >-->
|
||||
<!--<%# if @is_teacher %>-->
|
||||
<!--<!– 老师 –>-->
|
||||
<!--<!-- 老师 -->-->
|
||||
<!--<div id="add_student_score_<%#= work.id%>" class="mt10 evaluation">-->
|
||||
<!--<%#= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>-->
|
||||
<!--</div>-->
|
||||
|
@ -104,8 +104,8 @@
|
|||
<!--</ul>-->
|
||||
<% end %>
|
||||
|
||||
<!--<div class="ping_box fl" id="score_list_<%#= work.id%>" style="<%#= student_work_scores.empty? ? 'padding:0px;' : ''%>">-->
|
||||
<!--<%#= render :partial => 'student_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => is_member_work} %>-->
|
||||
<!--<div class="ping_box fl" id="score_list_<%#= work.id%>" style="<%#= student_work_scores.empty? ? 'padding:0px;' : ''%>">-->
|
||||
<!--<%#= render :partial => 'contestant_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => is_member_work} %>-->
|
||||
<!--</div>-->
|
||||
<div class="cl"></div>
|
||||
<!---ping_box end--->
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</div>
|
||||
<div class="homepagePostTitle hidden fl m_w505">
|
||||
<% index = get_work_index(homework, is_teacher) %>
|
||||
<%= link_to "<span class='fontBlue2'>题目#{index + 1}:</span>".html_safe + homework.name,contestant_works_path(:work => homework.id),:class => "postGrey"%>
|
||||
<%= link_to homework.name,contestant_works_path(:work => homework.id),:class => "postGrey"%>
|
||||
</div>
|
||||
<%=get_cw_status(homework).html_safe %>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<% is_member_work = @contestwork.work_type == 3 && @work.contestant_work_projects.empty? %>
|
||||
$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score,:is_member_work => is_member_work}) %>");
|
||||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||
|
||||
<% score_open = @is_teacher || @contestwork.score_open == 1 || @work.user == User.current %>
|
||||
|
||||
$("#score_list_<%= @work.id%>").html("<%=escape_javascript(render :partial => 'contestant_work_score_records', :locals => {:student_work_scores => @student_work_scores, :is_member_work => is_member_work}) %>");
|
||||
var num = $("#work_num_<%= @work.id%>").html();
|
||||
$("#score_list_<%= @work.id%>").removeAttr("style");
|
||||
|
||||
<% if @contestwork.work_type == 3 %>
|
||||
$("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'contest_evaluation_un_group_work', :locals => {:student_work => @work}) %>");
|
||||
<% else %>
|
||||
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'contest_evaluation_un_work',:locals => {:student_work => @work, :index => 1, :score_open => score_open}) %>");
|
||||
$("#work_num_<%= @work.id%>").html(num);
|
||||
<% end %>
|
||||
|
||||
$("#student_work_count").html("<%=@count %>");
|
|
@ -98,14 +98,14 @@
|
|||
<% end %>
|
||||
<% hcommons.each_with_index do |homework_common,index |%>
|
||||
<% if homework_common.id == @contestwork.id %>
|
||||
<%="题目 #{hcommons.count - index}" %>
|
||||
<%="提交 #{hcommons.count - index}" %>
|
||||
<% end %>
|
||||
<% end%>
|
||||
</a>
|
||||
<ul>
|
||||
<% hcommons.each_with_index do |homework_common,index |%>
|
||||
<li class="pr10">
|
||||
<%= link_to "题目#{hcommons.count - index}:#{homework_common.name}",student_work_index_path(:homework => homework_common.id)%>
|
||||
<%= link_to "提交#{hcommons.count - index}:#{homework_common.name}",contestant_works_path(:work => homework_common.id)%>
|
||||
<%#= link_to "第#{@homework_commons.count - index}次作业",student_work_index_path(:homework => homework_common.id)%>
|
||||
</li>
|
||||
<% end%>
|
||||
|
@ -143,7 +143,7 @@
|
|||
|
||||
<ul class="homework-detail-tab mb10 mt15 fb">
|
||||
<li class="selected" id="student_work_tab1" onclick="HoverLi(1);">
|
||||
<a href="javascript:void(0);" class="fontGrey3">题目信息</a>
|
||||
<a href="javascript:void(0);" class="fontGrey3">提交信息</a>
|
||||
</li>
|
||||
<li onclick="HoverLi(2);" id="student_work_tab2">
|
||||
<a href="javascript:void(0);" class="fontGrey3">作品列表</a>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<% when 'News' %>
|
||||
<%= render :partial => 'users/contest_news', :locals => {:activity => act, :user_activity_id => activity.id, :is_contest => 1} %>
|
||||
<% when 'Message' %>
|
||||
<%#= render :partial => 'users/contest_message', :locals => {:activity => act, :user_activity_id => activity.id,:is_course=>1,:is_board=>0} %>
|
||||
<%= render :partial => 'users/contest_message', :locals => {:activity => act, :user_activity_id => activity.id,:is_course=>1,:is_board=>0} %>
|
||||
<% when 'Poll' %>
|
||||
<%#= render :partial => 'users/contest_poll', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% when 'JournalsForMessage' %>
|
||||
|
|
|
@ -3,12 +3,18 @@
|
|||
<span class="sy_cgrey"> > </span>
|
||||
<%= link_to @contest.name, contest_path(@contest), :class => "sy_cgrey" %>
|
||||
</p>
|
||||
<% if User.current.admin_of_contest?(@contest) %>
|
||||
<% if User.current.admin_of_contest?(@contest) || User.current.admin? %>
|
||||
<%= render :partial => "contests/mamager_setting" %>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="banner-game"><img src="/images/game/banner-game.png" width="968" height="110"/></div>
|
||||
<div class="banner-game">
|
||||
<% if @contest.id == 786 %>
|
||||
<img src="/images/game/appbanner.jpg" width="968" height="110"/>
|
||||
<% else %>
|
||||
<img src="/images/game/banner-game.png" width="968" height="110"/>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="sy_class_info fl">
|
||||
<div class="sy_class_titbox">
|
||||
<h3 class="fl sy_class_title"><%= @contest.name %></h3>
|
||||
|
@ -32,5 +38,22 @@
|
|||
<% else %>
|
||||
<%= link_to "加入竞赛",join_contest_contests_path(),:remote => true, :method => "get", :class => "fr sy_btn_blue mt28 ml10" %>
|
||||
<% end %>
|
||||
<span class="fr mt30 f16"> 邀请码:<span class="sy_corange"><%= @contest.invite_code %></span></span>
|
||||
<div class="cl"></div>
|
||||
<span class="fr mt30 f16"> 邀请码:
|
||||
<span class="sy_corange">
|
||||
<span class="sy_corange">
|
||||
<% if @contest.invite_code_halt == 0 %>
|
||||
<%=@contest.generate_invite_code %>
|
||||
<% else %>
|
||||
已停用
|
||||
<% end %>
|
||||
</span>
|
||||
</span></span>
|
||||
<div class="cl"></div>
|
||||
<% if User.current.admin_of_contest?(@contest) || User.current.admin? %>
|
||||
<div class="invite_code_tip_box fontGrey2" id="invite_code_tip_box" style="top: 160px;">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p class="mt10 mb5"><%= @contest.invite_code_halt == 0 ? "请将邀请码告诉成员" : "邀请码已停用" %></p>
|
||||
<p class="mb10"><%= @contest.invite_code_halt == 0 ? "他们可以主动加入" : "暂时停止成员主动加入" %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<tr>
|
||||
<td><%= index + 1 %></td>
|
||||
<td>
|
||||
<%= link_to member.user.show_name, user_path(member.user), :class => "pro_new_idname", :title => "#{member.user.show_name}" %>
|
||||
<%= link_to member.user.show_name, user_path(member.user), :class => "pro_new_idname ml10", :title => "#{member.user.show_name}" %>
|
||||
</td>
|
||||
<td style="width: 200px">
|
||||
<span id="member_role_<%=member.id %>"><%= zh_contest_role(h member.roles.sort.collect(&:to_s).join(', ')) %></span>
|
||||
|
@ -75,7 +75,8 @@
|
|||
<a href="javascript:void(0)" class="sy_btn_blue mr5" style="display: none;" onclick="$('#member-<%= member.id%>-roles-form').submit();">保存</a>
|
||||
<a href="javascript:void(0)" class="sy_btn_grey mr5" style="display: none;" onclick="cancel_edit($(this), <%=member.id %>);">取消</a>
|
||||
<% unless member.user == @contest.user %>
|
||||
<%= delete_link contest_member_path(member),
|
||||
<a href="javascript:void(0)" class="sy_btn_grey mr5" id="delete_member_<%=member.id %>" onclick="delete_confirm_box_2('<%=contest_member_path(member) %>', '<%= l(:label_delete_confirm)%>')">删除</a>
|
||||
<%#= delete_link contest_member_path(member),
|
||||
:remote => true,
|
||||
:class => "sy_btn_grey mr5",
|
||||
:id => "delete_member_#{member.id}",
|
||||
|
|
|
@ -3,9 +3,19 @@
|
|||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to !@contest.is_public ? "设为公开" : "设为私有", {:controller => 'contests', :action => 'private_or_public', :id => @contest},:remote=>true,:confirm=>"您确定要设置为"+(!@contest.is_public ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
|
||||
<!--<li><a href="javascript:void(0);" class="postOptionLink">暂停加入</a></li>-->
|
||||
<% if @contest.invite_code_halt == 0 %>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink" onclick="alert_halt_code();">暂停加入</a></li>
|
||||
<% elsif @contest.invite_code_halt == 1 %>
|
||||
<li><a href="<%=set_invite_code_halt_contest_path(@contest) %>" data-remote="true" class="postOptionLink">放开加入</a></li>
|
||||
<% end %>
|
||||
<li><%= link_to "配置", {:controller => 'contests', :action => 'settings', :id => @contest}, :class => "postOptionLink" %></li>
|
||||
<!--<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>-->
|
||||
<li>
|
||||
<% if !@contest.is_delete %>
|
||||
<a href="javascript:void(0);" class="postOptionLink" onclick="delete_confirm_box_2('<%=contest_path(@contest) %>', '您确定要删除该竞赛吗?<br/>删除后可联系系统管理员进行恢复')">删除</a>
|
||||
<% else %>
|
||||
<%=link_to "恢复竞赛", renew_contest_path(@contest), :class => "postOptionLink" %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<li><%= link_to "作品动态", contest_activities_contest_path(@contest, :type => 'work'), :class => "homepagePostTypeAssignment postTypeGrey"%></li>
|
||||
<li><%= link_to "通知动态", contest_activities_contest_path(@contest, :type => 'news'), :class => "homepagePostTypeNotice postTypeGrey"%></li>
|
||||
<!--<li><%#= link_to "资源库动态", {:controller => "courses", :action => "show", :type => "attachment"}, :class => "homepagePostTypeResource resourcesGrey"%></li>-->
|
||||
<!--<li><%#= link_to "论坛动态", {:controller => "courses", :action => "show", :type => "message"}, :class => "homepagePostTypeForum postTypeGrey"%></li>-->
|
||||
<li><%= link_to "论坛动态", contest_activities_contest_path(@contest, :type => 'message'), :class => "homepagePostTypeForum postTypeGrey"%></li>
|
||||
<!--<li><%#= link_to "留言动态", {:controller => "courses", :action => "show", :type => "journalsForMessage"}, :class => "homepagePostTypeMessage postTypeGrey"%></li>-->
|
||||
<!--<li><%#= link_to "问卷动态", {:controller => "courses", :action => "show", :type => "poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%></li>-->
|
||||
</ul>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
hideModal();
|
||||
window.location.href = "<%=user_contest_community_path(User.current) %>";
|
|
@ -0,0 +1,2 @@
|
|||
$("#contest_base_info").html("<%= escape_javascript(render :partial => 'contests/contest_base_info') %>");
|
||||
hideModal();
|
|
@ -10,10 +10,10 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<div>
|
||||
<% if (@contest.description.nil? || @contest.description == "") && User.current.admin_of_contest?(@contest) %>
|
||||
<% if (@contest.description.nil? || (@contest.description == "" && @contest.attachments.blank?)) && User.current.admin_of_contest?(@contest) %>
|
||||
<div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
|
||||
<p class="sy_tab_con_p">请尽快补充竞赛说明,赢得更多参赛</p>
|
||||
<% elsif (@contest.description.nil? || @contest.description == "") %>
|
||||
<p class="sy_tab_con_p">请尽快补充竞赛说明,赢得更多参赛者的青睐吧~</p>
|
||||
<% elsif (@contest.description.nil? || (@contest.description == "" && @contest.attachments.blank?)) %>
|
||||
<div class="icons_tishi"><img src="../images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
|
||||
<p class="sy_tab_con_p">尚未发布竞赛说明,敬请期待~</p>
|
||||
<% else %>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<div style="width:460px;">
|
||||
<div class="sy_popup_top">
|
||||
<h3 class="fl">编辑贴吧</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="muban_popup_con mt15" >
|
||||
<%= labelled_form_for @forum, :forum_id => @forum.id, :html => {:id => "forum_new", :remote => true} do |f| %>
|
||||
<%= render :partial => "forums/form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,25 @@
|
|||
<div id="sy_popup_box" style="width:380px;">
|
||||
<div class="sy_popup_top sy_popup_top_tishi">
|
||||
<h3 class="fl">提示</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close02 fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con02" >
|
||||
<ul class="sy_popup_tishi ">
|
||||
<li>
|
||||
<% if !@user.nil? %>
|
||||
<p>反馈成功,我们将尽快处理好并通知您。感谢您的反馈!</p>
|
||||
<% else %>
|
||||
<p>反馈失败,请先登录!</p>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<% if @flag == 6 %>
|
||||
<%= link_to "知道了", project_path(@project), :class => "sy_btn_blue" %>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue " onclick="hideModal()">知道了</a>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
|
@ -47,7 +47,8 @@
|
|||
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
|
||||
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
|
||||
<%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'AnnexBtn fl mt3' %>
|
||||
<a href="javascript:void(0);" onclick="_file.click();" class="AnnexBtn fl mr15">上传附件</a>
|
||||
<%= button_tag "上传附件", :id => "upload_attachments", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
|
||||
<!--<a href="javascript:void(0);" onclick="_file.click();" class="AnnexBtn fl mr15">上传附件</a>-->
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => 'file_selector',
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<ul class="newuploadbox">
|
||||
<li class="mb10 clear">
|
||||
<label class="fl" style="width: 90px;text-align: right;">贴吧名称 : </label>
|
||||
<!--<input maxlength="80" class="postCreateInput" onfocus="hideError();" onblur="check_forum_name();" placeholder="输入贴吧名称" >-->
|
||||
<%= f.text_field :name, :label => "", :name => "forum[name]", :id => "forum_name", :onblur => "check_forum_name()", :class => "issues_calendar_input fl", :style => "width:320px;height:28px;", :placeholder => "请输入贴吧名称,最多50个字符", :onfocus => "$('#forum_name_error_tips').hide();" %>
|
||||
<!--<input type="text" name="forum[name]" id="forum_name" onfocus="$('#forum_name_error_tips').hide();" placeholder="请输入贴吧名称,最多50个字符" class="issues_calendar_input fl" style="width:320px;height:28px;">-->
|
||||
<div class="clear"></div>
|
||||
<p class="c_red ml90" style="display: none" id="forum_name_error_tips"></p>
|
||||
</li>
|
||||
<li class=" clear">
|
||||
<label class="fl" style="width: 90px;text-align: right;">贴吧描述 : </label>
|
||||
<%= f.text_area :description, :label => "", :maxlength => "5000", :name => "forum[description]", :id => "forum_desc", :class => "mr15 mb10 fl newupload_textarea", :style => "width:320px;height:100px;", :placeholder => "请输入新建贴吧描述,最多5000个字符", :onfocus => "$('#forum_description_error_tips').hide();" %>
|
||||
<div class="clear"></div>
|
||||
<p class="c_red ml90" style="display: none" id="forum_description_error_tips"></p>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<div class="clear mr45 mb10">
|
||||
<a href="javascript:void(0);" class="btn fr" onclick="hideModal()" >取消</a>
|
||||
<a href="javascript:void(0);" class="btn btn-blue fr mr5" onclick="forums_commit();">确定</a>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
function check_forum_name(){
|
||||
if ($("#forum_name").val().trim() == ""){
|
||||
$("#forum_name_error_tips").html("贴吧名称不能为空").show();
|
||||
}else if($("#forum_name").val().length > 50){
|
||||
$("#forum_name_error_tips").html("贴吧名称不能超过50个字符").show();
|
||||
}
|
||||
}
|
||||
function forums_commit(){
|
||||
$("#forum_name_error_tips").hide();
|
||||
$("#forum_description_error_tips").hide();
|
||||
if ($("#forum_name").val().trim() == ""){
|
||||
$("#forum_name_error_tips").html("贴吧名称不能为空").show();
|
||||
}
|
||||
else if($("#forum_name").val().length > 50){
|
||||
$("#forum_name_error_tips").html("贴吧名称不能超过50个字符").show();
|
||||
}
|
||||
else if($("#forum_desc").val().trim() == ""){
|
||||
$("#forum_description_error_tips").html("贴吧描述不能为空").show();
|
||||
}
|
||||
else if($("#forum_desc").val().length > 5000){
|
||||
$("#forum_description_error_tips").html("贴吧描述不能超过5000个字符").show();
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
url:'<%= check_forum_name_forums_path(:forum_id => @forum.try(:id)) %>',
|
||||
type:'get',
|
||||
data:{
|
||||
forum_name:$("#forum_name").val().trim()
|
||||
},
|
||||
success:function(data){
|
||||
if(data.result == true){
|
||||
$("#forum_new").submit();
|
||||
hideModal();
|
||||
return true;
|
||||
}else{
|
||||
$("#forum_name_error_tips").html("贴吧名称已存在").show();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error:function(){
|
||||
alert('请检查当前网络连接')
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,8 +1,10 @@
|
|||
<% forum.reload.tag_list.each do |tag|%>
|
||||
<span class="postlabel mr10">
|
||||
<a title="双击可编辑" ondblclick="rename_tag($(this),'<%= tag %>',<%= forum.id%>,5);" style="cursor: pointer" class="fontGrey2 mr5"><%= tag %></a>
|
||||
<%if forum.creator.id == User.current.id%>
|
||||
<a href="javascript:void(0);" class="fontGrey2" onclick="delete_forum_tag($(this));">×</a>
|
||||
<% if forum.creator.id == User.current.id %>
|
||||
<a title="双击可编辑" ondblclick="rename_tag($(this),'<%= tag %>', <%= forum.id %>, 5);" style="cursor: pointer" class="fontGrey2 mr5"><%= tag %></a>
|
||||
<a href="javascript:void(0);" class="fontGrey2" onclick="delete_forum_tag($(this));">×</a>
|
||||
<% else %>
|
||||
<a href="javacript:void(0)" style="cursor: pointer" class="fontGrey2 mr5"><%= tag %></a>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
|
@ -0,0 +1,16 @@
|
|||
<div class="postDetailContainer mb10 fl" style="width: 208px;">
|
||||
<div class="fl mr10"><%= link_to image_tag(url_to_avatar(User.current), :width => 50, :height => 50,:alt=>'贴吧图像' ), user_path( User.current) %></div>
|
||||
<div class="fl">
|
||||
<div class="f16 fontGrey2 ml38">我在问吧</div>
|
||||
<div class="homepageImageBlock" style="width: 68px !important;">
|
||||
<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%= @my_memos_count %></a></div>
|
||||
<div class="homepageImageText">回答</div>
|
||||
</div>
|
||||
<div class="homepageVerDiv"></div>
|
||||
<div class="homepageImageBlock" style="width: 68px !important;">
|
||||
<div><a href="javascript:void(0);" class="homepageImageNumber" style="cursor: default"><%= @my_forums_count %></a></div>
|
||||
<div class="homepageImageText">发帖</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -0,0 +1,12 @@
|
|||
<div style="width:460px;">
|
||||
<div class="sy_popup_top">
|
||||
<h3 class="fl">新建贴吧</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="muban_popup_con mt15" >
|
||||
<%= labelled_form_for @forum, :html => {:id => "forum_new", :remote => false} do |f| %>
|
||||
<%= render :partial => "form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
<% @forums.each_with_index do |forum, i| %>
|
||||
<div class="wenba-rightbar-li clearfix <%= i > 9 ? 'none' : ''%> " id="forum_list_<%= forum.id %>">
|
||||
<h4 class="fl wenba-rightbar-title mt5 ml10" style="border-bottom: 0px"><%= link_to forum.name, forum_path(forum), :class => "", :target => "_blank" %></h4>
|
||||
<ul class=" fl right-line wenba-rightbar-ul" >
|
||||
<li><%= link_to forum.memo_count, forum_path(forum), :class => "linkGrey5" %></li>
|
||||
<li>回答</li>
|
||||
</ul>
|
||||
<ul class=" fl wenba-rightbar-ul" >
|
||||
<li><%= link_to forum.topic_count, forum_path(forum), :class => "linkGrey5" %></li>
|
||||
<li>帖子</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
|
@ -5,6 +5,19 @@
|
|||
$(function(){
|
||||
showNormalImage('postDetailDes_<%= topic.id %>');
|
||||
autoUrl('postDetailDes_<%= topic.id %>');
|
||||
if($("#intro_content_<%= topic.id %>").height() > 300) {
|
||||
$("#intro_content_show_<%= topic.id %>").show();
|
||||
}
|
||||
$("#intro_content_show_<%= topic.id %>").click(function(){
|
||||
$("#postDetailDes_<%= topic.id %>").toggleClass("maxh300");
|
||||
$("#intro_content_show_<%= topic.id %>").hide();
|
||||
$("#intro_content_hide_<%= topic.id %>").show();
|
||||
});
|
||||
$("#intro_content_hide_<%= topic.id %>").click(function(){
|
||||
$("#postDetailDes_<%= topic.id %>").toggleClass("maxh300");
|
||||
$("#intro_content_hide_<%= topic.id %>").hide();
|
||||
$("#intro_content_show_<%= topic.id %>").show();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="postDetailRow">
|
||||
|
@ -23,9 +36,14 @@
|
|||
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
|
||||
</div>
|
||||
|
||||
<div class="postDetailDes" id = "postDetailDes_<%= topic.id %>"><%= topic.content.html_safe%>
|
||||
<!--<a href="javascript:void(0);" class="linkBlue2 underline ml8">显示全部</a>-->
|
||||
<div class="postDetailDes maxh300" id = "postDetailDes_<%= topic.id %>">
|
||||
<div id="intro_content_<%= topic.id %>">
|
||||
<%= topic.content.html_safe%>
|
||||
</div>
|
||||
</div>
|
||||
<div id="intro_content_show_<%= topic.id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= topic.id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<% author = topic.last_reply.try(:author)%>
|
||||
<% if author%>
|
||||
<div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.show_name%></a></div>
|
||||
|
@ -36,10 +54,10 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
|
||||
<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %>
|
||||
<ul class="pages" style="width: auto;display: table;margin-left: auto;margin-right: auto; padding-top: 10px">
|
||||
<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true, :is_new => true %>
|
||||
</ul>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -1,7 +1,5 @@
|
|||
<%if @save_flag%>
|
||||
//$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle();
|
||||
//$('#reorder_time').click();
|
||||
window.location.href= "<%= host_with_protocol %>"+"/forums/" + "<%= @forum.id%>"
|
||||
$("#forum_right_bar").html('<%= escape_javascript( render :partial => 'forums/right_bar') %>');
|
||||
<%else%>
|
||||
$("#error").html("<%= @forum.errors.full_messages[0]%>").show();
|
||||
<%end %>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'forums/edit') %>";
|
||||
pop_box_new(htmlvalue,460,390);
|
||||
|
||||
|
||||
|
|
@ -1,176 +1,159 @@
|
|||
<%= javascript_include_tag 'new_user' %>
|
||||
<%= stylesheet_link_tag 'css/common','css/public'%>
|
||||
<script>
|
||||
function add_class(id){
|
||||
if($("#"+id).hasClass("sortArrowActiveD")){
|
||||
$("#"+id).removeClass("sortArrowActiveD");
|
||||
$("#"+id).addClass("sortArrowActiveU");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=asc&page='+<%= @forums_pages.page%>
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
<div class="banner-big f16 fontGrey3 mb10">问吧</div>
|
||||
|
||||
});
|
||||
}else if($("#"+id).hasClass("sortArrowActiveU")){
|
||||
$("#"+id).removeClass("sortArrowActiveU");
|
||||
$("#"+id).addClass("sortArrowActiveD");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @forums_pages.page%>
|
||||
|
||||
});
|
||||
}else{
|
||||
$("#"+id).addClass("sortArrowActiveD");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @forums_pages.page%>
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
$("#complex").click(function(){
|
||||
$("#reorder_popu").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveU");
|
||||
add_class("reorder_complex");
|
||||
});
|
||||
$("#popu").click(function () {
|
||||
$("#reorder_complex").removeClass("sortArrowActiveD");
|
||||
$("#reorder_complex").removeClass("sortArrowActiveU");
|
||||
$("#reorder_time").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveU");
|
||||
add_class("reorder_popu");
|
||||
});
|
||||
$("#time").click(function () {
|
||||
$("#reorder_complex").removeClass("sortArrowActiveD");
|
||||
$("#reorder_complex").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveD");
|
||||
add_class("reorder_time");
|
||||
});
|
||||
$('#forum_name').keypress( function(e)
|
||||
{
|
||||
var n = 0;
|
||||
var str = this.value;
|
||||
for (i = 0; i < str.length; i++) {
|
||||
var leg = str.charCodeAt(i);//ASCII码
|
||||
if (leg > 255) {//大于255的都是中文
|
||||
n += 2;//如果是中文就是2个字节
|
||||
} else {
|
||||
n += 1;//英文,不多说了
|
||||
}
|
||||
}
|
||||
if(n >= 160 && e.keyCode != 8)
|
||||
if(document.all)
|
||||
{
|
||||
e.returnValue = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.preventDefault();
|
||||
}
|
||||
})
|
||||
});
|
||||
function check_and_submit(doc){
|
||||
$("#error").html('').hide();
|
||||
check_forum_name();
|
||||
if( $("textarea[name='forum[name]']").val().trim() == "" && $("textarea[name='forum[description]']").val().trim() != "" ){
|
||||
$("#error").html("名称不能为空").show();
|
||||
return;
|
||||
} else if( $("textarea[name='forum[description]']").val().trim() == "" && $("textarea[name='forum[name]']").val().trim() != "" ){
|
||||
$("#error").html("描述不能为空").show();
|
||||
return;
|
||||
}else if($("textarea[name='forum[description]']").val().trim() == "" && $("textarea[name='forum[name]']").val().trim() == ""){
|
||||
$("#error").html("名称和描述不能为空").show();
|
||||
return;
|
||||
}
|
||||
else{
|
||||
doc.parent().parent().submit();
|
||||
}
|
||||
}
|
||||
var check_pass = true;
|
||||
function check_forum_name(){
|
||||
check_pass = true;
|
||||
name = $("textarea[name='forum[name]']").val().trim();
|
||||
if( name != ""){
|
||||
$.get(
|
||||
'<%= check_forum_name_forums_path %>',
|
||||
{"forum_name":encodeURIComponent(name)},
|
||||
function(data){
|
||||
if( data == 'true'){
|
||||
$("#error").html("贴吧名称已经存在").show();
|
||||
check_pass = false;
|
||||
}
|
||||
}
|
||||
);
|
||||
}else{
|
||||
check_pass = false;
|
||||
}
|
||||
if(check_pass == false){
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
function hideError(){
|
||||
$("#error").html("").hide();
|
||||
}
|
||||
|
||||
function create_cancle(){
|
||||
$('#error').hide();
|
||||
$('#new_forum_div').slideToggle();
|
||||
$('#create_btn').parent().slideToggle();
|
||||
clear_form();
|
||||
}
|
||||
function clear_form(){
|
||||
$("#forum_name").val('');
|
||||
$("#forum_desc").val('');
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="homepageContentContainer mb10">
|
||||
<div class="homepageContent">
|
||||
<div class="postContainer">
|
||||
<div id="new_forum_div" class="mb5" style="display: none">
|
||||
<div class="red fl mb10" id="error" style="display: none">error</div>
|
||||
<%= form_tag({:controller => 'forums',:action=>'create',:format=>'js'},:method => 'post',:remote=>'true') do |f| %>
|
||||
<div>
|
||||
<textarea type="text" name="forum[name]" id="forum_name" maxlength="80" class="postCreateInput" onfocus="hideError();" onblur="check_forum_name();" placeholder="输入贴吧名称" ></textarea>
|
||||
<script>
|
||||
var textarea = document.getElementById('forum_name');
|
||||
autoTextarea(textarea);
|
||||
</script>
|
||||
</div>
|
||||
<div class="mt15">
|
||||
<textarea type="text" name="forum[description]" id="forum_desc" maxlength="5000" class="postCreateInput" placeholder="输入贴吧描述"></textarea>
|
||||
<script>
|
||||
var textarea1 = document.getElementById('forum_desc');
|
||||
autoTextarea(textarea1);
|
||||
</script>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<div class="fr"><a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit($(this));">确定</a></div>
|
||||
<div class="fr"><a href="javascript:void(0);" class="linkGrey2 mr10" onclick="create_cancle();">取消</a><span class="mr10 fontGrey">或</span></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="postBanner" id="postBanner">
|
||||
<%= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str}%>
|
||||
<!--<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" class="sortArrowActiveD"></a></div>-->
|
||||
<!--<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a><a href="javascript:void(0)" id="reorder_popu" ></a></div>-->
|
||||
<!--<div class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a><a href="javascript:void(0)" id="reorder_time" ></a></div>-->
|
||||
<!--<div class="creatPost"><a href="javascript:void(0);" id="create_btn" class="c_white db creatPostIcon bBlue" onclick="$('#error').hide();$('#new_forum_div').slideToggle();$(this).parent().slideToggle();">新建贴吧</a></div>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
|
||||
</div>
|
||||
<div id="forum_list">
|
||||
<%= render :partial => 'forum_list',:locals => {:forums=>@forums}%>
|
||||
</div>
|
||||
<ul class="wlist fr" id="pages" style="margin-top: 10px;">
|
||||
<%= pagination_links_full @forums_pages, @forums_count ,:per_page_links => true,:remote =>true,:flag=>true%>
|
||||
</ul>
|
||||
<div class="postRightContainer mr10">
|
||||
<div class="postDetailBanner" style="padding-bottom: 10px">
|
||||
<div class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a><a href="javascript:void(0);" id="reorder_time" class="sortArrowActiveD"></a></div>
|
||||
<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a><a href="javascript:void(0);" id="reorder_popu" class=""></a></div>
|
||||
<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" class=""></a><!--<a href="javascript:void(0);" class="sortArrowActiveD"></a>--></div>
|
||||
<div class="creatPost" id="create_memo_btn">
|
||||
<%= link_to "发布新帖",new_forum_memo_path(:forum_id => Forum.first.id), :class => "c_white db creatPostIcon bBlue" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="forum_list">
|
||||
<%= render :partial => 'show_topics',:locals => {:memos => @memos} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render :partial => "forums/my_count_message" %>
|
||||
|
||||
<div class="wenba-rightbar fr">
|
||||
<div class="wenba-rightbar-top clearfix">
|
||||
<h3 class="fl ml10">问吧</h3>
|
||||
<%= link_to "新建贴吧", new_forum_path, :class => "btn-blue btn fr mt5 mr5", :remote => true %>
|
||||
</div>
|
||||
<div id="forums_right_list">
|
||||
<%= render :partial => "forums/right_bar" %>
|
||||
<% if @forums.count > 10 %>
|
||||
<a href="javascript:void(0);" id="forum_more_id" class="wenba-rightbar-more linkBlue2" data-init="0" onclick="expand_forum('#forum_more_id', '#forums_right_list');">点击展开更多</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function expand_forum(btnid,container){
|
||||
var target = $(container).children('.wenba-rightbar-li');
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('点击收起');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('点击展开更多');
|
||||
target.hide();
|
||||
for(var i = 0; i < 10; i++)
|
||||
{
|
||||
target.eq(i).show()
|
||||
}
|
||||
btn.parent().show();
|
||||
}
|
||||
}
|
||||
function add_class(id){
|
||||
if($("#"+id).hasClass("sortArrowActiveD")){
|
||||
$("#"+id).removeClass("sortArrowActiveD");
|
||||
$("#"+id).addClass("sortArrowActiveU");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=asc&page='+<%= @topic_pages.page%>
|
||||
|
||||
});
|
||||
}else if($("#"+id).hasClass("sortArrowActiveU")){
|
||||
$("#"+id).removeClass("sortArrowActiveU");
|
||||
$("#"+id).addClass("sortArrowActiveD");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @topic_pages.page%>
|
||||
|
||||
});
|
||||
}else{
|
||||
$("#"+id).addClass("sortArrowActiveD");
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<%= forums_path %>' + '.js?' + id + '=desc&page='+<%= @topic_pages.page%>
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
$("#complex").click(function(){
|
||||
$("#reorder_popu").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveU");
|
||||
add_class("reorder_complex");
|
||||
});
|
||||
$("#popu").click(function () {
|
||||
$("#reorder_complex").removeClass("sortArrowActiveD");
|
||||
$("#reorder_complex").removeClass("sortArrowActiveU");
|
||||
$("#reorder_time").removeClass("sortArrowActiveD");
|
||||
$("#reorder_time").removeClass("sortArrowActiveU");
|
||||
add_class("reorder_popu");
|
||||
});
|
||||
$("#time").click(function () {
|
||||
$("#reorder_complex").removeClass("sortArrowActiveD");
|
||||
$("#reorder_complex").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveU");
|
||||
$("#reorder_popu").removeClass("sortArrowActiveD");
|
||||
add_class("reorder_time");
|
||||
});
|
||||
<% if @errors %>
|
||||
$('#create_memo_div').slideToggle();$('#create_memo_btn').slideToggle();
|
||||
$("#error").html('<%= @errors.html_safe %>').show();
|
||||
<% end %>
|
||||
});
|
||||
|
||||
var first_click = true;
|
||||
// function check_and_submit(){
|
||||
// if(!check_memo_name()){
|
||||
// return;
|
||||
// }
|
||||
// if($("textarea[name='memo[subject]']").val().trim() != "" && !memo_content.isEmpty() && first_click){
|
||||
// first_click = false;
|
||||
// memo_content.sync();
|
||||
// $.ajax({
|
||||
// url:'/forums/'+'<%#= @forum.id.to_s%>'+'/memos',
|
||||
// type:'post',
|
||||
// data:$("#new_memo").serialize(),
|
||||
// success:function(data){
|
||||
//
|
||||
// },
|
||||
// error:function(){
|
||||
// alert('请检查当前网络连接')
|
||||
// }
|
||||
// });
|
||||
// //$("#new_memo").submit();
|
||||
// }else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.isEmpty()){
|
||||
// $("#error").html("主题和内容不能为空").show();
|
||||
// }
|
||||
// else if($("textarea[name='memo[subject]']").val().trim() == "" && !memo_content.isEmpty() ){
|
||||
// $("#error").html("主题不能为空").show();
|
||||
// }else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.isEmpty()){
|
||||
// $("#error").html("内容不能为空").show();
|
||||
// }
|
||||
// }
|
||||
|
||||
function check_memo_name(){
|
||||
if($("#memo_subject").val().trim().length > 50){
|
||||
$("#error").html("主题 过长(最长为 50 个字符)").show();
|
||||
return false;
|
||||
}
|
||||
if(memo_content.html().length > 20000){
|
||||
$("#error").html("内容 过长(最长为 20000 个字符)").show();
|
||||
$("html,body").animate({scrollTop:$("#error").offset().top},1000)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function create_cancle(){
|
||||
$('#create_memo_div').slideToggle();
|
||||
$('#create_memo_btn').slideToggle();
|
||||
$('#memo_subject').val('');
|
||||
memo_content.html('')
|
||||
$('#error').html('').hide();
|
||||
}
|
||||
</script>
|
|
@ -1,4 +1,4 @@
|
|||
//$("#postBanner").html("<%#= render :partial => 'post_banner' ,:locals => {:order_type=>@type,:order_str=>@str }%>");
|
||||
$("#forum_list").html("<%= escape_javascript(render :partial => 'forum_list',:locals => {:forums=>@forums}) %>");
|
||||
$("#forum_list").html("<%= escape_javascript(render :partial => 'show_topics', :locals => {:memos => @memos}) %>");
|
||||
//这里出现一个问题竟然是单双引号引起的。注意!!
|
||||
$("#pages").html('<%= pagination_links_full @forums_pages, @forums_count,:per_page_links => false,:remote =>true,:flag=>true%>');
|
||||
$("#pages").html('<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true, :is_new => true %>');
|
|
@ -0,0 +1,2 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'forums/emali_valid_tip') %>";
|
||||
pop_box_new(htmlvalue,380,250);
|
|
@ -0,0 +1,5 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'forums/new') %>";
|
||||
pop_box_new(htmlvalue,460,390);
|
||||
|
||||
|
||||
|
|
@ -1,59 +1,42 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<%= javascript_include_tag 'new_user' %>
|
||||
<% end %>
|
||||
<div class="banner-big f16 fontGrey3 mb10"><%= link_to "问吧", forums_path, :class => "c_blue" %> > <span id="show_forum_name"><%= @forum.name %></span></div>
|
||||
|
||||
|
||||
<div class="postRightContainer">
|
||||
<div id="create_memo_div" style="display: none">
|
||||
<div id="error" class="red fl mb10" style="display: none">error</div>
|
||||
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum),:remote=>true) do |f| %>
|
||||
<div>
|
||||
<textarea type="text" name="memo[subject]" id="memo_subject" maxlength="50" onblur="check_memo_name();" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="postDetailInput" placeholder="输入帖子标题" ></textarea>
|
||||
<script>
|
||||
var textarea1 = document.getElementById('memo_subject');
|
||||
autoTextarea(textarea1);
|
||||
</script>
|
||||
</div>
|
||||
<div class="mt15">
|
||||
<%= kindeditor_tag 'memo[content]','',:height=>300,:editor_id=>'memo_content'%>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">上传附件</a>-->
|
||||
<%= render :partial => 'file_form', :locals => {:container => @memo} %>
|
||||
<div class="fr">
|
||||
<a href="javascript:void(0);" class="submit_btn" onclick="check_and_submit();">确定</a>
|
||||
</div>
|
||||
<div class="fr"><a href="javascript:void(0);" class="linkGrey2 mr10" onclick="create_cancle();">取消</a><span class="mr10 fontGrey">或</span></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="postDetailBanner">
|
||||
<div class="postRightContainer mr10">
|
||||
<div class="postDetailBanner" style="padding-bottom: 10px">
|
||||
<div class="postSort" id="time"><a href="javascript:void(0);" class="linkGrey2 fl">时间</a><a href="javascript:void(0);" id="reorder_time" class="sortArrowActiveD"></a></div>
|
||||
<div class="postSort" id="popu"><a href="javascript:void(0);" class="linkGrey2 fl">人气</a><a href="javascript:void(0);" id="reorder_popu" class=""></a></div>
|
||||
|
||||
<div class="postSort" id="complex"><a href="javascript:void(0);" class="linkGrey2 fl">综合</a><a href="javascript:void(0);" id="reorder_complex" class=""></a><!--<a href="javascript:void(0);" class="sortArrowActiveD"></a>--></div>
|
||||
|
||||
<div class="creatPost" id="create_memo_btn"><a href="javascript:void(0);" class="c_white db creatPostIcon bBlue" onclick="$('#error').hide();$('#create_memo_div').slideToggle();$(this).parent().slideToggle();">发布新帖</a></div>
|
||||
<div class="creatPost" id="create_memo_btn">
|
||||
<%= link_to "我要提问", new_forum_memo_path(:forum_id => @forum), :class => "c_white db creatPostIcon bBlue" %>
|
||||
<!--<a href="javascript:void(0);" class="c_white db creatPostIcon bBlue" onclick="$('#error').hide();$('#create_memo_div').slideToggle();$(this).parent().slideToggle();">发布新帖</a>-->
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div id="topics_list">
|
||||
<%= render :partial => 'show_topics',:locals => {:memos=>@memos}%>
|
||||
<%= render :partial => 'show_topics',:locals => {:memos => @memos}%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fl">
|
||||
<div id="my_count_message">
|
||||
<%= render :partial => "memos/my_count_message" %>
|
||||
</div>
|
||||
|
||||
<!--<div class="pageRoll">-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">上一页</a></div>-->
|
||||
<!--<div class="pageCell pageCellActive"><a href="javascript:void(0);" class="c_white">1</a></div>-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">2</a></div>-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">3</a></div>-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">...</a></div>-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">14</a></div>-->
|
||||
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">下一页</a></div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
</div>
|
||||
<div class="homepageLeft-new" id="forum_right_bar">
|
||||
<div class="wenba-rightbar">
|
||||
<div class="wenba-rightbar-top clearfix">
|
||||
<h3 class="fl ml10">推荐贴吧</h3>
|
||||
</div>
|
||||
<%= render :partial => "forums/right_bar" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
function add_class(id){
|
||||
if($("#"+id).hasClass("sortArrowActiveD")){
|
||||
|
|
|
@ -1 +1 @@
|
|||
$("#topics_list").html("<%= escape_javascript(render :partial => 'show_topics',:locals => {:memos=>@memos})%>")
|
||||
$("#topics_list").html("<%= escape_javascript(render :partial => 'show_topics',:locals => {:memos=>@memos}) %>")
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
$("#my_count_message").html('<%= escape_javascript( render :partial => 'memos/my_count_message') %>');
|
||||
$("#show_forum_name").html('<%= @forum.name %>');
|
|
@ -19,10 +19,10 @@ function set_score_rule_submit() {
|
|||
if($("#late_penalty_num").val().trim() == ""){
|
||||
$("#late_penalty_num").val("0");
|
||||
}
|
||||
if($("#absence_penalty_num").val().trim() == ""){
|
||||
if($("#absence_penalty_num").length > 0 && $("#absence_penalty_num").val().trim() == ""){
|
||||
$("#absence_penalty_num").val("0");
|
||||
}
|
||||
if($("#appeal_penalty").val().trim() == ""){
|
||||
if($("#absence_penalty_num").length > 0 && $("#appeal_penalty").val().trim() == ""){
|
||||
$("#appeal_penalty").val("0");
|
||||
}
|
||||
$('#muban_popup_box').find('form').submit();
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<% unless memo.nil? %>
|
||||
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
|
||||
<% end %>
|
||||
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a>|</li>
|
||||
<li class="fl"><a href="javascript:void:(0);" class="f_grey ml20" target="_blank"><%= l(:label_language)%></a>
|
||||
<li class="fl"><a href="javascript:void(0);" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a>|</li>
|
||||
<li class="fl"><a href="javascript:void(0);" class="f_grey ml20" target="_blank"><%= l(:label_language)%></a>
|
||||
<select class="languageBox">
|
||||
<option value="Chinese" selected="selected">中文</option>
|
||||
<option value="English">英文</option>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<% if hidden_unproject_infos && !memo.nil? %>
|
||||
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
|
||||
<% end %>
|
||||
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>
|
||||
<li class="fl"><a href="<%= forums_path %>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -7,30 +7,31 @@
|
|||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "首页", user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页" %>
|
||||
</li>
|
||||
<!-- <li class="navHomepageMenu fl">
|
||||
<%#= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %>
|
||||
</li>-->
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "课程", user_course_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
<% if !hidden_unproject_infos %>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<% if hidden_unproject_infos %>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "课程", user_course_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "项目", user_project_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
|
||||
<% if hidden_unproject_infos %>
|
||||
<!-- <li class="navHomepageMenu fl">
|
||||
<%#= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
||||
</li>-->
|
||||
<% memo = Memo.where(:id => 1168).first %>
|
||||
<% unless memo.nil? %>
|
||||
<li class="navHomepageMenu fl mr30">
|
||||
<%= link_to "帮助中心", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<li class="navHomepageMenu fl mr40">
|
||||
<a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" >公共贴吧</a>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "竞赛", user_contest_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="navHomepageMenu fl mr20">
|
||||
<%= link_to "问吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -57,7 +58,11 @@
|
|||
<% name = name%>
|
||||
|
||||
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、班级、项目、用户、资源以及帖子"/>
|
||||
<% if hidden_unproject_infos %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、班级、项目、用户、资源以及帖子" />
|
||||
<% else %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的项目、用户、资源以及帖子" />
|
||||
<% end %>
|
||||
<input type="hidden" name="search_type" id="type" value="all"/>
|
||||
<input type="text" style="display: none;"/>
|
||||
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<% unless memo.nil? %>
|
||||
<li ><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="" >帮助中心<span>|</span></a></li>
|
||||
<% end %>
|
||||
<li ><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="" > 贴吧交流</a></li>
|
||||
<li ><a href="<%= forums_path %>" target="_blank" class="" > 问吧交流</a></li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<p>Copyright 2007~2016, All Rights Reserved 湘ICP备09019772</p>
|
||||
|
|
|
@ -150,6 +150,10 @@
|
|||
<li><a href="<%=news_path(ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 发布了新闻:<%= ma.forge_message.title.html_safe%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>发布了新闻:<%= ma.forge_message.title.html_safe%></a></li>
|
||||
<% elsif ma.forge_message_type == "Comment" %>
|
||||
<li><a href="<%=news_path(ma.forge_message.commented.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>评论了新闻:<%= ma.forge_message.commented.title%></a></li>
|
||||
<% elsif ma.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => ma.forge_message_id).count != 0%>
|
||||
<% send_message_user = PullRequest.where(:pull_request_id => ma.forge_message_id) %>
|
||||
<% author = User.find(ma.operate_user_id.nil? ? 2 : ma.operate_user_id) %>
|
||||
<li><a href="<%= project_pull_requests_path(ma.project_id) %>" target="_blank" title="<%= User.find(author.id).show_name %> <%= pull_request_message_status(ma) %> <%= send_message_user[0].title %>"><span class="shadowbox_news_user"><%= User.find(author.id).show_name %> </span><%= pull_request_message_status(ma) %> <%= send_message_user[0].title %></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.class == MemoMessage %>
|
||||
<% if ma.memo_type == "Memo" && !ma.memo.nil? && !ma.memo.author.nil? %>
|
||||
|
@ -179,8 +183,8 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<a onclick = "show_more();" id = "show_more_messages" style="display: none; cursor: pointer;" class = "shadowbox_news_all">展开更多</a>
|
||||
<%= link_to '查看全部', user_message_path(User.current),:id =>'show_all_messages', :class => "shadowbox_news_all", :style => "display:none", :target =>"_Blank" %>
|
||||
<!--<a onclick = "show_more();" id = "show_more_messages" style="display: none; cursor: pointer;" class = "shadowbox_news_all">展开更多</a>-->
|
||||
<%= link_to '查看全部', user_message_path(User.current),:id =>'show_all_messages', :class => "shadowbox_news_all", :target =>"_Blank" %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -7,11 +7,17 @@
|
|||
<!--<li class="navHomepageMenu fl mr40">-->
|
||||
<!--<%#= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>-->
|
||||
<!--</li>-->
|
||||
<% memo = Memo.where(:id => 1168).first %>
|
||||
<% unless memo.nil? %>
|
||||
<li class="navHomepageMenu fl mr40">
|
||||
<a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="c_white f16 db p10" >帮助中心</a>
|
||||
</li>
|
||||
<% if hidden_unproject_infos %>
|
||||
<% memo = Memo.where(:id => 1168).first %>
|
||||
<% unless memo.nil? %>
|
||||
<li class="navHomepageMenu fl mr40">
|
||||
<a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="c_white f16 db p10" >帮助中心</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<li class="navHomepageMenu fl mr40">
|
||||
<%= link_to "问吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -14,22 +14,30 @@
|
|||
<ul class="user_navmore_txt">
|
||||
<% if is_teacher %>
|
||||
<li class="clear">
|
||||
<%= link_to "作品",works_path(:contest => contest.id), :class => 'user_navmore_li fl', :target => '_blank' %>
|
||||
<%= link_to "提交",works_path(:contest => contest.id), :class => 'user_navmore_li fl', :target => '_blank' %>
|
||||
<%= link_to '+',works_path(:contest => contest.id,:is_new => 1), :class => 'user_navmore_add fl', :title => '发布作品',:target => '_blank' %>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<%= link_to "通知", contest_news_index_path(contest), :class => 'user_navmore_li fl',:target => '_blank' %>
|
||||
<%= link_to "+", new_contest_news_path(contest,:is_new=>1), :class => 'user_navmore_add fl', :title => '发布通知',:target => '_blank' %>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<%= link_to "论坛", contest_boards_path(contest), :class => 'user_navmore_li fl',:target => '_blank' %>
|
||||
<%= link_to "+", contest_boards_path(contest, :flag => true, :is_new => 1), :class => 'user_navmore_add fl', :title => '发布帖子',:target => '_blank' %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li>
|
||||
<%= link_to "作品",works_path(:contest => contest.id), :class => 'user_navmore_li', :target => '_blank' %>
|
||||
<%= link_to "提交",works_path(:contest => contest.id), :class => 'user_navmore_li', :target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "通知", contest_news_index_path(contest), :class => 'user_navmore_li',:target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<%= link_to "论坛", contest_boards_path(contest), :class => 'user_navmore_li fl',:target => '_blank' %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<!--<li class="clear">-->
|
||||
<!--<%#= link_to "论坛",contest_boards_path(contest), :class => 'user_navmore_li fl',:target => '_blank' %>-->
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<ul>
|
||||
<% if User.current.logged?%>
|
||||
<% if User.current == target%>
|
||||
<!-- <li style="width: 119px; float: left; border-right: 1px solid #ddd;"><%#= link_to("个人资料", my_account_path, :class => "user_editinfo") %></li>-->
|
||||
<% if User.current == target %>
|
||||
<!--<li style="width: 119px; float: left; border-right: 1px solid #ddd;"><%#= link_to("个人资料", my_account_path, :class => "user_editinfo") %></li>-->
|
||||
<li><%= link_to '个人主页', homepage_user_path(@user), :class => "user_editinfo", :target => '_blank' %></li>
|
||||
<li class="cl"></li>
|
||||
<% else%>
|
||||
<!-- <li style="width: 119px; float: left; border-right: 1px solid #ddd;">
|
||||
<%# if target.base_homepage.nil? %>
|
||||
<a href="javascript:void(0)" class ="user_editinfo" style="color: #cccccc" title="该用户暂未设置主页">主页</a>
|
||||
<%# else %>
|
||||
<%#=link_to "主页", homepage_user_path(@user.login), :class => 'user_editinfo', :target => '_blank' %>
|
||||
<%# end %>
|
||||
</li>-->
|
||||
<li>
|
||||
<li style="width: 119px; float: left; border-right: 1px solid #ddd;">
|
||||
<% if target.base_homepage.nil? %>
|
||||
<a href="javascript:void(0)" class ="user_editinfo" style="color: #cccccc" title="该用户暂未设置主页">TA的主页</a>
|
||||
<% else %>
|
||||
<%=link_to "TA的主页", homepage_user_path(@user.login), :class => 'user_editinfo', :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li style="width: 118px; float: left;">
|
||||
<%if(target.watched_by?(User.current))%>
|
||||
<%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "delete",:remote => "true", :title => "取消关注"%>
|
||||
<% else %>
|
||||
|
@ -20,6 +20,6 @@
|
|||
<% end %>
|
||||
</li>
|
||||
<li class="cl"></li>
|
||||
<% end%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
|
@ -10,7 +10,7 @@
|
|||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify','contest'%>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= yield :header_tags -%>
|
||||
|
@ -47,7 +47,7 @@
|
|||
<div class="user_leftnav ">
|
||||
<% if hidden_unproject_infos %>
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_01" class="user_icons_course">
|
||||
<li id="user_01" class="user_icons_contest">
|
||||
<%= link_to '竞赛',{:controller => "users", :action => "user_contestlist", :id => @user}, :id => "user_contest_list" %>
|
||||
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_contestlist", :id => @user}, :style => "color:#aaa;" %></font>
|
||||
<% contests = @user.favorite_contests.visible.where("is_delete =?", 0).select("contests.*,(SELECT MAX(updated_at) FROM `contest_activities` WHERE contest_activities.contest_id = contests.id) AS a").order("a desc").limit(10) %>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus', 'css/moduel','css/contest'%>
|
||||
<%= javascript_include_tag "course","avatars","header","attachments",'prettify' %>
|
||||
<%= javascript_include_tag "course","avatars","header","attachments",'prettify','contest' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
@ -40,11 +40,16 @@
|
|||
</li>
|
||||
<!--<li id="sy_03" class="sy_icons_boards"> <a href="">讨论区<span>26</span></a> <a href="javascript:void(0);" class="sy_class_add"></a></li>-->
|
||||
<li id="sy_03" class="sy_icons_hwork">
|
||||
<a href="<%= works_path(:contest => @contest) %>">作品<span><%= work_num%></span></a>
|
||||
<a href="<%= works_path(:contest => @contest) %>">提交<span><%= work_num%></span></a>
|
||||
<% if is_admin %>
|
||||
<a href="<%= works_path(:contest => @contest.id,:is_new => 1) %>" class="sy_class_add"></a>
|
||||
<% end %>
|
||||
</li>
|
||||
<li id="sy_04" class="sy_icons_boards">
|
||||
<% count = @contest.boards.first ? (@contest.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @contest.boards.first.id, nil).count) : 0 %>
|
||||
<a href="<%=contest_boards_path(@contest) %>">讨论区<span><%=count %></span></a>
|
||||
<%= link_to( "",contest_boards_path(@contest, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") if is_admin %>
|
||||
</li>
|
||||
<li id="sy_05" class="sy_icons_news">
|
||||
<%= link_to "通知<span>#{@contest.news.count}</span>".html_safe, contest_news_index_path(@contest), :class => "sy_icons_feedback" %>
|
||||
<% if is_admin %>
|
||||
|
@ -110,6 +115,13 @@
|
|||
}
|
||||
<% end %>
|
||||
});
|
||||
function alert_halt_code(){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">邀请码停用后,用户不能主动加入该竞赛了</p><p class="text_c mt10 f14">您是否确认停用</p><div class="cl"></div>'+
|
||||
'<a href="<%=set_invite_code_halt_contest_path(@contest) %>" class="fr sy_btn_blue mr135 mt10" data-remote="true">确 定</a>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取 消</a></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 180);
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -71,7 +71,10 @@
|
|||
<ul class="users_accordion mb10">
|
||||
<% if @user == User.current %>
|
||||
<li id="user_05" class="user_icons_myhw">
|
||||
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
|
||||
<%=link_to '我发布的作业', user_manage_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_05" class="user_icons_myhw">
|
||||
<%=link_to '我收到的作业', user_receive_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_06" class="icons-doc clear">
|
||||
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :style => "font-size:14px;" %>
|
||||
|
|
|
@ -219,7 +219,7 @@
|
|||
</div>
|
||||
<div class="postDetailContainer mt10">
|
||||
<div class="fl mr10"><%= link_to image_tag(url_to_avatar(User.current),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path( User.current) %></div>
|
||||
<div class="fl f16 fontGrey2">我在贴吧</div>
|
||||
<div class="fr f16 fontGrey2">我在贴吧</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt8">
|
||||
<div class="homepageImageBlock" style="width: 68px !important;">
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="<%= current_language %>">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%=h html_title %></title>
|
||||
<%= render :partial => "layouts/point_browser" %>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "jquery.leanModal.min" %>
|
||||
<%= javascript_include_tag 'seems_rateable/jRating','prettify', 'seems_rateable/rateable'%>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public', 'css/moduel', 'css/font-awesome', 'css/popup', :media => 'all'%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
</head>
|
||||
<body class="<%=h body_css_classes %>" onload="prettyPrint();">
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="navContainer mb10">
|
||||
<% if User.current.logged? %>
|
||||
<%= render :partial => 'layouts/logined_header',:locals=>{:name=>@name,:type=>@type} %>
|
||||
<% else%>
|
||||
<%= render :partial => 'layouts/unlogin_header',:locals=>{:name=>@name,:type=>@type} %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<div id="main" class="nosidebar">
|
||||
<div id="content_">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= stylesheet_link_tag 'css/common','css/structure','css/public','css/forum','css/popup' ,:media => 'all'%>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
|
||||
<!--add by huang-->
|
||||
<body onload="prettyPrint();">
|
||||
<div class="navContainer mb10"> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="Container">
|
||||
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
<% if hidden_unproject_infos %>
|
||||
<%= render :partial => 'layouts/new_feedback' %>
|
||||
<% end %>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
showMathMenu: false,
|
||||
showMathMenuMSIE: false,
|
||||
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
|
||||
});
|
||||
</script>
|
||||
<%= javascript_include_tag('jquery-1.8.3-ui-1.9.2-ujs-2.0.3', 'application', 'jquery.colorbox-min') %>
|
||||
</html>
|
||||
|
|
@ -156,7 +156,7 @@
|
|||
<% unless memo.nil? %>
|
||||
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
|
||||
<% end %>
|
||||
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank">贴吧交流</a></li>
|
||||
<li class="fl"><a href="<%= forums_path %>" class="f_grey mw20" target="_blank">问吧交流</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -410,7 +410,7 @@
|
|||
<% unless memo.nil? %>
|
||||
<li><a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="fl">帮助中心</a></li>
|
||||
<% end %>
|
||||
<li><a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="fl"> 贴吧交流</a></li>
|
||||
<li><a href="<%= forums_path %>" target="_blank" class="fl"> 问吧交流</a></li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<p>Copyright 2007~2016 All Rights Reserved<br>湘ICP备09019772</p>
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<% unless memo.nil? %>
|
||||
<li class="fl"><a href="javascript:void(0);" class="f_grey mw20" target="_blank">帮助中心</a>|</li>
|
||||
<% end %>
|
||||
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">贴吧交流</a></li>
|
||||
<li class="fl"><a href="javascript:void(0);" class=" f_grey mw20" target="_blank">问吧交流</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -62,7 +62,10 @@
|
|||
<%= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_09" class="user_icons_myissues">
|
||||
<%= link_to "我的Issue", user_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
|
||||
<%= link_to "我发布的issue", user_manage_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_10" class="user_icons_myissues">
|
||||
<%= link_to "我收到的issue", user_receive_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/common', 'css/structure', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/common', 'css/structure', 'css/font-awesome', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user"%>
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
<div class="user_leftinfo mb10">
|
||||
<% if User.current.logged? && User.current == @user%>
|
||||
<div class="pr" style="width: 80px; margin:0 auto;">
|
||||
<%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_source_tx'),
|
||||
<%= link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_source_tx'),
|
||||
my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true %>
|
||||
<div class="homepageEditProfile undis">
|
||||
<%=link_to '', my_clear_user_avatar_temp_path, :class => 'homepageEditProfileIcon', :remote => true, :title => '点击编辑Logo' %>
|
||||
|
@ -159,38 +159,29 @@
|
|||
</div>
|
||||
</div>
|
||||
<% if is_current_user %>
|
||||
<div class="home-user-leftnav">
|
||||
<h3 >
|
||||
<%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" , :target => "_blank", :style => "color:#666" %>
|
||||
</h3>
|
||||
<%# if hidden_unproject_infos %>
|
||||
<% if hidden_unproject_infos && user_course_count > 0 %>
|
||||
<div class="home-user-leftnav">
|
||||
<h3 >
|
||||
<%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" , :target => "_blank", :style => "color:#666" %>
|
||||
</h3>
|
||||
<%# if hidden_unproject_infos %>
|
||||
<ul>
|
||||
<li class="home-user-leftnav-li icons-class clear">
|
||||
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;font-size: 11px;background-color:#f5f2f2;color:#666;'>#{user_course_count}</span>".html_safe : "课程",
|
||||
user_course_community_path(User.current), :id => "user_course_list", :target => "_blank" %>
|
||||
<!-- <div class="user_navmore_box" >
|
||||
<ul>
|
||||
<li class="user_navmore_icons">
|
||||
<ul class="user_navmore_txt02" >
|
||||
<%# if is_current_user %>
|
||||
<li>
|
||||
<%#= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= link_to "加入班级", join_private_courses_courses_path, :remote => true, :method => "post", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<#% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>-->
|
||||
user_course_community_path(User.current), :id => "user_course_list", :target => "_blank" %>
|
||||
</li>
|
||||
<% if user_manage_homework_count > 0 %>
|
||||
<li class="home-user-leftnav-li icons-homework clear">
|
||||
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl", :style => "color:#666" %>
|
||||
<%= link_to user_manage_homework_count > 0 ? "我发布的作业<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_manage_homework_count}</span>".html_safe : "我发布的作业",
|
||||
user_manage_homeworks_user_path(@user), :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if user_receive_homework_count > 0 %>
|
||||
<li class="home-user-leftnav-li icons-homework clear">
|
||||
<%= link_to "我收到的作业<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_receive_homework_count}</span>".html_safe,
|
||||
user_receive_homeworks_user_path(@user), :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="home-user-leftnav-li icons-doc clear">
|
||||
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :class => "fl", :style => "color:#666" %>
|
||||
</li>
|
||||
|
@ -198,77 +189,72 @@
|
|||
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank", :class => "fl", :style => "color:#666" %>
|
||||
</li>
|
||||
</ul>
|
||||
<%# end %>
|
||||
</div>
|
||||
|
||||
<div class="home-user-leftnav">
|
||||
<h3 >
|
||||
<%= link_to "项目社区", user_project_community_path(User.current), :class => "fl", :target => "_blank", :style => "color:#666" %>
|
||||
</h3>
|
||||
<ul>
|
||||
<li class="home-user-leftnav-li icons-project clear">
|
||||
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_project_count}</span>".html_safe : "项目",
|
||||
user_project_community_path(User.current), :id => 'user_project_list', :target => "_blank" %>
|
||||
<!-- <div class="user_navmore_box" >
|
||||
<ul>
|
||||
<li class="user_navmore_icons">
|
||||
<ul class="user_navmore_txt02">
|
||||
<li>
|
||||
<%#= link_to "新建项目", new_project_path(:host => Setting.host_name), :target => "_blank", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<li>
|
||||
<%#= link_to "我的关注", user_watchlist_user_path(@user), :remote => true, :method => "post", :class => "user_navmore_li" %>
|
||||
</li>
|
||||
<!–<li><a href="javascript:void(0);" class="user_navmore_li">发现更多</a></li>–>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>-->
|
||||
</li>
|
||||
<li class="home-user-leftnav-li icons-issue clear">
|
||||
<%= link_to issues_author_is_self_count > 0 ? "我发布的issue<span class='issues_nav_tag mr10 fr'style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:##666;'>#{issues_author_is_self_count}</span>".html_safe : "我发布的issue",
|
||||
user_issues_user_path(@user, :type => "author" ), :target => "_blank" %>
|
||||
</li>
|
||||
<li class="home-user-leftnav-li icons-issue clear">
|
||||
<%= link_to issues_assigned_is_self_count > 0 ? "我收到的issue<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{issues_assigned_is_self_count}</span>".html_safe : "我收到的issue",
|
||||
user_issues_user_path(@user, :type => "assigned"), :target => "_blank" %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="home-user-leftnav">
|
||||
<h3 >
|
||||
<%= link_to "竞赛社区", user_contest_community_path(User.current), :class => "fl" , :target => "_blank"%>
|
||||
</h3>
|
||||
<ul>
|
||||
<li class="home-user-leftnav-li icons-class clear">
|
||||
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{user_contest_count}</span>".html_safe : "竞赛",
|
||||
user_contest_community_path(User.current), :id => "user_contest_list", :target => "_blank" %>
|
||||
</li>
|
||||
</ul>
|
||||
<%# end %>
|
||||
</div>
|
||||
<%# end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if user_project_count > 0%>
|
||||
<div class="home-user-leftnav">
|
||||
<h3 >
|
||||
<%= link_to "项目社区", user_project_community_path(User.current), :class => "fl", :target => "_blank", :style => "color:#666" %>
|
||||
</h3>
|
||||
<ul>
|
||||
<li class="home-user-leftnav-li icons-project clear">
|
||||
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_project_count}</span>".html_safe : "项目",
|
||||
user_project_community_path(User.current), :id => 'user_project_list', :target => "_blank" %>
|
||||
</li>
|
||||
<% if issues_author_is_self_count > 0 %>
|
||||
<li class="home-user-leftnav-li icons-issue clear">
|
||||
<%= link_to issues_author_is_self_count > 0 ? "我发布的issue<span class='issues_nav_tag mr10 fr'style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:##666;'>#{issues_author_is_self_count}</span>".html_safe : "我发布的issue",
|
||||
user_manage_issues_user_path(@user), :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if issues_assigned_is_self_count > 0 %>
|
||||
<li class="home-user-leftnav-li icons-issue clear">
|
||||
<%= link_to issues_assigned_is_self_count > 0 ? "我收到的issue<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{issues_assigned_is_self_count}</span>".html_safe : "我收到的issue",
|
||||
user_receive_issues_user_path(@user), :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if hidden_unproject_infos && user_contest_count > 0 %>
|
||||
<div class="home-user-leftnav">
|
||||
<h3 >
|
||||
<%= link_to "竞赛社区", user_contest_community_path(User.current), :class => "fl" , :target => "_blank"%>
|
||||
</h3>
|
||||
<ul>
|
||||
<li class="home-user-leftnav-li icons-contest clear">
|
||||
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{user_contest_count}</span>".html_safe : "竞赛",
|
||||
user_contest_community_path(User.current), :id => "user_contest_list", :target => "_blank" %>
|
||||
</li>
|
||||
</ul>
|
||||
<%# end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="home-user-leftnav">
|
||||
<h3 >Ta在确实
|
||||
<span class="fr mr5" style="font-size:12px;color: #7f7f7f;"><%= time_tag(@user.created_on).html_safe %></span>
|
||||
</h3>
|
||||
<ul>
|
||||
<li class="home-user-leftnav-li icons-class clear">
|
||||
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag ml140'>#{user_course_count}</span>".html_safe : "课程",
|
||||
user_course_community_path(@user), :id => "user_course_list", :class => "fl", :target => "_blank" %>
|
||||
</li>
|
||||
<% if hidden_unproject_infos && user_course_count > 0 %>
|
||||
<li class="home-user-leftnav-li icons-class clear">
|
||||
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag ml140'>#{user_course_count}</span>".html_safe : "课程",
|
||||
user_course_community_path(@user), :id => "user_course_list", :class => "fl", :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if user_project_count > 0 %>
|
||||
<li class="home-user-leftnav-li icons-project clear">
|
||||
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag ml140'>#{user_project_count}</span>".html_safe : "项目",
|
||||
user_project_community_path(@user), :id => 'user_project_list', :class => "fl", :target => "_blank" %>
|
||||
</li>
|
||||
<li class="home-user-leftnav-li icons-project clear">
|
||||
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag ml140'>#{user_contest_count}</span>".html_safe : "竞赛",
|
||||
user_contest_community_path(@user), :id => 'user_contest_list', :class => "fl", :target => "_blank" %>
|
||||
user_project_community_path(@user), :id => 'user_project_list', :class => "fl", :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if hidden_unproject_infos && user_contest_count > 0 %>
|
||||
<li class="home-user-leftnav-li icons-project clear">
|
||||
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag ml140'>#{user_contest_count}</span>".html_safe : "竞赛",
|
||||
user_contest_community_path(@user), :id => 'user_contest_list', :class => "fl", :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue