user score merge
This commit is contained in:
commit
f0b497e455
|
@ -1,4 +1,5 @@
|
|||
/.project
|
||||
/.idea
|
||||
/.bundle
|
||||
|
||||
/config/database.yml
|
||||
|
|
6
Gemfile
6
Gemfile
|
@ -1,5 +1,11 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
# unix-like only
|
||||
gem 'iconv'
|
||||
gem 'rubyzip'
|
||||
gem 'zip-zip'
|
||||
end
|
||||
gem "rails", "3.2.13"
|
||||
gem "jquery-rails", "~> 2.0.2"
|
||||
gem "i18n", "~> 0.6.0"
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,2 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -0,0 +1,4 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
|
@ -0,0 +1,4 @@
|
|||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
|
@ -150,6 +150,7 @@ class AttachmentsController < ApplicationController
|
|||
ori = Attachment.find_by_id(attach_id)
|
||||
next if ori.blank?
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = obj
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
|
@ -174,7 +175,7 @@ private
|
|||
@attachment = Attachment.find(params[:id])
|
||||
# Show 404 if the filename in the url is wrong
|
||||
raise ActiveRecord::RecordNotFound if params[:filename] && params[:filename] != @attachment.filename
|
||||
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo'
|
||||
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication'
|
||||
@project = @attachment.project
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
|
@ -472,22 +472,22 @@ class BidsController < ApplicationController
|
|||
|
||||
# added by bai type ==1 需求,type==2 竞赛, type==3 作业
|
||||
if @bid.reward_type == 1
|
||||
flash[:notice] = l(:label_bidding_succeed)
|
||||
flash.now[:notice] = l(:label_bidding_succeed)
|
||||
|
||||
elsif @bid.reward_type == 2
|
||||
flash[:notice] = l(:label_bidding_contest_succeed)
|
||||
flash.now[:notice] = l(:label_bidding_contest_succeed)
|
||||
|
||||
else @bid.reward_type == 3
|
||||
flash[:notice] = l(:label_bidding_homework_succeed)
|
||||
flash.now[:notice] = l(:label_bidding_homework_succeed)
|
||||
end
|
||||
# end
|
||||
|
||||
end
|
||||
else
|
||||
if @bid.reward_type == 3
|
||||
flash[:error] = l(:label_bidding_homework_fail)
|
||||
flash.now[:error] = l(:label_bidding_homework_fail)
|
||||
else
|
||||
flash[:error] = l(:label_bidding_fail)
|
||||
flash.now[:error] = l(:label_bidding_fail)
|
||||
end
|
||||
end
|
||||
@bidding_project = @bid.biding_projects
|
||||
|
|
|
@ -0,0 +1,494 @@
|
|||
# fq
|
||||
# class BidsController < ApplicationController
|
||||
class ContestsController < ApplicationController
|
||||
menu_item :respond
|
||||
menu_item :project, :only => :show_project
|
||||
menu_item :application, :only => :show_softapplication
|
||||
before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward,
|
||||
:show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
|
||||
|
||||
# added by fq
|
||||
before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest]
|
||||
# end
|
||||
before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ]
|
||||
|
||||
helper :watchers
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
include ApplicationHelper
|
||||
helper :projects
|
||||
helper :words
|
||||
|
||||
|
||||
def index
|
||||
# @contests = Contest.visible
|
||||
# @contests ||= []
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@contests = Contest.visible
|
||||
@contests = @contests.like(params[:name]) if params[:name].present?
|
||||
@contest_count = @contests.count
|
||||
@contest_pages = Paginator.new @contest_count, @limit, params['page']
|
||||
|
||||
@offset ||= @contest_pages.reverse_offset
|
||||
if params[:contest_sort_type].present?
|
||||
case params[:contest_sort_type]
|
||||
when '0'
|
||||
unless @offset == 0
|
||||
@contests = @contests.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @contest_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@contests = @contests.offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 0
|
||||
when '1'
|
||||
unless @offset == 0
|
||||
@contests = @contests.reorder('contests.commit').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @contest_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@contests = @contests.reorder('contests.commit').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 1
|
||||
when '2'
|
||||
unless @offset == 0
|
||||
@contests = @contests.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @contest_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@contests = @contests.offset(@offset).limit(@limit).all.reverse
|
||||
end
|
||||
@s_state = 0
|
||||
end
|
||||
else
|
||||
unless @offset == 0
|
||||
@contests = @contests.reorder('contests.commit').offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @contest_count % @limit
|
||||
limit = @limit if limit == 0
|
||||
@contests = @contests.reorder('contests.commit').offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
@s_state = 1
|
||||
end
|
||||
end
|
||||
|
||||
def show_contest
|
||||
@user = @contest.author
|
||||
@jours = @contest.journals_for_messages.order('created_on DESC')
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
@state = false
|
||||
|
||||
respond_to do |format|
|
||||
layout_file = 'base_newcontest'
|
||||
format.html {
|
||||
render :layout => layout_file
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def join_in_contest
|
||||
if params[:contest_password] == @contest.password
|
||||
JoinInCompetition.create(:user_id => User.current.id, :competition_id => @contest.id)
|
||||
@state = 0
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} }
|
||||
end
|
||||
end
|
||||
|
||||
def unjoin_in_contest
|
||||
|
||||
joined = JoinInCompetition.where('competition_id = ? and user_id = ?', @contest.id, User.current.id)
|
||||
|
||||
joined.each do |join|
|
||||
join.delete
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} }
|
||||
end
|
||||
end
|
||||
|
||||
def new_join
|
||||
|
||||
|
||||
end
|
||||
|
||||
def show_participator
|
||||
render :layout => 'base_newcontest'
|
||||
|
||||
end
|
||||
|
||||
|
||||
def settings
|
||||
if @contest.author.id == User.current.id
|
||||
@contest = Contest.find(params[:id])
|
||||
render :layout => 'base_newcontest'
|
||||
else
|
||||
render_403 :message => :notice_not_contest_setting_authorized
|
||||
end
|
||||
end
|
||||
|
||||
def show_contest_project
|
||||
contests = Contest.where('parent_id = ?', @contest.id)
|
||||
@projects = []
|
||||
for contest in contests
|
||||
@projects += contest.contesting_projects
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base_newcontest'
|
||||
}
|
||||
format.api
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def show_contest_softapplication
|
||||
contests = Contest.where('parent_id = ?', @contest.id)
|
||||
@softapplications = []
|
||||
for contest in contests
|
||||
@softapplications += contest.contesting_softapplications
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base_newcontest'
|
||||
}
|
||||
format.api
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def show_contest_user
|
||||
contests = Contest.find(:all)
|
||||
@users = []
|
||||
for contest in contests
|
||||
for project in contest.projects
|
||||
@users += project.users
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base_newcontest'
|
||||
}
|
||||
format.api
|
||||
|
||||
end
|
||||
end
|
||||
#显示参赛的项目
|
||||
def show_project
|
||||
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
@option = []
|
||||
# @contesting_project_count = @contesting_project_all.count
|
||||
# @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page']
|
||||
@membership.each do |membership|
|
||||
unless(membership.project.project_type==1)
|
||||
membership.member_roles.each{|role|
|
||||
if(role.role_id == 3)
|
||||
@option << membership.project
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
@user = @contest.author
|
||||
@contesting_project = @contest.contesting_projects.all
|
||||
if params[:student_id].present?
|
||||
@temp = []
|
||||
@contesting_project.each do |pro|
|
||||
if pro.project && pro.project.project_status
|
||||
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
|
||||
@temp << pro
|
||||
end
|
||||
end
|
||||
@temp
|
||||
end
|
||||
@contesting_project = @temp
|
||||
else
|
||||
|
||||
@temp = []
|
||||
@contesting_project.each do |pro|
|
||||
if pro.project && pro.project.project_status
|
||||
@temp << pro
|
||||
end
|
||||
@temp
|
||||
end
|
||||
if @temp.size > 0
|
||||
@contesting_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
|
||||
end
|
||||
end
|
||||
@contesting_project = paginateHelper @contesting_project
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base_newcontest'
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
############
|
||||
##显示参赛的应用
|
||||
def show_softapplication
|
||||
# @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
# @option = []
|
||||
|
||||
# @user = @contest.user
|
||||
@softapplication = Softapplication.all
|
||||
@contesting_softapplication = @contest.contesting_softapplications
|
||||
|
||||
@contesting_softapplication = paginateHelper @contesting_softapplication, 10
|
||||
|
||||
# @temp = []
|
||||
# @softapplicationt.each do |pro|
|
||||
# if pro.project && pro.project.project_status
|
||||
# @temp << pro
|
||||
# end
|
||||
# @temp
|
||||
|
||||
# if @temp.size > 0
|
||||
# @contesting_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
|
||||
# end
|
||||
# end
|
||||
# respond_to do |format|
|
||||
# format.html {
|
||||
# render :layout => 'base_newcontest'
|
||||
# }
|
||||
# format.api
|
||||
# end
|
||||
##########################
|
||||
@contest = Contest.find_by_id(params[:id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base_newcontest'
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
###添加已创建的参赛项目
|
||||
def add
|
||||
project = Project.find(params[:contest])
|
||||
contest_message = params[:contest_for_save][:contest_message]
|
||||
if ContestingProject.where("project_id = ? and contest_id = ?", project.id, @contest.id).size == 0
|
||||
if ContestingProject.cerate_contesting(@contest.id, project.id, contest_message)
|
||||
flash.now[:notice] = l(:label_bidding_contest_succeed)
|
||||
end
|
||||
else
|
||||
flash.now[:error] = l(:label_bidding_fail)
|
||||
end
|
||||
|
||||
@contesting_project = paginateHelper @contest.contesting_projects
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
format.html { redirect_to :back }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
###添加已发布的参赛应用
|
||||
def add_softapplication
|
||||
softapplication = Softapplication.find(params[:contest])
|
||||
contest_message = params[:contest_for_save][:contest_message]
|
||||
if ContestingSoftapplication.where("softapplication_id = ? and contest_id = ?", softapplication.id, @contest.id).size == 0
|
||||
if ContestingSoftapplication.create_softapplication_contesting(@contest.id, softapplication.id, contest_message)
|
||||
flash.now[:notice] = l(:label_release_add_contest_succeed)
|
||||
end
|
||||
else
|
||||
flash.now[:error] = l(:label_add_contest_succeed_fail)
|
||||
end
|
||||
|
||||
@contesting_softapplication = paginateHelper @contest.contesting_softapplications
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
format.html { redirect_to :back }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
## 新建留言
|
||||
def create
|
||||
|
||||
if params[:contest_message][:message].size>0
|
||||
if params[:reference_content]
|
||||
message = params[:contest_message][:message] + "\n" + params[:reference_content]
|
||||
else
|
||||
message = params[:contest_message][:message]
|
||||
end
|
||||
refer_user_id = params[:contest_message][:reference_user_id].to_i
|
||||
@contest.add_jour(User.current, message, refer_user_id)
|
||||
end
|
||||
@user = @contest.author
|
||||
@jours = @contest.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
@contest.set_commit(@feedback_count)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
##删除留言
|
||||
def destroy
|
||||
@user = @contest.author
|
||||
if User.current.admin? || User.current.id == @user.id
|
||||
JournalsForMessage.delete_message(params[:object_id])
|
||||
end
|
||||
@jours = @contest.journals_for_messages.reverse
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
|
||||
@contest.set_commit(@feedback_count)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
##引用留言
|
||||
def new
|
||||
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
|
||||
if @jour
|
||||
user = @jour.user
|
||||
text = @jour.notes
|
||||
else
|
||||
user = @contest.author
|
||||
text = @contest.description
|
||||
end
|
||||
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
||||
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
|
||||
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
@id = user.id
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
##新建竞赛
|
||||
def new_contest
|
||||
@contest = Contest.new
|
||||
@contest.safe_attributes = params[:contest]
|
||||
end
|
||||
|
||||
##提交创建的竞赛
|
||||
def create_contest
|
||||
@contest = Contest.new
|
||||
@contest.name = params[:contest][:name]
|
||||
@contest.description = params[:contest][:description]
|
||||
@contest.budget = params[:contest][:budget]
|
||||
@contest.deadline = params[:contest][:deadline]
|
||||
@contest.password = params[:contest][:password]
|
||||
@contest.author_id = User.current.id
|
||||
@contest.commit = 0
|
||||
if @contest.save
|
||||
unless @contest.watched_by?(User.current)
|
||||
if @contest.add_watcher(User.current)
|
||||
flash[:notice] = l(:label_contesting_created_succeed)
|
||||
end
|
||||
end
|
||||
redirect_to show_contest_contest_path(@contest)
|
||||
else
|
||||
@contest.safe_attributes = params[:contest]
|
||||
render :action => 'new_contest'
|
||||
end
|
||||
end
|
||||
|
||||
##更新竞赛配置信息
|
||||
def update_contest
|
||||
@contest = Contest.find(params[:id])
|
||||
@contest.name = params[:contest][:name]
|
||||
@contest.description = params[:contest][:description]
|
||||
|
||||
@contest.budget = params[:contest][:budget]
|
||||
@contest.deadline = params[:contest][:deadline]
|
||||
@contest.password = params[:contest][:password]
|
||||
@contest.author_id = User.current.id
|
||||
@contest.commit = 0
|
||||
if @contest.save
|
||||
unless @contest.watched_by?(User.current)
|
||||
if @contest.add_watcher(User.current)
|
||||
flash[:notice] = l(:label_contesting_updated_succeed)
|
||||
end
|
||||
end
|
||||
redirect_to show_contest_contest_path(@contest)
|
||||
|
||||
else
|
||||
@contest.safe_attributes = params[:contest]
|
||||
render :action => 'new_contest'
|
||||
end
|
||||
end
|
||||
|
||||
def more
|
||||
@jour = @contest.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@state = true
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
def back
|
||||
@jour = @contest.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@state = false
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
def set_reward
|
||||
@b_p = nil
|
||||
@contesting_project_id = nil
|
||||
|
||||
if params[:set_reward][:reward]&&((User.current.id==@contest.author_id)||User.current.admin)
|
||||
# @contest_id = params[:id]
|
||||
@contesting_project_id = params[:set_reward][:b_id] #[:b_id]???
|
||||
@b_p = ContestingProject.find_by_id(@contesting_project_id)
|
||||
|
||||
# 把字段存进表中
|
||||
@b_p.update_reward(params[:set_reward][:reward].to_s)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def manage
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_contest
|
||||
if params[:id]
|
||||
@contest = Contest.find(params[:id])
|
||||
@user = @contest.author
|
||||
end
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -33,8 +33,8 @@ class FilesController < ApplicationController
|
|||
'size' => "#{Attachment.table_name}.filesize",
|
||||
'downloads' => "#{Attachment.table_name}.downloads"
|
||||
|
||||
@containers = [ Project.includes(:attachments).reorder("attachments.created_on DESC").find(@project.id)] #modify by Long Jun
|
||||
@containers += @project.versions.includes(:attachments).reorder("created_on DESC").all.sort
|
||||
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] #modify by Long Jun
|
||||
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
|
||||
|
||||
if @project.project_type == 1
|
||||
render :layout => 'base_courses'
|
||||
|
|
|
@ -11,6 +11,42 @@ class ForumsController < ApplicationController
|
|||
include SortHelper
|
||||
|
||||
PageLimit = 20
|
||||
|
||||
def create_memo
|
||||
@memo = Memo.new(params[:memo])
|
||||
@memo.forum_id = @forum.id
|
||||
@memo.author_id = User.current.id
|
||||
|
||||
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
|
||||
|
||||
respond_to do |format|
|
||||
if @memo.save
|
||||
format.html { redirect_to (forum_memo_path(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))), notice: "#{l :label_memo_create_succ}" }
|
||||
format.json { render json: @memo, status: :created, location: @memo }
|
||||
else
|
||||
sort_init 'updated_at', 'desc'
|
||||
sort_update 'created_at' => "#{Memo.table_name}.created_at",
|
||||
'replies' => "#{Memo.table_name}.replies_count",
|
||||
'updated_at' => "COALESCE (last_replies_memos.created_at, #{Memo.table_name}.created_at)"
|
||||
|
||||
@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).
|
||||
limit(@topic_pages.per_page).
|
||||
offset(@topic_pages.offset).
|
||||
order(sort_clause).
|
||||
preload(:author, {:last_reply => :author}).
|
||||
all
|
||||
|
||||
flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
|
||||
# back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id)
|
||||
format.html { render action: :show, layout: 'base_forums' }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
||||
format.json { render json: @memo.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
|
|
|
@ -47,7 +47,30 @@ class MemosController < ApplicationController
|
|||
else
|
||||
flash[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
|
||||
# back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id)
|
||||
format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
||||
pre_count = REPLIES_PER_PAGE
|
||||
|
||||
@memo_new = @memo.dup
|
||||
@memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示
|
||||
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
|
||||
|
||||
page = params[:page]
|
||||
if params[:r] && page.nil?
|
||||
offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count
|
||||
page = 1 + offset / pre_count
|
||||
else
|
||||
|
||||
end
|
||||
@reply_count = @memo.children.count
|
||||
@reply_pages = Paginator.new @reply_count, pre_count, page
|
||||
@replies = @memo.children.
|
||||
includes(:author, :attachments).
|
||||
reorder("#{Memo.table_name}.created_at ASC").
|
||||
limit(@reply_pages.per_page).
|
||||
offset(@reply_pages.offset).
|
||||
all
|
||||
|
||||
format.html { render action: :show }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
||||
# format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
||||
format.json { render json: @memo.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
@ -76,7 +99,7 @@ class MemosController < ApplicationController
|
|||
offset(@reply_pages.offset).
|
||||
all
|
||||
|
||||
@mome_new = Memo.new
|
||||
@memo_new = Memo.new
|
||||
|
||||
|
||||
# @memo = Memo.find_by_id(params[:id])
|
||||
|
|
|
@ -87,7 +87,7 @@ class MyController < ApplicationController
|
|||
se = UserExtensions.new
|
||||
se.user_id = @user.id
|
||||
if params[:occupation]
|
||||
se.occupation = params[:occupation]
|
||||
se.school_id = params[:occupation]
|
||||
end
|
||||
|
||||
se.gender = params[:gender]
|
||||
|
@ -109,7 +109,7 @@ class MyController < ApplicationController
|
|||
else
|
||||
se = @user.user_extensions
|
||||
if params[:occupation]
|
||||
se.occupation = params[:occupation]
|
||||
se.school_id = params[:occupation]
|
||||
end
|
||||
|
||||
se.gender = params[:gender]
|
||||
|
|
|
@ -69,6 +69,8 @@ class PraiseTreadController < ApplicationController
|
|||
@obj = Project.find_by_id(id)
|
||||
when 'Bid'
|
||||
@obj = Bid.find_by_id(id)
|
||||
when 'Contest'
|
||||
@obj = Contest.find_by_id(id)
|
||||
end
|
||||
return @obj
|
||||
end
|
||||
|
|
|
@ -68,6 +68,8 @@ class ProjectsController < ApplicationController
|
|||
|
||||
helper :bids
|
||||
include BidsHelper
|
||||
helper :contests
|
||||
include ContestsHelper
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :custom_fields
|
||||
|
@ -218,8 +220,10 @@ class ProjectsController < ApplicationController
|
|||
|
||||
def search
|
||||
#modified by nie
|
||||
@projects = Project.visible
|
||||
@projects = @projects.visible.where('project_type = ?', params[:project_type]).like(params[:name]) if params[:name].present?
|
||||
project_type = params[:project_type]
|
||||
projects_all = (project_type.eql? Project::ProjectType_project) ? Project.project_entities : Project.course_entities
|
||||
@projects = projects_all.visible
|
||||
@projects = @projects.visible.like(params[:name]) if params[:name].present?
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@project_count = @projects.visible.count
|
||||
@project_pages = Paginator.new @project_count, @limit, params['page']
|
||||
|
@ -346,7 +350,7 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@project_type = params[:project_type]
|
||||
@project_type = params[:project_type] ||= params[:course]
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
@trackers = Tracker.sorted.all
|
||||
|
||||
|
@ -360,9 +364,9 @@ class ProjectsController < ApplicationController
|
|||
@course_tag = params[:course]
|
||||
@course = Course.new
|
||||
@course.safe_attributes = params[:course]
|
||||
else
|
||||
render_404
|
||||
return -1
|
||||
else # default Project
|
||||
@project = Project.new
|
||||
@project.safe_attributes = params[:project]
|
||||
end
|
||||
render :layout => 'base'
|
||||
end
|
||||
|
@ -388,7 +392,7 @@ class ProjectsController < ApplicationController
|
|||
# added by bai
|
||||
@course.term = params[:term]
|
||||
@course.time = params[:time]
|
||||
@course.school_id = params[:school]
|
||||
@course.school_id = params[:occupation]
|
||||
@course.setup_time = params[:setup_time]
|
||||
@course.endup_time = params[:endup_time]
|
||||
@course.class_period = params[:class_period]
|
||||
|
@ -567,6 +571,7 @@ class ProjectsController < ApplicationController
|
|||
"show_messages" => true,
|
||||
"show_news" => true,
|
||||
"show_bids" => true,
|
||||
"show_contests" => true,
|
||||
"show_journals_for_messages" => true
|
||||
}
|
||||
@date_to ||= Date.today + 1
|
||||
|
@ -849,8 +854,7 @@ class ProjectsController < ApplicationController
|
|||
|
||||
def select_project_layout
|
||||
project = Project.find_by_id(params[:id])
|
||||
project ||= @project
|
||||
project ||= @course
|
||||
project ||= @project ||= @course ||= params[:course] ||= params[:project_type]
|
||||
(project.try(:project_type) == Project::ProjectType_project) ? 'base_projects' : 'base_courses'
|
||||
end
|
||||
|
||||
|
|
|
@ -1,2 +1,15 @@
|
|||
class SchoolController < ApplicationController
|
||||
def get_options
|
||||
@school = School.where("province = ?", params[:province])
|
||||
p = params[:province]
|
||||
##@school = School.all
|
||||
options = ""
|
||||
|
||||
@school.each do |s|
|
||||
options << "<option value=#{s.id}>#{s.name}</option>"
|
||||
end
|
||||
|
||||
render :text => options
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,194 @@
|
|||
class SoftapplicationsController < ApplicationController
|
||||
# GET /softapplications
|
||||
# GET /softapplications.json
|
||||
def index
|
||||
@softapplications = Softapplication.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @softapplications }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /softapplications/1
|
||||
# GET /softapplications/1.json
|
||||
def show
|
||||
@softapplication = Softapplication.find(params[:id])
|
||||
@jours = @softapplication.journals_for_messages.order('created_on DESC')
|
||||
@image_results = []
|
||||
@softapplication.attachments.each do |f|
|
||||
f.image? ? @image_results << f : @image_results
|
||||
end
|
||||
@app_items = []
|
||||
@softapplication.attachments.each do |f|
|
||||
f.pack? ? @app_items << f : @app_items
|
||||
end
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
@state = false
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @softapplication }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /softapplications/new
|
||||
# GET /softapplications/new.json
|
||||
def new
|
||||
@softapplication = Softapplication.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @softapplication }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /softapplications/1/edit
|
||||
def edit
|
||||
@softapplication = Softapplication.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /softapplications
|
||||
# POST /softapplications.json
|
||||
def create
|
||||
@softapplication = Softapplication.new(params[:softapplication])
|
||||
@softapplication.user = User.current
|
||||
@softapplication.save_attachments(params[:attachments])
|
||||
respond_to do |format|
|
||||
if @softapplication.save
|
||||
format.html { redirect_to @softapplication, notice: 'Softapplication was successfully created.' }
|
||||
format.json { render json: @softapplication, status: :created, location: @softapplication }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @softapplication.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /softapplications/1
|
||||
# PUT /softapplications/1.json
|
||||
def update
|
||||
@softapplication = Softapplication.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @softapplication.update_attributes(params[:softapplication])
|
||||
format.html { redirect_to @softapplication, notice: 'Softapplication was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @softapplication.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def add_attach
|
||||
@softapplication = Softapplication.find(params[:id])
|
||||
@softapplication.save_attachments(params[:attachments])
|
||||
end
|
||||
|
||||
# DELETE /softapplications/1
|
||||
# DELETE /softapplications/1.json
|
||||
def destroy
|
||||
@softapplication = Softapplication.find(params[:id])
|
||||
@softapplication.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to softapplications_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
#应用评价涉及到的方法
|
||||
def new_message
|
||||
@jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id]
|
||||
if @jour
|
||||
user = @jour.user
|
||||
text = @jour.notes
|
||||
else
|
||||
user = @softapplication.user
|
||||
text = @softapplication.description
|
||||
end
|
||||
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
||||
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
|
||||
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
@id = user.id
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
#新建评价
|
||||
def create_message
|
||||
|
||||
if params[:softapplication_message][:message].size>0
|
||||
if params[:reference_content]
|
||||
message = params[:softapplication_message][:message] + "\n" + params[:reference_content]
|
||||
else
|
||||
message = params[:softapplication_message][:message]
|
||||
end
|
||||
refer_user_id = params[:softapplication_message][:reference_user_id].to_i
|
||||
@softapplication = Softapplication.find(params[:id])
|
||||
@softapplication.add_jour(User.current, message, refer_user_id)
|
||||
|
||||
end
|
||||
|
||||
@user = @softapplication.user
|
||||
@jours = @softapplication.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
#@softapplication.set_commit(@feedback_count)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
##删除评价
|
||||
def destroy_message
|
||||
@user = @softapplication.user
|
||||
if User.current.admin? || User.current.id == @user.id
|
||||
JournalsForMessage.delete_message(params[:object_id])
|
||||
end
|
||||
@jours = @softapplication.journals_for_messages.reverse
|
||||
@limit = 10
|
||||
@feedback_count = @jours.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@jour = @jours[@offset, @limit]
|
||||
|
||||
@softapplication.set_commit(@feedback_count)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
#
|
||||
def more
|
||||
@jour = @softapplication.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@state = true
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
#
|
||||
def back
|
||||
@jour = @softapplication.journals_for_messages
|
||||
@jour.each_with_index {|j,i| j.indice = i+1}
|
||||
@state = false
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,6 +11,7 @@ class TagsController < ApplicationController
|
|||
include BidsHelper
|
||||
include ForumsHelper
|
||||
include AttachmentsHelper
|
||||
include ContestsHelper
|
||||
include ActsAsTaggableOn::TagsHelper
|
||||
helper :projects
|
||||
include TagsHelper
|
||||
|
@ -30,7 +31,7 @@ class TagsController < ApplicationController
|
|||
# 最后是2个过滤何种数据,显示结果的控制参数params[:obj_id],params[:object_falg]
|
||||
# 0代表删除tag 1代表增加tag
|
||||
def index
|
||||
|
||||
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_flag = params[:object_flag]
|
||||
|
||||
|
@ -44,28 +45,29 @@ class TagsController < ApplicationController
|
|||
@tag = params[:tag]
|
||||
@selected_tags = params[:current_selected_tags]
|
||||
@selected_tags = @selected_tags.nil? ? Array.new : @selected_tags
|
||||
|
||||
|
||||
case @do_what
|
||||
when '0' then
|
||||
@selected_tags.delete @tag #数组中删除有多方式 可以改用shift,pop
|
||||
@selected_tags.delete @tag #数组中删除有多方式 可以改用shift,pop
|
||||
when '1' then
|
||||
# 判断是否已存在该tag 主要用来处理分页的情况
|
||||
unless @selected_tags.include? @tag
|
||||
@selected_tags << @tag
|
||||
end
|
||||
# 判断是否已存在该tag 主要用来处理分页的情况
|
||||
unless @selected_tags.include? @tag
|
||||
@selected_tags << @tag
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num,
|
||||
|
||||
@users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num,@contests_tags_num,
|
||||
@forum_tags_num, @attachments_tags_num = get_tags_size
|
||||
|
||||
|
||||
# 获取搜索结果
|
||||
@obj,@obj_pages,@results_count,@users_results,
|
||||
@projects_results,
|
||||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results,
|
||||
@attachments_results = refresh_results(@obj_id,@obj_flag,@selected_tags)
|
||||
@attachments_results,
|
||||
@contests_tags = refresh_results(@obj_id,@obj_flag,@selected_tags)
|
||||
|
||||
# 这里是做tag推荐用的, 用来生产推荐的tags
|
||||
unless @obj.nil?
|
||||
|
@ -74,13 +76,13 @@ class TagsController < ApplicationController
|
|||
# @selected_tags.each do |i|
|
||||
# @tags.delete(i)
|
||||
# end
|
||||
@related_tags = @tags
|
||||
@related_tags = @tags
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
# 增加已选的tag
|
||||
def add_tag
|
||||
@tag = params[:tag]
|
||||
|
@ -90,11 +92,13 @@ class TagsController < ApplicationController
|
|||
$related_tags.delete(@tag)
|
||||
|
||||
# 获取搜索结果
|
||||
@obj,@obj_pages,@users_results,
|
||||
@obj,@obj_pages,@results_count,@users_results,
|
||||
@projects_results,
|
||||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results = refresh_results(@obj_id,@show_flag)
|
||||
@forums_results,
|
||||
@attachments_results,
|
||||
@contests_results = refresh_results(@obj_id,@show_flag)
|
||||
end
|
||||
|
||||
# 删除已选tag
|
||||
|
@ -110,13 +114,15 @@ class TagsController < ApplicationController
|
|||
@projects_results,
|
||||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results = refresh_results(@obj_id,@show_flag)
|
||||
@forums_results,
|
||||
@attachments_results,
|
||||
@contests_results = refresh_results(@obj_id,@show_flag)
|
||||
end
|
||||
|
||||
def show_all
|
||||
@tags = ActsAsTaggableOn::Tag.find(:all)
|
||||
@tags = ActsAsTaggableOn::Tag.find(:all)
|
||||
end
|
||||
|
||||
|
||||
# 完全从数据库删除tag
|
||||
# 这种删除方式是针对 印有该 tag所有对象来做删除的
|
||||
# 这样是从整个系统数据库中把该tag删除了
|
||||
|
@ -148,24 +154,24 @@ class TagsController < ApplicationController
|
|||
|
||||
# if can_remove_tag?(User.current,@taggable_id,@taggable_type)
|
||||
|
||||
@taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type)
|
||||
|
||||
unless @taggings.nil?
|
||||
@taggings.delete
|
||||
end
|
||||
@taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type)
|
||||
|
||||
unless @taggings.nil?
|
||||
@taggings.delete
|
||||
end
|
||||
|
||||
# 是否还有其他记录 引用了 tag_id
|
||||
@tagging = ActsAsTaggableOn::Tagging.find_by_tag_id(@tag_id)
|
||||
@tagging = ActsAsTaggableOn::Tagging.find_by_tag_id(@tag_id)
|
||||
# 如果taggings表中记录已经不存在 ,那么检查tags表 作删除动作
|
||||
if @tagging.nil?
|
||||
@tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id)
|
||||
@tag.delete unless @tag.nil?
|
||||
end
|
||||
if @tagging.nil?
|
||||
@tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id)
|
||||
@tag.delete unless @tag.nil?
|
||||
end
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
private
|
||||
# 这里用来刷新搜索结果的区域
|
||||
# 函数的返回值 前2字段用来处理获取其他tag和分页 ,另外4个返回值为过滤结果
|
||||
def refresh_results(obj_id,obj_flag,selected_tags)
|
||||
|
@ -173,11 +179,13 @@ private
|
|||
@projects_results = nil
|
||||
@issues_results = nil
|
||||
@bids_results = nil
|
||||
@contests_results = nil
|
||||
@forums_results = nil
|
||||
attachments_results = nil
|
||||
@obj_pages = nil
|
||||
@obj = nil
|
||||
|
||||
@result = nil
|
||||
|
||||
# 这里为了提高系统的响应速度 把搜索结果放到case中去了
|
||||
case obj_flag
|
||||
when '1' then
|
||||
|
@ -197,11 +205,27 @@ private
|
|||
@obj_pages,@forums_results,@results_count = for_pagination(get_forums_by_tag(selected_tags))
|
||||
when '6'
|
||||
@obj = Attachment.find_by_id(obj_id)
|
||||
@obj_pages, attachments_results, @results_count = for_pagination(get_attachments_by_tag(selected_tags))
|
||||
|
||||
# modifed by Long Jun
|
||||
# this is used to find the attachments that came from the same project and tagged with the same tag.
|
||||
@result = get_attachments_by_project_tag(selected_tags, @obj)
|
||||
@obj_pages, attachments_results, @results_count = for_pagination(@result)
|
||||
when '7'
|
||||
@obj = Contest.find_by_id(obj_id)
|
||||
@obj_pages,@contests_results,@results_count = for_pagination(get_contests_by_tag(selected_tags))
|
||||
else
|
||||
@obj = nil
|
||||
@obj = nil
|
||||
end
|
||||
return @obj,@obj_pages,@results_count,@users_results,@projects_results,@issues_results,@bids_results,@forums_results, attachments_results
|
||||
return [@obj,
|
||||
@obj_pages,
|
||||
@results_count,
|
||||
@users_results,
|
||||
@projects_results,
|
||||
@issues_results,
|
||||
@bids_results,
|
||||
@forums_results,
|
||||
attachments_results,
|
||||
@contests_results]
|
||||
end
|
||||
|
||||
def for_pagination(results)
|
||||
|
@ -221,7 +245,8 @@ private
|
|||
@bids_tags_num = Bid.tag_counts.size
|
||||
forum_tags_num = Forum.tag_counts.size
|
||||
attachment_tags_num = Attachment.tag_counts.size
|
||||
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num
|
||||
@contests_tags_num = Contest.tag_counts.size
|
||||
return @users_tags_num,@projects_tags_num,@issues_tags_num,@bids_tags_num, forum_tags_num, attachment_tags_num, @contests_tags_num
|
||||
end
|
||||
|
||||
# 通过数字 来转换出对象的类型
|
||||
|
@ -242,6 +267,8 @@ private
|
|||
return 'Forum'
|
||||
when '6'
|
||||
return 'Attachment'
|
||||
when '7'
|
||||
return 'Contest'
|
||||
else
|
||||
render_error :message => e.message
|
||||
return
|
||||
|
|
|
@ -1,160 +1,56 @@
|
|||
class TestController < ApplicationController
|
||||
|
||||
before_filter :find_user, :only => [:new, :create, :destroy]
|
||||
|
||||
|
||||
def index
|
||||
# @users = User.where('status = ?', 1)
|
||||
# for user in @users
|
||||
# if user.user_extensions.nil?
|
||||
# UserExtensions.create(:user_id => user.id)
|
||||
# end
|
||||
# end
|
||||
|
||||
# @message = Message.all
|
||||
# @message.each do |m|
|
||||
# Activity.create(:act_id => m.id, :act_type => 'Message', :user_id => m.author_id)
|
||||
# end
|
||||
# activity = Message.all
|
||||
# activity += News.all
|
||||
# activity += Journal.all
|
||||
# activity += Issue.all
|
||||
# activity += Bid.all
|
||||
# @activity = activity.sort {|x,y| x.created_on <=> y.created_on}
|
||||
# @activity.each do |act|
|
||||
# if act.instance_of?(Bid)
|
||||
# act.acts << Activity.new(:user_id => act.author_id)
|
||||
# elsif act.instance_of?(News)
|
||||
# act.acts << Activity.new(:user_id => act.author_id)
|
||||
# elsif act.instance_of?(Message)
|
||||
# act.acts << Activity.new(:user_id => act.author_id)
|
||||
# elsif act.instance_of?(Journal)
|
||||
# act.acts << Activity.new(:user_id => act.user_id)
|
||||
# elsif act.instance_of?(Issue)
|
||||
# act.acts << Activity.new(:user_id => act.author_id)
|
||||
# elsif act.instance_of?(Changeset)
|
||||
# act.acts << Activity.new(:user_id => act.user_id)
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
#@watchers_of_projects = WatchersOfProjects.new
|
||||
#@watchers_of_projects.user_id = 1
|
||||
#@watchers_of_projects.project_id = 1
|
||||
#@watchers_of_projects.save
|
||||
|
||||
#测试user表与watch_project表之间的关联是否成功
|
||||
#@user = User.find(params[:id])
|
||||
#@watch_table = @user.watch_projects.to_a.first
|
||||
|
||||
#@watch = WatchProject.find(1)
|
||||
#@watcher = @watch.user
|
||||
|
||||
#测试通过watch_project表使user表可以访问project表
|
||||
#@watch_project = @user.projects
|
||||
#watch_project_path(@watch)
|
||||
|
||||
#@project = Project.find(11)
|
||||
#project_path(@project)
|
||||
#@member = @project.users
|
||||
#@watched = @project.watch_projects
|
||||
#@issue = Issue.find(6)
|
||||
|
||||
|
||||
#user_path(@user)
|
||||
#issue_path(@issue)
|
||||
|
||||
#@watcher2=WatchProject.where("#{WatchProject.table_name}.project_id = ?" , temp)
|
||||
|
||||
#测试where语句
|
||||
#temp = 1
|
||||
#@watcher2=WatchProject.where(:project_id => temp).to_a
|
||||
|
||||
#测试新建记录
|
||||
#@watch_new = WatchProject.new
|
||||
#@watch_new.user_id = 4
|
||||
#@watch_new.project_id = 1
|
||||
#@watch_new.save
|
||||
#@id = params[:id]
|
||||
|
||||
#测试添加关注项目功能
|
||||
#WatchersOfProjects.watch(3,10)
|
||||
#Project.find(50)
|
||||
#测试统计关注该项目的用户数
|
||||
#@count = WatchersOfProjects.watcher_count(@watch_project.to_a.first)
|
||||
#测试取消关注功能
|
||||
#WatchersOfProjects.watch_cancle(10,35)
|
||||
|
||||
#测试关注用户功能
|
||||
#测试关注功能
|
||||
#WatchersOfUser.watch_user(7,7)
|
||||
#测试取消关注功能
|
||||
#WatchersOfUser.cancel_watching_user(1,2)
|
||||
#测试查找关注的人功能
|
||||
#@user = WatchersOfUser.find_users(1)
|
||||
#测试查找被关注的人功能
|
||||
#@user = WatchersOfUser.find_watchers(10)
|
||||
|
||||
#测试用户留言功能
|
||||
#测试留言功能
|
||||
# MessagesForUser.leave_message(User.current.id, 6, 'test')
|
||||
#测试查找留言功能
|
||||
#@message_table = MessagesForUser.find_message(3)
|
||||
#测试查找留言用户功能
|
||||
#@messager=@message_table.first.find_messager
|
||||
|
||||
|
||||
#测试需求
|
||||
#测试新建需求
|
||||
#bids = Bid.creat_bids(10000, '2013.7.25', 'test', 'sfsadgfag')
|
||||
#测试修改需求
|
||||
#bids.update_bids(10, '2014.7.222', 'asdf')
|
||||
#测试删除需求
|
||||
# bids = Bid.where('id = ?', 5)
|
||||
# bids.each do |bid|
|
||||
# bid.delete_bids
|
||||
# end
|
||||
def zip
|
||||
homeworks_attach_path = []
|
||||
homework_id = params[:homework_id]
|
||||
bid = Bid.find_by_id(homework_id)
|
||||
|
||||
bid.homeworks.each do |homeattach|
|
||||
homeattach.attachments.each do |attach|
|
||||
length = attach.storage_path.length
|
||||
homeworks_attach_path << attach.diskfile.to_s.slice((length+1)..-1)
|
||||
end
|
||||
end
|
||||
@paths = homeworks_attach_path
|
||||
zipfile = ziping homeworks_attach_path
|
||||
send_file zipfile, :filename => bid.name,
|
||||
:type => detect_content_type(zipfile)
|
||||
rescue Errno::ENOENT => e
|
||||
logger.error "[Errno::ENOENT] ===> #{e}"
|
||||
|
||||
end
|
||||
|
||||
def courselist
|
||||
@courses = Project.course_entities
|
||||
end
|
||||
|
||||
def ziping files_path
|
||||
ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
|
||||
folder = "#{Rails.root}/files"
|
||||
input_filename = files_path
|
||||
zipfile_name = "#{Rails.root}/tmp/archiveZip/archive_#{Time.now.to_i}.zip"
|
||||
|
||||
# ##########留言功能 message by fq
|
||||
# def new
|
||||
# end
|
||||
#
|
||||
# def create
|
||||
#
|
||||
# if params[:user_search].size>0
|
||||
# unless params[:user_id].nil?
|
||||
# message = params[:user_search]
|
||||
# MessagesForUser.leave_message(User.current.id, params[:user_id], message)
|
||||
# @message = MessagesForUser.find_message(@user.id)
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# respond_to do |format|
|
||||
# # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
|
||||
# format.js
|
||||
# #format.api { render_api_ok }
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def destroy
|
||||
# MessagesForUser.delete_message(params[:object_id])
|
||||
# @message = MessagesForUser.find_message(@user.id)
|
||||
# respond_to do |format|
|
||||
# format.html { redirect_to :back }
|
||||
# format.js
|
||||
# #format.api { render_api_ok }
|
||||
# end
|
||||
# end
|
||||
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
|
||||
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
|
||||
input_filename.each do |filename|
|
||||
zipfile.add(ic.iconv(filename_to_real(File.basename(filename))), folder + '/' + filename)
|
||||
end
|
||||
zipfile.get_output_stream("ReadMe"){ |os|
|
||||
os.write "Homeworks"
|
||||
}
|
||||
end
|
||||
zipfile_name
|
||||
end
|
||||
|
||||
def detect_content_type(name)
|
||||
content_type = Redmine::MimeType.of(name)
|
||||
content_type.to_s
|
||||
end
|
||||
|
||||
# private
|
||||
#
|
||||
# def find_user
|
||||
# if params[:user_id]
|
||||
# @user = User.find(params[:user_id])
|
||||
# end
|
||||
# rescue
|
||||
# render_404
|
||||
# end
|
||||
#######end of message
|
||||
def filename_to_real name
|
||||
attach = Attachment.find_by_disk_filename(name)
|
||||
attach.filename
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -23,19 +23,20 @@ class UsersController < ApplicationController
|
|||
menu_item :user_homework, :only => :user_homeworks
|
||||
menu_item :user_project, :only => [:user_projects, :watch_projects]
|
||||
menu_item :requirement_focus, :only => :watch_bids
|
||||
menu_item :requirement_focus, :only => :watch_contests
|
||||
menu_item :user_newfeedback, :only => :user_newfeedback
|
||||
|
||||
|
||||
#Ended by young
|
||||
|
||||
|
||||
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info,
|
||||
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
|
||||
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:activity_score_index, :influence_score_index, :score_index]
|
||||
#edit has been deleted by huang, 2013-9-23
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
|
||||
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
||||
:watch_bids, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:activity_score_index, :influence_score_index, :score_index]
|
||||
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
||||
|
||||
|
@ -116,6 +117,28 @@ class UsersController < ApplicationController
|
|||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
#new add by linchun
|
||||
def watch_contests
|
||||
@bids = Contest.watched_by(@user)
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@contest_count = @contests.count
|
||||
@contest_pages = Paginator.new @contest_count, @limit, params['page']
|
||||
@offset ||= @contest_pages.reverse_offset
|
||||
unless @offset == 0
|
||||
@contest = @contests.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
@contest = @contests.offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base_users'
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
# added by fq
|
||||
def user_activities
|
||||
|
@ -633,6 +656,8 @@ class UsersController < ApplicationController
|
|||
@obj = Forum.find_by_id(@obj_id)
|
||||
when '6'
|
||||
@obj = Attachment.find_by_id(@obj_id)
|
||||
when '7' then
|
||||
@obj = Contest.find_by_id(@obj_id)
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
|
|
|
@ -27,6 +27,7 @@ class WelcomeController < ApplicationController
|
|||
@projectHidenCount = @projectCount - @projectPublicCount
|
||||
|
||||
@developerCount = User.developer.count
|
||||
@allUsercount = User.count
|
||||
end
|
||||
|
||||
def robots
|
||||
|
@ -80,7 +81,7 @@ class WelcomeController < ApplicationController
|
|||
def entry_select_contest
|
||||
if request.original_url.match(/contest\.trustie\.net/)
|
||||
contest
|
||||
render :contest, layout: false
|
||||
render :contest
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -190,6 +190,10 @@ class WordsController < ApplicationController
|
|||
obj = User.find_by_id(obj_id)
|
||||
elsif ( referer.match(/bids/) || referer.match(/calls/) )
|
||||
obj = Bid.find_by_id(obj_id)
|
||||
elsif ( referer.match(/contests/) || referer.match(/contests/) ) #new added
|
||||
obj = Contest.find_by_id(obj_id)
|
||||
elsif ( referer.match(/softapplications/) || referer.match(/softapplications/) ) #new added
|
||||
obj = Softapplication.find_by_id(obj_id)
|
||||
else
|
||||
raise 'create reply obj unknow type.'
|
||||
end
|
||||
|
@ -204,6 +208,10 @@ class WordsController < ApplicationController
|
|||
Project.add_new_jour(nil, nil, obj.id, options)
|
||||
elsif obj.kind_of? Bid
|
||||
obj.add_jour(nil, nil, nil, options)
|
||||
elsif obj.kind_of? Contest
|
||||
obj.add_jour(nil, nil, obj.id, options) #new added
|
||||
elsif obj.kind_of? Softapplication
|
||||
obj.add_jour(nil, nil, obj.id, options) #new added
|
||||
else
|
||||
raise 'create reply obj unknow type.'
|
||||
end
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
class ZipdownController < ApplicationController
|
||||
SAVE_FOLDER = "#{Rails.root}/files"
|
||||
OUTPUT_FOLDER = "#{Rails.root}/tmp/archiveZip"
|
||||
|
||||
def assort
|
||||
obj_class = params[:obj_class]
|
||||
obj_id = params[:obj_id]
|
||||
obj = obj_class.constantize.find(obj_id)
|
||||
zipfile = nil
|
||||
case obj.class.to_s.to_sym
|
||||
when :Bid
|
||||
zipfile = zip_bid obj
|
||||
else
|
||||
logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!"
|
||||
end
|
||||
send_file zipfile, :filename => obj.name, :type => detect_content_type(zipfile) if zipfile
|
||||
|
||||
#rescue NameError, ActiveRecord::RecordNotFound => e
|
||||
#logger.error "[ZipDown] ===> #{e}"
|
||||
#@error = e
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def zip_bid(bid)
|
||||
# Todo: User Access Controll
|
||||
|
||||
homeattaches = bid.homeworks
|
||||
# 得到每一个人所有文件打包的zip文件
|
||||
# 并将每一个人的zip打包为一个并返回路径
|
||||
user_zip_paths = homeattaches.map do |homeattach|
|
||||
zip_homework_by_user homeattach
|
||||
end
|
||||
zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER
|
||||
|
||||
#@paths = homeworks_attach_path
|
||||
#zipfile = ziping homeworks_attach_path
|
||||
#send_file zipfile, :filename => bid.name,
|
||||
# :type => detect_content_type(zipfile)
|
||||
#rescue Errno::ENOENT => e
|
||||
# logger.error "[Errno::ENOENT] ===> #{e}"
|
||||
# @error = e
|
||||
end
|
||||
|
||||
def zip_homework_by_user(homeattach)
|
||||
homeworks_attach_path = []
|
||||
# 需要将所有homework.attachments遍历加入zip
|
||||
# 并且返回zip路径
|
||||
user_attaches_paths = homeattach.attachments.each do |attach|
|
||||
#length = attach.storage_path.length
|
||||
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
|
||||
end
|
||||
zipping "#{Time.now.to_i}_#{homeattach.user.name.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true
|
||||
end
|
||||
|
||||
|
||||
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false)
|
||||
# 输入待打包的文件列表,已经打包文件定位到ouput_path
|
||||
ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
|
||||
input_filename = files_paths
|
||||
|
||||
rename_zipfile = zip_name_refer ||= "archive_#{Time.now.to_i}.zip"
|
||||
zipfile_name = "#{output_path}/#{rename_zipfile}"
|
||||
|
||||
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
|
||||
|
||||
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
|
||||
input_filename.each do |filename|
|
||||
rename_file = Time.now.to_i.to_s+ ic.iconv( (File.basename(filename)) ).to_s
|
||||
rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment
|
||||
|
||||
zipfile.add(rename_file, filename)
|
||||
end
|
||||
zipfile.get_output_stream('ReadMe') do |os|
|
||||
os.write 'Homeworks'
|
||||
end
|
||||
end
|
||||
zipfile_name
|
||||
rescue Errno => e
|
||||
logger.error "[zipdown#zipping] ===> #{e}"
|
||||
@error = e
|
||||
end
|
||||
|
||||
#def ziping files_path
|
||||
# ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
|
||||
# folder = SaveFolder
|
||||
# input_filename = files_path
|
||||
# zipfile_name = "#{OutputFolder}/archive_#{Time.now.to_i}.zip"
|
||||
#
|
||||
# Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
|
||||
# Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
|
||||
# input_filename.each do |filename|
|
||||
# zipfile.add(ic.iconv(filename_to_real(File.basename(filename))), folder + '/' + filename)
|
||||
# end
|
||||
# zipfile.get_output_stream("ReadMe") { |os|
|
||||
# os.write "Homeworks"
|
||||
# }
|
||||
# end
|
||||
# zipfile_name
|
||||
#rescue Errno => e
|
||||
# logger.error "[zipdown#zipping] ===> #{e}"
|
||||
# @error = e
|
||||
#end
|
||||
|
||||
def detect_content_type(name)
|
||||
content_type = Redmine::MimeType.of(name)
|
||||
content_type.to_s
|
||||
end
|
||||
|
||||
def filename_to_real(name)
|
||||
attach = Attachment.find_by_disk_filename(name)
|
||||
attach.filename
|
||||
end
|
||||
|
||||
end
|
|
@ -24,10 +24,10 @@ module ActivitiesHelper
|
|||
events.sort {|x, y| y.event_datetime <=> x.event_datetime}.each do |event|
|
||||
if group_events = events_by_group.delete(event.event_group)
|
||||
group_events.sort {|x, y| y.event_datetime <=> x.event_datetime}.each_with_index do |e, i|
|
||||
sorted_events << [e, i > 0]
|
||||
sorted_events << [e, i > 0] unless e.event_description.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
sorted_events
|
||||
sorted_events
|
||||
end
|
||||
end
|
||||
|
|
|
@ -111,6 +111,14 @@ module ApplicationHelper
|
|||
link_to text, url, html_options
|
||||
end
|
||||
|
||||
def link_to_attachment_img(attachment, options={})
|
||||
text = options.delete(:text) || attachment.filename
|
||||
route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path
|
||||
html_options = options.slice!(:only_path)
|
||||
url = send(route_method, attachment, attachment.filename, options)
|
||||
image_tag url, html_options
|
||||
end
|
||||
|
||||
# Generates a link to a SCM revision
|
||||
# Options:
|
||||
# * :text - Link text (default to the formatted revision)
|
||||
|
@ -1402,6 +1410,71 @@ module ApplicationHelper
|
|||
end
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
#display contest project
|
||||
def show_more_contest_project?(contest)
|
||||
if contest.projects.where('is_public = 1').count > 12
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def show_more_contest_softapplication?(contest)
|
||||
if contest.softapplications.where('is_public = 1').count > 12
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def show_contest_project(bid)
|
||||
html = ''
|
||||
if contest.projects.where('is_public = 1').count == 0
|
||||
html << (content_tag "p", l(:label_no_bid_project), :class => "font_lighter")
|
||||
else
|
||||
contest.projects.where('is_public = 1').take(12).each do |project|
|
||||
html << (link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name), project_path(project), :class => "avatar")
|
||||
end
|
||||
end
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
def show_contest_project(contest)
|
||||
html = ''
|
||||
if contest.projects.where('is_public = 1').count == 0
|
||||
html << (content_tag "p", l(:label_no_bid_project), :class => "font_lighter")
|
||||
else
|
||||
contest.projects.where('is_public = 1').take(12).each do |project|
|
||||
html << (link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name), project_path(project), :class => "avatar")
|
||||
end
|
||||
end
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
def show_contest_softapplication(contest)
|
||||
html = ''
|
||||
if contest.softapplications.where('is_public = 1').count == 0
|
||||
html << (content_tag "p", l(:label_no_contest_softapplication), :class => "font_lighter")
|
||||
else
|
||||
contest.softapplications.where('is_public = 1').take(12).each do |softapplication|
|
||||
html << (link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name), project_path(project), :class => "avatar")
|
||||
end
|
||||
end
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
def show_contest_fans_picture(obj)
|
||||
html = ''
|
||||
if obj.watcher_users.count == 0
|
||||
html << (content_tag "span", l(:label_project_no_follow))
|
||||
else
|
||||
obj.watcher_users.take(12).each do |user|
|
||||
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
|
||||
end
|
||||
end
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
#display fans picture
|
||||
def show_more_fans?(obj)
|
||||
|
@ -1494,13 +1567,14 @@ module ApplicationHelper
|
|||
home_link = link_to l(:field_homepage), {:controller => 'welcome', :action => 'index'}
|
||||
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain}
|
||||
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain}
|
||||
|
||||
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain}
|
||||
|
||||
course_all_course_link = link_to l(:label_course_all), {:controller => 'projects', :action => 'course', :project_type => 1, :host => Setting.course_domain}
|
||||
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain}
|
||||
courses_link = link_to l(:label_course_practice), {:controller => 'projects', :action => 'course', :project_type => 1, :host => Setting.course_domain}
|
||||
projects_link = link_to l(:label_project_deposit), {:controller => 'projects', :action => 'index', :project_type => 0, :host => Setting.project_domain}
|
||||
users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain}
|
||||
contest_link = link_to l(:label_contest_innovate), {:controller => 'bids', :action => 'contest', :project_type => 1 , :host => Setting.contest_domain}
|
||||
contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'}
|
||||
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
|
||||
forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index"}
|
||||
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
|
||||
|
@ -1513,6 +1587,7 @@ module ApplicationHelper
|
|||
|
||||
nav_list.push(main_project_link) if @nav_dispaly_main_project_label
|
||||
nav_list.push(main_course_link) if @nav_dispaly_main_course_label
|
||||
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label
|
||||
|
||||
nav_list.push(courses_link) if @nav_dispaly_course_label
|
||||
nav_list.push(projects_link) if @nav_dispaly_project_label
|
||||
|
@ -1528,5 +1603,9 @@ module ApplicationHelper
|
|||
end
|
||||
content_tag :ul, content_li.html_safe
|
||||
end
|
||||
|
||||
def current_user
|
||||
User.current
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -76,6 +76,22 @@ module AttachmentsHelper
|
|||
Attachment.tagged_with(tag_name).order('created_on desc')
|
||||
end
|
||||
|
||||
# this method is used to get all attachments that from one project and tagged one tag
|
||||
# added by Long Jun
|
||||
def get_attachments_by_project_tag(tag_name, obj)
|
||||
@project_id =nil
|
||||
if obj.container_type == 'Version'
|
||||
@project_id = Version.find(obj.container_id).project_id
|
||||
|
||||
elsif obj.container_type == 'Project'
|
||||
@project_id = obj.container_id
|
||||
|
||||
end
|
||||
Attachment.tagged_with(tag_name).order('created_on desc').where("(container_id = :project_id and container_type = 'Project') or
|
||||
(container_id in (select id from versions where project_id =:project_id) and container_type = 'Version')", {:project_id => @project_id})
|
||||
end
|
||||
|
||||
|
||||
def render_attachments_for_new_project(project, limit=nil)
|
||||
# 查询条件
|
||||
params[:q] ||= ""
|
||||
|
|
|
@ -0,0 +1,172 @@
|
|||
#enconding:utf-8
|
||||
# fq
|
||||
module ContestsHelper
|
||||
|
||||
def render_notes(contest, journal, options={})
|
||||
content = ''
|
||||
removable = User.current == journal.user || User.current == contest.author
|
||||
links = []
|
||||
if !journal.notes.blank?
|
||||
links << link_to(image_tag('comment.png'),
|
||||
{:controller => 'contests', :action => 'new', :id => contest, :journal_id => journal},
|
||||
:remote => true,
|
||||
:method => 'post',
|
||||
:title => l(:button_quote)) if options[:reply_links]
|
||||
if removable
|
||||
url = {:controller => 'contests',
|
||||
:action => 'destroy',
|
||||
:object_id => journal,
|
||||
:id => contest}
|
||||
links << ' '
|
||||
links << link_to(image_tag('delete.png'), url,
|
||||
:remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete))
|
||||
end
|
||||
end
|
||||
content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty?
|
||||
content << textilizable(journal.notes)
|
||||
css_classes = "wiki"
|
||||
content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
|
||||
end
|
||||
|
||||
def link_to_in_place_notes_editor(text, field_id, url, options={})
|
||||
onclick = "$.ajax({url: '#{url_for(url)}', type: 'get'}); return false;"
|
||||
link_to text, '#', options.merge(:onclick => onclick)
|
||||
end
|
||||
|
||||
# this method is used to get all projects that tagged one tag
|
||||
# added by william
|
||||
def get_contests_by_tag(tag_name)
|
||||
Contest.tagged_with(tag_name).order('updated_on desc')
|
||||
end
|
||||
|
||||
#added by huang
|
||||
def sort_contest_enterprise(state, project_type)
|
||||
content = ''.html_safe
|
||||
case state
|
||||
when 0
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:contest_sort_type => '1', :project_type => project_type)))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:contest_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
||||
|
||||
when 1
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:contest_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:contest_sort_type => '0', :project_type => project_type)))
|
||||
end
|
||||
content = content_tag('ul', content)
|
||||
content_tag('div', content, :class => "tabs_enterprise")
|
||||
end
|
||||
#end
|
||||
|
||||
|
||||
#huang
|
||||
def sort_contest(state)
|
||||
content = ''.html_safe
|
||||
case state
|
||||
when 0
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), {controller: 'contests', action: 'index' ,:contest_sort_type => '1'}))
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), {controller: 'contests', action: 'index' ,:contest_sort_type => '0'}, :class=>"selected"), :class=>"selected")
|
||||
|
||||
when 1
|
||||
content << content_tag('li', link_to(l(:label_sort_by_active), {controller: 'contests', action: 'index' ,:contest_sort_type => '1'}, :class=>"selected"), :class=>"selected")
|
||||
content << content_tag('li', link_to(l(:label_sort_by_time), {controller: 'contests', action: 'index' ,:contest_sort_type => '0'}))
|
||||
end
|
||||
content = content_tag('ul', content)
|
||||
content_tag('div', content, :class => "tabs")
|
||||
end
|
||||
#end
|
||||
|
||||
# def course_options_for_select(courses)
|
||||
# # <option value = '0'>#{l(:label_choose_reward)}</option>
|
||||
# html = ''
|
||||
# courses.each do |course|
|
||||
# html << "<option value = #{course.id}>"
|
||||
# html << course.name
|
||||
# html << "</option>"
|
||||
# end
|
||||
# html.html_safe
|
||||
# end
|
||||
|
||||
|
||||
# used to get the reward and handle the value which can be used to display in views
|
||||
# added by william
|
||||
def get_prize(c_project)
|
||||
c_project.get_reward
|
||||
end
|
||||
|
||||
def count_contest_project
|
||||
contests = Contest.find(:id)
|
||||
@projects = []
|
||||
for contest in contests
|
||||
@projects += contest.contesting_projects
|
||||
end
|
||||
@projects.count
|
||||
end
|
||||
|
||||
def count_contest_softapplication
|
||||
contests = Contest.find(:id)
|
||||
@softapplications = []
|
||||
for contest in contests
|
||||
@softapplications += contest.contesting_softapplications
|
||||
end
|
||||
@projects.count
|
||||
end
|
||||
|
||||
|
||||
def count_contest_user
|
||||
contests = Contest.find(:id)
|
||||
@users = []
|
||||
for contest in contests
|
||||
for project in contest.projects
|
||||
@users += project.users
|
||||
end
|
||||
end
|
||||
@users.count
|
||||
end
|
||||
|
||||
def count_contest_softapplication_user
|
||||
contests = Contest.find(:id)
|
||||
@users = []
|
||||
for contest in contests
|
||||
for project in contest.softapplications
|
||||
@users += softapplication.users
|
||||
end
|
||||
end
|
||||
@users.count
|
||||
end
|
||||
def im_watching_student_id? contest
|
||||
people = []
|
||||
people << contest.author
|
||||
# case bid.reward_type # 天煞的bid分了三用途,里面各种hasmany还不定能用!
|
||||
# when 1
|
||||
# when 2
|
||||
# bid.join_in_contests.each do |jic|
|
||||
# people << jic.user
|
||||
# end
|
||||
# when 3
|
||||
# people += bid.courses.first.users.to_a
|
||||
# else
|
||||
# raise 'bids_helper: unknow bid type' # 出了错看这里!不知道的抛异常,省的找不到出错的地方!
|
||||
# end
|
||||
|
||||
contest.join_in_contests.each do |jic|
|
||||
people << jic.user
|
||||
end
|
||||
people.include?(User.current)
|
||||
end
|
||||
|
||||
def select_option_helper option
|
||||
tmp = Hash.new
|
||||
option.each do |project|
|
||||
tmp[project.name] = project.identifier
|
||||
end
|
||||
tmp
|
||||
end
|
||||
def select_option_app_helper options
|
||||
tmp = Hash.new
|
||||
options.each do |option|
|
||||
tmp[option.name] = option.id
|
||||
end
|
||||
tmp
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module SoftapplicationsHelper
|
||||
end
|
|
@ -5,15 +5,17 @@ module TagsHelper
|
|||
@obj = nil
|
||||
case obj_type
|
||||
when '1'
|
||||
@obj = User.find_by_id(obj_id)
|
||||
@obj = User.find_by_id(obj_id)
|
||||
when '2'
|
||||
@obj = Project.find_by_id(obj_id)
|
||||
when '3'
|
||||
@obj = Issue.find_by_id(obj_id)
|
||||
when '4'
|
||||
@obj = Bid.find_by_id(obj_id)
|
||||
@obj = Bid.find_by_id(obj_id)
|
||||
when '6'
|
||||
@obj = Attachment.find_by_id(obj_id)
|
||||
when '7'
|
||||
@obj= Contest.find_by_id(obj_id)
|
||||
else
|
||||
raise Exception, '[TagsHelper] ===> tag type unknow.'
|
||||
end
|
||||
|
@ -40,6 +42,10 @@ module TagsHelper
|
|||
if user.id == obj_id
|
||||
@result = true
|
||||
end
|
||||
when '7'
|
||||
if user.id == obj_id
|
||||
@result = true
|
||||
end
|
||||
end
|
||||
return @result
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ module WatchersHelper
|
|||
objects = Array.wrap(objects)
|
||||
|
||||
watched = objects.any? {|object| object.watched_by?(user)}
|
||||
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Bid)))
|
||||
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or objects.first.instance_of?(Contest) or (objects.first.instance_of?(Bid)))
|
||||
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
|
@ -46,6 +46,27 @@ module WatchersHelper
|
|||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
|
||||
############## added by linchun
|
||||
def new_watcher_link(objects, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
objects = Array.wrap(objects)
|
||||
|
||||
watched = objects.any? {|object| object.watched_by?(user)}
|
||||
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Contest)))
|
||||
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
text = @watch_flag ?
|
||||
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
|
||||
|
||||
url = watch_path(
|
||||
:object_type => objects.first.class.to_s.underscore,
|
||||
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
|
||||
)
|
||||
method = watched ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
# added by fq, modify nyan
|
||||
# Somebody may use option params
|
||||
def join_in_course(course, user, options=[])
|
||||
|
@ -93,8 +114,40 @@ module WatchersHelper
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
##new add by linchun
|
||||
def join_in_contest(contest, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
joined = user.join_in_contest?(contest)
|
||||
text = joined ? l(:label_exit_contest) : l(:label_join_contest)
|
||||
url_t = join_in_contest_path(:id => contest.id)
|
||||
url_f = try_join_in_contest_path(:id => contest.id)
|
||||
# url = join_in_contest_path(:id => contest.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{contest.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||
else
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{contest.id}", :class => []+options
|
||||
end
|
||||
end
|
||||
|
||||
# liuwanwei 的需求, 新竞赛
|
||||
# 新路由命名为 competition
|
||||
def join_in_competition(competition, user)
|
||||
return '' unless user && user.logged?
|
||||
joined = JoinInCompetition.where('competition_id = ? AND user_id = ?', competition.id, user.id).count>0
|
||||
text = joined ? l(:label_exit_contest) : l(:label_join_contest)
|
||||
url_f = new_join_contests_path(:id => competition.id)
|
||||
url_t = unjoin_in_contest_contests_path(:id => competition.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
# 退出竞赛用
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{competition.id}", :confirm => l(:text_are_you_sure_out)
|
||||
else
|
||||
# 加入竞赛用
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{competition.id}"
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the css class used to identify watch links for a given +object+
|
||||
def watcher_css(objects)
|
||||
objects = Array.wrap(objects)
|
||||
|
|
|
@ -97,10 +97,21 @@ module WelcomeHelper
|
|||
sort_bid_by_hot
|
||||
end
|
||||
|
||||
def find_all_hot_contest
|
||||
sort_contest_by_hot
|
||||
def find_all_hot_contest limit=10
|
||||
# Contest.reorder("created_on DESC").all.take limit
|
||||
mix_bid = []
|
||||
mix_bid += Contest.reorder("created_on DESC").take(limit).to_a
|
||||
mix_bid += Bid.visible.where('reward_type = ?', 2).reorder('bids.created_on desc').take(limit).to_a
|
||||
mix_bid.sort do |older, newer|
|
||||
newer.created_on - older.created_on
|
||||
end
|
||||
mix_bid.take limit
|
||||
end
|
||||
|
||||
def find_all_hot_softapplication limit=10
|
||||
Softapplication.reorder("created_at DESC").all.take limit
|
||||
end
|
||||
|
||||
def cal_memos_count event
|
||||
return nil if event.parent_id
|
||||
event.replies_count
|
||||
|
@ -220,6 +231,10 @@ module WelcomeHelper
|
|||
def sort_contest_by_hot
|
||||
sort_bid_by_hot_rails 2
|
||||
end
|
||||
#new added by linchun
|
||||
def sort_contest_by_time
|
||||
sort_bid_by_time 2
|
||||
end
|
||||
|
||||
#取得所有活动
|
||||
def find_all_activities limit=6
|
||||
|
@ -274,6 +289,10 @@ module WelcomeHelper
|
|||
Bid.visible.where('reward_type = ?', reward_type).reorder('bids.commit desc').limit(limit)
|
||||
end
|
||||
|
||||
def sort_bid_by_time reward_type, limit = 10
|
||||
Bid.visible.where('reward_type = ?', reward_type).reorder('bids.created_on desc').limit(limit)
|
||||
end
|
||||
|
||||
def find_all_event_type event
|
||||
case event.event_type
|
||||
when 'news'
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
module ZipdownHelper
|
||||
end
|
|
@ -21,6 +21,7 @@ require "fileutils"
|
|||
class Attachment < ActiveRecord::Base
|
||||
belongs_to :container, :polymorphic => true
|
||||
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
|
||||
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
|
||||
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
|
||||
|
||||
validates_presence_of :filename, :author
|
||||
|
@ -33,7 +34,7 @@ class Attachment < ActiveRecord::Base
|
|||
acts_as_event :title => :filename,
|
||||
:url => Proc.new {|o| {:controller => 'attachments', :action => 'download', :id => o.id, :filename => o.filename}}
|
||||
|
||||
acts_as_activity_provider :type => 'files',
|
||||
acts_as_activity_provider :type => 'files',
|
||||
:permission => :view_files,
|
||||
:author_key => :author_id,
|
||||
:find_options => {:select => "#{Attachment.table_name}.*",
|
||||
|
@ -179,6 +180,10 @@ class Attachment < ActiveRecord::Base
|
|||
!!(self.filename =~ /\.(bmp|gif|jpg|jpe|jpeg|png)$/i)
|
||||
end
|
||||
|
||||
def pack?
|
||||
!!(self.filename =~ /\.(zip|rar|tar|gz)$/i)
|
||||
end
|
||||
|
||||
def thumbnailable?
|
||||
image?
|
||||
end
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
class Contest < ActiveRecord::Base
|
||||
attr_accessible :author_id, :budget, :commit, :deadline, :description, :name, :password
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => :author_id
|
||||
has_many :contesting_projects, :dependent => :destroy
|
||||
has_many :projects, :through => :contesting_projects
|
||||
has_many :contesting_softapplications, :dependent => :destroy
|
||||
has_many :softapplications, :through => :contesting_softapplications
|
||||
has_many :projects_member, :class_name => 'User', :through => :projects
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
has_many :join_in_competitions, foreign_key: 'competition_id', :dependent => :destroy
|
||||
has_many :join_in_contests, class_name: 'JoinInCompetition', foreign_key: 'competition_id', :dependent => :destroy
|
||||
|
||||
|
||||
|
||||
acts_as_attachable
|
||||
|
||||
NAME_LENGTH_LIMIT = 60
|
||||
DESCRIPTION_LENGTH_LIMIT = 250
|
||||
|
||||
validates_length_of :name, :maximum => NAME_LENGTH_LIMIT
|
||||
validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT
|
||||
validates_presence_of :author_id, :name, :deadline
|
||||
validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/
|
||||
validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
|
||||
validate :validate_user
|
||||
after_create :act_as_activity
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
nil
|
||||
}
|
||||
|
||||
scope :like, lambda {|arg|
|
||||
if arg.blank?
|
||||
where(nil)
|
||||
else
|
||||
pattern = "%#{arg.to_s.strip.downcase}%"
|
||||
where("LOWER(id) LIKE :p OR LOWER(name) LIKE :p OR LOWER(description) LIKE :p", :p => pattern)
|
||||
end
|
||||
}
|
||||
|
||||
acts_as_watchable
|
||||
acts_as_taggable
|
||||
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_requirement)} ##{o.id}: #{o.name}" },
|
||||
:description => :description,
|
||||
:author => :author,
|
||||
:url => Proc.new {|o| {:controller => 'contests', :action => 'show_contest', :id => o.id}}
|
||||
|
||||
acts_as_activity_provider :find_options => {:include => [:projects, :author]},
|
||||
:author_key => :author_id
|
||||
|
||||
safe_attributes 'name',
|
||||
'description',
|
||||
'budget',
|
||||
'deadline',
|
||||
'password'
|
||||
|
||||
|
||||
def add_jour(user, notes, reference_user_id = 0, options = {})
|
||||
if options.count == 0
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id)
|
||||
else
|
||||
jfm = self.journals_for_messages.build(options)
|
||||
jfm.save
|
||||
jfm
|
||||
end
|
||||
end
|
||||
|
||||
def self.creat_contests(budget, deadline, name, description=nil)
|
||||
self.create(:author_id => User.current.id, :budget => budget,
|
||||
:deadline => deadline, :name => name, :description => description, :commit => 0)
|
||||
end
|
||||
|
||||
def update_contests(budget, deadline, name, description=nil)
|
||||
if(User.current.id == self.author_id)
|
||||
self.name = name
|
||||
self.budget = budget
|
||||
self.deadline = deadline
|
||||
self.description = description
|
||||
self.save
|
||||
end
|
||||
end
|
||||
|
||||
def delete_contests
|
||||
unless self.nil?
|
||||
if User.current.id == self.author_id
|
||||
self.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_commit(commit)
|
||||
self.update_attribute(:commit, commit)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_user
|
||||
errors.add :author_id, :invalid if author.nil? || !author.active?
|
||||
end
|
||||
|
||||
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.author_id)
|
||||
end
|
||||
|
||||
def validate_contest_manager(user_id)
|
||||
unless user_id.nil?
|
||||
if self.author_id == user_id
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,52 @@
|
|||
class ContestingProject < ActiveRecord::Base
|
||||
attr_accessible :contest_id, :description, :project_id, :user_id, :reward
|
||||
|
||||
belongs_to :contest
|
||||
belongs_to :project
|
||||
belongs_to :user
|
||||
|
||||
DESCRIPTION_LENGTH_LIMIT = 500
|
||||
|
||||
validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT
|
||||
validates_presence_of :user_id, :contest_id, :project_id
|
||||
validate :validate_user
|
||||
validate :validate_contest
|
||||
validate :validate_project
|
||||
validates_uniqueness_of :contest_id, :scope => :project_id
|
||||
|
||||
def self.cerate_contesting(contest_id, project_id, description = nil)
|
||||
self.create(:user_id => User.current.id, :contest_id => contest_id,
|
||||
:project_id => project_id, :description => description)
|
||||
end
|
||||
|
||||
|
||||
def update_reward(which)
|
||||
self.update_attribute(:reward,which)
|
||||
end
|
||||
|
||||
def get_reward
|
||||
self.reward
|
||||
end
|
||||
|
||||
def cancel_contesting
|
||||
unless self.nil?
|
||||
if User.current.id == self.user_id
|
||||
self.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_user
|
||||
errors.add :user_id, :invalid if user.nil? || !user.active?
|
||||
end
|
||||
|
||||
def validate_contest
|
||||
errors.add :contest_id, :invalid if contest.nil?
|
||||
end
|
||||
|
||||
def validate_project
|
||||
errors.add :project_id, :invalid if project.nil?
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
class ContestingSoftapplication < ActiveRecord::Base
|
||||
attr_accessible :contest_id, :description, :softapplication_id, :user_id
|
||||
|
||||
belongs_to :contest
|
||||
belongs_to :softapplication
|
||||
belongs_to :user
|
||||
|
||||
|
||||
def self.create_softapplication_contesting(contest_id, softapplication_id, description = nil)
|
||||
self.create(:user_id => User.current.id, :contest_id => contest_id,
|
||||
:softapplication_id => softapplication_id, :description => description)
|
||||
end
|
||||
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
class HomeworkAttach < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :user
|
||||
belongs_to :bid
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
# 新竞赛参加关系表
|
||||
class JoinInCompetition < ActiveRecord::Base
|
||||
attr_accessible :competition_id, :user_id
|
||||
belongs_to :user, :class_name => "User", :foreign_key => :user_id
|
||||
belongs_to :competition, :class_name => "Contest", :foreign_key => :competition_id
|
||||
|
||||
validates :user_id, presence: true
|
||||
validates :competition_id, presence: true
|
||||
|
||||
end
|
|
@ -4,9 +4,10 @@ class Memo < ActiveRecord::Base
|
|||
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
|
||||
|
||||
validates_presence_of :author_id, :forum_id, :subject
|
||||
#validates :content, presence: true
|
||||
# 若是主题帖,则内容可以是空
|
||||
validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
|
||||
validates_length_of :subject, maximum: 50
|
||||
#validates_length_of :content, maximum: 3072
|
||||
validates_length_of :content, maximum: 3072
|
||||
validate :cannot_reply_to_locked_topic, :on => :create
|
||||
|
||||
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"
|
||||
|
|
|
@ -55,6 +55,7 @@ class Project < ActiveRecord::Base
|
|||
has_many :changesets, :through => :repository
|
||||
#added by xianbo for delete biding_project
|
||||
has_many :biding_projects, :dependent => :destroy
|
||||
has_many :contesting_projects, :dependent => :destroy
|
||||
#ended by xianbo
|
||||
# added by fq
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
class Softapplication < ActiveRecord::Base
|
||||
attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id, :contest_id, :application_developers
|
||||
acts_as_attachable
|
||||
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :contesting_softapplications, :dependent => :destroy
|
||||
belongs_to :user
|
||||
belongs_to :contest
|
||||
|
||||
def add_jour(user, notes, reference_user_id = 0, options = {})
|
||||
if options.count == 0
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id)
|
||||
else
|
||||
jfm = self.journals_for_messages.build(options)
|
||||
jfm.save
|
||||
jfm
|
||||
end
|
||||
end
|
||||
def set_commit(commit)
|
||||
self.update_attribute(:commit, commit)
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -78,11 +78,17 @@ class User < Principal
|
|||
belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang
|
||||
## added by xianbo for delete
|
||||
has_many :biding_projects, :dependent => :destroy
|
||||
has_many :contesting_projects, :dependent => :destroy
|
||||
has_many :contesting_softapplications, :dependent => :destroy
|
||||
belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy
|
||||
##ended by xianbo
|
||||
|
||||
#####fq
|
||||
has_many :jours, :class_name => 'JournalsForMessage', :dependent => :destroy
|
||||
has_many :journals_messages, :class_name => 'JournalsForMessage', :foreign_key => "user_id", :dependent => :destroy
|
||||
has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
|
||||
has_many :contests, :foreign_key => 'author_id', :dependent => :destroy
|
||||
has_many :softapplications, :foreign_key => 'user_id', :dependent => :destroy
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1"
|
||||
has_many :journal_replies, :dependent => :destroy
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
=end
|
||||
class UserExtensions < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :school, :class_name => 'School', :foreign_key => :school_id
|
||||
attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id
|
||||
TEACHER = 0
|
||||
STUDENT = 1
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<!-- #wang -->
|
||||
<% for attachment in attachments %><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
||||
<% if attachment.is_text? %>
|
||||
<%= link_to image_tag('magnifier.png'),
|
||||
:controller => 'attachments', :action => 'show',
|
||||
:id => attachment, :filename => attachment.filename %>
|
||||
<% end %>
|
||||
<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
|
||||
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
<% end -%>
|
|
@ -12,11 +12,14 @@
|
|||
<% end %>
|
||||
</span>
|
||||
<span class="add_attachment">
|
||||
<%= button_tag "浏览", :type=>"button", :onclick=>"_file.click()" %>
|
||||
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => nil,
|
||||
:id => '_file',
|
||||
:class => 'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addInputFiles(this);',
|
||||
:style => 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
|
@ -24,6 +27,7 @@
|
|||
:upload_path => uploads_path(:format => 'js'),
|
||||
:description_placeholder => l(:label_optional_description)
|
||||
} %>
|
||||
<span id="upload_file_count"><%= l(:label_no_file_uploaded)%></span>
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</span>
|
||||
|
||||
|
|
|
@ -1 +1,8 @@
|
|||
$('#attachments_<%= j params[:attachment_id] %>').remove();
|
||||
var count=$('#attachments_fields>span').length;
|
||||
if(count<=0){
|
||||
$("#upload_file_count").text("未上传文件");
|
||||
$(".remove_all").remove();
|
||||
}else{
|
||||
$("#upload_file_count").html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件");
|
||||
}
|
|
@ -8,7 +8,7 @@ fileSpan.find('a.remove-upload')
|
|||
.attr({
|
||||
"data-remote": true,
|
||||
"data-method": 'delete',
|
||||
href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
|
||||
"href": '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
|
||||
})
|
||||
.off('click');
|
||||
<% end %>
|
||||
|
|
|
@ -60,7 +60,10 @@
|
|||
<% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%= l(:label_price) %><%= l(:label_RMB_sign) %><%= bid.budget%></strong></td> --></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580px" ><span class="font_description"><%= bid.description %></span></td>
|
||||
<td colspan="2" width="580px" ><span class="font_description">
|
||||
<%#= bid.description %>
|
||||
<%= textilizable bid, :description %>
|
||||
</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><span class="font_lighter"><span> <%= l(:label_create_time) %> : <%=format_time bid.created_on %></span><span style="float: right"> <%= l(:field_deadline) %> : <%=bid.deadline %></span></td>
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% display_id = im_watching_student_id? @bid%>
|
||||
<%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;display: inline-block;" if(
|
||||
User.current.admin? ||
|
||||
!(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) ||
|
||||
(Rails.env.development?) %>
|
||||
<% @homework_list.each do |homework|%>
|
||||
<% if homework.attachments.any?%>
|
||||
<table width="660px" border="0" align="center">
|
||||
|
@ -22,7 +26,12 @@
|
|||
<td>
|
||||
<table width="580px" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong> <%= link_to homework.user, user_path(homework.user)%></strong> <span class="font_lighter">提交了作业</span></td>
|
||||
<td colspan="1" valign="top"><strong> <%= link_to homework.user, user_path(homework.user)%></strong> <span class="font_lighter">已提交</span></td>
|
||||
<td valign="top" align="right">
|
||||
<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.attachments[0].created_on.to_s) %>
|
||||
<span class="required">迟交</span>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
|
|
|
@ -147,6 +147,13 @@
|
|||
<%= format_time b_project.created_at%>
|
||||
</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<% if Time.parse(@bid.deadline.to_s) < Time.parse(b_project.created_at.to_s) %>
|
||||
<span class="required">迟交</span>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td width="30%">
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
<p id="put-bid-form-partial">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= link_to (t :button_back), project_for_bid_homework_path %>
|
||||
</fieldset>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= link_to (t :button_back), project_for_bid_homework_path %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
|
@ -14,7 +14,7 @@
|
|||
<% else %>
|
||||
<% end %>
|
||||
<div class="bid_description">
|
||||
<%= @bid.description %>
|
||||
<%= textilizable(@bid, :description) %>
|
||||
<% if @bid.attachments.any?%>
|
||||
<% options = {:author => true} %>
|
||||
<%= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!-- fq -->
|
||||
|
||||
<% if @bid.homework_type == 1%>
|
||||
<% if @bid.homework_type == Bid::HomeworkFile %>
|
||||
<%= render :partial => 'homework' %>
|
||||
|
||||
<% else %>
|
||||
|
|
|
@ -91,13 +91,13 @@
|
|||
</td>
|
||||
</tr> -->
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- </tbody>
|
||||
</table> -->
|
||||
<div class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<!-- fq -->
|
||||
<% contests.each do |contest|%>
|
||||
<table width="95%" border="0" style="padding-left: 10px; padding-top: 10px;">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= link_to(image_tag(url_to_avatar(contest.author), :class => 'avatar'), user_path(contest.author), :class => "avatar") %></td>
|
||||
<td>
|
||||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong><%= link_to(contest.author, user_path(contest.author), :class => 'bid_user') %>: <%= link_to(contest.name, show_contest_contest_path(contest), :class => 'bid_path', :target => "_blank") %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="500">
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<strong><%= l(:label_contests_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= contest.budget%></span></strong>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><span class="font_lighter"><%= l(:label_contest_project, :count => contest.contesting_projects.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_projects.count, show_project_contest_path(contest), :target => "_blank") %></span></strong>)</span>
|
||||
<span class="font_lighter"><%= l(:label_contest_softapplication, :count => contest.contesting_softapplications.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_softapplications.count, show_softapplication_contest_path(contest), :target => "_blank") %></span></strong>)</span>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table></td>
|
||||
<td width="200" align="right" class="a"><span class="font_lighter"> <%= l :label_create_time %>: <%= format_time contest.created_on %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="bid-description" style="border-left: 1px solid #d9d8d8; border-bottom: 1px solid #d9d8d8; padding-left: 20px; padding-bottom: 10px; margin-bottom: 20px;">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<!-- <td> <%= contest.description%> </td> -->
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
|
||||
<ul>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!-- huang -->
|
||||
<script type="text/javascript" language="javascript">
|
||||
function show(id, id_t, label_reward, label_money, label_credit, label_content) {
|
||||
var text = $('#' + id);
|
||||
var text_t = $('#' + id_t);
|
||||
if (text.val() == 0) {
|
||||
text_t.attr("placeholder", label_reward);
|
||||
}
|
||||
if (text.val() == 1) {
|
||||
text_t.attr("placeholder", label_money);
|
||||
}
|
||||
if (text.val() == 3) {
|
||||
text_t.attr("placeholder", label_credit);
|
||||
}
|
||||
if (text.val() == 2) {
|
||||
text_t.attr("placeholder", label_content);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
</script>
|
||||
<%= error_messages_for 'contest' %>
|
||||
<!--[form:project]-->
|
||||
<p style="width:500px;"><%= l(:label_bids_form_contest_new_description) %></p>
|
||||
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Contest::NAME_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_name)}" %></p>
|
||||
|
||||
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %></p>
|
||||
|
||||
<p style="margin-left:-10px;"><%= f.text_field :password, :size => 60, :style => "width:488px;margin-left: 10px;" %></p>
|
||||
|
||||
<p>
|
||||
<%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
|
||||
|
||||
<!-- 设置奖项设置的打开 关闭开关-->
|
||||
</p>
|
||||
<!-- <em class="info" style="margin-left:95px;"><%= l(:text_contest_reward) %></em> -->
|
||||
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('contest_deadline')%></p>
|
|
@ -0,0 +1,53 @@
|
|||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
<% tip1 = l(:label_user_response) %>
|
||||
<p class="font_lighter" style="font-size: 15px; padding-left: 12px; "><%=tip1%></p>
|
||||
|
||||
<div id='leave-message'>
|
||||
<%= render :partial => 'new', :locals => {:contest => @contest, :sta => @state} %>
|
||||
</div>
|
||||
|
||||
|
||||
<% if journals.size >0 %>
|
||||
<ul class="message-for-user">
|
||||
<% for journal in journals%>
|
||||
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
|
||||
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
|
||||
<span class="body">
|
||||
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
|
||||
<span class="font_lighter"><% label = l(:label_contest_requirement) %></span>
|
||||
<div> <%= textilizable journal.notes%> </div>
|
||||
<span class="font_lighter"><%= l(:label_bids_published) %> <%= time_tag(journal.created_on).html_safe %> <%= l(:label_bids_published_ago) %></span>
|
||||
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
|
||||
<span>
|
||||
<% if reply_allow %>
|
||||
<%#= link_to(l(:button_quote), {:controller => 'contests', :action => 'new', :id => contest, :journal_id => journal}, :remote => true, :method => 'post', :title => l(:button_quote))%>
|
||||
<%= link_to(l(:button_quote), contests_path(:id => contest, :journal_id => journal), :remote => true, :method => 'post', :title => l(:button_quote))%>
|
||||
<%= link_to l(:label_bid_respond_quote),'',
|
||||
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}: '); $('##{ids} textarea') ;return false;"}%>
|
||||
<% end %>
|
||||
|
||||
<% if @user==User.current|| User.current.admin? %>
|
||||
<%#= link_to(l(:label_bid_respond_delete), {:controller => 'bids', :action => 'destroy', :object_id => journal, :id => bid},:confirm => l(:label_delete_confirm),
|
||||
:remote => true, :method => 'delete', :class => "delete", :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
|
||||
<%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
||||
<% end %>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<div style="clear: both;"></div>
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
<% if reply_allow %>
|
||||
<div id='<%= ids %>' class="respond-form">
|
||||
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div style="clear: both;"></div>
|
||||
<div>
|
||||
<%= render :partial => "words/journal_reply", :locals => {:journal => journal } %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
|
@ -0,0 +1,103 @@
|
|||
|
||||
<% contesting_project.each do |c_project|%>
|
||||
<% if c_project.project %>
|
||||
<table width="90%" border="0" align='center'>
|
||||
<tr>
|
||||
<td>
|
||||
<table width="660px" border="0" align='center'>
|
||||
<tr>
|
||||
<td width="50px" valign="top" colspan="2" align="middle">
|
||||
<div style="width: 50px; height: 50px;">
|
||||
<%= image_tag(url_to_avatar(c_project.project), :class => 'avatar3') %>
|
||||
|
||||
</div></td>
|
||||
<td width="65%" valign="top">
|
||||
<table width="100%" valign="top">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50%">
|
||||
<strong>
|
||||
<%= link_to(c_project.project.name, project_path(c_project.project)) %>
|
||||
</strong>
|
||||
<span class="font_lighter"><%= l(:label_joined_contest)%></span>
|
||||
</td>
|
||||
|
||||
<!-- 如果需求到期 并且是该需求的管理员 -->
|
||||
|
||||
<td style="color: #ec6300;" align="right" valign="0.1em" width="16%">
|
||||
<strong>
|
||||
<span id="reward_result_<%=c_project.id%>"> <!-- 调用js进行刷新 -->
|
||||
<%= l(:label_system_grade) %>:<%= (c_project.project.project_status.nil? ? 0.0 : c_project.project.project_status.grade) unless (c_project.project.project_status.nil? && c_project.project.nil?) %>
|
||||
<% if get_prize(c_project).nil? or get_prize(c_project) == "" %>
|
||||
<% if @contest.deadline < Date.today %>
|
||||
<%= l(:label_noawards)%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
||||
<% case get_prize(c_project) %>
|
||||
<% when '-1' %>
|
||||
<%= image_tag("/images/bid/special_reward.png")%>
|
||||
<% when '0' %>
|
||||
<%= image_tag("/images/bid/first_reward.png")%>
|
||||
<% when '1' %>
|
||||
<%= image_tag("/images/bid/second_reward.png")%>
|
||||
<% when '2' %>
|
||||
<%= image_tag("/images/bid/third_reward.png")%>
|
||||
<% when '3' %>
|
||||
<%= image_tag("/images/bid/forth_reward.png")%>
|
||||
<% when '4' %>
|
||||
<%= image_tag("/images/bid/fifth_reward.png")%>
|
||||
<% when '5' %>
|
||||
<%= image_tag("/images/bid/qualified.png")%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
</strong>
|
||||
</td>
|
||||
|
||||
<!-- 评价显隐控制按钮-->
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="50%" style=" word-wrap: break-word; word-break: break-all"><%= c_project.project.description %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><span class="font_lighter">
|
||||
<%= format_time c_project.created_at%>
|
||||
</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td width="30%">
|
||||
<div class="bid-user-message" style="border-left: 1px solid rgb(225, 225, 225); margin-left: 20px; padding-left: 20px;">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<strong>
|
||||
<%= l(:label_contest_user) %>
|
||||
<% unless c_project.user.nil? %>
|
||||
<%= c_project.user.lastname %><%= c_project.user.firstname %>
|
||||
<% end %>
|
||||
</strong>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td style=" word-wrap: break-word; word-break: break-all">
|
||||
<%= l(:label_contest_reason) %>
|
||||
<%= c_project.description %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
<% contesting_softapplication.each do |c_softapplication|%>
|
||||
<% if c_softapplication.softapplication %>
|
||||
<div style="padding-left: 18px">
|
||||
<div style="font-size: 15px">
|
||||
<tr>
|
||||
<td><strong>应用软件:</strong></td>
|
||||
<td>
|
||||
<%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication)) %>
|
||||
</td>
|
||||
</tr></br>
|
||||
</div>
|
||||
<div style="padding-left: 68px">
|
||||
<tr>
|
||||
<td>简介:</td>
|
||||
<td>
|
||||
<%= c_softapplication.softapplication.description %>
|
||||
</td>
|
||||
</tr></br>
|
||||
</div>
|
||||
<div style="padding-left: 68px; padding-bottom: 8px">
|
||||
<tr>
|
||||
<td>发布时间:</td>
|
||||
<td>
|
||||
<%=format_time c_softapplication.created_at %>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="underline-contests_three"></div>
|
||||
<% end %>
|
||||
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<!-- fq -->
|
||||
<script type="text/javascript" language="javascript">
|
||||
function clearInfo(id, content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == content) {
|
||||
$('#' + id).val('');
|
||||
}
|
||||
}
|
||||
|
||||
function showInfo(id, content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == '') {
|
||||
$('#' + id).val(content);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<%= form_for('contest_message',
|
||||
:remote => true, :method => :post,
|
||||
:url => {:controller => 'contests',
|
||||
:action => 'create',
|
||||
:id => contest,
|
||||
:sta => sta}
|
||||
) do |f|%>
|
||||
|
||||
<div id = 'pre_show'> <!--what function?-->
|
||||
<%= render :partial => 'pre_show', :locals => {:content => @content} %>
|
||||
</div>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<table border="0" width="525px" align="center" >
|
||||
<tr>
|
||||
<td><%= f.text_area 'message', :rows => 3, :cols => 65, :placeholder => l(:label_my_respond), :style => "resize: none;", :class => 'noline'%></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<%= f.text_field :reference_user_id, :style=>"display:none"%> <!--what function?-->
|
||||
|
||||
<!-- modified by bai -->
|
||||
<table border="0" width="525px" align="center">
|
||||
<tr>
|
||||
<td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "contest_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
|
||||
<%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('contest_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- end -->
|
||||
<% else %>
|
||||
<div style="font-size: 14px;margin:10px;">
|
||||
<%= l(:label_user_login_tips) %>
|
||||
<%= link_to l(:label_user_login_new), signin_path %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -0,0 +1,57 @@
|
|||
<!-- added by fq -->
|
||||
<style>
|
||||
input[type="submit"].contest_btn {
|
||||
vertical-align: middle;
|
||||
width: 60px;/*modified by ming*/
|
||||
height: 25px;
|
||||
line-height: 19px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
/*margin-top: -10px;*/
|
||||
/*margin-right: -4px;*/
|
||||
}
|
||||
input[type="button"].contest_btn {
|
||||
width: 60px;/*modified by ming*/
|
||||
height: 25px;
|
||||
line-height: 19px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
/*margin-top: -10px;*/
|
||||
margin-right: -2px;
|
||||
}
|
||||
textarea:focus {
|
||||
border: #d5dee9 1px solid;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h3 class="title">请输入竞赛密码</h3>
|
||||
|
||||
<%= form_tag( join_in_contest_contests_path(id: contest.id),
|
||||
:remote => true,
|
||||
:method => :post,
|
||||
:id => 'new-watcher-form') do %>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td align="cneter">
|
||||
</td>
|
||||
|
||||
<%= text_field_tag 'contest_password', nil, :size => 45 %>
|
||||
|
||||
<p class="buttons" style="padding-top: 10px; padding-bottom: 1px; margin-bottom: 1px">
|
||||
<%= submit_tag l(:label_new_join), :name => nil, :class => "contest_btn", :onclick => "hideModal(this);" %>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :class => "contest_btn", :onclick => "hideModal(this);", :type => 'button' %>
|
||||
</td>
|
||||
</tr></table>
|
||||
<% end %>
|
|
@ -0,0 +1,13 @@
|
|||
<!-- fq -->
|
||||
<% unless content.nil?%>
|
||||
<table width="60%" style="margin-left: 60px;">
|
||||
<tr>
|
||||
<td> <%= textilizable content %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<!-- fq -->
|
||||
<%= render_flash_messages %>
|
||||
|
||||
<table width="100%" border="0" style="padding-left: 15px">
|
||||
<td width="15%" class="font_lighter" style="font-size: 15px;"><%= l(:label_bidding_project) %>(<%= contesting_project.count%>)</td> <!--标注参与项目及数量-->
|
||||
<% if User.current.logged? %>
|
||||
<td width="85%">
|
||||
<div class='icon icon-add'> <!--标注我要参加及添加图标-->
|
||||
<%= toggle_link l(:button_contesting_as_project), 'put-bid-form' %>
|
||||
</div>
|
||||
</td>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<%= render :partial=> "list_projects",:locals => {:contesting_project => contesting_project,:contest => @contest }%>
|
|
@ -0,0 +1,8 @@
|
|||
$("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_competition(@contest, user) %>');
|
||||
<% if @state %>
|
||||
<% if @state == 0 %>
|
||||
alert("加入成功")
|
||||
<% else %>
|
||||
alert("密码错误")
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -0,0 +1,15 @@
|
|||
<!-- fq -->
|
||||
<%= render_flash_messages %>
|
||||
|
||||
<table width="100%" border="0" style="padding-left: 15px">
|
||||
<td width="15%" class="font_lighter" style="font-size: 15px;"><%= l(:label_contest_softapplication) %>(<%= @contest.contesting_softapplications.count%>)</td> <!--标注参赛应用及数量-->
|
||||
<% if User.current.logged? %>
|
||||
<td width="85%">
|
||||
<div class='icon icon-add'> <!--标注我要参加及添加图标-->
|
||||
|
||||
<%= link_to l(:button_contesting_as_application), "javascript:void(0);", onclick: "$('#put-bid-form').toggle();" %>
|
||||
</div>
|
||||
</td>
|
||||
<% end %>
|
||||
</table>
|
||||
<%= render :partial=> "list_softapplications",:locals => {:contesting_softapplication => contesting_softapplication,:contest => @contest }%>
|
|
@ -0,0 +1,4 @@
|
|||
$('#contesting_project_list').html('<%= escape_javascript(render(:partial => 'project_list', :locals => {:contesting_project => @contesting_project})) %>');
|
||||
$("#project_id").val("请选择项目");
|
||||
$("#contest_message").val( "<%= l(:label_bid_reason) %>" );
|
||||
$("#put-bid-form").hide();
|
|
@ -0,0 +1,4 @@
|
|||
$('#contesting_softapplication_list').html('<%= escape_javascript(render(:partial => 'softapplication_list', :locals => {:contesting_softapplication => @contesting_softapplication})) %>');
|
||||
$("#softapplication_id").val("请选择参赛应用");
|
||||
$("#contest_message").val( "<%= l(:label_bid_reason) %>" );
|
||||
$("#put-bid-form").hide();
|
|
@ -0,0 +1,2 @@
|
|||
$('#history').html('<%= escape_javascript(render(:partial => 'history', :locals => {:contest => @contest, :journals => @jour, :state => @state})) %>');
|
||||
$('#contest_message_reference_user_id').val("");
|
|
@ -0,0 +1,4 @@
|
|||
$('#history').html('<%= escape_javascript(render(:partial => 'contests/history', :locals => {:contest => @contest, :journals => @jour, :state => true})) %>');
|
||||
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
|
||||
$('#contest_message_message').val("");
|
||||
$('#contest_message_reference_user_id').val("");
|
|
@ -0,0 +1,2 @@
|
|||
$('#history').html('<%= escape_javascript(render(:partial => 'history', :locals => {:contest => @contest, :journals => @jour, :state => false})) %>');
|
||||
$('#contest_message_reference_user_id').val("");
|
|
@ -0,0 +1,38 @@
|
|||
<div class="top-content">
|
||||
<%= form_tag({:controller => 'contests', :action => 'index'}, :method => :get) do %>
|
||||
<table width="940px">
|
||||
<tr>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_contest_innovate) %></td>
|
||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td rowspan="2">
|
||||
<% if User.current.logged? %>
|
||||
<% unless User.current.user_extensions.identity == 1 %>
|
||||
<%= link_to(l(:label_newtype_contest), {:controller => 'contests', :action => 'new_contest'}, :class => 'icon icon-add', :target => "_blank") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td rowspan="2" >
|
||||
<div class="project-search" style="float: right">
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to request.host()+"/contests", :controller => 'contests', :action => 'index' %> </a></td>
|
||||
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if @contests.size > 0%>
|
||||
<%= sort_contest(@s_state)%>
|
||||
<div id="bid-show">
|
||||
<%= render :partial => 'contest_list', :locals => {:contests => @contests, :contest_pages => @contest_pages} %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "layouts/no_content"%>
|
||||
<% end %>
|
||||
|
||||
<% html_title l(:label_contest_list)%>
|
|
@ -0,0 +1,2 @@
|
|||
$('#history').html('<%= escape_javascript(render(:partial => 'history', :locals => {:contest => @contest, :journals => @jour, :state => @state})) %>');
|
||||
$('#contest_message_reference_user_id').val("");
|
|
@ -0,0 +1,5 @@
|
|||
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => @content})) %>');
|
||||
$('#contest_message_reference_user_id').val("<%= @id%>");
|
||||
showAndScrollTo("pre_show", "contest_message_reference_user_id");
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<!-- huang -->
|
||||
<h3><%=l(:label_newtype_contest)%></h3>
|
||||
|
||||
<%= labelled_form_for @contest, :url => {:controller => 'contests', :action => 'create_contest'}, method: :post do |f| %>
|
||||
<div class="box tabular">
|
||||
<%= render :partial => 'form_contest', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= javascript_tag "$('#bid_name').focus();" %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'contests/new_join', :locals => {:contest => @contest}) %>');
|
||||
showModal('ajax-modal', '400px');
|
||||
$('#ajax-modal').addClass('new-watcher');
|
|
@ -0,0 +1,31 @@
|
|||
$('#reward_result_<%= @contesting_project_id %>').html('<%= j(
|
||||
|
||||
if get_prize(@b_p).nil? or get_prize(@b_p) == ""
|
||||
if @contest.deadline < Date.today
|
||||
puts '未评奖'
|
||||
end
|
||||
else
|
||||
|
||||
case get_prize(@b_p)
|
||||
when '-1'
|
||||
image_tag("/images/bid/special_reward.png")
|
||||
when '1'
|
||||
when '0'
|
||||
image_tag("/images/bid/first_reward.png")
|
||||
when '1'
|
||||
image_tag("/images/bid/second_reward.png")
|
||||
when '2'
|
||||
image_tag("/images/bid/third_reward.png")
|
||||
when '3'
|
||||
image_tag("/images/bid/forth_reward.png")
|
||||
when '4'
|
||||
image_tag("/images/bid/fifth_reward.png")
|
||||
when '5'
|
||||
image_tag("/images/bid/qualified.png")
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
%>')
|
||||
|
||||
$('#<%= @contesting_project_id %>').hide()
|
|
@ -0,0 +1,30 @@
|
|||
<!-- added by bai -->
|
||||
<h3><%=l(:label_settings)%></h3>
|
||||
<script type="text/javascript" language="javascript">
|
||||
function show(id, id_t, label_reward, label_money, label_credit, label_content) {
|
||||
var text = $('#' + id);
|
||||
var text_t = $('#' + id_t);
|
||||
if (text.val() == 0) {
|
||||
text_t.attr("placeholder", label_reward);
|
||||
}
|
||||
if (text.val() == 1) {
|
||||
text_t.attr("placeholder", label_money);
|
||||
}
|
||||
if (text.val() == 3) {
|
||||
text_t.attr("placeholder", label_credit);
|
||||
}
|
||||
if (text.val() == 2) {
|
||||
text_t.attr("placeholder", label_content);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
</script>
|
||||
<%= error_messages_for 'contest' %>
|
||||
|
||||
<%= labelled_form_for @contest, :url => update_contest_contest_path(@contest) do |f| %>
|
||||
<div class="box tabular">
|
||||
<%= render :partial => 'form_contest', :locals => { :f => f } %>
|
||||
</div>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= javascript_tag "$('#bid_name').focus();" %>
|
||||
<% end %>
|
|
@ -0,0 +1,34 @@
|
|||
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
<div style="margin-left: 20px;">
|
||||
<span class="portrait"><%= image_tag(url_to_avatar(@contest.author), :class => "avatar")%></span>
|
||||
<span class="body">
|
||||
<h3><%= link_to(@contest.author.lastname+@contest.author.firstname, user_path(@contest.author))%>:<%= @contest.name %></h3>
|
||||
<p>
|
||||
<strong><%= l(:label_bids_reward_method) %><span class="bonus"><%= @contest.budget%></span></strong>
|
||||
</p>
|
||||
<div class="bid_description">
|
||||
<%= @contest.description %>
|
||||
<!-- <%# if @contest.attachments.any?%>
|
||||
<%# options = {:author => true} %>
|
||||
<%#= render :partial => 'attachments/links', :locals => {:attachments => @bid.attachments, :options => options} %>
|
||||
<%# end %> -->
|
||||
</div>
|
||||
<span id="praise_tread" style="float: right">
|
||||
<%= render :partial => "/praise_tread/praise_tread",
|
||||
:locals => {:obj => @contest,:show_flag => true,:user_id =>User.current.id}%>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div style="clear: both;"></div>
|
||||
|
||||
<div id="history">
|
||||
<%= render :partial => 'history', :locals => { :contest => @contest, :journals => @jour, :state => false} %>
|
||||
</div>
|
||||
|
||||
<div class="pagination" style="float:left;">
|
||||
<ul>
|
||||
<%= pagination_links_full @feedback_pages %>
|
||||
<ul>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<div class="inf_user_image">
|
||||
<% for user in @contest.watcher_users %>
|
||||
<ul class="list_watch"><li>
|
||||
<table width="660px" border="0" align="center">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(user), :class => "avatar") %></td>
|
||||
<td><table width="580px" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580px" ><p class="font_description">
|
||||
<% unless user.memberships.empty? %>
|
||||
<%= l(:label_x_contribute_to, :count => user.memberships.count) %>
|
||||
<% for member in user.memberships %>
|
||||
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
|
||||
</td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table></li></ul>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,71 @@
|
|||
<!--add by bai-->
|
||||
<h3><%=link_to l(:label_x_join_in_contest, :count => @contest.join_in_contests.count)+"("+@contest.join_in_contests(@user.id).count.to_s+")", :controller=>"contests", :action=>"show_participator"%></h3>
|
||||
<div class="inf_user_image">
|
||||
<% for temp in @contest.join_in_contests %>
|
||||
<% user = temp.user %>
|
||||
<ul class="list_watch">
|
||||
<li>
|
||||
<table width="660px" border="0" align="center">
|
||||
<tr>
|
||||
<!-- modified by bai 显示人名全称-->
|
||||
<td colspan="2" valign="top" width="50" >
|
||||
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.show_name}" %>
|
||||
</td>
|
||||
<td>
|
||||
<table width="580px" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><%= content_tag "div", link_to(user.show_name, user_path(user)), :class => "project_avatar_name" , :title => "#{user.show_name}" %>
|
||||
<!-- added by bai 增加了学员的学号 -->
|
||||
<% if (im_watching_student_id? @contest) && user.user_extensions.identity.to_i.eql?(1) %>
|
||||
<%= l(:label_bidding_user_studentcode) %> :<%= user.user_extensions.student_id%>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<!-- modified by bai 区分课程与项目-->
|
||||
<td colspan="2" width="580px" >
|
||||
<p class="font_description">
|
||||
<% unless user.memberships.empty? %>
|
||||
<% cond = Project.visible_condition(User.current) + "AND projects.project_type <> 1" %>
|
||||
<% memberships = user.memberships.all(:conditions => cond) %>
|
||||
<%= l(:label_x_contribute_to, :count => memberships.count) %>
|
||||
<%
|
||||
links = Array.new
|
||||
memberships.collect{|member| links << link_to_project(member.project) }
|
||||
%>
|
||||
|
||||
<%= raw links.join(" , ") %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<!-- added by bai -->
|
||||
<!--
|
||||
<p class="font_description">
|
||||
<% unless user.memberships.empty? %>
|
||||
<% cond = Project.visible_condition(User.current) + "AND projects.project_type = 1" %>
|
||||
<% memberships = user.memberships.all(:conditions => cond) %>
|
||||
<%= l(:label_x_course_contribute_to, :count => memberships.count) %>
|
||||
<% for member in memberships %>
|
||||
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
-->
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- end -->
|
||||
|
||||
<tr>
|
||||
<td width="200" align="right" class="font_lighter">
|
||||
<%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,100 @@
|
|||
|
||||
<style>
|
||||
input[type="submit"].contest_btn {
|
||||
vertical-align: middle;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
line-height: 18px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: url("/images/button/bg103.jpg") no-repeat scroll left top transparent;
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
margin-top: -10px;
|
||||
/*margin-right: -4px;*/
|
||||
}
|
||||
input[type="button"].contest_btn {
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
line-height: 18px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: url("/images/button/bg103.jpg") no-repeat scroll left top transparent;
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
margin-top: -10px;
|
||||
margin-right: -2px;
|
||||
}
|
||||
textarea:focus {
|
||||
border: #d5dee9 1px solid;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
function clearInfo(id,content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == content) {
|
||||
$('#' + id).val('');
|
||||
}
|
||||
}
|
||||
|
||||
function showInfo(id,content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == '') {
|
||||
$('#' + id).val(content);
|
||||
}
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
$("#put-bid-form").hide();
|
||||
}
|
||||
</script>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<!--我要竞标弹出框-->
|
||||
<div id = 'flash' style="float:left; width: 100%; display: none" ></div>
|
||||
<div id="put-bid-form" style="display: none">
|
||||
<%= form_for "contest_for_save", :remote=>true, :url => {:controller => 'contests', :action => 'add'}, :update => "contesting_project_list", :complete => '$("#put-bid-form").hide();' do |f| %>
|
||||
<table id="contesting_table" border="0" width="100%" style="margin-left: 40px;"> <!--该table为点击我要参加后弹出的-->
|
||||
<tr>
|
||||
<td><%= select_tag 'contest', options_for_select(select_option_helper(@option)), :name => 'contest', :class => 'grayline' %></td>
|
||||
<div id="prompt_create_pro">
|
||||
<td>
|
||||
<p>
|
||||
<div class="font_lighter" style="font-size: 13px;">
|
||||
<%= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target=>'_blank'%> <!--跳转到project的new.html.erb-->
|
||||
</div>
|
||||
</p>
|
||||
</td>
|
||||
</div>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><%= f.text_area :contest_message, :id => "contest_message", :required => true, :rows => 4, :cols => 40, :placeholder => l(:label_bid_reason), :style => "resize: none;", :class => 'noline'%></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">
|
||||
<%= submit_tag l(:button_add), :name => nil , :class => "enterprise",
|
||||
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -30px'"%>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
|
||||
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id='contesting_project_list'>
|
||||
<%= render :partial => 'project_list', :locals => {:contesting_project => @contesting_project,:contest => @contest} %>
|
||||
</div>
|
||||
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
|
||||
<style>
|
||||
input[type="submit"].contest_btn {
|
||||
vertical-align: middle;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
line-height: 18px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: url("/images/button/bg103.jpg") no-repeat scroll left top transparent;
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
margin-top: -10px;
|
||||
/*margin-right: -4px;*/
|
||||
}
|
||||
input[type="button"].contest_btn {
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
line-height: 18px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: url("/images/button/bg103.jpg") no-repeat scroll left top transparent;
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
margin-top: -10px;
|
||||
margin-right: -2px;
|
||||
}
|
||||
textarea:focus {
|
||||
border: #d5dee9 1px solid;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
function clearInfo(id,content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == content) {
|
||||
$('#' + id).val('');
|
||||
}
|
||||
}
|
||||
|
||||
function showInfo(id,content) {
|
||||
var text = $('#' + id);
|
||||
if (text.val() == '') {
|
||||
$('#' + id).val(content);
|
||||
}
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
$("#put-bid-form").hide();
|
||||
}
|
||||
</script>
|
||||
|
||||
<% if User.current.logged? %>
|
||||
<!--我要以发布应用的形式参加竞赛-弹出框-->
|
||||
<div id = 'flash' style="float:left; width: 100%; display: nonea" ></div>
|
||||
<div id="put-bid-form" style="display: none">
|
||||
<%= form_for "contest_for_save", :remote=>true, :url => {:controller => 'contests', :action => 'add_softapplication'}, :update => "contesting_softapplication_list", :complete => '$("#put-bid-form").hide();' do |f| %>
|
||||
<table id="contesting_table" border="0" width="100%" style="margin-left: 40px;"> <!--该table为点击我要参加后弹出的-->
|
||||
<tr>
|
||||
<td><%= select_tag 'contest', options_for_select(select_option_app_helper(@softapplication)), :name => 'contest', :class => 'grayline' %></td>
|
||||
<div id="prompt_create_pro">
|
||||
<td>
|
||||
<p>
|
||||
<div class="font_lighter" style="font-size: 13px;">
|
||||
<%= link_to '发布应用', new_softapplication_path(:target=>'_blank'), :target=>'_blank' %>
|
||||
</div>
|
||||
</p>
|
||||
</td>
|
||||
</div>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><%= f.text_area :contest_message, :id => "contest_message", :required => true, :rows => 4, :cols => 40, :placeholder => l(:label_bid_reason), :style => "resize: none;", :class => 'noline'%></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">
|
||||
<%= submit_tag l(:button_add), :name => nil , :class => "enterprise",
|
||||
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -30px'"%>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
|
||||
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
<div id='contesting_softapplication_list'>
|
||||
<%= render :partial => 'softapplication_list', :locals => {:contesting_softapplication => @contesting_softapplication,:contest => @contest} %>
|
||||
</div>
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
<%
|
||||
id = "finish_course_tag"
|
||||
id = "finish_course_#{project.id}"
|
||||
display = (project.course_extra.teacher.id == User.current.id )
|
||||
%>
|
||||
|
||||
<% if course_endTime_timeout?(project) #如果课程已结束%>
|
||||
<% if display && course_endTime_timeout?(project) #如果课程已结束%>
|
||||
<%= link_to '重启课程', restartcourse_project_path(project), :remote => true, :method => :post, :id => id, :confirm => ('确定要重启课程?') %>
|
||||
<% else %>
|
||||
<%= link_to '关闭课程', finishcourse_project_path(project), :remote => true, :method => :post, :id => id, :confirm => ('确定要关闭课程?') %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div id="add-memo" class='lz' style="display: none; padding: 20px;">
|
||||
<h3><%=l(:label_memo_new)%></h3>
|
||||
<% if User.current.logged? %>
|
||||
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum), :html => {:multipart => true} ) do |f| %>
|
||||
<%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
|
||||
<% if @memo.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:</h2>
|
||||
|
|
|
@ -1,20 +1,28 @@
|
|||
<!--add by huang-->
|
||||
<div class="clearfix"></div>
|
||||
<div id="footer" style="margin-left:-5px;padding-top: 50px;clear: both;">
|
||||
<div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 5px;margin-top: -10px;"></div>
|
||||
<div class="base_footer"><div align="center">
|
||||
<span> Trustie 研发团队 2007~2014 </span>
|
||||
</div></div>
|
||||
<div id="footer" style="margin-left:-5px;padding-top: 50px;clear: both;font-size: 12px;">
|
||||
<div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 5px;margin-top: -50px;"></div>
|
||||
<div class="base_footer">
|
||||
<div align="center">
|
||||
|
||||
<!--gcm-->
|
||||
<p>
|
||||
<span>主办单位:</span>
|
||||
<span class="footer_text_link"><%= link_to "国防科学技术大学并行与分布处理国家重点实验室","http://www.nudt.edu.cn/ArticleShow.asp?ID=47",:target=>"_blank"%></span>
|
||||
<span id="copyright">版权@2007~2014</span>
|
||||
<span id="contact_us" class="footer_text_link"><%= link_to "联系我们","http://forge.trustie.net/projects/2/member",:target=>"_blank"%></span>
|
||||
<span id="record"class="footer_text_link"><%= link_to "湘ICP备09019772","http://www.miibeian.gov.cn/"%></span>
|
||||
|
||||
</p>
|
||||
<div id="logo_link">
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>"国防科学技术大学计算机学院"),"http://www.nudt.edu.cn/special.asp?classid=12"%></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>"北京大学信息科学技术学院软件研究所"), "http://eecs.pku.edu.cn"%></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>"北京航空航天大学计算机学院"), "http://scse.buaa.edu.cn/"%></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>"中国科学院软件研究所"), "http://www.iscas.ac.cn"%></span>
|
||||
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>"山东中创软件商用中间件股份有限公司"), "http://www.inforbus.com"%></span>
|
||||
</div>
|
||||
<!--gcm-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= debug(params) if Rails.env.development? %>
|
||||
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-46523987-1', 'trustie.net');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
|
@ -13,6 +13,10 @@
|
|||
@nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1
|
||||
elsif (realUrl.match(/contest\.trustie\.net\/*/))
|
||||
@nav_dispaly_contest_label = 1
|
||||
@nav_dispaly_store_all_label = 1
|
||||
else
|
||||
@nav_dispaly_project_all_label = 1
|
||||
@nav_dispaly_course_all_label = 1
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%=link_to request.host()+"/course", :controller => 'projects', :action => 'course' %></a></td>
|
||||
<td style="padding-left: 8px"><%=link_to request.host()+"/course", :controller => 'projects', :action => 'course' %></td>
|
||||
<td><p class="top-content-list"><%=link_to "主页", home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course' %> > <%=link_to @project.name, nil %></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -79,8 +79,8 @@
|
|||
<%= render :partial => 'courses/set_course_time', :locals => {:project => @project}%>
|
||||
<% else %>
|
||||
|
||||
<%= join_in_course(@project, User.current) %></div>
|
||||
<% end %> </div>
|
||||
<%= join_in_course(@project, User.current) %>
|
||||
<% end %>
|
||||
<% unless User.current.member_of?(@project) %>
|
||||
<!-- <%= image_tag "/images/fav.png" %> -->
|
||||
<div style="padding-right: 10px">
|
||||
|
@ -88,7 +88,7 @@
|
|||
<%= watcher_link(@project, User.current) %></span></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</td></tr></table>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -233,21 +233,22 @@
|
|||
<!-- <li><%= link_to(l(:label_course_repository), {:controller => 'repositories', :action => 'show', :id => @project, :repository_id => nil, :path => nil, :rev => nil, :course => 1 })%></li> -->
|
||||
<% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles&Role.where('id = ? or id = ?', 7, 9)).size >0))%>
|
||||
|
||||
</ul>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
|
||||
<!--gcm-->
|
||||
|
||||
</div>
|
||||
<!--gcm move it mistakenly-->
|
||||
<%= render :partial => 'layouts/base_footer'%>
|
||||
</div>
|
||||
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,238 @@
|
|||
<% @nav_dispaly_contest_label = 1 %>
|
||||
<!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 %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%= h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%=render :partial => 'layouts/base_header'%>
|
||||
<div id="main" class="">
|
||||
|
||||
<div class="top-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style="width: 240px; color: #15bccf">创新竞赛社区</td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="project-search">
|
||||
<%= form_tag({controller: 'contests', action: 'index'}, method: :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><%=link_to request.host()+"/contests", :controller=>'contests', :action=>'index' %></td>
|
||||
<td ><%=link_to l(:field_homepage), home_path %> >
|
||||
<%=link_to l(:label_contest_innovate), :controller=>'contests', :action=>'index' %> >
|
||||
<span><%= link_to @contest.name, show_contest_contest_path %></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="sidebar">
|
||||
<div class="main_context">
|
||||
<div class="spaceleft">
|
||||
<div class="inf_user_image">
|
||||
<table>
|
||||
<tr>
|
||||
<td align="left" width="100px">
|
||||
<%= image_tag(url_to_avatar(@user), :class => "avatar2") %>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @contest.name %></td>
|
||||
</tr>
|
||||
<% if User.current.login? %>
|
||||
<tr colspan='3'>
|
||||
<td valign="middle">
|
||||
<span style="display:block; margin-left:20px; margin-bottom: 5px"><%= join_in_competition(@contest, User.current)%></span>
|
||||
<span style="display:block; margin-left:20px;"><%= new_watcher_link(@contest, User.current) %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- 竞赛的配置 -->
|
||||
<% if User.current.logged? %>
|
||||
<% if @contest.author.id == User.current.id %>
|
||||
<tr colspan='3'>
|
||||
<td valign="middle">
|
||||
<span style="display:block; margin-left:20px;"><%= link_to l(:label_contest_modify_settings), {:controller => 'contests', :action => 'settings', :id => @contest} %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!-- 参与人和参与项目的数量显示 -->
|
||||
<div class="user_fans">
|
||||
<table width="240" border="0">
|
||||
<tr align="center" width="80px">
|
||||
<td class="font_index">
|
||||
<%=link_to "#{@contest.join_in_competitions.count}",:controller => "contests",:action => "show_participator" %>
|
||||
</td>
|
||||
<td class="font_index">
|
||||
<%=link_to "#{@contest.projects.where('is_public=1').count}", :controller => 'contests', :action => 'show_project' %>
|
||||
</td>
|
||||
<td class="font_index">
|
||||
<%=link_to "#{@contest.contesting_softapplications.count}", :controller => 'contests', :action => 'show_softapplication' %>
|
||||
</td>
|
||||
<tr class="font_aram">
|
||||
<td align="center" width="70px"> <%= l(:label_participate) %></td>
|
||||
<td align="center" width="70px"> <%= l(:label_contest_project) %></td>
|
||||
<td align="center" width="70px"> <%= l(:label_contest_application) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="user_underline"></div>
|
||||
</div>
|
||||
|
||||
<div class="inf_user_image">
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= l(:lable_contest_user) %><%= link_to(@user.show_name, user_path(@user))%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= l(:label_bids_reward_method) %><%= @contest.budget%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= l(:label_limit_time) %> : <%= @contest.deadline%></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
|
||||
<div class="inf_user_context">
|
||||
<div class="font_title_left">
|
||||
<%= l(:label_project_overview) %>
|
||||
</div>
|
||||
<div style="padding-bottom: 8px">
|
||||
<% if @contest.description.size>0 %>
|
||||
<div class="font_lighter_sidebar">
|
||||
|
||||
<%= textilizable @contest.description %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="font_lighter_sidebar">
|
||||
<%= l(:label_contest_description_no) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="created_on_project">
|
||||
<strong style="color: #068d9c"><%= l(:label_create_time) %>:</strong><%= format_time(@contest.created_on) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
</div>
|
||||
|
||||
<!--标签-->
|
||||
<div class="user_fans">
|
||||
<div class="user_underline"></div>
|
||||
<table style="font-family:微软雅黑">
|
||||
<tr>
|
||||
<td>
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => @contest, :object_flag => "7"}%>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!--关注-->
|
||||
<div class="user_fans">
|
||||
<div class="user_underline"></div>
|
||||
<div class="font_title_left">
|
||||
<strong><%= l(:label_x_followers, :count => @contest.watcher_users.count) %></strong>
|
||||
<% if show_more_fans?(@contest) %>
|
||||
<span style="display:inline-block; font-size: 12px; float:right; margin-bottom: -4px;"><%= link_to l(:label_more), :controller => 'contests', :action => 'show_contest_user'%></span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="left_wf">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 5px">
|
||||
<%= show_contest_fans_picture(@contest)%>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 参赛项目 -->
|
||||
|
||||
|
||||
<!-- 参赛应用-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="user_underline"></div>
|
||||
<!--参与者-->
|
||||
<div class="user_fans">
|
||||
<div class="font_title_left">
|
||||
<strong><%= l(:label_participate) %></strong>
|
||||
<% if show_more_participate?(@contest) %>
|
||||
<span style="font-size: 12px; display: inline; float: right;" >
|
||||
<%= link_to l(:label_more), :controller => "contests", :action => "show_participator"%>
|
||||
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="left_wf">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 5px"> <%= show_participate_picture(@contest) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="content">
|
||||
<% if display_main_menu?(@contest) %>
|
||||
<div class="tabs_new">
|
||||
<%= render_menu :contest_menu %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
<%=render :partial => 'layouts/base_footer'%>
|
||||
</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>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
|
@ -1,275 +1,279 @@
|
|||
<% @nav_dispaly_user_label = show_item_on_navbar(params) %>
|
||||
<!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 %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%= h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%= render :partial => 'layouts/base_header'%>
|
||||
<div id="main">
|
||||
<!--added by huang-->
|
||||
<div class="top-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style="width: 238px; color: #15bccf"><%= l(:label_user_home) %></td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search <%='hidden' if show_search_bar(params) %>">
|
||||
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><%=link_to request.host()+"/users" ,:controller => 'users', :action => 'index' %></td>
|
||||
<!-- modified by bai --> <td><%=link_to "主页", home_path %> > <%=link_to "软件创客", :controller => 'users', :action => 'index' %> > <span><%=link_to @user.name, user_path %></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--end-->
|
||||
<!--user page, add by huang-->
|
||||
<div id="sidebar">
|
||||
<div class="main_context">
|
||||
<div class="spaceleft">
|
||||
<div class="inf_user_image">
|
||||
<table>
|
||||
<tr>
|
||||
<td align="left" valign="middle" ><%= image_tag(url_to_avatar(@user), :class => 'avatar2') %></td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= h (@user.name) %> <!-- added by bai -->
|
||||
<%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"> <% unless User.current == @user %>
|
||||
<%= watcher_link(@user, User.current) %>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_user_edit), my_account_path(@user)) if User.current %>
|
||||
<% end %></td>
|
||||
</tr>
|
||||
|
||||
<!-- added by bai 增加个人得分 -->
|
||||
<% messages_count = @user.messages.count %>
|
||||
<% messages_score = messages_count * 0.05%>
|
||||
<% finall_messages_score = messages_score %>
|
||||
|
||||
<% journals_count = @user.journals.count %>
|
||||
<% journals_score = journals_count * 0.1 %>
|
||||
<% user_changesets_count = @user.changesets.count %>
|
||||
<% user_changesets_score = user_changesets_count * 0.3 %>
|
||||
<% finall_user_project_score = journals_score + user_changesets_score %>
|
||||
|
||||
<% journals_for_messages_count = @user.journals_for_messages.count %>
|
||||
<% activities_count = @user.activities.count %>
|
||||
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||
<% activities_score = activities_count * 0.2 %>
|
||||
<% finall_activity_score = journals_for_messages_score + activities_score %>
|
||||
|
||||
<% news_count = @user.news.count %>
|
||||
<% news_score = news_count * 0.1 %>
|
||||
<% wiki_contents_count = @user.wiki_contents.count %>
|
||||
<% wiki_contents_score = wiki_contents_count * 0.1 %>
|
||||
<% comments_count = @user.comments.count %>
|
||||
<% comments_score = comments_count * 0.1 %>
|
||||
<% finall_influence_score = news_score + wiki_contents_score + comments_score %>
|
||||
<% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
|
||||
|
||||
<tr><td class="score">
|
||||
<%= l(:label_user_grade)%>:
|
||||
<%= link_to(format("%.2f" , finall_user_score).to_f, {:controller => 'users',
|
||||
:action => 'show_score',
|
||||
:remote => true,
|
||||
:id => @user.id
|
||||
}, :style => 'color :#E8770D;') %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- end -->
|
||||
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
<strong class="font_small_watch"><%= link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%></strong>
|
||||
|
||||
<strong class="font_small_watch"><%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users.count.to_s+")", :controller=>"users", :action=>"user_fanslist" %></strong>
|
||||
|
||||
<strong class="font_small_watch"><%= link_to l(:label_requirement_focus)+"("+Bid.watched_by(@user).where('reward_type = ?', 1).count.to_s+")" ,:controller=>"users", :action=>"watch_bids"%></strong> <!-- added by huang -->
|
||||
<!-- added by bai 个人签名-->
|
||||
<% if @user.id == User.current.id %>
|
||||
<p>
|
||||
<%= toggle_link l(:label_brief_introduction), 'introduction', {:focus => 'new_form_user_introduction'} %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% unless @user.user_extensions.nil? %>
|
||||
<p>
|
||||
<%= @user.user_extensions.brief_introduction %>
|
||||
</p>
|
||||
<% end %>
|
||||
<div id="introduction" style="display: none">
|
||||
<%= form_for('new_form', :method => :post,
|
||||
:url => {:controller => 'words', :action => 'add_brief_introdution'}) do |f|%>
|
||||
<table border="0" width="100%" align="center" >
|
||||
<tr>
|
||||
<td><%= f.text_area 'user_introduction', :rows => 3,
|
||||
:cols => 65,
|
||||
:placeholder => "#{l(:label_my_brief_introduction)}",
|
||||
:style => "resize: none;",
|
||||
:class => 'noline'%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" width="200px" align="center">
|
||||
<tr>
|
||||
<td align="right"> <%= submit_tag l(:button_submit), :name => nil ,
|
||||
:class => "bid_btn" %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
<!--info-->
|
||||
<div class="inf_user_context">
|
||||
<table style="font-family:微软雅黑" width="240">
|
||||
<tr>
|
||||
<td style="padding-left: 5px" width="70px"><%= l(:label_user_joinin) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= format_time(@user.created_on) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 5px"><%= l(:label_user_login) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px"><%= format_time(@user.last_login_on) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="padding-left: 5px;"><%= l(:label_user_mail) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px; word-wrap: break-word; word-break: break-all"><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></td>
|
||||
</tr>
|
||||
<!-- added by bai 在个人主页里显示“工作单位”“地区”"教师的职称"-->
|
||||
<!-- modified by linchun 在个人主页里显示“加入时间”,“最后登录”,“邮件地址”后面添加冒号-->
|
||||
<% unless @user.user_extensions.nil? %>
|
||||
<% unless @user.user_extensions.identity == 2 %>
|
||||
<tr>
|
||||
<td style="padding-left: 5px" width="70px"><%= l(:field_occupation) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.occupation %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td style="padding-left: 5px" width="76px"><%= l(:label_location) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.location %><%= @user.user_extensions.location_city %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<% if @user.user_extensions.identity == 0 %>
|
||||
<td style="padding-left: 5px" width="76px">
|
||||
<%= l(:label_technical_title) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.technical_title %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% if( (@user.user_extensions.identity == 1) && (is_watching?(@user) ) )%>
|
||||
<tr>
|
||||
<td style="padding-left: 8px" width="70px"><%= l(:label_bidding_user_studentcode)%>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.student_id %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else%>
|
||||
<tr>
|
||||
<td style="padding-left: 8px" width="70px"><%= l(:field_occupation) %>:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px" width="70px"><%= l(:label_location) %>:</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- end -->
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<!--Modified by nie-->
|
||||
<div class="user_underline"></div>
|
||||
<div class="user_tags">
|
||||
<div id="tags">
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => @user,:object_flag => "1"}%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
<div class="user_fans">
|
||||
<div class="font_title_left">
|
||||
<strong><%= l(:label_user_watcher) %></strong>
|
||||
<% if show_more_watchers?(@user) %>
|
||||
<div style="font-size: 11px; display: inline; float: right; margin-top: 5px; margin-right: 20px" >
|
||||
<%= link_to l(:label_more), :controller => "users", :action => "user_watchlist"%>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="left_wf">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 5px"> <%= show_watcher_profile(@user) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
<!--fans-->
|
||||
<div class="user_fans">
|
||||
<div class="font_title_left">
|
||||
<strong><%= l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count) %></strong>
|
||||
<% if show_more_fans?(@user) %>
|
||||
<div style="font-size: 11px; display: inline; float: right; margin-top: 5px; margin-right: 20px" >
|
||||
<%= link_to l(:label_more), :controller => "users", :action => "user_fanslist"%>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="left_wf">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 5px"> <%= show_fans_picture(@user) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="content" style="padding-top: 0px;">
|
||||
<div class="tabs_new">
|
||||
<% if @user.user_extensions.identity == 2 %>
|
||||
<%= render_menu :user_enterprise_menu %>
|
||||
<% else %>
|
||||
<%= render_menu :user_menu %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
<%= render_flash_messages %>
|
||||
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'layouts/base_footer'%>
|
||||
</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>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
||||
<% @nav_dispaly_user_label = show_item_on_navbar(params) %>
|
||||
<!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 %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%= h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%= render :partial => 'layouts/base_header'%>
|
||||
<div id="main">
|
||||
<!--added by huang-->
|
||||
<div class="top-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style="width: 238px; color: #15bccf"><%= l(:label_user_home) %></td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search <%='hidden' if show_search_bar(params) %>">
|
||||
<%= form_tag(:controller => 'users', :action => 'search', :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><%=link_to request.host()+"/users" ,:controller => 'users', :action => 'index' %></td>
|
||||
<!-- modified by bai --> <td><%=link_to "主页", home_path %> > <%=link_to "软件创客", :controller => 'users', :action => 'index' %> > <span><%=link_to @user.name, user_path %></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--end-->
|
||||
<!--user page, add by huang-->
|
||||
<div id="sidebar">
|
||||
<div class="main_context">
|
||||
<div class="spaceleft">
|
||||
<div class="inf_user_image">
|
||||
<table>
|
||||
<tr>
|
||||
<td align="left" valign="middle" ><%= image_tag(url_to_avatar(@user), :class => 'avatar2') %></td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= h (@user.name) %> <!-- added by bai -->
|
||||
<%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"> <% unless User.current == @user %>
|
||||
<%= watcher_link(@user, User.current) %>
|
||||
<% else %>
|
||||
<%= link_to(l(:label_user_edit), my_account_path(@user)) if User.current %>
|
||||
<% end %></td>
|
||||
</tr>
|
||||
|
||||
<!-- added by bai 增加个人得分 -->
|
||||
<% messages_count = @user.messages.count %>
|
||||
<% messages_score = messages_count * 0.05%>
|
||||
<% finall_messages_score = messages_score %>
|
||||
|
||||
<% journals_count = @user.journals.count %>
|
||||
<% journals_score = journals_count * 0.1 %>
|
||||
<% user_changesets_count = @user.changesets.count %>
|
||||
<% user_changesets_score = user_changesets_count * 0.3 %>
|
||||
<% finall_user_project_score = journals_score + user_changesets_score %>
|
||||
|
||||
<% journals_for_messages_count = @user.journals_messages.count %>
|
||||
<% activities_count = @user.activities.count %>
|
||||
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
|
||||
<% activities_score = activities_count * 0.2 %>
|
||||
<% finall_activity_score = journals_for_messages_score + activities_score %>
|
||||
|
||||
<% news_count = @user.news.count %>
|
||||
<% news_score = news_count * 0.1 %>
|
||||
<% wiki_contents_count = @user.wiki_contents.count %>
|
||||
<% wiki_contents_score = wiki_contents_count * 0.1 %>
|
||||
<% comments_count = @user.comments.count %>
|
||||
<% comments_score = comments_count * 0.1 %>
|
||||
<% finall_influence_score = news_score + wiki_contents_score + comments_score %>
|
||||
<% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
|
||||
|
||||
<tr><td class="score">
|
||||
<%= l(:label_user_grade)%>:
|
||||
<%= link_to(format("%.2f" , finall_user_score).to_f, {:controller => 'users',
|
||||
:action => 'show_score',
|
||||
:remote => true,
|
||||
:id => @user.id
|
||||
}, :style => 'color :#E8770D;') %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- end -->
|
||||
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
<strong class="font_small_watch"><%= link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%></strong>
|
||||
|
||||
<strong class="font_small_watch"><%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users.count.to_s+")", :controller=>"users", :action=>"user_fanslist" %></strong>
|
||||
|
||||
<strong class="font_small_watch"><%= link_to l(:label_requirement_focus)+"("+Bid.watched_by(@user).where('reward_type = ?', 1).count.to_s+")" ,:controller=>"users", :action=>"watch_bids"%></strong> <!-- added by huang -->
|
||||
<!-- added by bai 个人签名-->
|
||||
<% if @user.id == User.current.id %>
|
||||
<p>
|
||||
<%= toggle_link l(:label_brief_introduction), 'introduction', {:focus => 'new_form_user_introduction'} %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% unless @user.user_extensions.nil? %>
|
||||
<p>
|
||||
<%= @user.user_extensions.brief_introduction %>
|
||||
</p>
|
||||
<% end %>
|
||||
<div id="introduction" style="display: none">
|
||||
<%= form_for('new_form', :method => :post,
|
||||
:url => {:controller => 'words', :action => 'add_brief_introdution'}) do |f|%>
|
||||
<table border="0" width="100%" align="center" >
|
||||
<tr>
|
||||
<td><%= f.text_area 'user_introduction', :rows => 3,
|
||||
:cols => 65,
|
||||
:placeholder => "#{l(:label_my_brief_introduction)}",
|
||||
:style => "resize: none;",
|
||||
:class => 'noline'%></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" width="200px" align="center">
|
||||
<tr>
|
||||
<td align="right"> <%= submit_tag l(:button_submit), :name => nil ,
|
||||
:class => "bid_btn" %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- end -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
<!--info-->
|
||||
<div class="inf_user_context">
|
||||
<table style="font-family:微软雅黑" width="240">
|
||||
<tr>
|
||||
<td style="padding-left: 5px" width="70px"><%= l(:label_user_joinin) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= format_time(@user.created_on) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 5px"><%= l(:label_user_login) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px"><%= format_time(@user.last_login_on) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="padding-left: 5px;"><%= l(:label_user_mail) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px; word-wrap: break-word; word-break: break-all"><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></td>
|
||||
</tr>
|
||||
<!-- added by bai 在个人主页里显示“工作单位”“地区”"教师的职称"-->
|
||||
<!-- modified by linchun 在个人主页里显示“加入时间”,“最后登录”,“邮件地址”后面添加冒号-->
|
||||
<% unless @user.user_extensions.nil? %>
|
||||
<% unless @user.user_extensions.identity == 2 %>
|
||||
<tr>
|
||||
<td style="padding-left: 5px" width="70px"><%= l(:field_occupation) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
<% unless @user.user_extensions.school.nil? %>
|
||||
<%= @user.user_extensions.school.name %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td style="padding-left: 5px" width="76px"><%= l(:label_location) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.location %><%= @user.user_extensions.location_city %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<% if @user.user_extensions.identity == 0 %>
|
||||
<td style="padding-left: 5px" width="76px">
|
||||
<%= l(:label_technical_title) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.technical_title %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% if( (@user.user_extensions.identity == 1) && (is_watching?(@user) ) )%>
|
||||
<tr>
|
||||
<td style="padding-left: 8px" width="70px"><%= l(:label_bidding_user_studentcode)%>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.student_id %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else%>
|
||||
<tr>
|
||||
<td style="padding-left: 8px" width="70px"><%= l(:field_occupation) %>:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px" width="70px"><%= l(:label_location) %>:</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- end -->
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<!--Modified by nie-->
|
||||
<div class="user_underline"></div>
|
||||
<div class="user_tags">
|
||||
<div id="tags">
|
||||
<%= render :partial => 'tags/tag', :locals => {:obj => @user,:object_flag => "1"}%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
<div class="user_fans">
|
||||
<div class="font_title_left">
|
||||
<strong><%= l(:label_user_watcher) %></strong>
|
||||
<% if show_more_watchers?(@user) %>
|
||||
<div style="font-size: 11px; display: inline; float: right; margin-top: 5px; margin-right: 20px" >
|
||||
<%= link_to l(:label_more), :controller => "users", :action => "user_watchlist"%>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="left_wf">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 5px"> <%= show_watcher_profile(@user) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
<!--fans-->
|
||||
<div class="user_fans">
|
||||
<div class="font_title_left">
|
||||
<strong><%= l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count) %></strong>
|
||||
<% if show_more_fans?(@user) %>
|
||||
<div style="font-size: 11px; display: inline; float: right; margin-top: 5px; margin-right: 20px" >
|
||||
<%= link_to l(:label_more), :controller => "users", :action => "user_fanslist"%>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="left_wf">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 5px"> <%= show_fans_picture(@user) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user_underline"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="content" style="padding-top: 0px;">
|
||||
<div class="tabs_new">
|
||||
<% if @user.user_extensions.identity == 2 %>
|
||||
<%= render_menu :user_enterprise_menu %>
|
||||
<% else %>
|
||||
<%= render_menu :user_menu %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
<%= render_flash_messages %>
|
||||
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'layouts/base_footer'%>
|
||||
</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>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_for(@mome_new, url: forum_memos_path, :html => {:multipart => true}) do |f| %>
|
||||
<%= form_for(@memo_new, url: forum_memos_path, :html => {:multipart => true}) do |f| %>
|
||||
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
|
||||
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
|
||||
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="lz">
|
||||
<div class="lz-left">
|
||||
<div class=""><%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %></div>
|
||||
<p class=""><%=link_to @memo.author.name, user_path(@memo.author) %></p>
|
||||
<div><%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %></div>
|
||||
<p class="clearfix"><%=link_to @memo.author.name, user_path(@memo.author) %></p>
|
||||
</div>
|
||||
<div class="memo-section">
|
||||
<div class="contextual-borad">
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
|
||||
<div style="float: right"><%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %></div>
|
||||
</div>
|
||||
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -172,7 +172,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<div id="reply" style="display:none;">
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f, :replying => true} %>
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
<script type="text/javascript">
|
||||
function get_options(value){
|
||||
$.ajax({
|
||||
type :"POST",
|
||||
url :'/school/get_options/'+encodeURIComponent(value),
|
||||
data :'text',
|
||||
success: function(data){
|
||||
$("#occupation").html(data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="contextual" style="padding-right: 10px;">
|
||||
<%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %>
|
||||
<%= call_hook(:view_my_account_contextual, :user => @user)%>
|
||||
|
@ -61,13 +78,23 @@
|
|||
<% end %>
|
||||
|
||||
<!-- added by bai 单位-->
|
||||
<% unless @user.user_extensions.nil?%>
|
||||
<p style="width:400px;padding-left: 26px;"><%= l(:field_occupation)%> <%= text_field_tag "occupation", @user.user_extensions.occupation, :class => 'occupation'%>
|
||||
<!--<% unless @user.user_extensions.nil?%>
|
||||
<p style="width:400px;padding-left: 26px;"><%= l(:field_occupation)%> <span class="required">*</span><%= text_field_tag "occupation", @user.user_extensions.occupation, :class => 'occupation' %>
|
||||
</p>
|
||||
<%else%>
|
||||
<p style="width:400px;padding-left: 26px;"><%= l(:field_occupation)%><%= text_field_tag "occupation", nil, :class => 'occupation'%>
|
||||
<p style="width:400px;padding-left: 26px;"><%= l(:field_occupation)%><span class="required">*</span><%= text_field_tag "occupation", nil, :class => 'occupation' %>
|
||||
</p>
|
||||
<%end%>
|
||||
-->
|
||||
|
||||
<!-- added by Wen -->
|
||||
<p style="width:357px;padding-left: 26px;">
|
||||
<%= l(:field_occupation) %> <span class="required">*</span><%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), :onchange => "get_options(this.value)" %>
|
||||
|
||||
<%= select_tag "occupation" %>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<!-- added by bai 增加了地区 -->
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
</p>
|
||||
<div class="buttons_for_course" style="margin-top:30px;margin-left:144px">
|
||||
<span class="info"></span>
|
||||
<% if @project.project_type==Project::ProjectType_course %>
|
||||
<% if(course_endTime_timeout? @project) %>
|
||||
<span class="font_lighter">
|
||||
课程学期已结束
|
||||
|
@ -54,6 +55,7 @@
|
|||
<% else %>
|
||||
<%= join_in_course_for_list(@project, User.current,['regular'])%>
|
||||
<% end -%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,19 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
function get_options(value){
|
||||
$.ajax({
|
||||
type :"POST",
|
||||
url :'/school/get_options/'+encodeURIComponent(value),
|
||||
data :'text',
|
||||
success: function(data){
|
||||
$("#occupation").html(data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<% object = [] %>
|
||||
|
@ -269,10 +284,12 @@
|
|||
|
||||
|
||||
<!--added by Wen -->
|
||||
|
||||
<p style="margin-left:-76px;">
|
||||
<strong><%=l(:label_new_course_school)%></strong><span class="required">*</span>
|
||||
<%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), :onclick => "get_options(this.value)" %>
|
||||
|
||||
<p>
|
||||
<select name='province' "><%= options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province) %></select>
|
||||
<%= select_tag 'school', options_from_collection_for_select(School.all, :id, :name)%>
|
||||
<%= select_tag "occupation" %>
|
||||
</p>
|
||||
|
||||
<!-- end -->
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<% if Rails.env.development? %>
|
||||
console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@project.identifier).try(:endup_time)%>');
|
||||
<% end %>
|
||||
$('#finish_course_tag').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:project => @project} )%>")
|
||||
$('#finish_course_<%=@project.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:project => @project} )%>")
|
||||
<% else %>
|
||||
alert('设置失败,请在论坛提交问题,等待管理员处理。');
|
||||
<% end %>
|
||||
|
|
|
@ -51,7 +51,7 @@ function showSubH(/* ... */){
|
|||
}
|
||||
}
|
||||
function deal_error (argument) {
|
||||
$('#OpenWindow-content').html('<span class=\"font_color_orange\" > Network Error:<br/>http_status:' + argument.status + '<br/>statusText:' + argument.statusText + ' <\/span>\n');
|
||||
$('#OpenWindow-content').html('<strong>Network Error</strong><span class=\"font_color_orange\" > <br/>http_status:' + argument.status + '<br/>statusText:' + argument.statusText + ' <\/span>\n');
|
||||
}
|
||||
$.post(post_url,{}, deal_post).error(deal_error);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<% if @course_tag == '1' %>
|
||||
<h3><%=l(:label_course_new)%></h3>
|
||||
<div class="box tabular">
|
||||
<p style="font-weight: bold; color: rgb(237,137,36)"><%=raw l(:label_course_news_description)%></p>
|
||||
|
||||
<%= render :partial => 'course_form', :locals => { :f => f } %>
|
||||
<span style="padding-left: 60px"><%= submit_tag l(:button_create), :class => "enterprise"%></span>
|
||||
<!-- <%= submit_tag l(:button_create_and_continue), :name => 'course_continue' %> -->
|
||||
|
|
|
@ -40,14 +40,37 @@
|
|||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- Added by Longjun 在最后一页显示创建信息 -->
|
||||
<% if format_date(day) == format_date(@date_to - @days) %>
|
||||
<div >
|
||||
<table width="660">
|
||||
<tr>
|
||||
<td><%= image_tag(url_to_avatar(@user), :class => "avatar") %></td>
|
||||
<td colspan="2">
|
||||
<table width="580">
|
||||
<tr>
|
||||
<td > <%= link_to (h @user.try(:name)), user_path(@user) if @user %> <%= l(:label_user_create_project) %> <%= link_to @project.name %><strong> !</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@project.created_on) %>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end -%>
|
||||
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @events_pages%>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="font_description">
|
||||
|
@ -66,3 +89,5 @@
|
|||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
:class => 'repository' + (repo == @repository ? ' selected' : '')
|
||||
}.join(' | ').html_safe %>)</p>
|
||||
<% else %>
|
||||
<h3>项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码</h3>
|
||||
<h3>建立版本库文件夹,打开命令行执行如下:</h3>
|
||||
<div class="repos_explain">
|
||||
<p>git init</p>
|
||||
|
@ -30,11 +31,22 @@
|
|||
<p>git remote add origin <%= @repos_url%></p>
|
||||
<p>git push -u origin master:master</p>
|
||||
</div>
|
||||
<h3>已经有本地库,打开命令行执行如下:</h3>
|
||||
<h3>已经有本地库,还没有配置远程地址,打开命令行执行如下:</h3>
|
||||
<div class="repos_explain">
|
||||
<p>git remote add origin <%= @repos_url%></p>
|
||||
<p>git add .</p>
|
||||
<p>git commit -m "first commit"</p>
|
||||
<p>git push -u origin master:matser</p>
|
||||
</div>
|
||||
</h3>
|
||||
<h3>从网上获取别人的开源版本库,转交到trustie网站上,打开命令行执行如下:</h3>
|
||||
<div class="repos_explain">
|
||||
<p>git remote add trustie <%= @repos_url%></p>
|
||||
<p>git add .</p>
|
||||
<p>git commit -m "first commit"</p>
|
||||
<p>git push -u trustie master:matser</p>
|
||||
<p><%= link_to "李海提供", user_path(646)%></p>
|
||||
</div>
|
||||
<% end %>
|
||||
</h3>
|
||||
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue