作业列表效果显示

This commit is contained in:
sw 2015-08-25 13:50:42 +08:00
parent 5b99effbc8
commit c93bc5be40
4 changed files with 124 additions and 101 deletions

View File

@ -304,6 +304,9 @@ class UsersController < ApplicationController
#用户作业列表
def user_homeworks
user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc")
@homework_commons = paginateHelper homework_commons,10
respond_to do |format|
format.html {render :layout => 'new_base_user'}
end

View File

@ -2314,7 +2314,27 @@ module ApplicationHelper
elsif homework.homework_type == 2 #编程作业不能修改作品
"<span class='fr mr10 pr_join_span ' title='编程作业不可修改作品'>作品已交</span>".html_safe
else
link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit'
link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit c_blue'
end
end
end
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
def user_for_homework_common homework,is_teacher
if is_teacher #老师显示作品数量
link_to "提交(#{homework.student_works.count}",student_work_index_path(:homework => homework.id),:class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
if work.nil?
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
link_to "修改作品", "", :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "作品已交", "",:class => 'c_blue',:title => "编程作业不可修改作品"
else
link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue'
end
end
end
end

View File

@ -1,4 +1,6 @@
<div class="HomeWork">
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10">
<div class="RightBanner">
<div class="NewsBannerName">发布作业</div>
</div>
@ -36,66 +38,60 @@
<div class="DropLine" ></div>
<div class="cl"></div>
</div>
</div>
</div><!----HomeWork end-->
<% end%>
</div>
</div><!----HomeWork end-->
<div class="HomeWork mt10">
<% @homework_commons.each do |homework_common|%>
<% is_teacher = User.current.allowed_to?(:as_teacher,homework_common.course) %>
<div class="HomeWork mb10">
<div class="homepagePostBrief">
<div class="homepagePostPortrait"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像" /></a></div>
<div class="homepagePostPortrait">
<%=link_to image_tag(url_to_avatar(homework_common.user),width:"90px", height: "90px"), user_activities_path(homework_common.user.id)%>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO <a href="javascript:void(0);" class="newsBlue ml15">Trustie Forge项目名称</a></div>
<div class="homepagePostTitle"><a href="javascript:void(0);" class="postGrey">上传资源未显示在项目动态中(缺陷标题)</a><span class="green_btn_cir">正常</span></div>
<div class="homepagePostTo">
<%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%>
TO
<%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%>
</div>
<div class="homepagePostTitle">
<%= link_to homework_common.name,student_work_index_path(:homework => homework_common.id),:class => "postGrey"%>
</div>
<div class="homepagePostSubmitContainer">
<div class="homepagePostAssignTo">指派给&nbsp;&nbsp;<a href="javascript:void(0);" class="newsBlue mr15">苏稳</a></div>
<div class="homepagePostDeadline">时间2015-08-20</div>
<div class="homepagePostSubmit">
<%= user_for_homework_common homework_common,is_teacher %>
</div>
<div class="homepagePostDeadline">
<%= l(:label_end_time)%><%= homework_common.end_time%>
</div>
</div>
<div class="homepagePostIntro upload_img break_word">
<%= homework_common.description.html_safe %>
</div>
<div class="homepagePostIntro">缺陷描述系统中有多个ckeditor且每个ckeditor的id未知怎么样做到当光标聚焦某个ckeditor的文本框中该编辑器的默认值应自动消失的处理网络拓扑图开发</div>
<div class="mt10">
<span class="pic_img fl "></span><a href="javascript:void(0);" class=" fl FilesName">附件名称附件名称附件名称附件名称附件名附件名称附件名附件附件名称附件名附件附件名称附件附件名称.png123KB</a><span class="pic_del fl "></span><div class="cl"></div>
<span class="pic_files fl "></span><a href="javascript:void(0);" class=" fl ">附件名称.zip123KB</a><span class="pic_del fl "></span><div class="cl"></div>
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
<div class="cl"></div>
</div>
<% if is_teacher%>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="cl"></div>
</div>
</div><!----HomeWork end-->
<div class="HomeWork mt10">
<div class="homepagePostBrief">
<div class="homepagePostPortrait"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像" /></a></div>
<div class="homepagePostDes">
<div class="homepagePostTo"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO <a href="javascript:void(0);" class="newsBlue ml15">Trustie Forge项目名称</a></div>
<div class="homepagePostTitle"><a href="javascript:void(0);" class="postGrey">上传资源未显示在项上传资源未显示在项目动上传资源未显示在项目动上传资源未显示在项目动上传资源未显示在项目动目动态中(缺陷标题)</a><span class="red_btn_cir">紧急</span></div>
<div class="homepagePostSubmitContainer">
<div class="homepagePostAssignTo">指派给&nbsp;&nbsp;<a href="javascript:void(0);" class="newsBlue mr15">苏稳</a></div>
<div class="homepagePostDeadline">时间2015-08-20</div>
</div>
<div class="homepagePostIntro">缺陷描述系统中有多个ckeditor且每个ckeditor的id未知怎么样做到当光标聚焦某个ckeditor的文本框中该编辑器的默认值应自动消失的处理网络拓扑图开发</div>
<div class="mt10">
<span class="pic_img fl "></span><a href="javascript:void(0);" class=" fl FilesName">附件名称附件名称附件名称附件名称附件名附件名称附件名附件附件名称附件名附件附件名称附件附件名称.png123KB</a><span class="pic_del fl "></span><div class="cl"></div>
<span class="pic_files fl "></span><a href="javascript:void(0);" class=" fl ">附件名称.zip123KB</a><span class="pic_del fl "></span><div class="cl"></div>
</div>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
<li>
<%= link_to l(:button_edit),edit_homework_common_path(homework_common), :class => "postOptionLink"%>
</li>
<li>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li>
</ul>
</li>
</ul>
</div>
<% end%>
</div>
<div class="cl"></div>
</div>
</div><!----HomeWork end-->
<% end%>

View File

@ -10,6 +10,9 @@ a:hover,a:active{color:#000;}
/*常用*/
/*#RSide{ background:#fff;}*/
/*上传图片处理*/
.upload_img img{max-width: 100%;}
blockquote img{max-width: 100%;}
.hidden{overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
.none{display: none;}
.rside_back{ width:670px; margin-left:10px; background:#fff; margin-bottom:10px;}
@ -475,7 +478,7 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
.homepageFollowCancel {background:url(../images/homepage_icon.png) -178px -8px no-repeat; width:20px; height:20px; position:absolute; right:9px; top:9px;}
.homepageEditProfile {width:20px; height:20px; border-radius:2px; background-color:#888888; position:absolute; right:9px; bottom:9px; font-size:12px; filter:alpha(opacity=50); -moz-opacity:0.5; opacity: 0.5;}
.homepageEditProfileIcon {background:url(../images/homepage_icon.png) -11px -35px no-repeat; width:20px; height:20px; display:block;}
.homepageImageName {font-size:16px; color:#484848; margin-left:15px; margin-right:8px; height:20px; float:left;}
.homepageImageName {font-size:16px; color:#484848; margin-left:15px; margin-right:8px; height:21px; float:left;}
.homepageImageSex {top:116px; left:5px; width:20px; height:20px; background:url(../images/homepage_icon.png) -10px -112px no-repeat; float:left;}
.homepageImageSexWomen {width: 20px;height: 20px;background: url(../images/homepage_icon.png) -10px -149px no-repeat;float: left;}
.homepageSignatureTextarea {width:207px; height:80px; max-width:207px; max-height:80px; border:1px solid #d9d9d9; outline:none; margin:0px 0px 12px 15px;;}
@ -820,6 +823,7 @@ a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;}
.SearchIcon:hover{background:url(../images/homepage_icon.png) 676px -419px no-repeat; }
a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; }
a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;}
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;}
a.FilesName{ max-width:540px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:block;}
a.FilesName02{ max-width:665px;overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:block;}
.ProResultUl span { display:block; float:left;}