Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
c9754259ea
|
@ -144,8 +144,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)
|
||||
|
@ -244,8 +245,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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -93,11 +93,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 +362,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).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).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 = Forum.where(:creator_id => User.current.id).count
|
||||
@my_memos_count = Memo.where(:author_id => 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 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
|
||||
@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,24 @@ 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]
|
||||
result = Forum.find_by_name(forum_name).blank? ? {:result => true} : {:result => false}
|
||||
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 = 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.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, notice: "#{l :label_memo_create_succ}" }
|
||||
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|
|
||||
|
@ -148,7 +137,7 @@ class MemosController < ApplicationController
|
|||
|
||||
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
|
||||
|
@ -157,13 +146,16 @@ class MemosController < ApplicationController
|
|||
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
|
||||
@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
|
||||
|
|
|
@ -4087,6 +4087,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
|
||||
# 我参与的竞赛
|
||||
|
|
|
@ -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
|
||||
|
@ -71,6 +72,13 @@ class WorksController < ApplicationController
|
|||
|
||||
homework.work_status = homework.publish_time > Date.today ? 0 : 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
|
||||
homework_detail_group = WorkDetailGroup.new
|
||||
|
@ -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")}
|
||||
|
@ -3097,20 +3107,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 => "不可修改作品"
|
||||
|
@ -3958,6 +3962,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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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|
|
||||
|
@ -188,6 +188,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 +235,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 +282,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 +344,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 +389,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 +416,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
|
||||
|
||||
|
@ -240,7 +250,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}"
|
||||
|
|
|
@ -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>
|
|
@ -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,7 +3,7 @@
|
|||
<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 %>
|
||||
|
||||
|
@ -38,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 %>
|
||||
|
|
|
@ -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,52 @@
|
|||
<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 => true} do |f| %>
|
||||
<%= render :partial => "forums/form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
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_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 %>',
|
||||
type:'get',
|
||||
data:{
|
||||
forum_name:$("#forum_name").val().trim()
|
||||
},
|
||||
success:function(data){
|
||||
if(data.result == true){
|
||||
alert("提交成功");
|
||||
$("#forum_new").submit();
|
||||
hideModal();
|
||||
return true;
|
||||
}else{
|
||||
alert("提交失败");
|
||||
$("#forum_name_error_tips").html("贴吧名称已存在").show();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error:function(){
|
||||
alert('请检查当前网络连接')
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -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 %>',
|
||||
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 => "" %></h4>
|
||||
<ul class=" fl right-line wenba-rightbar-ul" >
|
||||
<li><%= link_to forum.topic_count, forum_path(forum), :class => "linkGrey5" %></li>
|
||||
<li>回答</li>
|
||||
</ul>
|
||||
<ul class=" fl wenba-rightbar-ul" >
|
||||
<li><%= link_to forum.memo_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,190);
|
||||
|
||||
|
||||
|
|
@ -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,560,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" %> > <%= @forum.name %></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 @@
|
|||
$("#my_count_message").html('<%= escape_javascript( render :partial => 'memos/my_count_message') %>');
|
|
@ -16,18 +16,21 @@
|
|||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "项目", user_project_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "竞赛", user_contest_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 class="navHomepageMenu fl mr20">
|
||||
<%= link_to "贴吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<li class="navHomepageMenu fl mr40">
|
||||
<li class="navHomepageMenu fl mr30">
|
||||
<a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" >公共贴吧</a>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
@ -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' %>-->
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
@ -244,7 +244,7 @@
|
|||
<%= link_to "竞赛社区", user_contest_community_path(User.current), :class => "fl" , :target => "_blank"%>
|
||||
</h3>
|
||||
<ul>
|
||||
<li class="home-user-leftnav-li icons-class clear">
|
||||
<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>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
(如果链接点击无效,请手动复制链接并粘贴到浏览器地址栏中,然后按“回车”打开页面即可)
|
||||
</span>
|
||||
</p>
|
||||
<div style="width: 100%; border-top: 1px solid #ddd; margin:30px 0;"></div>
|
||||
<div style="width: 100%; border-top: 1px solid #ddd; margin:10px 0;"></div>
|
||||
<img src="https://www.trustie.net/images/wechat/trustie_QR.jpg" width="120" height="120" >
|
||||
<p style=" color:#666;">
|
||||
扫一扫,关注 Trustie 微信公众号,更方便获任务通知,作业等提醒<br/>
|
||||
|
|
|
@ -1,3 +1,111 @@
|
|||
<%= error_messages_for 'bid' %>
|
||||
<p><%= f.text_field :content, :required => true, :size => 60, :style => "width:150px;" %></p>
|
||||
<p><%= hidden_field_tag 'subject'||=@memo.subject %>
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
||||
<div class="wenba-tiwenbox fl mr10 mb10">
|
||||
<div class="wenba-tiwen-con">
|
||||
<ul >
|
||||
<li class="mb10">
|
||||
<%= f.text_field :subject, :no_label => true, :id => "memo_subject", :maxlength => "50", :style => "width:708px", :onblur => "check_memo_name();", :onfocus => "$('#memo_name_error_tips').hide();", :onmouseover => "this.style.borderColor='#d9d9d9'", :class => "wenba-tiwen-input", :placeholder => "请输入标题" %>
|
||||
<p class="c_red" style="display: none" id="memo_name_error_tips"></p>
|
||||
<script>
|
||||
var textarea1 = document.getElementById('memo_subject');
|
||||
autoTextarea(textarea1);
|
||||
</script>
|
||||
</li>
|
||||
<li class="mb10">
|
||||
<%= f.kindeditor :content, :editor_id => "memo_content", :height => 300, :no_label => true %>
|
||||
</li>
|
||||
<p class="c_red" style="display: none" id="memo_contents_error_tips"></p>
|
||||
<li class="clear mb10">
|
||||
<%= render :partial => 'forums/file_form', :locals => {:container => @memo} %>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="wenba-tagbox clearfix">
|
||||
<h3 class="mb5 c_red" id="memo_classify_tips">请选择分类</h3>
|
||||
<% @forums.each do |forum| %>
|
||||
<li class="hidden" style="max-width: 200px;"><a href="javascript:void(0)" class="wenba-tiwen-tag" name="<%= forum.name %>" id="forums_question_<%= forum.id %>" onclick="add_forum('forums_question_<%= forum.id %>')" ><%= forum.name %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<input type="text" style="display: none" id="forum_name" name="forum_name" value="">
|
||||
<div class="clear ">
|
||||
<%= link_to "取消", forum_path(@forum), :class => "btn fr" %>
|
||||
<a href="javascript:void(0);" class="btn btn-blue fr mr5" onclick="memo_commit();">确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#forums_question_"+<%= params[:forum_id] %>).addClass("wenba-tiwen-tag-active");
|
||||
});
|
||||
function add_forum(id){
|
||||
$("#memo_classify_tips").attr('style','color: #333;');
|
||||
$('a').removeClass("wenba-tiwen-tag-active");
|
||||
$("#"+id).addClass("wenba-tiwen-tag-active");
|
||||
}
|
||||
function check_memo_name(){
|
||||
if($("#memo_subject").val().trim().length > 50){
|
||||
$("#memo_name_error_tips").html("主题 过长(最长为 50 个字符)").show();
|
||||
return false;
|
||||
}
|
||||
if(memo_content.html().length > 20000){
|
||||
$("#memo_contents_error_tips").html("内容 过长(最长为 20000 个字符)").show();
|
||||
$("html,body").animate({scrollTop:$("#memo_contents_error_tips").offset().top},1000);
|
||||
return false;
|
||||
}
|
||||
if($("#memo_subject").val().trim() == ""){
|
||||
$("#memo_name_error_tips").html("标题不能为空").show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
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()){
|
||||
$("#memo_error_tips").html("主题和内容不能为空").show();
|
||||
}
|
||||
else if($("textarea[name='memo[subject]']").val().trim() == "" && !memo_content.isEmpty() ){
|
||||
$("#memo_error_tips").html("主题不能为空").show();
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.isEmpty()){
|
||||
$("#memo_error_tips").html("内容不能为空").show();
|
||||
}
|
||||
}
|
||||
var first_click = true;
|
||||
function memo_commit(){
|
||||
$("#memo_name_error_tips").hide();
|
||||
$("#memo_contents_error_tips").hide();
|
||||
var f_name = $('.wenba-tiwen-tag-active').attr('name');
|
||||
$("#forum_name").attr('value',f_name);
|
||||
if($("#memo_subject").val().trim() != "" && !memo_content.isEmpty() && first_click && $("#forum_name").attr('value') != ""){
|
||||
// alert($("#forum_name").attr('name'));
|
||||
memo_content.sync();
|
||||
$("#new_memo").submit();
|
||||
} else if($("#memo_subject").val().trim() == ""){
|
||||
$("#memo_name_error_tips").html("标题不能为空").show();
|
||||
}else if(memo_content.isEmpty()){
|
||||
$("#memo_contents_error_tips").html("内容不能为空").show();
|
||||
}else if ($("#forum_name").attr('value')== ""){
|
||||
alert("请选择分类");
|
||||
$("#memo_classify_tips").attr('style','color: #F00;');
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,157 @@
|
|||
<div class="homepageLeft-new">
|
||||
<div class="postDetailContainer">
|
||||
<div class="fl mr10 pr"> <%= link_to image_tag(url_to_avatar(@forum.creator),:width => 75,:height => 75,:alt => '贴吧图像' ), user_path( @forum.creator) %>
|
||||
<!--<div class="homepageEditProfile"><a href="javascript:void(0);" class="homepageEditProfileIcon"></a></div>-->
|
||||
</div>
|
||||
<div class="fl" style="width: 120px;">
|
||||
<% user_name = @forum.creator.show_name.empty? ? @forum.creator.name : @forum.creator.show_name %>
|
||||
<div class="fl mb8 mt10">吧主:</div>
|
||||
<a href="<%= user_path(@forum.creator)%>" target="_blank" class="linkBlue w80 fl mb8 mt10" style="overflow: hidden;white-space: nowrap;text-overflow:ellipsis; "><%= user_name %></a>
|
||||
<div class="fontGrey3 fl">回答:<a href="javascript:void(0);" class="linkOrange mr5" style="cursor: default"><%= @my_replies_count %></a> 帖子:<a href="javascript:void(0);" class="linkOrange" style="cursor: default"><%= @my_topic_count %></a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="fl">
|
||||
<%= link_to @forum.name, forum_path(@forum), :class => "f16 fontBlue", :style => "word-break: break-all; word-wrap:break-word;white-space:pre-wrap;" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="fontGrey2 mt10">
|
||||
<span id="forum_desc_span" style="word-break:normal; width:auto; display:block; white-space:pre-wrap;word-wrap : break-word ;overflow: hidden ;"><%= h @forum.description.html_safe%></span>
|
||||
<% if @forum.creator.id == User.current.id %>
|
||||
<a href="javascript:void(0);" onclick="edit_desc();">
|
||||
<%= image_tag('signature_edit.png',{:width => 12,:height => 12}) %>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--<div class="mt15">-->
|
||||
<!--<div id="forum_tag_list">-->
|
||||
<!--<%#= render :partial => 'forums/forum_tag_list', :locals => {:forum => @forum} %>-->
|
||||
<!--</div>-->
|
||||
<!--<%# if(@forum.creator.id == User.current.id) %>-->
|
||||
<!--<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();">+ 添加标签</a>-->
|
||||
<!--<%# end %>-->
|
||||
<!--<span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l">-->
|
||||
<!--<input type="text" name="addTag" size="20" class="isTxt w90 f_l" maxlength="<%#= Setting.tags_max_length %>" minlength="<%#= Setting.tags_min_length%>" />-->
|
||||
<!--<input type="button" class="submit f_l" onclick="addTag();" />-->
|
||||
<!--</span></div>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
<% if @forum.creator.id == User.current.id %>
|
||||
<span class="postEdit"></span>
|
||||
<%= link_to "编辑贴吧", edit_forum_path(@forum), :class => "linkGrey3", :remote => true %>
|
||||
<a href="javascript:void(0);" data-method="delete" onclick="del_forum_confirm();" class="fr linkGrey3">删除贴吧</a>
|
||||
<a href="<%= forum_path(@forum) %>" data-method="delete" id="del_link" type="hidden"></a>
|
||||
<span class="postDelete"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% unless params[:controller] == "forums" %>
|
||||
<div class="f1">
|
||||
<%= link_to "<span class='btn-big-blue mt10'>我要提问</span>".html_safe, new_forum_memo_path(:forum_id => @forum) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<script>
|
||||
var desc;
|
||||
function edit_desc(){
|
||||
desc = $("#forum_desc_span").html();
|
||||
$("#forum_desc_span").html("<textarea id='forum_desc_input' onblur='change_forum_desc();' style='width: 200px;height: 80px; max-width: 207px; max-height: 80px; border: 1px solid #d9d9d9;outline: none;margin: 0px 0px 12px 0px;'>" + desc + "</textarea>");
|
||||
$("#forum_desc_input").focus();
|
||||
}
|
||||
|
||||
function change_forum_desc(){
|
||||
$.ajax({
|
||||
url: '<%= update_memo_description_forum_path(@forum) %>',
|
||||
type: 'post',
|
||||
data:{"forum[description]":$("#forum_desc_input").val().trim()},
|
||||
success:function(data){
|
||||
if(data.result == true){
|
||||
$("#forum_desc_input").hide();
|
||||
$("#forum_desc_span").html($("#forum_desc_input").val().trim());
|
||||
}else{
|
||||
alert("保存失败");
|
||||
$("#forum_desc_input").hide();
|
||||
$("#forum_desc_span").html(desc);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function delete_forum_tag(doc){
|
||||
tag_name = doc.parent().children().eq(0).html().trim();
|
||||
$.ajax(
|
||||
"<%= delete_forum_tag_forum_path(@forum)+ '.js?tag_name='%>"+tag_name,
|
||||
{},
|
||||
function(data){
|
||||
alert(data == true)
|
||||
if(data == true){
|
||||
doc.parent().remove();
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function addTag(){
|
||||
if(<%=@forum.creator.id == User.current.id%>) {
|
||||
if ($("input[name='addTag']").val().trim() != "" ) {
|
||||
if($("input[name='addTag']").val().trim().length <= 120) {
|
||||
$.get(
|
||||
'<%= add_forum_tag_forum_path(@forum)%>' + "?tag_str=" + $("input[name='addTag']").val(),
|
||||
{}
|
||||
);
|
||||
$("input[name='addTag']").val('');
|
||||
}else{
|
||||
alert("标签名字长度不能超过120个字符");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var tagName; //标签的值
|
||||
var parentCssBorder; //当前双击的链接的父节点
|
||||
var ele; //当前双击的链接
|
||||
var taggableId; //标签的id
|
||||
var taggableType; //被标签的类型
|
||||
//这里renameTag有两种情况,一种是改变某个资源的tag名称。如果其他资源也有这个tag。则新增一个改变后的tag名
|
||||
//第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。
|
||||
//目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id,就是第一种情况。如果没有id。就是第二种情况
|
||||
function rename_tag(domEle,name,id,type){
|
||||
if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动
|
||||
return;
|
||||
}
|
||||
tagNameHtml = domEle.parent().html();
|
||||
tagName = name;
|
||||
parentCssBorder = domEle.parent().css("border");
|
||||
ele = domEle;
|
||||
taggableId = id;
|
||||
taggableType = type;
|
||||
width = parseInt(domEle.css('width').replace('px','')) >=100 ? parseInt(domEle.css('width').replace('px','')) : 100;
|
||||
domEle.html('<input name="" id="renameTagName" maxlength="<%=Setting.tags_max_length%>" minlength="<%= Setting.tags_min_length%>" style="width:'+width+'px;" value="'+name+'"/>');
|
||||
domEle.parent().css("border","1px solid #ffffff");
|
||||
$("#renameTagName").focus();
|
||||
}
|
||||
$("#renameTagName").live('blur',function(){
|
||||
if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
|
||||
if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
|
||||
}else{ //否则就要更新tag名称了
|
||||
if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){
|
||||
$.post(
|
||||
'<%= update_tag_name_path %>',
|
||||
{"taggableId": taggableId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim()}
|
||||
)
|
||||
}else{
|
||||
ele.parent().css("border","");
|
||||
ele.parent().html(tagNameHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
function del_forum_confirm(){
|
||||
if(confirm('您确定要删除么?')){
|
||||
$("#del_link").click();
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,33 @@
|
|||
<div class="wenba-tiwenbox">
|
||||
<div class="wenba-tiwen-con" >
|
||||
<ul>
|
||||
<li class="mb10 ">
|
||||
<input type="text" placeholder="请输入标题" class="wenba-tiwen-input ">
|
||||
</li>
|
||||
<li class="mb10">
|
||||
<textarea placeholder=" 请输入描述详情" class="wenba-tiwen-textarea"></textarea>
|
||||
</li>
|
||||
<li class="clear mb10">
|
||||
<button class="sub_btn fl " name="button" type="button">上传附件</button>
|
||||
<p class="fl ml5 mt3 c_grey">(未选择文件) 您可以上传小于<span class="c_red">50MB</span>的文件</p>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="wenba-tagbox clearfix">
|
||||
<h3 class="mb5">请选择分类(<span class="c_red">1</span>个)</h3>
|
||||
<li><a href="javascript:void(0);" class="wenba-tiwen-tag wenba-tiwen-tag-active">新手讨论吧</a></li>
|
||||
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">网站建议吧</a></li>
|
||||
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">技术动态吧</a></li>
|
||||
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">教程共享吧</a></li>
|
||||
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">创业吧</a></li>
|
||||
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">互联网新闻</a></li>
|
||||
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">开源创新吧</a></li>
|
||||
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">网站新闻吧</a></li>
|
||||
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">技术知识交流</a></li>
|
||||
<li><a href="javascript:void(0);" class="wenba-tiwen-tag">假日问候吧</a></li>
|
||||
</ul>
|
||||
<div class="clear ">
|
||||
<button class=" btn btn-blue fr ">确定</button >
|
||||
<button class=" btn fr mr5">取消</button >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
<%#= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
|
||||
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %>
|
||||
<a href="<%= praise_tread_praise_plus_path({:obj_id=>obj.id,:obj_type=>obj.class,:horizontal => horizontal })%>" data-remote="true" class="linkGrey2 postLikeIcon mr30" title="<%= l(:label_issue_praise)%>" > <%= get_praise_num(obj)%></a>
|
||||
<a href="<%= praise_tread_praise_plus_path({:obj_id=>obj.id,:obj_type=>obj.class,:horizontal => horizontal })%>" data-remote="true" class="<%= params[:controller] == 'memos' ? 'linkGrey2 postLikeIcon': 'linkGrey2 postLikeIcon mr30' %>" title="<%= l(:label_issue_praise)%>" > <%= get_praise_num(obj)%></a>
|
||||
<!--<%# else %>-->
|
||||
|
||||
<!--<%#= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),-->
|
||||
|
|
|
@ -39,33 +39,19 @@
|
|||
}
|
||||
}
|
||||
</script>
|
||||
<div class="homepageRightBanner mt15">
|
||||
<div class="NewsBannerName">编辑帖子</div>
|
||||
<div class="banner-big f16 fontGrey3 mb10">
|
||||
<%= link_to "问吧", forums_path, :class => "c_blue" %> > <%= link_to @forum.name, forum_path(@forum), :class => "c_blue" %> >
|
||||
<%= @memo.subject %>
|
||||
</div>
|
||||
<div class="postRightContainer" style="margin-top: 15px">
|
||||
<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo),:html=>{:id=>'edit_memo'}) do |f| %>
|
||||
<div id="error" style="color:red ;display: none">
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<textarea type="text" id="memo_subject" name="memo[subject]" maxlength="50" class="postDetailInput" placeholder="对应帖子标题" ><%= @memo.subject%></textarea>
|
||||
<script>
|
||||
var ta = document.getElementById('memo_subject')
|
||||
autoTextarea(ta)
|
||||
</script>
|
||||
</div>
|
||||
<div class="mt15">
|
||||
<%= kindeditor_tag 'memo[content]',@memo.content,:height=>300,:editor_id=>'memo_content'%>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<!--<a href="javascript:void(0);" class="AnnexBtn fl mt3">对应附件名称</a>-->
|
||||
<%= render :partial => 'forums/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="<%= forum_memo_path(@memo.forum,@memo)%>" class="linkGrey2 mr10">取消</a><span class="mr10 fontGrey">或</span></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo),:html=>{:id => 'new_memo'}) do |f| %>
|
||||
<%= render :partial => "memos/form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
<div class="fl">
|
||||
<%= render :partial => "memos/my_count_message" %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
limitStrsize('memo_subject',50);
|
||||
|
|
|
@ -1,35 +1,6 @@
|
|||
<% @nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<!-- <h1>New memo</h1> -->
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<div class="banner-big f16 fontGrey3 mb10"><%= link_to "问吧", forums_path, :class => "c_blue" %> > <%= link_to @forum.name, forum_path(@forum), :class => "c_blue" %> > 我要提问</div>
|
||||
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %>
|
||||
<%= render :partial => "memos/form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="top-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style="width: 240px; color: #15bccf"><%= l(:label_projects_community)%></td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><%= link_to request.host()+"/forums", forums_path %></td>
|
||||
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to l(:label_forum), :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name %></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<h3><%=l(:label_memo_new)%></h3>
|
||||
<div class="box tabular">
|
||||
<div style="width:780px">
|
||||
<%= render :partial => 'memos/topic_form' %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<%= render :partial => "forums/my_count_message" %>
|
|
@ -3,6 +3,10 @@
|
|||
<%= javascript_include_tag 'forum' %>
|
||||
<% end %>
|
||||
|
||||
<div class="banner-big f16 fontGrey3 mb10">
|
||||
<%= link_to "问吧", forums_path, :class => "c_blue" %> > <%= link_to @forum.name, forum_path(@forum), :class => "c_blue" %> > <%=h @memo.subject %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
sd_create_editor_from_data(<%= @memo.id%>,null,"100%", "<%=@memo.class.to_s%>");
|
||||
|
@ -16,7 +20,7 @@
|
|||
}
|
||||
}
|
||||
</script>
|
||||
<div class="postRightContainer">
|
||||
<div class="postRightContainer mr10">
|
||||
<div class="postThemeContainer">
|
||||
<div class="postDetailPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(@memo.author),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path(@memo.author) %>
|
||||
|
@ -96,6 +100,12 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fl">
|
||||
<%= render :partial => "memos/my_count_message" %>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#activity_description_<%= @memo.id %> p,#activity_description__<%= @memo.id %> span,#activity_description_<%= @memo.id %> em").each(function(){
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container).children();
|
||||
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();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
sd_create_editor_from_data(<%= @topic.id%>,null,"100%", "<%=@topic.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @topic.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @topic.id%>').show();" onmouseout="$('#message_setting_<%= @topic.id%>').hide();">
|
||||
<div class="postThemeContainer">
|
||||
<div class="postDetailPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(@topic.author), :width => 50, :height => 50,:alt=>'图像' ), user_path(@topic.author) %>
|
||||
</div>
|
||||
<div class="postThemeWrap">
|
||||
<% if User.current.logged? %>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @topic.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:action => 'edit', :id => @topic},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.contest_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => @topic},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.contest_destroyable_by?(User.current) %>
|
||||
</li>
|
||||
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="postDetailTitle fl break_full_word">
|
||||
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @topic.subject%></a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="postDetailCreater">
|
||||
<%= link_to @topic.author.show_name, user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostIntro memo-content upload_img break_full_word ke-block" id="message_description_<%= @topic.id %>" >
|
||||
<%= @topic.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @topic} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= @reply_count>0 ? "(#{@reply_count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=@topic.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@topic, :user_activity_id=>@topic.id,:type=>"activity"}%>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<%# all_comments = []%>
|
||||
<%# comments = get_all_children(all_comments, @topic) %>
|
||||
<div class="" id="reply_div_<%= @topic.id %>">
|
||||
<%= render :partial => "messages/contest_show_replies" %>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<% if !@topic.locked? && User.current.logged? %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @topic.id %>">
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
|
||||
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
|
||||
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "grey_btn fr c_white mt10 mr5 ml10" %>
|
||||
<%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'course_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#message_description_<%= @topic.id %> p,#message_description_<%= @topic.id %> span,#message_description_<%= @topic.id %> em").each(function(){
|
||||
var postContent = $(this).html();
|
||||
postContent = postContent.replace(/ /g," ");
|
||||
postContent= postContent.replace(/ {2}/g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
$(this).html(postContent);
|
||||
});
|
||||
autoUrl('message_description_<%= @topic.id %>');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,60 @@
|
|||
<% @replies.each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
autoUrl('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=reply.id %>').show();" onmouseout="$('#delete_reply_<%=reply.id %>').hide();">
|
||||
<%= render :partial => 'users/message_contents', :locals => {:comment => reply, :type => 'Message', :user_activity_id => @topic.id}%>
|
||||
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
</div>
|
||||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span class="reply_praise_count_<%= reply.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:action => 'quote', :id => reply},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<span id="reply_iconup_<%= reply.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||
</span>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => reply},
|
||||
:method => :post,
|
||||
:id => "delete_reply_#{reply.id}",
|
||||
:class => 'fr mr20 undis',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.contest_destroyable_by?(User.current) %>
|
||||
</span>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @limit_count > @page * @limit + 10 %>
|
||||
<div id="more_message_replies">
|
||||
<div class="detail_cont_hide clearfix">
|
||||
<span class="orig_icon" >↓ </span>
|
||||
<span class="orig_icon" style="display:none;" > ↑</span>
|
||||
<%= link_to '点击展开更多回复', board_message_path(@topic.board_id, @topic, :page => @page),:remote=>true %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -7,6 +7,8 @@ $("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(re
|
|||
|
||||
<%elsif @course%>
|
||||
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
<%elsif @contest%>
|
||||
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/contest_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% elsif @org_subfield %>
|
||||
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'organizations/org_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
<%end%>
|
||||
|
|
|
@ -24,6 +24,19 @@
|
|||
:locals => {:f => f, :edit_mode => true, :topic => @message, :course => @message.course} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% elsif @message.contest %>
|
||||
<div nhname="topic_form">
|
||||
<%= form_for @message, {
|
||||
:as => :message,
|
||||
:url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board},
|
||||
:html => {:multipart => true,
|
||||
:id => 'message-form',
|
||||
:method => :post}
|
||||
} do |f| %>
|
||||
<%= render :partial => 'boards/contest_message_edit',
|
||||
:locals => {:f => f, :edit_mode => true, :topic => @message, :contest => @message.contest} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% elsif @message.board.org_subfield %>
|
||||
<%= form_for @message, {
|
||||
:as => :message,
|
||||
|
|
|
@ -7,6 +7,8 @@ $("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(re
|
|||
|
||||
<%elsif @course%>
|
||||
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
<%elsif @contest%>
|
||||
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/contest_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% elsif @org_subfield %>
|
||||
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'organizations/org_message_post_reply', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
<%end%>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<%= render :partial => 'project_show', locals: {project: @project} %>
|
||||
<% elsif @course %>
|
||||
<%= render :partial => 'course_show', locals: {course: @course} %>
|
||||
<% elsif @contest %>
|
||||
<%= render :partial => 'contest_show', locals: {contest: @contest} %>
|
||||
<% else %>
|
||||
<%= render :partial => 'org_subfield_show', :locals => {:org_subfield => @org_subfield} %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%= form_for('new_form', :remote => true, :method => :post,:url => add_score_student_work_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=>250),:maxlength => 250 %>
|
||||
<%= 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>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% member = ContestMember.where("user_id = #{@user.id} and contest_id = #{contest.id}").first %>
|
||||
<% if User.current == @user %>
|
||||
<% if member %>
|
||||
<%= link_to "", cancel_or_collect_user_path(@user, :contest => contest.id), :class => "#{member.is_collect == true ? 'icons_project_favorite mt3' : 'icons_project_star mt3'}", :target => '_blank', :remote => true, :title => "#{member.is_collect == true ? '点击将其从个人主页的项目列表中移除' : '点击将其添加至个人主页的项目列表中'}" %>
|
||||
<%= link_to "", cancel_or_collect_user_path(@user, :contest => contest.id), :class => "#{member.is_collect == true ? 'icons_project_favorite mt3' : 'icons_project_star mt3'}", :target => '_blank', :remote => true, :title => "#{member.is_collect == true ? '点击将其从左侧导航的竞赛列表中移除' : '点击将其添加至左侧导航的竞赛列表中'}" %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if member %>
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
<div>
|
||||
<p class="fl sy_p_grey">
|
||||
更新时间:<%= format_date(contest.updated_at) %>
|
||||
<% contestUser = User.where("id=?", contest.user_id).first %>
|
||||
单位:<%= contestUser.user_extensions.school_id.blank? ? "无" : contestUser.user_extensions.school.name %>
|
||||
创建者:<%= contest.user.show_name %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" onmouseover="$('#message_setting_<%= user_activity_id%>').show();" onmouseout="$('#message_setting_<%= user_activity_id%>').hide();">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author, :host => Setting.host_user), :alt => "用户头像" %>
|
||||
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word">
|
||||
<%= link_to activity.author.show_name, user_path(activity.author, :host=>Setting.host_user), :class => "newsBlue mr15" %>
|
||||
TO
|
||||
<% str = is_course == 1 ? "#{activity.board.parent.nil? ? '竞赛讨论区' : activity.board.name}" : activity.contest.name.to_s+" | #{activity.board.parent.nil? ? '竞赛讨论区' : activity.board.name}" %>
|
||||
<%= link_to str, contest_boards_path(activity.contest), :class => "newsBlue ml15"%>
|
||||
</div>
|
||||
<div class="homepagePostTitle hidden m_w530 fl">
|
||||
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
|
||||
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
|
||||
<% else %>
|
||||
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if activity.sticky == 1 %>
|
||||
<span class="sticky_btn_cir ml10">置顶</span>
|
||||
<% end%>
|
||||
<% if activity.locked %>
|
||||
<span class="locked_btn_cir ml10 fl" title="已锁定"> </span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate fl">
|
||||
发帖时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(ContestActivity.where("contest_act_type='#{activity.class}' and contest_act_id =#{activity.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if activity.parent_id.nil? %>
|
||||
<% content = activity.content %>
|
||||
<% else %>
|
||||
<% content = activity.parent.content %>
|
||||
<% end %>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= user_activity_id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
|
||||
:class => 'postOptionLink'
|
||||
) if activity.contest_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.contest_destroyable_by?(User.current) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="homepagePostReply">
|
||||
<div id="activity_post_reply_<%=user_activity_id %>">
|
||||
<%=render :partial => 'users/contest_message_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
user_card_show_hide();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,35 @@
|
|||
<% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %>
|
||||
<% count = all_replies.count %>
|
||||
<% no_children_comments = get_no_children_comments all_replies %>
|
||||
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :expand_more =>no_children_comments[:three_more]} %>
|
||||
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<%= render :partial => 'users/message_replies', :locals => {:comments => no_children_comments[:no_children_comments], :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id}%>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !activity.locked? %>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue