Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop
This commit is contained in:
commit
dde65a5895
|
@ -6,7 +6,8 @@ class BidsController < ApplicationController
|
|||
menu_item :homework_respond, :only => :homework_respond
|
||||
menu_item :homework_statistics, :only => :homework_statistics
|
||||
#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, :show_course]
|
||||
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]
|
||||
before_filter :require_login,:only => [:set_reward]
|
||||
|
||||
helper :watchers
|
||||
|
@ -234,6 +235,60 @@ class BidsController < ApplicationController
|
|||
|
||||
end
|
||||
end
|
||||
|
||||
def show_bid_project
|
||||
bids = Bid.where('parent_id = ?', @bid.id)
|
||||
@projects = []
|
||||
for bid in bids
|
||||
@projects += bid.biding_projects
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
render :layout => 'base_bids'
|
||||
}
|
||||
else
|
||||
format.html {
|
||||
render :layout => 'base_contest'
|
||||
}
|
||||
end
|
||||
format.api
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def show_bid_user
|
||||
bids = Bid.where('parent_id = ?', @bid.id)
|
||||
@users = []
|
||||
for bid in bids
|
||||
for project in bid.projects
|
||||
@users += project.users
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
render :layout => 'base_bids'
|
||||
}
|
||||
else
|
||||
format.html {
|
||||
render :layout => 'base_contest'
|
||||
}
|
||||
end
|
||||
format.api
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def show_project
|
||||
# flash[:notice] = ""
|
||||
|
@ -411,7 +466,7 @@ class BidsController < ApplicationController
|
|||
end
|
||||
# Replaces pre blocks with [...]
|
||||
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@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
|
||||
|
|
|
@ -71,7 +71,7 @@ class WordsController < ApplicationController
|
|||
end
|
||||
# Replaces pre blocks with [...]
|
||||
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
|
||||
@content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> "
|
||||
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
|
||||
# @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
|
|
|
@ -105,4 +105,24 @@ module BidsHelper
|
|||
def get_prize(b_project)
|
||||
b_project.get_reward
|
||||
end
|
||||
|
||||
def count_bid_project
|
||||
bids = Bid.where('parent_id = ?', @bid.id)
|
||||
@projects = []
|
||||
for bid in bids
|
||||
@projects += bid.biding_projects
|
||||
end
|
||||
@projects.count
|
||||
end
|
||||
|
||||
def count_bid_user
|
||||
bids = Bid.where('parent_id = ?', @bid.id)
|
||||
@users = []
|
||||
for bid in bids
|
||||
for project in bid.projects
|
||||
@users += project.users
|
||||
end
|
||||
end
|
||||
@users.count
|
||||
end
|
||||
end
|
|
@ -7,11 +7,14 @@ class Bid < ActiveRecord::Base
|
|||
belongs_to :course
|
||||
has_many :biding_projects, :dependent => :destroy
|
||||
has_many :projects, :through => :biding_projects
|
||||
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 :homework_for_courses, :dependent => :destroy
|
||||
has_many :courses, :through => :homework_for_courses, :source => :project
|
||||
has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
|
||||
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
|
||||
|
||||
|
||||
acts_as_attachable
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
<% if get_prize(b_project).nil? or get_prize(b_project) == "" %>
|
||||
<% if @bid.deadline < Date.today %>
|
||||
未评奖
|
||||
<%= l(:label_noawards)%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% case @bid.reward_type %>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<table width="1000px" border="0" style="padding-left: 15px">
|
||||
<td class="font_lighter" style="font-size: 15px;"><%= l(:label_homework_project) %>(<%= @bidding_project.count%>)</td>
|
||||
<td class="font_lighter" style="font-size: 15px;"><%= l(:label_homework_project) %>(<%= bidding_project.count%>)</td>
|
||||
<td>
|
||||
<% if 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 = ?', 5, 7)).size >0) %>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
<% end %>
|
||||
</td>
|
||||
</table>
|
||||
<!-- <% @bidding_project.each do |b_project|%>
|
||||
<!-- <% bidding_project.each do |b_project|%>
|
||||
<table width="90%" border="0" align='center'>
|
||||
<tr>
|
||||
<td>
|
||||
|
@ -63,7 +63,7 @@
|
|||
|
||||
<% else %>
|
||||
<table width="1000px" border="0" style="padding-left: 15px">
|
||||
<td class="font_lighter" style="font-size: 15px;"><%= l(:label_bidding_project) %>(<%= @bidding_project.count%>)</td>
|
||||
<td class="font_lighter" style="font-size: 15px;"><%= l(:label_bidding_project) %>(<%= bidding_project.count%>)</td>
|
||||
<% if User.current.logged? %>
|
||||
<td>
|
||||
<div class='icon icon-add'>
|
||||
|
@ -72,7 +72,7 @@
|
|||
<% end %>
|
||||
</table>
|
||||
|
||||
<!-- <% @bidding_project.each do |b_project|%>
|
||||
<!-- <% bidding_project.each do |b_project|%>
|
||||
<table width="90%" border="0" align='center'>
|
||||
<tr>
|
||||
<td>
|
||||
|
@ -112,4 +112,4 @@
|
|||
</table>
|
||||
<% end %> -->
|
||||
<% end %>
|
||||
<%= render :partial=> "list_projects",:locals => {:bidding_project => @bidding_project,:bid => @bid }%>
|
||||
<%= render :partial=> "list_projects",:locals => {:bidding_project => bidding_project,:bid => @bid }%>
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
</span></td>
|
||||
<td valign="center"><% if User.current.logged? %>
|
||||
|
||||
<!-- <div class='icon icon-add'> -->
|
||||
<%= link_to(l(:label_newtype_contest), {:controller => 'bids', :action => 'new_contest'}, :class => 'icon icon-add') %>
|
||||
<!-- <div class='icon icon-add'> -->
|
||||
<% if User.current.user_extensions.identity == 0 %>
|
||||
<%= link_to(l(:label_newtype_contest), {:controller => 'bids', :action => 'new_contest'}, :class => 'icon icon-add') %>
|
||||
<% end %>
|
||||
<!-- <%= toggle_link l(:label_new_call), 'put-bid-form', {:focus => 'project_id'} %> -->
|
||||
<!-- </div> -->
|
||||
<% end %></td>
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<% @projects.each do |b_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;">
|
||||
<%= link_to image_tag(url_to_avatar(b_project.project), :class => 'avatar3'), :class => "avatar" %>
|
||||
</div></td>
|
||||
<td width="60%" valign="top">
|
||||
<table width="100%" valign="top">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong><%= link_to(b_project.project.name, project_path(b_project.project)) %></strong><a class="font_lighter"><%= l(:label_jion_bidding_homework)%></a></td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
<tr>
|
||||
<td valign="top"><%= b_project.project.description %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top"><a class="font_lighter"><%=format_time(b_project.created_at) %></a></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><%= l(:label_bidding_user_studentcode) %> : <%= @user.user_extensions.student_id %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= l(:label_bidding_user_homework) %> : <%= link_to(b_project.user.name, user_path(b_project.user)) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style=" word-wrap: break-word; word-break: break-all"><%= l(:label_bidding_reason_homewrok) %> : <%= b_project.description %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
|
@ -0,0 +1,30 @@
|
|||
<div class="inf_user_image">
|
||||
<% for user in @users %>
|
||||
<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>
|
|
@ -69,8 +69,15 @@
|
|||
<td><%= l(:label_investment_time_limit) %><%= @bid.deadline%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div style="color: rgb(255, 0, 0); font-size: 14px"><%= l(:label_has_been)%> <%= link_to(Bid.where('parent_id = ?', @bid.id).count, show_course_path(@bid), :class => 'reference') %>
|
||||
<%= l(:label_course_userd_by)%></div></td>
|
||||
<td><div style="color:#ed8924 ; font-size: 14px">被 <strong><%= link_to(Bid.where('parent_id = ?', @bid.id).count, show_course_path(@bid)) %></strong>
|
||||
个高校课程引用为作业!</div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div style="color:#ed8924 ; font-size: 14px">有 <strong><%= link_to(count_bid_project, show_bid_project_path(@bid)) %></strong>
|
||||
个项目正在实现该需求!</div></td>
|
||||
</tr>
|
||||
<td><div style="color: #ed8924; font-size: 14px">有 <strong><%= link_to(count_bid_user, show_bid_user_path(@bid)) %></strong>
|
||||
个高校用户正在努力完成此需求!</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div>
|
||||
|
|
|
@ -47,13 +47,13 @@
|
|||
<tr>
|
||||
<td align="left"><span class="font_lighter"> <%= format_time(membership.created_on) %></span></td><!-- modified by ming -->
|
||||
<td align="right" style="font-size: 13px">
|
||||
课程角色:
|
||||
<%= l(:role_of_course)%>:
|
||||
<% if membership.roles.sort.collect(&:to_s).join(', ') =='Manager' %>
|
||||
老师
|
||||
<%= l(:label_teacher)%>
|
||||
<% elsif membership.roles.sort.collect(&:to_s).join(', ') =='Reporter' %>
|
||||
学生
|
||||
<%= l(:label_student)%>
|
||||
<% elsif membership.roles.sort.collect(&:to_s).join(', ') =='TA' %>
|
||||
助教
|
||||
<%= l(:label_ta)%>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -12,8 +12,13 @@
|
|||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td colspan="2"><%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author), :class => 'bid_user') %>
|
||||
在课程: <%= link_to(bid.courses.first.name, project_path(bid.courses.first)) %>
|
||||
中布置了作业: <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %>
|
||||
<%if @user.language=='zh'%>
|
||||
<%= l(:label_in_course)%>: <%= link_to(bid.courses.first.name, project_path(bid.courses.first)) %>
|
||||
<%= l(:label_assign_homework)%>: <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %>
|
||||
<%else%>
|
||||
<%= l(:label_assign_homework)%>: <%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %>
|
||||
<%= l(:label_in_course)%>: <%= link_to(bid.courses.first.name, project_path(bid.courses.first)) %>
|
||||
<%end%>
|
||||
<span style="float: right">
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
|
|
|
@ -1535,3 +1535,11 @@ en:
|
|||
label_task_submit_form_accessory: Submitted as accessory
|
||||
label_task_submit_form_project: Submitted as project
|
||||
label_news_notice: Release course news
|
||||
|
||||
role_of_course: Role
|
||||
label_student: student
|
||||
label_teacher: teacher
|
||||
label_ta: teacher assistant
|
||||
label_in_course: in course
|
||||
label_assign_homework: assigned homewok
|
||||
label_noawards: No awards
|
||||
|
|
|
@ -1626,3 +1626,13 @@ zh:
|
|||
label_new_join_order: 请输入课程密码
|
||||
label_task_submit_form_accessory: 作业最终以附件形式提交
|
||||
label_task_submit_form_project: 作业最终以项目形式提交
|
||||
label_has_been: 已经被
|
||||
label_course_userd_by: 个课程引用
|
||||
|
||||
role_of_course: 课程角色
|
||||
label_student: 学生
|
||||
label_teacher: 老师
|
||||
label_ta: 助教
|
||||
label_in_course: 在课程中
|
||||
label_assign_homework: 中布置了作业
|
||||
label_noawards: 未评奖
|
|
@ -456,6 +456,8 @@ RedmineApp::Application.routes.draw do
|
|||
match 'project/enterprise_course', :to => 'projects#enterprise_course'
|
||||
match 'project/course_enterprise', :to => 'projects#course_enterprise'
|
||||
match 'calls/:id/show_course', :to => 'bids#show_course', :as => 'show_course'
|
||||
match 'calls/:id/show_bid_project', :to => 'bids#show_bid_project', :as => 'show_bid_project'
|
||||
match 'calls/:id/show_bid_user', :to => 'bids#show_bid_user', :as => 'show_bid_user'
|
||||
|
||||
post 'join_in/join', :to => 'courses#join', :as => 'join'
|
||||
delete 'join_in/join', :to => 'courses#unjoin'
|
||||
|
|
Loading…
Reference in New Issue