1.修改新建作业及视图

2.修改编辑作业及视图
This commit is contained in:
nwb 2014-06-17 11:32:41 +08:00
parent 099e8a0912
commit 78612488e5
10 changed files with 346 additions and 221 deletions

View File

@ -375,7 +375,7 @@ class BidsController < ApplicationController
unless(membership.project.project_type==1) unless(membership.project.project_type==1)
membership.member_roles.each{|role| membership.member_roles.each{|role|
if(role.role_id == 3) if(role.role_id == 3)
@option << membership.project @option << membership.project
end end
} }
end end
@ -397,18 +397,18 @@ class BidsController < ApplicationController
end end
@bidding_project = @temp @bidding_project = @temp
else else
#added by nie #added by nie
@temp = [] @temp = []
@bidding_project.each do |pro| @bidding_project.each do |pro|
if pro.project && pro.project.project_status if pro.project && pro.project.project_status
@temp << pro @temp << pro
end
@temp
end end
@temp if @temp.size > 0
end
if @temp.size > 0
@bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade} @bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
end end
#ended #ended
end end
if @bid.homework_type == 1 if @bid.homework_type == 1
@ -419,9 +419,9 @@ class BidsController < ApplicationController
if params[:student_id].present? if params[:student_id].present?
@temp = [] @temp = []
@homework_list.each do |pro| @homework_list.each do |pro|
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
@temp << pro @temp << pro
end end
@temp @temp
end end
@homework_list = @temp @homework_list = @temp
@ -430,17 +430,94 @@ class BidsController < ApplicationController
respond_to do |format| respond_to do |format|
if @bid.reward_type == 3 if @bid.reward_type == 3
format.html { format.html {
render :layout => 'base_homework' render :layout => 'base_homework'
} }
elsif @bid.reward_type == 1 elsif @bid.reward_type == 1
format.html { format.html {
render :layout => 'base_bids' render :layout => 'base_bids'
} }
else else
format.html { format.html {
render :layout => 'base_contest' render :layout => 'base_contest'
} }
end
format.api
end
end
# 显示作业课程
# add by nwb
def show_course
# flash[:notice] = ""
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
@option = []
@membership.each do |membership|
membership.member_roles.each{|role|
if(role.role_id == 3)
@option << membership.course
end
}
end
@user = @bid.author
@bidding_project = @bid.biding_projects.all
if params[:student_id].present?
@temp = []
@bidding_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
@bidding_project = @temp
else
#added by nie
@temp = []
@bidding_project.each do |pro|
if pro.project && pro.project.project_status
@temp << pro
end
@temp
end
if @temp.size > 0
@bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
end
#ended
end
if @bid.homework_type == 1
@homework = HomeworkAttach.new
#@homework_list = @bid.homeworks
#增加作业按评分排序,
@homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC")
if params[:student_id].present?
@temp = []
@homework_list.each do |pro|
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
@temp << pro
end
@temp
end
@homework_list = @temp
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 end
format.api format.api
end end
@ -724,14 +801,16 @@ class BidsController < ApplicationController
render file: 'courses/new_homework', layout: 'base_courses' render file: 'courses/new_homework', layout: 'base_courses'
end end
end end
# modify by nwb\
# 编辑作业
def edit def edit
@bid = Bid.find(params[:bid_id]) @bid = Bid.find(params[:bid_id])
if (User.current.admin?||User.current.id==@bid.author_id) if (User.current.admin?||User.current.id==@bid.author_id)
@project_id = params[:project_id] @course_id = params[:course_id]
respond_to do |format| respond_to do |format|
format.html { format.html {
@project = Project.find(params[:project_id]) @course = Course.find(params[:course_id])
@user= User.find(User.current.id) @user= User.find(User.current.id)
render :layout => 'base_courses' render :layout => 'base_courses'
} }
@ -743,11 +822,11 @@ class BidsController < ApplicationController
def update def update
@bid = Bid.find(params[:id]) @bid = Bid.find(params[:id])
@project = @bid.courses.first#Project.find(params[:course_id]) @course = @bid.courses.first#Project.find(params[:course_id])
@bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
if @bid.update_attributes(params[:bid]) && @bid.save if @bid.update_attributes(params[:bid]) && @bid.save
flash[:notice] = l(:label_update_homework_succeed) flash[:notice] = l(:label_update_homework_succeed)
redirect_to project_homework_path(@project) redirect_to course_homework_path(@course)
else else
@bid.safe_attributes = params[:bid] @bid.safe_attributes = params[:bid]
render :action => 'edit', :layout =>'base_courses' render :action => 'edit', :layout =>'base_courses'

View File

@ -42,7 +42,7 @@ module AvatarHelper
end end
def get_avatar?(source) def get_avatar?(source)
if File.exist?(disk_filename(source.class,source.id)) if source && File.exist?(disk_filename(source.class,source.id))
return true return true
else else
return false return false

View File

@ -51,6 +51,19 @@ module CoursesHelper
end end
#是否启动互评下拉框
def is_evaluation_option
type = []
option1 = []
option2 = []
option1 << l(:lable_start_mutual_evaluation)
option1 << 1
option2 << l(:lable_close_mutual_evaluation)
option2 << 2
type << option1
type << option2
end
# garble count 混淆数量 # garble count 混淆数量
# alias projectCountOrigin projectCount # alias projectCountOrigin projectCount
# def projectCount project # def projectCount project

View File

@ -21,12 +21,12 @@ class Bid < ActiveRecord::Base
belongs_to :author, :class_name => 'User', :foreign_key => :author_id belongs_to :author, :class_name => 'User', :foreign_key => :author_id
belongs_to :course belongs_to :course
has_many :biding_projects, :dependent => :destroy has_many :biding_projects, :dependent => :destroy
has_many :projects, :through => :biding_projects has_many :courses, :through => :biding_courses
has_many :projects_member, :class_name => 'User', :through => :projects has_many :courses_member, :class_name => 'User', :through => :courses
has_many :journals_for_messages, :as => :jour, :dependent => :destroy has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
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 => :course
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 :join_in_contests, :dependent => :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy has_many :praise_tread, as: :praise_tread_object, dependent: :destroy

View File

@ -1,8 +1,8 @@
class HomeworkForCourse < ActiveRecord::Base class HomeworkForCourse < ActiveRecord::Base
attr_accessible :bid_id, :project_id attr_accessible :bid_id, :course_id
belongs_to :bid belongs_to :bid
belongs_to :project belongs_to :course
end end

View File

@ -13,9 +13,9 @@
<span class="font_lighter"><%= l(:label_user_create_project_homework) %></span> <span class="font_lighter"><%= l(:label_user_create_project_homework) %></span>
<span><%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %></span> <span><%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %></span>
<span style="float: right"> <span style="float: right">
<% 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 = ? or id =?',5, 10, 7)).size >0)) %> <% if(User.current.logged? && (!Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)) %>
<%# 提交作业按钮 %> <%# 提交作业按钮 %>
<!--<%= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@project) %>--> <!--<%= link_to l(:label_commit_homework), '#OpenWindow', rel: 'leanModal', onclick: "showSubH(#{bid.id}, '#{bid.name}');" if User.current.member_of?(@course) %>-->
<% cur_user_homework = cur_user_homework_for_bid(bid) %> <% cur_user_homework = cur_user_homework_for_bid(bid) %>
<% if cur_user_homework!= nil && cur_user_homework.count == 0 %> <% if cur_user_homework!= nil && cur_user_homework.count == 0 %>
<%= link_to l(:label_commit_homework),new_homework_attach_path(bid) %> <%= link_to l(:label_commit_homework),new_homework_attach_path(bid) %>
@ -26,7 +26,7 @@
<% if (User.current.admin?||User.current.id==bid.author_id) %> <% if (User.current.admin?||User.current.id==bid.author_id) %>
<%= link_to( <%= link_to(
l(:button_edit), l(:button_edit),
{:action => 'edit', :controller=>'bids', :project_id =>@project.id, :bid_id => bid.id}, {:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id},
:class => 'icon icon-edit' :class => 'icon icon-edit'
) %> ) %>
<%= link_to( <%= link_to(
@ -51,9 +51,9 @@
end end
%> %>
<% if bid.homework_type == 1%> <% if bid.homework_type == 1%>
<%= l(:label_x_homework_project, :count => bid.homeworks.count) %>(<strong><%= link_to bid.homeworks.count, project_for_bid_path(bid.id) %></strong>) <%= l(:label_x_homework_project, :count => bid.homeworks.count) %>(<strong><%= link_to bid.homeworks.count, course_for_bid_path(bid.id) %></strong>)
<% else %> <% else %>
<%= l(:label_x_homework_project, :count => @temp.count) %>(<strong><%= link_to @temp.count, project_for_bid_path(bid.id) %></strong>) <%= l(:label_x_homework_project, :count => @temp.count) %>(<strong><%= link_to @temp.count, course_for_bid_path(bid.id) %></strong>)
<% end %></span> <% end %></span>
<span class="font_lighter"><%= l(:label_x_responses, :count => bid.commit) %>(<strong><%= link_to bid.commit, respond_path(bid) %></strong>)</span> <span class="font_lighter"><%= l(:label_x_responses, :count => bid.commit) %>(<strong><%= link_to bid.commit, respond_path(bid) %></strong>)</span>
<span style="float: right"> <span style="float: right">

View File

@ -21,7 +21,6 @@
</script> </script>
<%= error_messages_for 'bid' %> <%= error_messages_for 'bid' %>
<!--[form:course]-->
<p><%= l(:label_homeworks_form_new_description) %></p> <p><%= l(:label_homeworks_form_new_description) %></p>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %></p> <p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %></p>

View File

@ -18,214 +18,226 @@
<%= yield :header_tags -%> <%= yield :header_tags -%>
</head> </head>
<body class="<%= h body_css_classes %>"> <body class="<%= h body_css_classes %>">
<% project = @bid.courses.includes(:course_extra).first %> <% course = @bid.courses.first %>
<% course = project.course_extra %> <% if course %>
<div id="wrapper"> <div id="wrapper">
<div id="wrapper2"> <div id="wrapper2">
<div id="wrapper3"> <div id="wrapper3">
<%= render :partial => 'layouts/base_header'%> <%= render :partial => 'layouts/base_header' %>
<div id="main"> <div id="main">
<!--added by huang--> <!--added by huang-->
<div class="top-content"> <div class="top-content">
<table> <table>
<tr> <tr>
<td class="info_font" style="width: 240px; color: #15bccf">高校课程实践社区</td> <td class="info_font" style="width: 240px; color: #15bccf">高校课程实践社区</td>
<td style="width: auto; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td> <td style="width: auto; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/courses", :controller => 'projects', :action => 'course'%></a></td> <td style="padding-left: 8px">
<td><p class="top-content-list-homework"><%=link_to "主页", home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course' %> > <a><%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index' %></a></td>
<span><%= link_to(@bid.courses.first.name.to_s, homework_project_path(@bid.courses.first)) if @bid.courses.first%></span> > <td><p class="top-content-list-homework"><%= link_to "主页", home_path %>
<%=link_to(@bid.name, respond_path(@bid)) %></p></td> > <%= link_to l(:label_course_practice), :controller => 'courses', :action => 'index' %> >
</tr> <span><%= link_to(@bid.courses.first.name.to_s, homework_course_path(@bid.courses.first)) if @bid.courses.first %></span>
</table> >
</div> <%= link_to(@bid.name, respond_path(@bid)) %></p></td>
<!--end--> </tr>
</table>
</div>
<!--end-->
<div id="sidebar"> <div id="sidebar">
<div class="main_context"> <div class="main_context">
<div class="spaceleft"> <div class="spaceleft">
<div> <div>
<table> <table>
<tr> <tr>
<td style="padding-left:8px "> <td style="padding-left:8px ">
<% if get_avatar?(project) %> <% if get_avatar?(course) %>
<%= image_tag(url_to_avatar(project),:style => "width:80px;height:80px" ) %> <%= image_tag(url_to_avatar(course), :style => "width:80px;height:80px") %>
<% else %> <% else %>
<%= image_tag('../images/avatars/Project/course.jpg', :style => "width:80px;height:80px") %> <%= image_tag('../images/avatars/course/course.jpg', :style => "width:80px;height:80px") %>
<% end %> <% end %>
</td> </td>
<td> <td>
<table> <table>
<tr> <tr>
<td style="vertical-align: top;font-size: 16px;text-align: center;" > <td style="vertical-align: top;font-size: 16px;text-align: center;">
<span style=" word-wrap: break-word; word-break: break-all"> <span style=" word-wrap: break-word; word-break: break-all">
<strong> <strong>
<%= link_to @bid.courses.first.name.to_s, homework_project_path(@bid.courses.first) if @bid.courses.first %> <%= link_to @bid.courses.first.name.to_s, homework_course_path(@bid.courses.first) if @bid.courses.first %>
</strong> </strong>
</span> </span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style=" word-wrap: break-word; word-break: break-all;font-size: 16px;text-align: center"> <td style=" word-wrap: break-word; word-break: break-all;font-size: 16px;text-align: center">
<span style=" color:#ed8924"> <span style=" color:#ed8924">
<strong><%= h @bid.name %></strong> <strong><%= h @bid.name %></strong>
</span> </span>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
<div class="user_underline"></div> <div class="user_underline"></div>
<!--count--> <!--count-->
<div class="inf_user_image"> <div class="inf_user_image">
<table> <table>
<tr> <tr>
<td valign="top" colspan="2" style="font-size: 16px;padding-left: 8px;"><strong><%= l(:label_new_course_description) %> :</strong></td> <td valign="top" colspan="2" style="font-size: 16px;padding-left: 8px;">
</tr> <strong><%= l(:label_new_course_description) %> :</strong></td>
</tr>
<tr> <tr>
<td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;"><%= textilizable project.description %></td> <td class="font_lighter_sidebar" colspan="2" style="padding-left: 8px;"><%= textilizable course.description %></td>
</tr> </tr>
<tr> <tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_create_time) %> :</td> <td valign="top" style="padding-left: 8px;"><%= l(:label_create_time) %> :</td>
<td class="font_lighter_sidebar"><%= format_time course.created_at %></td> <td class="font_lighter_sidebar"><%= format_time course.created_at %></td>
</tr> </tr>
<tr> <tr>
<td valign="top" style="padding-left: 8px; width:60px">主讲老师 :</td> <td valign="top" style="padding-left: 8px; width:60px">主讲老师 :</td>
<td class="font_lighter_sidebar"><%= link_to(@user.lastname+@user.firstname, user_path(@user)) %></td> <td class="font_lighter_sidebar"><%= link_to(@user.lastname+@user.firstname, user_path(@user)) %></td>
</tr> </tr>
<tr> <tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_class_period) %> :</td> <td valign="top" style="padding-left: 8px;"><%= l(:label_class_period) %> :</td>
<td class="font_lighter_sidebar"><%= course.class_period.to_s %>&nbsp;<%= l(:label_class_hour) %></td> <td class="font_lighter_sidebar"><%= course.class_period.to_s %>&nbsp;<%= l(:label_class_hour) %></td>
</tr> </tr>
<tr> <tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_main_term) %> :</td> <td valign="top" style="padding-left: 8px;"><%= l(:label_main_term) %> :</td>
<td class="font_lighter_sidebar"><%= course.time.to_s %> <%= course.term %></td> <td class="font_lighter_sidebar"><%= course.time.to_s %> <%= course.term %></td>
</tr> </tr>
<tr> <tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td> <td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td>
<td class="font_lighter_sidebar"><%= @user.user_extensions.occupation %></td> <td class="font_lighter_sidebar"><%= @user.user_extensions.occupation %></td>
</tr> </tr>
</table> </table>
</div> </div>
<div class="user_underline"></div> <div class="user_underline"></div>
<!-- info --> <!-- info -->
<div class="inf_user_image"> <div class="inf_user_image">
<table> <table>
<tr> <tr>
<td><%= l(:label_limit_time) %>: <%= @bid.deadline %></td> <td><%= l(:label_limit_time) %>: <%= @bid.deadline %></td>
</tr> </tr>
<tr> <tr>
<td>作业类型: <%=@bid.homework_type==Bid::HomeworkFile ? "提交文件" : "提交项目"%></td> <td>作业类型: <%= @bid.homework_type==Bid::HomeworkFile ? "提交文件" : "提交项目" %></td>
</tr> </tr>
<% unless @bid.parent_id.nil?%> <% unless @bid.parent_id.nil? %>
<tr> <tr>
<td> <td>
<div style=" color: rgb(255, 0, 0); width:200px"> <div style=" color: rgb(255, 0, 0); width:200px">
<% author=Bid.find(@bid.parent_id).author%> <% author=Bid.find(@bid.parent_id).author %>
作业来源于<%= link_to(author.lastname+author.firstname, user_path(Bid.find(@bid.parent_id).author))%>的需求:<%= link_to(Bid.find(@bid.parent_id).name, respond_path(Bid.find(@bid.parent_id))) %> 作业来源于<%= link_to(author.lastname+author.firstname, user_path(Bid.find(@bid.parent_id).author)) %>
</div></td> 的需求:<%= link_to(Bid.find(@bid.parent_id).name, respond_path(Bid.find(@bid.parent_id))) %>
</tr> </div>
<% end %> </td>
</table> </tr>
</div> <% end %>
</table>
</div>
<!-- tags --> <!-- tags -->
<div class="user_fans"> <div class="user_fans">
<div class="user_underline"></div> <div class="user_underline"></div>
<table style="font-family:'微软雅黑'; padding-left: 8px"> <table style="font-family:'微软雅黑'; padding-left: 8px">
<tr> <tr>
<td><!-- added by william -for tag --> <%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"}%> </td> <td><!-- added by william -for tag --> <%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"} %> </td>
</tr> </tr>
</table> </table>
</div> </div>
<!--homework--> <!--homework-->
<div class="user_fans"> <div class="user_fans">
<div class="user_underline"></div> <div class="user_underline"></div>
<div class="font_title_left"> <div class="font_title_left">
<strong><%= l(:label_commit_homework) %></strong> <strong><%= l(:label_commit_homework) %></strong>
</div> </div>
<div class="left_wf"> <div class="left_wf">
<table> <table>
<tr> <tr>
<td style="padding-top: 5px"> <% if @bid.homework_type == 1%> <td style="padding-top: 5px">
<% if @bid.homeworks.size>0 %> <% if @bid.homework_type == 1 %>
<% for homework in @bid.homeworks.eager_load(:user) %> <% if @bid.homeworks.size>0 %>
<%= link_to image_tag(url_to_avatar(homework.user), :class => "avatar", :title => homework.user.name), user_path(homework.user), :class => "avatar" %> <% end %> <% for homework in @bid.homeworks.eager_load(:user) %>
<% else %> <%= link_to image_tag(url_to_avatar(homework.user), :class => "avatar", :title => homework.user.name), user_path(homework.user), :class => "avatar" %>
<p class="font_lighter"> <% end %>
<%= l(:label_no_course_project) %> <% else %>
</p> <% end %> <p class="font_lighter">
<% else %> <%= l(:label_no_course_project) %>
<% if @bid.projects.size>0 %> </p>
<% for project in @bid.projects%>
<%= link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name), project_path(project), :class => "avatar" %> <% end %>
<% else %>
<p class="font_lighter">
<%= l(:label_no_course_project) %>
</p> <% end %>
<% end %> </td>
</tr>
</table>
</div>
</div>
<div class="user_underline"></div>
</div>
</div>
<!-- end -->
</div>
<div id="content">
<div class="tabs_new">
<ul>
<li>
<%= link_to l(:label_question_student), {:controller => 'bids', :action => 'show' },:class => link_class(:respond)%>
</li>
<% if User.current.member_of? @bid.courses.first%>
<li>
<% if User.current.logged? && @bid.courses.first && (!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) %>
<%= link_to l(:label_homework_commit), {:controller => 'bids', :action => 'show_project' },:class => link_class(:project)%>
<% else %>
<%= link_to l(:label_homework_info), {:controller => 'bids', :action => 'show_project' },:class => link_class(:project)%>
<% end %>
</li>
<% end %> <% end %>
<!-- <li><%= link_to l(:label_homework_statistics), { :controller => 'bids', :action => 'homework_statistics' },:class => link_class(:homework_statistics)%></li> --> <% else %>
<!-- <li><%= link_to l(:label_homework_respond), { :controller => 'bids', :action => 'homework_respond' },:class => link_class(:homework_respond)%></li> <% if @bid.courses.size>0 %>
<% for course in @bid.courses %>
<%= link_to image_tag(url_to_avatar(course), :class => "avatar", :title => course.name), course_path(course), :class => "avatar" %>
<% end %>
<% else %>
<p class="font_lighter">
<%= l(:label_no_course_project) %>
</p>
<% end %>
<% end %> </td>
</tr>
</table>
</div>
</div>
<div class="user_underline"></div>
</div>
</div>
<!-- end -->
</div>
<div id="content">
<div class="tabs_new">
<ul>
<li>
<%= link_to l(:label_question_student), {:controller => 'bids', :action => 'show'}, :class => link_class(:respond) %>
</li>
<% if User.current.member_of? @bid.courses.first %>
<li>
<% if User.current.logged? && @bid.courses.first && (!Member.where('user_id = ? and course_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?', 5, 10, 7)).size >0) %>
<%= link_to l(:label_homework_commit), {:controller => 'bids', :action => 'show_course'}, :class => link_class(:course) %>
<% else %>
<%= link_to l(:label_homework_info), {:controller => 'bids', :action => 'show_course'}, :class => link_class(:course) %>
<% end %>
</li>
<% end %>
<!-- <li><%= link_to l(:label_homework_statistics), {:controller => 'bids', :action => 'homework_statistics'}, :class => link_class(:homework_statistics) %></li> -->
<!-- <li><%= link_to l(:label_homework_respond), {:controller => 'bids', :action => 'homework_respond'}, :class => link_class(:homework_respond) %></li>
--></ul> --></ul>
</div> </div>
<%= yield %> <%= yield %>
<%= call_hook :view_layouts_base_content %> <%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div> <div style="clear:both;"></div>
</div> </div>
<%= render :partial => 'layouts/base_footer'%> <%= render :partial => 'layouts/base_footer' %>
</div> </div>
</div> </div>
</div> </div>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>
</div> </div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
</div> </div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
<% end %>
</body> </body>
</html> </html>

View File

@ -591,6 +591,7 @@ RedmineApp::Application.routes.draw do
end end
resources :news, :except => [:show, :edit, :update, :destroy] resources :news, :except => [:show, :edit, :update, :destroy]
resources :boards resources :boards
match '/homework', :controller => 'courses', :action => 'homework', :as => 'homework', :via => :get
end # end of resources :courses end # end of resources :courses
match 'courses/:id/feedback', :to => 'courses#feedback', :via => :get, :as => 'course_feedback' match 'courses/:id/feedback', :to => 'courses#feedback', :via => :get, :as => 'course_feedback'
match '/courses/search', :controller => 'courses', :action => 'search', :via => [:get, :post] match '/courses/search', :controller => 'courses', :action => 'search', :via => [:get, :post]
@ -632,6 +633,7 @@ RedmineApp::Application.routes.draw do
match 'calls/new_bid', :controller => 'bids', :action => 'new_bid' match 'calls/new_bid', :controller => 'bids', :action => 'new_bid'
match 'contest/new_contest', :controller => 'bids', :action => 'new_contest' #huang match 'contest/new_contest', :controller => 'bids', :action => 'new_contest' #huang
match 'calls/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid' match 'calls/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid'
match 'calls/:id/show_course', :controller => 'bids', :action => 'show_course', :as => 'course_for_bid' # nwb added
match 'calls/:id/new_exercise_book', :controller => 'homework_attach', :action => 'new', :as => 'new_homework_attach' match 'calls/:id/new_exercise_book', :controller => 'homework_attach', :action => 'new', :as => 'new_homework_attach'
match 'calls/:id/add', :controller => 'bids', :action => 'add' match 'calls/:id/add', :controller => 'bids', :action => 'add'
match 'calls/:id/delete', :controller => 'bids', :action => 'delete' match 'calls/:id/delete', :controller => 'bids', :action => 'delete'

View File

@ -207,6 +207,17 @@ ActiveRecord::Schema.define(:version => 20140611161801) do
t.string "reward" t.string "reward"
end end
create_table "contestnotifications", :force => true do |t|
t.integer "contest_id"
t.string "title"
t.string "summary"
t.string "description"
t.integer "author_id"
t.integer "notificationcomments_count"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "contests", :force => true do |t| create_table "contests", :force => true do |t|
t.string "name" t.string "name"
t.string "budget", :default => "" t.string "budget", :default => ""
@ -595,6 +606,15 @@ ActiveRecord::Schema.define(:version => 20140611161801) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "notificationcomments", :force => true do |t|
t.string "notificationcommented_type"
t.integer "notificationcommented_id"
t.integer "author_id"
t.text "notificationcomments"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "open_id_authentication_associations", :force => true do |t| create_table "open_id_authentication_associations", :force => true do |t|
t.integer "issued" t.integer "issued"
t.integer "lifetime" t.integer "lifetime"