Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop
This commit is contained in:
commit
abea7add69
|
@ -8,7 +8,10 @@ class BidsController < ApplicationController
|
||||||
menu_item :homework_statistics, :only => :homework_statistics
|
menu_item :homework_statistics, :only => :homework_statistics
|
||||||
#Ended by young
|
#Ended by young
|
||||||
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
|
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
|
||||||
:show_course, :show_bid_project, :show_bid_user]
|
:show_course, :show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator]
|
||||||
|
# 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, ]
|
before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ]
|
||||||
|
|
||||||
helper :watchers
|
helper :watchers
|
||||||
|
@ -210,6 +213,48 @@ class BidsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def join_in_contest
|
||||||
|
if @bid.reward_type == 2 && params[:course_password] == @bid.password
|
||||||
|
JoinInContest.create(:user_id => User.current.id, :bid_id => @bid.id)
|
||||||
|
@state = 0
|
||||||
|
else
|
||||||
|
@state = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||||
|
# TO_DO
|
||||||
|
format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def unjoin_in_contest
|
||||||
|
|
||||||
|
joined = JoinInContest.where('bid_id = ? and user_id = ?', @bid.id, User.current.id)
|
||||||
|
|
||||||
|
joined.each do |join|
|
||||||
|
join.delete
|
||||||
|
end
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||||
|
format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_join
|
||||||
|
# added by fq
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# added by bai
|
||||||
|
def show_participator
|
||||||
|
render :layout => 'base_contest'
|
||||||
|
|
||||||
|
end
|
||||||
|
#end
|
||||||
|
|
||||||
def show_course
|
def show_course
|
||||||
bids = Bid.where('parent_id = ?', @bid.id)
|
bids = Bid.where('parent_id = ?', @bid.id)
|
||||||
@courses = []
|
@courses = []
|
||||||
|
@ -536,6 +581,7 @@ class BidsController < ApplicationController
|
||||||
@bid.reward_type = 2
|
@bid.reward_type = 2
|
||||||
@bid.budget = params[:bid][:budget]
|
@bid.budget = params[:bid][:budget]
|
||||||
@bid.deadline = params[:bid][:deadline]
|
@bid.deadline = params[:bid][:deadline]
|
||||||
|
@bid.password = params[:bid][:password] #added by bai
|
||||||
@bid.author_id = User.current.id
|
@bid.author_id = User.current.id
|
||||||
@bid.commit = 0
|
@bid.commit = 0
|
||||||
if @bid.save
|
if @bid.save
|
||||||
|
|
|
@ -30,10 +30,12 @@ class BoardsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@boards = @project.boards.includes(:last_message => :author).all
|
@boards = @project.boards.includes(:last_message => :author).all
|
||||||
# show the board if there is only one
|
# show the board if there is only one
|
||||||
|
unless @project.project_type == 1
|
||||||
if @boards.size == 1
|
if @boards.size == 1
|
||||||
@board = @boards.first
|
@board = @boards.first
|
||||||
show
|
show
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if @project.project_type == 1
|
if @project.project_type == 1
|
||||||
render :layout => 'base_courses'
|
render :layout => 'base_courses'
|
||||||
else
|
else
|
||||||
|
@ -88,9 +90,7 @@ class BoardsController < ApplicationController
|
||||||
def create
|
def create
|
||||||
@board = @project.boards.build
|
@board = @project.boards.build
|
||||||
@board.safe_attributes = params[:board]
|
@board.safe_attributes = params[:board]
|
||||||
if @project.project_type == 1
|
|
||||||
render :layout => 'base_courses'
|
|
||||||
end
|
|
||||||
if @board.save
|
if @board.save
|
||||||
flash[:notice] = l(:notice_successful_create)
|
flash[:notice] = l(:notice_successful_create)
|
||||||
#Modified by young
|
#Modified by young
|
||||||
|
|
|
@ -1393,7 +1393,32 @@ module ApplicationHelper
|
||||||
html << (content_tag "span", l(:label_no_current_fans))
|
html << (content_tag "span", l(:label_no_current_fans))
|
||||||
end
|
end
|
||||||
for user in obj.watcher_users
|
for user in obj.watcher_users
|
||||||
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.name}")
|
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.show_name}")
|
||||||
|
count = count + 1
|
||||||
|
if count >= 12
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
html.html_safe
|
||||||
|
end
|
||||||
|
|
||||||
|
# added by bai
|
||||||
|
def show_more_participate?(obj)
|
||||||
|
if obj.join_in_contests.count > 12
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show_participate_picture(obj)
|
||||||
|
html = ''
|
||||||
|
count = 0
|
||||||
|
if obj.join_in_contests.count == 0
|
||||||
|
html << (content_tag "span", l(:label_no_current_participate))
|
||||||
|
end
|
||||||
|
for temp in obj.join_in_contests
|
||||||
|
html << (link_to image_tag(url_to_avatar(temp.user), :class => "avatar"), user_path(temp.user), :class => "avatar", :title => "#{temp.user.show_name}")
|
||||||
count = count + 1
|
count = count + 1
|
||||||
if count >= 12
|
if count >= 12
|
||||||
break
|
break
|
||||||
|
@ -1402,6 +1427,7 @@ module ApplicationHelper
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
# add by huang
|
# add by huang
|
||||||
def show_watcher_list(user)
|
def show_watcher_list(user)
|
||||||
html = ''
|
html = ''
|
||||||
|
|
|
@ -56,9 +56,9 @@ module WatchersHelper
|
||||||
url_f = try_join_path(:object_id => course.id)
|
url_f = try_join_path(:object_id => course.id)
|
||||||
method = joined ? 'delete' : 'post'
|
method = joined ? 'delete' : 'post'
|
||||||
if joined
|
if joined
|
||||||
link_to text, url_t, :remote => true, :method => method, :id => 'join', :confirm => l(:text_are_you_sure_out), :class => []+options
|
link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||||
else
|
else
|
||||||
link_to text, url_f, :remote => true, :method => method, :id => 'join', :class => []+options
|
link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -76,6 +76,25 @@ module WatchersHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#added by bai
|
||||||
|
def join_in_contest(bid, user, options=[])
|
||||||
|
if bid.reward_type == 2
|
||||||
|
return '' unless user && user.logged?
|
||||||
|
joined = user.join_in_contest?(bid)
|
||||||
|
text = joined ? l(:label_exit_contest) : l(:label_join_contest)
|
||||||
|
url_t = join_in_contest_path(:id => bid.id)
|
||||||
|
url_f = try_join_in_contest_path(:id => bid.id)
|
||||||
|
# url = join_in_contest_path(:id => bid.id)
|
||||||
|
method = joined ? 'delete' : 'post'
|
||||||
|
if joined
|
||||||
|
link_to text, url_t, :remote => true, :method => method, :id => "#{bid.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||||
|
else
|
||||||
|
link_to text, url_f, :remote => true, :method => method, :id => "#{bid.id}", :class => []+options
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# Returns the css class used to identify watch links for a given +object+
|
# Returns the css class used to identify watch links for a given +object+
|
||||||
def watcher_css(objects)
|
def watcher_css(objects)
|
||||||
objects = Array.wrap(objects)
|
objects = Array.wrap(objects)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
####by fq
|
####by fq
|
||||||
class Bid < ActiveRecord::Base
|
class Bid < ActiveRecord::Base
|
||||||
attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type
|
attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password
|
||||||
include Redmine::SafeAttributes
|
include Redmine::SafeAttributes
|
||||||
|
|
||||||
belongs_to :author, :class_name => 'User', :foreign_key => :author_id
|
belongs_to :author, :class_name => 'User', :foreign_key => :author_id
|
||||||
|
@ -13,6 +13,7 @@ class Bid < ActiveRecord::Base
|
||||||
has_many :homework_for_courses, :dependent => :destroy
|
has_many :homework_for_courses, :dependent => :destroy
|
||||||
has_many :courses, :through => :homework_for_courses, :source => :project
|
has_many :courses, :through => :homework_for_courses, :source => :project
|
||||||
has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
|
has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
|
||||||
|
has_many :join_in_contests, :dependent => :destroy
|
||||||
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
|
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +64,8 @@ class Bid < ActiveRecord::Base
|
||||||
'budget',
|
'budget',
|
||||||
'deadline',
|
'deadline',
|
||||||
'homework_type',
|
'homework_type',
|
||||||
'reward_type'
|
'reward_type',
|
||||||
|
'password'
|
||||||
|
|
||||||
|
|
||||||
# safe_attributes 'name',
|
# safe_attributes 'name',
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
class JoinInContest < ActiveRecord::Base
|
||||||
|
attr_accessible :bid_id, :user_id
|
||||||
|
|
||||||
|
belongs_to :user
|
||||||
|
belongs_to :bid
|
||||||
|
|
||||||
|
validates_presence_of :user_id, :bid_id
|
||||||
|
|
||||||
|
|
||||||
|
end
|
|
@ -90,6 +90,7 @@ class User < Principal
|
||||||
has_many :students_for_courses
|
has_many :students_for_courses
|
||||||
has_many :courses, :through => :students_for_courses, :source => :project
|
has_many :courses, :through => :students_for_courses, :source => :project
|
||||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||||
|
has_many :join_in_contests, :dependent => :destroy
|
||||||
#####
|
#####
|
||||||
|
|
||||||
######added by nie
|
######added by nie
|
||||||
|
@ -167,6 +168,16 @@ class User < Principal
|
||||||
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true)
|
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 判断用户是否加入了竞赛中 fq
|
||||||
|
def join_in_contest?(bid)
|
||||||
|
joined = JoinInContest.where('user_id = ? and bid_id =?', self.id, bid.id)
|
||||||
|
if joined.size > 0
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
### fq
|
### fq
|
||||||
def join_in?(course)
|
def join_in?(course)
|
||||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', self.id, course.id)
|
joined = StudentsForCourse.where('student_id = ? and course_id = ?', self.id, course.id)
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_name)}" %></p>
|
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::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 => Bid::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %></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 => Bid::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>
|
<p>
|
||||||
<%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
|
<%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,13 @@
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" width="580px" >
|
<td colspan="2" width="580px" >
|
||||||
|
<% unless User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %>
|
||||||
<p class="font_description">
|
<p class="font_description">
|
||||||
<% options = {:author => true, :deletable => attach_delete(homework)} %>
|
<% options = {:author => true, :deletable => attach_delete(homework)} %>
|
||||||
<%= render :partial => 'attachments/links',
|
<%= render :partial => 'attachments/links',
|
||||||
:locals => {:attachments => homework.attachments, :options => options} %>
|
:locals => {:attachments => homework.attachments, :options => options} %>
|
||||||
</p>
|
</p>
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
<!-- added by fq -->
|
||||||
|
<style>
|
||||||
|
input[type="submit"].bid_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"].bid_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({:controller => 'bids',
|
||||||
|
:action => 'join_in_contest',
|
||||||
|
:id => course.id},
|
||||||
|
:remote => true,
|
||||||
|
:method => :post,
|
||||||
|
:id => 'new-watcher-form') do %>
|
||||||
|
<table border="0">
|
||||||
|
<tr>
|
||||||
|
<td align="cneter">
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<%= text_field_tag 'course_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 => "bid_btn", :onclick => "hideModal(this);" %>
|
||||||
|
<%= submit_tag l(:button_cancel), :name => nil, :class => "bid_btn", :onclick => "hideModal(this);", :type => 'button' %>
|
||||||
|
</td>
|
||||||
|
</tr></table>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,8 @@
|
||||||
|
$("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_contest(@bid, user) %>');
|
||||||
|
<% if @state %>
|
||||||
|
<% if @state == 0 %>
|
||||||
|
alert("加入成功")
|
||||||
|
<% else %>
|
||||||
|
alert("密码错误")
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,3 @@
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'bids/new_join', :locals => {:course => @bid}) %>');
|
||||||
|
showModal('ajax-modal', '400px');
|
||||||
|
$('#ajax-modal').addClass('new-watcher');
|
|
@ -0,0 +1,33 @@
|
||||||
|
<!--add by bai-->
|
||||||
|
<h3><%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count)%></h3>
|
||||||
|
<div class="inf_user_image">
|
||||||
|
<% for temp in @bid.join_in_contests %>
|
||||||
|
<% user = temp.user %>
|
||||||
|
<ul class="list_watch"><li>
|
||||||
|
<table width="660px" border="0" align="center">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %></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>
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? && User.current.member_of?(@project) %>
|
||||||
<%= link_to l(:label_board_new), new_project_board_path(@project), :class => 'icon icon-add' %>
|
<%= link_to l(:label_board_new), new_project_board_path(@project), :class => 'icon icon-add' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -64,14 +64,16 @@
|
||||||
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @bid.name %></td>
|
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @bid.name %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center"> <%= watcher_link(@bid, User.current) %> <!-- <%= link_to("选为作业", fork_path(@bid)) %> --></td>
|
<td align="center">
|
||||||
|
<%= join_in_contest(@bid, User.current)%>
|
||||||
|
<%= watcher_link(@bid, User.current) %> <!-- <%= link_to("选为作业", fork_path(@bid)) %> --></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table></td>
|
</table></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= l(:lable_contest_user) %><%= link_to(@user, user_path(@user))%></td>
|
<td><%= l(:lable_contest_user) %><%= link_to(@user.show_name, user_path(@user))%></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td>
|
<td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td>
|
||||||
|
@ -145,7 +147,7 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--fans-->
|
<!-- participate -->
|
||||||
<div class="user_fans">
|
<div class="user_fans">
|
||||||
<div class="font_title_left">
|
<div class="font_title_left">
|
||||||
<strong><%= l(:label_bidding_project) %></strong>
|
<strong><%= l(:label_bidding_project) %></strong>
|
||||||
|
@ -176,6 +178,27 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- end -->
|
<!-- end -->
|
||||||
|
|
||||||
|
<div class="user_underline"></div>
|
||||||
|
<!--fans fq-->
|
||||||
|
<div class="user_fans">
|
||||||
|
<div class="font_title_left">
|
||||||
|
<strong><%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count) %></strong>
|
||||||
|
<% if show_more_participate?(@bid) %>
|
||||||
|
<div style="font-size: 11px; display: inline; float: right; margin-top: 5px; margin-right: 20px" >
|
||||||
|
<%= link_to l(:label_more), :controller => "bids", :action => "show_participator"%>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="left_wf">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td style="padding-top: 5px"> <%= show_participate_picture(@bid) %> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<% if display_main_menu?(@bid) %>
|
<% if display_main_menu?(@bid) %>
|
||||||
|
|
|
@ -70,13 +70,14 @@
|
||||||
<td class="info-course"><%= @project.name %></td>
|
<td class="info-course"><%= @project.name %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td align="center">
|
<tr><td align="center">
|
||||||
|
<div id=join_in_course>
|
||||||
<%if User.current.logged? %>
|
<%if User.current.logged? %>
|
||||||
<% if @course.teacher.id == User.current.id %>
|
<% if @course.teacher.id == User.current.id %>
|
||||||
<%= link_to l(:label_course_modify_settings), {:controller => 'projects', :action => 'settings', :id => @project} %>
|
<%= link_to l(:label_course_modify_settings), {:controller => 'projects', :action => 'settings', :id => @project} %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
||||||
<%= join_in_course(@project, User.current) %></div>
|
<%= join_in_course(@project, User.current) %></div>
|
||||||
<% end %>
|
<% end %> </div>
|
||||||
<% unless User.current.member_of?(@project) %>
|
<% unless User.current.member_of?(@project) %>
|
||||||
<!-- <%= image_tag "/images/fav.png" %> -->
|
<!-- <%= image_tag "/images/fav.png" %> -->
|
||||||
<div style="padding-right: 10px">
|
<div style="padding-right: 10px">
|
||||||
|
@ -214,6 +215,9 @@
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:label_homework), {:controller => 'projects', :action => 'homework'}, :class => link_class('Task')%>
|
<%= link_to l(:label_homework), {:controller => 'projects', :action => 'homework'}, :class => link_class('Task')%>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to l(:label_course_board), { :controller => 'boards', :action => 'index', :project_id => @project}, :class => link_class(:boards) %>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:label_course_file), project_files_path(@project), :class => link_class(:files)%>
|
<%= link_to l(:label_course_file), project_files_path(@project), :class => link_class(:files)%>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -18,6 +18,11 @@
|
||||||
<!-- added by bai 新增开课时间、结课时间、课时 -->
|
<!-- added by bai 新增开课时间、结课时间、课时 -->
|
||||||
|
|
||||||
<%= f.fields_for @course do |m| %>
|
<%= f.fields_for @course do |m| %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- added by bai 新增开课时间、结课时间、课时 -->
|
||||||
|
|
||||||
<% unless @course.nil?%>
|
<% unless @course.nil?%>
|
||||||
<p><table><tr><td><span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:20px"><%= l(:label_setup_time) %><span class="required"> * </span></span>
|
<p><table><tr><td><span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:20px"><%= l(:label_setup_time) %><span class="required"> * </span></span>
|
||||||
<span class="info" style="width: 10px"><%= text_field_tag :setup_time, @course.setup_time, :placeholder => "在此选择开课日期" %></span>
|
<span class="info" style="width: 10px"><%= text_field_tag :setup_time, @course.setup_time, :placeholder => "在此选择开课日期" %></span>
|
||||||
|
@ -53,11 +58,12 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<!-- end -->
|
<!-- end -->
|
||||||
|
|
||||||
<!-- added by bai 增加了“年度”和“学期” -->
|
<!-- added by bai 增加了“年度”和“学期” -->
|
||||||
<p><table><tr><td>
|
<p><table><tr><td>
|
||||||
<% unless @course.nil? %>
|
<% unless @course.nil? %>
|
||||||
<% if @course.time == 2008 %>
|
<% if @course.time == 2008 %>
|
||||||
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> * </span></strong></td>
|
<p><table><tr><td class="info" align="right" style="width: 90px; margin-left:20px"><strong><%= l(:label_term) %><span class="required"> * </span></strong></td>
|
||||||
<td class="info" style="width: 10px">
|
<td class="info" style="width: 10px">
|
||||||
<%= select_tag 'time', "<option value = '2008' selected='selected'>2008</option>
|
<%= select_tag 'time', "<option value = '2008' selected='selected'>2008</option>
|
||||||
<option value = '2009'>2009</option>
|
<option value = '2009'>2009</option>
|
||||||
|
@ -263,7 +269,7 @@
|
||||||
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
|
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
|
||||||
<% end %>
|
<% end %>
|
||||||
<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;" %></p><!--by young-->
|
<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;" %></p><!--by young-->
|
||||||
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %></em></p>
|
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %><%= l(:label_public_info) %></em></p><!-- modified by bai -->
|
||||||
<p style="display:none;"><%= f.text_field :project_type, :value => 1 %></p>
|
<p style="display:none;"><%= f.text_field :project_type, :value => 1 %></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,16 +11,33 @@
|
||||||
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
|
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
<!-- added by bai 区分了个人列表里的项目与课程 -->
|
||||||
<td colspan="2" width="580px" ><p class="font_description">
|
<td colspan="2" width="580px" ><p class="font_description">
|
||||||
<% unless user.memberships.empty? %>
|
<% unless user.memberships.empty? %>
|
||||||
<%= l(:label_x_contribute_to, :count => user.memberships.count) %>
|
<% 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) %>
|
||||||
<% for member in user.memberships %>
|
<% for member in user.memberships %>
|
||||||
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
|
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</p></td>
|
</p>
|
||||||
|
<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>
|
</tr>
|
||||||
|
<!-- end -->
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
|
<td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!--add by huang-->
|
<!--add by huang-->
|
||||||
<p>温馨提示:项目可以是一次作业,也可以是别人或者自己创建的一项小工程~</p>
|
<p>温馨提示:这里显示的是您创建或参与的所有项目。</p>
|
||||||
<div class="content-title-top-project">
|
<div class="content-title-top-project">
|
||||||
<% if @user == User.current %>
|
<% if @user == User.current %>
|
||||||
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => 0}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
||||||
|
|
|
@ -621,8 +621,9 @@ zh:
|
||||||
label_course_overview: "课程动态"
|
label_course_overview: "课程动态"
|
||||||
label_question_student: 作业交流 #bai
|
label_question_student: 作业交流 #bai
|
||||||
label_homework_commit: 提交作业 #huang
|
label_homework_commit: 提交作业 #huang
|
||||||
label_homework_info: 作业情况 #huang
|
label_homework_info: 作业提交情况 #huang
|
||||||
label_course_news: 课程通知
|
label_course_news: 课程通知
|
||||||
|
label_course_board: 讨论区
|
||||||
label_version: 版本
|
label_version: 版本
|
||||||
label_version_new: 新建版本
|
label_version_new: 新建版本
|
||||||
label_version_plural: 版本
|
label_version_plural: 版本
|
||||||
|
@ -834,6 +835,11 @@ zh:
|
||||||
one: 粉丝
|
one: 粉丝
|
||||||
other: 粉丝
|
other: 粉丝
|
||||||
#end
|
#end
|
||||||
|
label_x_join_in_contest:
|
||||||
|
zero: 参与者
|
||||||
|
one: 参与者
|
||||||
|
other: 参与者
|
||||||
|
#end
|
||||||
label_user_commits: "代码提交"
|
label_user_commits: "代码提交"
|
||||||
label_user_watchered: "关注" # huang添加的
|
label_user_watchered: "关注" # huang添加的
|
||||||
label_user_newfeedback: "留言" ## huang添加的
|
label_user_newfeedback: "留言" ## huang添加的
|
||||||
|
@ -1580,6 +1586,10 @@ zh:
|
||||||
one: "参与了 %{count} 个课程:"
|
one: "参与了 %{count} 个课程:"
|
||||||
other: "参与了 %{count} 个课程:"
|
other: "参与了 %{count} 个课程:"
|
||||||
|
|
||||||
|
label_join_contest: 加入竞赛
|
||||||
|
label_exit_contest: 退出竞赛
|
||||||
|
label_no_current_participate: 该竞赛暂无参与者
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
label_course: 课程
|
label_course: 课程
|
||||||
|
|
|
@ -471,8 +471,13 @@ RedmineApp::Application.routes.draw do
|
||||||
|
|
||||||
post 'join_in/join', :to => 'courses#join', :as => 'join'
|
post 'join_in/join', :to => 'courses#join', :as => 'join'
|
||||||
delete 'join_in/join', :to => 'courses#unjoin'
|
delete 'join_in/join', :to => 'courses#unjoin'
|
||||||
|
post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest'
|
||||||
|
delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest'
|
||||||
|
match 'calls/:id/show_participator', :to => 'bids#show_participator' #bai
|
||||||
|
|
||||||
delete 'attachment/:id', :to => 'attachments#delete_homework'
|
delete 'attachment/:id', :to => 'attachments#delete_homework'
|
||||||
match 'new_join', :to => 'projects#new_join', :as => 'try_join'
|
match 'new_join', :to => 'projects#new_join', :as => 'try_join'
|
||||||
|
match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest'
|
||||||
match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post
|
match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post
|
||||||
match 'calls/:id/manage',:to => 'bids#manage',:via => [:get,:post]
|
match 'calls/:id/manage',:to => 'bids#manage',:via => [:get,:post]
|
||||||
match 'project/course', :to => 'projects#course', :as => 'course' #nyan
|
match 'project/course', :to => 'projects#course', :as => 'course' #nyan
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddPasswordToBids < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :bids, :password, :string
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateJoinInContests < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :join_in_contests do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :bid_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -92,6 +92,7 @@ ActiveRecord::Schema.define(:version => 20131112005309) do
|
||||||
t.integer "reward_type"
|
t.integer "reward_type"
|
||||||
t.integer "homework_type"
|
t.integer "homework_type"
|
||||||
t.integer "parent_id"
|
t.integer "parent_id"
|
||||||
|
t.string "password"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "boards", :force => true do |t|
|
create_table "boards", :force => true do |t|
|
||||||
|
@ -349,6 +350,13 @@ ActiveRecord::Schema.define(:version => 20131112005309) do
|
||||||
add_index "issues", ["status_id"], :name => "index_issues_on_status_id"
|
add_index "issues", ["status_id"], :name => "index_issues_on_status_id"
|
||||||
add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id"
|
add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id"
|
||||||
|
|
||||||
|
create_table "join_in_contests", :force => true do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "bid_id"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "journal_details", :force => true do |t|
|
create_table "journal_details", :force => true do |t|
|
||||||
t.integer "journal_id", :default => 0, :null => false
|
t.integer "journal_id", :default => 0, :null => false
|
||||||
t.string "property", :limit => 30, :default => "", :null => false
|
t.string "property", :limit => 30, :default => "", :null => false
|
||||||
|
|
|
@ -1723,7 +1723,7 @@ button.tab-right {
|
||||||
#content .tabs_new {height: 2.6em; margin-bottom:1.2em; margin-top: 0.8em; position:relative; overflow:hidden;}
|
#content .tabs_new {height: 2.6em; margin-bottom:1.2em; margin-top: 0.8em; position:relative; overflow:hidden;}
|
||||||
#content .tabs_new ul {margin:0; position:absolute; bottom:0; padding-left: 0.5em; width: 2000px; border-bottom: 1px solid #15BCCF;font-size:14px;}
|
#content .tabs_new ul {margin:0; position:absolute; bottom:0; padding-left: 0.5em; width: 2000px; border-bottom: 1px solid #15BCCF;font-size:14px;}
|
||||||
#content .tabs_new ul li {
|
#content .tabs_new ul li {
|
||||||
width:85px; /*modified by linchun*/
|
width:100px; /*modified by linchun*/
|
||||||
float:left;
|
float:left;
|
||||||
list-style-type:none;
|
list-style-type:none;
|
||||||
white-space:nowrap;
|
white-space:nowrap;
|
||||||
|
|
Loading…
Reference in New Issue