Merge branch 'Homework' of http://repository.trustie.net/xianbo/trustie2 into Homework
Conflicts: app/views/bids/_bid_homework_show.html.erb
This commit is contained in:
commit
5cbbb98536
|
@ -491,7 +491,6 @@ class BidsController < ApplicationController
|
|||
if @bid.homework_type
|
||||
@homework = HomeworkAttach.new
|
||||
@is_teacher = is_course_teacher(User.current,@bid.courses.first)
|
||||
#if @is_teacher
|
||||
teachers = "("
|
||||
teacher_members = searchTeacherAndAssistant(@bid.courses.first)
|
||||
teacher_members.each do |member|
|
||||
|
@ -501,14 +500,22 @@ class BidsController < ApplicationController
|
|||
teachers += member.user_id.to_s + ","
|
||||
end
|
||||
end
|
||||
if @is_teacher
|
||||
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score
|
||||
FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1
|
||||
WHERE table1.t_score IS NULL")
|
||||
#else
|
||||
# all_homework_list = HomeworkAttach.all
|
||||
#end
|
||||
else
|
||||
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 3123) AS m_score
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id}) AS table1
|
||||
WHERE table1.m_score IS NULL")
|
||||
end
|
||||
|
||||
@homework_list = paginateHelper all_homework_list,10
|
||||
@jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
|
|
|
@ -7,7 +7,7 @@ class HomeworkAttachController < ApplicationController
|
|||
before_filter :can_show_course,except: []
|
||||
#判断当前角色权限时需先找到当前操作的project
|
||||
before_filter :find_course_by_bid_id, :only => [:new]
|
||||
before_filter :find_bid_and_course,:only => [:get_not_batch_homework,:get_batch_homeworks,:get_homeworks,:get_homework_jours]
|
||||
before_filter :find_bid_and_course,:only => [:get_not_batch_homework,:get_batch_homeworks,:get_homeworks,:get_homework_jours, :get_student_batch_homework, :get_my_homework]
|
||||
before_filter :find_course_by_hoemwork_id, :only => [:edit,:update,:destroy,:show,:add_homework_users,:destory_homework_users]
|
||||
#判断当前角色是否有操作权限
|
||||
#勿删 before_filter :authorize, :only => [:new,:edit,:update,:destroy]
|
||||
|
@ -68,6 +68,48 @@ class HomeworkAttachController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#获取学生匿评列表
|
||||
def get_student_batch_homework
|
||||
@is_student_batch_homework = true
|
||||
teachers = find_course_teachers @course
|
||||
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 3123) AS m_score
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id}) AS table1
|
||||
WHERE table1.m_score IS NULL")
|
||||
@homework_list = paginateHelper all_homework_list,10
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#获取我的作业
|
||||
def get_my_homework
|
||||
@is_my_homework = true
|
||||
teachers = find_course_teachers @course
|
||||
all_homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score
|
||||
FROM homework_attaches
|
||||
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_attaches.user_id = #{User.current.id}")
|
||||
#如果我没有创建过作业,就检索我是否参与了某个作业
|
||||
if all_homework_list.empty?
|
||||
all_homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_users ON homework_users.homework_attach_id = homework_attaches.id
|
||||
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_users.user_id = #{User.current.id}")
|
||||
end
|
||||
@homework_list = paginateHelper all_homework_list,10
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#获取作业的留言列表
|
||||
def get_homework_jours
|
||||
#@user = @bid.author
|
||||
|
@ -270,9 +312,14 @@ class HomeworkAttachController < ApplicationController
|
|||
def destroy
|
||||
if User.current.admin? || User.current == @homework.user
|
||||
if @homework.destroy
|
||||
#respond_to do |format|
|
||||
# format.html { redirect_to course_for_bid_url @homework.bid }
|
||||
# format.json { head :no_content }
|
||||
#end
|
||||
@homework_list = []
|
||||
@is_my_homework = true
|
||||
respond_to do |format|
|
||||
format.html { redirect_to course_for_bid_url @homework.bid }
|
||||
format.json { head :no_content }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
end
|
||||
|
@ -406,7 +453,10 @@ class HomeworkAttachController < ApplicationController
|
|||
|
||||
def find_course_by_hoemwork_id
|
||||
@homework = HomeworkAttach.find(params[:id])
|
||||
@course = @homework.bid.courses[0]
|
||||
@bid = @homework.bid
|
||||
@course = @bid.courses.first
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
#获取课程的老师列表
|
||||
|
|
|
@ -28,6 +28,7 @@ class Bid < ActiveRecord::Base
|
|||
has_many :homework_for_courses, :dependent => :destroy
|
||||
has_many :courses, :through => :homework_for_courses, :source => :course
|
||||
has_many :homeworks, :class_name => 'HomeworkAttach', :dependent => :destroy
|
||||
has_many :homework_evaluations, :through => :homeworks
|
||||
has_many :join_in_contests, :dependent => :destroy
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
|
||||
|
|
|
@ -10,6 +10,7 @@ class HomeworkAttach < ActiveRecord::Base
|
|||
has_many :users, :through => :homework_users
|
||||
seems_rateable :allow_update => true, :dimensions => :quality
|
||||
belongs_to :project
|
||||
has_many :homework_evaluations, :dependent => :destroy
|
||||
|
||||
safe_attributes "bid_id",
|
||||
"user_id"
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class HomeworkEvaluation < ActiveRecord::Base
|
||||
attr_accessible :homework_attach_id, :user_id
|
||||
|
||||
belongs_to :homework_attach
|
||||
belongs_to :user
|
||||
end
|
|
@ -75,6 +75,7 @@ class User < Principal
|
|||
|
||||
has_many :homework_users
|
||||
has_many :homework_attaches, :through => :homework_users
|
||||
has_many :homework_evaluations
|
||||
|
||||
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
|
||||
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
||||
|
|
|
@ -5,22 +5,32 @@
|
|||
<% else %>
|
||||
<% bids.each do |bid|%>
|
||||
<table class="content-text-list">
|
||||
<tr><td colspan="2" valign="top" width="50" ><%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %></td>
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" >
|
||||
<%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %>
|
||||
</td>
|
||||
<td>
|
||||
<table width="580px" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><strong><%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_user_create_project_homework) %></span>
|
||||
<span><%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %></span>
|
||||
<td colspan="2" valign="top">
|
||||
<strong>
|
||||
<%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author)) %>
|
||||
</strong>
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_user_create_project_homework) %>
|
||||
</span>
|
||||
<span>
|
||||
<%= link_to(bid.name, course_for_bid_path(bid), :class => 'bid_path') %>
|
||||
</span>
|
||||
<span style="float: right">
|
||||
<% 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?(@course) %>-->
|
||||
<% cur_user_homework = cur_user_homework_for_bid(bid) %>
|
||||
<% if cur_user_homework!= nil && cur_user_homework.count == 0 %>
|
||||
<%= link_to l(:label_commit_homework),new_homework_attach_path(bid) %>
|
||||
<% else %>
|
||||
<span style="color: green; float: right"><%= l(:lable_has_commit_homework)%></span>
|
||||
<span style="color: green; float: right">
|
||||
<%= l(:lable_has_commit_homework)%>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if (User.current.admin?||User.current.id==bid.author_id) %>
|
||||
|
@ -29,18 +39,20 @@
|
|||
{:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id},
|
||||
:class => 'icon icon-edit'
|
||||
) %>
|
||||
<%= link_to(
|
||||
<%#= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'homework_destroy', :controller=>'bids', :course_id => bid.id},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'icon icon-del'
|
||||
) %></span>
|
||||
) %>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><span class="font_lighter">
|
||||
<td colspan="2">
|
||||
<span class="font_lighter">
|
||||
<% bidding_project = bid.biding_projects.all
|
||||
temp = []
|
||||
bidding_project.each do |pro|
|
||||
|
@ -51,48 +63,89 @@
|
|||
end
|
||||
%>
|
||||
<% if bid.homework_type == 1%>
|
||||
<%= l(:label_x_homework_project, :count => bid.homeworks.count) %>(<strong><%= link_to bid.homeworks.count, course_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 %>
|
||||
<%= l(:label_x_homework_project, :count => temp.count) %>(<strong><%= link_to temp.count, course_for_bid_path(bid.id) %></strong>)
|
||||
<% end %></span>
|
||||
<span class="font_lighter"><%= l(:label_x_responses, :count => bid.commit) %>(<strong><%= bid.commit %></strong>)</span>
|
||||
<%= l(:label_x_homework_project, :count => temp.count) %>
|
||||
(
|
||||
<strong>
|
||||
<%= link_to temp.count, course_for_bid_path(bid.id) %>
|
||||
</strong>)
|
||||
<% end %>
|
||||
</span>
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_x_responses, :count => bid.commit) %>
|
||||
(
|
||||
<strong>
|
||||
<%= bid.commit %>
|
||||
</strong>
|
||||
)
|
||||
</span>
|
||||
<span style="float: right">
|
||||
<% if betweentime(bid.deadline) < 0 %>
|
||||
<span style="color: red; float: right"><%= l(:label_commit_limit)%></span>
|
||||
<span style="color: red; float: right">
|
||||
<%= l(:label_commit_limit)%>
|
||||
</span>
|
||||
<% else %>
|
||||
<% if betweentime(bid.deadline) < 3 %>
|
||||
<span style="color: red"><%= l(:label_commit_ar) %></span>
|
||||
<% else %>
|
||||
<span style="color: red">
|
||||
<%= l(:label_commit_ar) %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %> </span>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> <% if bid.reward_type.nil? or bid.reward_type == 1 %> <strong><%= l(:label_bids_reward_method) %><span style="color: #ed8924;font-family: 14px; font-family: '微软雅黑'"><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %>
|
||||
<%= bid.budget%></span></strong> <% elsif bid.reward_type == 2 %> <strong><%= l(:label_bids_reward_method) %><span style="color: #15bccf;font-family: 14px; font-family:' 微软雅黑'"><%= bid.budget%></span></strong>
|
||||
<% else %>
|
||||
|
||||
<% end %> <!-- <td style="color: rgb(255, 0, 0);"><strong><%#= l(:label_price) %><%#= l(:label_RMB_sign) %><%#= bid.budget%></strong></td> --></td>
|
||||
<td colspan="2">
|
||||
<% if bid.reward_type.nil? or bid.reward_type == 1 %>
|
||||
<strong>
|
||||
<%= l(:label_bids_reward_method) %>
|
||||
<span style="color: #ed8924;font-family: 14px; font-family: '微软雅黑'">
|
||||
<%= l(:label_call_bonus) %>
|
||||
|
||||
<%= l(:label_RMB_sign) %>
|
||||
<%= bid.budget%>
|
||||
</span>
|
||||
</strong>
|
||||
<% elsif bid.reward_type == 2 %>
|
||||
<strong>
|
||||
<%= l(:label_bids_reward_method) %>
|
||||
<span style="color: #15bccf;font-family: 14px; font-family:' 微软雅黑'">
|
||||
<%= bid.budget%>
|
||||
</span>
|
||||
</strong>
|
||||
<% 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 %>
|
||||
<td colspan="2" width="580px" >
|
||||
<span class="font_description">
|
||||
<%= textilizable bid, :description %>
|
||||
</span></td>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: left">
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_create_time) %> : <%=format_time bid.created_on %></span><span style="float: right"> <%= l(:field_deadline) %> : <%=bid.deadline %>
|
||||
</span></td>
|
||||
<%= l(:label_create_time) %>
|
||||
:
|
||||
<%=format_time bid.created_on %>
|
||||
</span>
|
||||
<span style="float: right">
|
||||
<%= l(:field_deadline) %>
|
||||
:
|
||||
<%=bid.deadline %>
|
||||
</span>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="pagination">
|
||||
|
|
|
@ -28,13 +28,6 @@
|
|||
}
|
||||
</script>
|
||||
</div>
|
||||
<% if User.current.logged? && User.current.member_of_course?(@bid.courses.first) && cur_user_homework_for_bid(@bid).count == 0 && is_cur_course_student(@bid.courses.first) %>
|
||||
<div class='icon icon-add'>
|
||||
<%= link_to l(:label_course_new_homework),new_homework_attach_path %>
|
||||
<strong style="color: #a9a9a9"> (每一个作业都可以是一个精美的作品)</strong>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div id='bidding_project_list'>
|
||||
<%= render :partial => 'homework_list' %>
|
||||
</div>
|
||||
|
|
|
@ -28,16 +28,16 @@
|
|||
</ul>
|
||||
<% else %>
|
||||
<ul>
|
||||
<li id="tb_1" class="hovertab">待评作品
|
||||
|
||||
<li id="tb_5" class="hovertab">
|
||||
<%= link_to "待评作品", get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
</li>
|
||||
<li id="tb_2" class="normaltab">我的作品
|
||||
|
||||
<li id="tb_6" class="normaltab">
|
||||
<%= link_to "我的作品", get_my_homework_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
</li>
|
||||
<li id="tb_3" class="normaltab">
|
||||
<li id="tb_7" class="normaltab">
|
||||
<%= link_to "所有作品", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
</li>
|
||||
<li id="tb_4" class="normaltab">
|
||||
<li id="tb_8" class="normaltab">
|
||||
<%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
(<span id="jours_count" class="c_red f_12"><%= @jours_count %></span>)
|
||||
</li>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<span id="bid_deadline_span">
|
||||
</span>
|
||||
</p>
|
||||
<p>
|
||||
<p style="display: none">
|
||||
<%= f.select :is_evaluation, is_evaluation_option %>
|
||||
</p>
|
||||
<p>
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<% is_teacher = is_course_teacher(User.current,@bid.courses.first) %>
|
||||
<div class="code_list">
|
||||
<% is_my_homework ||= false %>
|
||||
<% is_student_batch_homework ||= false %>
|
||||
|
||||
<% unless is_my_homework || is_student_batch_homework %>
|
||||
<div class="code_list">
|
||||
<span>
|
||||
<%= l(:label_homework_list)%>
|
||||
(<font color="#CC0000">
|
||||
|
@ -12,10 +16,29 @@
|
|||
<%= link_to l(:label_time), sort_homework_path(@bid, 'time', @direction), {:remote => true}%>
|
||||
<%= l(:label_sort) %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
|
||||
<% unless homeworks.nil? %>
|
||||
<% if !is_teacher && is_my_homework && homeworks.empty? %>
|
||||
<!-- 是学生,我的作业,且作业列表为空,即我未提交作业 -->
|
||||
<ul>
|
||||
<li class="pic_head">
|
||||
<%= link_to image_tag(url_to_avatar(User.current), :width => "40", :height => "40"), user_path(User.current) %>
|
||||
<span>
|
||||
<%= link_to User.current.login, user_path(User.current), :title => User.current.login%>
|
||||
</span>
|
||||
</li>
|
||||
<li class="c_red" style="margin:25px 0 0 20px;"> 您还没交作业,请创建作业!</li>
|
||||
<li class="wping">
|
||||
<%= link_to "创建作业", new_exercise_book_path(@bid), :style => "width:80px; margin:20px 0 0 350px;" %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
||||
<% homeworks.each do |homework| %>
|
||||
<ul>
|
||||
<li class="pic_head">
|
||||
|
@ -50,15 +73,48 @@
|
|||
<%= homework.s_score.nil? ? l(:label_without_score) : format("%.2f",homework.s_score) %>
|
||||
</span>
|
||||
</li>
|
||||
<% if is_teacher %>
|
||||
<!-- 是老师,所有列表正常显示 -->
|
||||
<li class="wping">
|
||||
<%= link_to l(:label_work_rating),homework_attach_path(homework),:remote => true %>
|
||||
<% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
<span class="c_red"> 迟交!</span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% else %>
|
||||
<!-- 是学生 -->
|
||||
<% if is_my_homework %>
|
||||
<!-- 我的作品,显示为编辑和删除 -->
|
||||
<li class="wmine">
|
||||
<%= link_to l(:button_edit), edit_homework_attach_path(homework) %>
|
||||
<% if homework.user == User.current || User.current.admin? %>
|
||||
<%= link_to(l(:label_bid_respond_delete), homework,
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true ) %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% elsif is_student_batch_homework%>
|
||||
<!-- 学生匿评列表,正常显示 -->
|
||||
<li class="wping">
|
||||
<%= link_to l(:label_work_rating),homework_attach_path(homework),:remote => true %>
|
||||
<% if Time.parse(bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>
|
||||
<span class="c_red"> 迟交!</span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% else %>
|
||||
<!-- 学生众评列表,显示为点赞 -->
|
||||
<li class="wping">
|
||||
<a href="#" target="_blank" >点赞</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% end %>
|
||||
<ul class="wlist"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => remote, :flag => true%></ul>
|
||||
<!-- 如果是我的作业或者匿评列表界面不现实分页控件 -->
|
||||
<% unless is_my_homework || is_student_batch_homework %>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => remote, :flag => true%>
|
||||
</ul>
|
||||
<% end %>
|
|
@ -0,0 +1,2 @@
|
|||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list',
|
||||
:locals => {:homeworks => @homework_list, :bid => @bid, :remote => true, :is_my_homework => @is_my_homework} )) %>');
|
|
@ -1,3 +1,6 @@
|
|||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homework_jours',:locals => { :bid => @bid, :journals => @jour, :state => false} )) %>');
|
||||
for(var i=1;i<=4;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_4").removeClass().addClass("hovertab");
|
||||
|
||||
for(var i=5;i<=8;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_8").removeClass().addClass("hovertab");
|
||||
|
|
|
@ -3,3 +3,6 @@ $('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list',
|
|||
for(var i=1;i<=4;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_3").removeClass().addClass("hovertab");
|
||||
|
||||
for(var i=5;i<=8;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_7").removeClass().addClass("hovertab");
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list',
|
||||
:locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => true, :is_my_homework => @is_my_homework} )) %>');
|
||||
for(var i=5;i<=8;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_6").removeClass().addClass("hovertab");
|
|
@ -1,4 +1,4 @@
|
|||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list',
|
||||
:locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => true} )) %>');
|
||||
for(var i=1;i<=5;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
for(var i=1;i<=4;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_1").removeClass().addClass("hovertab");
|
|
@ -0,0 +1,4 @@
|
|||
$('#tbc_01').html('<%= escape_javascript(render(:partial => 'homeworks_list',
|
||||
:locals => {:homeworks => @homework_list, :homework_count => @obj_count, :bid => @bid, :remote => true, :is_student_batch_homework => @is_student_batch_homework} )) %>');
|
||||
for(var i=5;i<=8;i++){$("#tb_"+i).removeClass().addClass("normaltab");}
|
||||
$("#tb_5").removeClass().addClass("hovertab");
|
|
@ -48,6 +48,8 @@ RedmineApp::Application.routes.draw do
|
|||
get 'get_batch_homeworks'
|
||||
get 'get_homeworks'
|
||||
get 'get_homework_jours'
|
||||
get 'get_student_batch_homework'
|
||||
get 'get_my_homework'
|
||||
end
|
||||
member do
|
||||
match 'add_homework_users', :via => [:get,:post]
|
||||
|
@ -699,7 +701,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'contest/new_contest', :to => 'bids#new_contest' #huang
|
||||
match 'calls/:id/show_project', :to => 'bids#show_project', :as => 'project_for_bid'
|
||||
match 'calls/:id/show_course', :to => 'bids#show_courseEx', :as => 'course_for_bid' # nwb added
|
||||
match 'calls/:id/new_exercise_book', :to => 'homework_attach#new', :as => 'new_homework_attach'
|
||||
match 'calls/:id/new_exercise_book', :to => 'homework_attach#new', :as => 'new_exercise_book'
|
||||
match 'calls/:id/add', :to => 'bids#add'
|
||||
match 'calls/:id/delete', :to => 'bids#delete'
|
||||
match 'calls/:id/add_homework', :to => 'bids#add_homework', :via => :post
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class CreateHomeworkEvaluations < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :homework_evaluations do |t|
|
||||
t.string :user_id
|
||||
t.string :homework_attach_id
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20141029065917) do
|
||||
ActiveRecord::Schema.define(:version => 20141031111632) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -478,6 +478,13 @@ ActiveRecord::Schema.define(:version => 20141029065917) do
|
|||
t.integer "project_id", :default => 0
|
||||
end
|
||||
|
||||
create_table "homework_evaluations", :force => true do |t|
|
||||
t.string "user_id"
|
||||
t.string "homework_attach_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "homework_for_courses", :force => true do |t|
|
||||
t.integer "course_id"
|
||||
t.integer "bid_id"
|
||||
|
|
Loading…
Reference in New Issue