1、增加学生新建、修改作品静态页面
2、homework_common_control增加权限判断 3、学生进入作业界面显示作业当前状态不正确
This commit is contained in:
parent
25672aa229
commit
86b9daf821
|
@ -2,6 +2,7 @@ class HomeworkCommonController < ApplicationController
|
|||
layout "base_courses"
|
||||
before_filter :find_course, :only => [:index,:new,:create]
|
||||
before_filter :find_homework, :only => [:edit,:update]
|
||||
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
|
||||
|
||||
def index
|
||||
homeworks = @course.homework_commons
|
||||
|
@ -151,4 +152,8 @@ class HomeworkCommonController < ApplicationController
|
|||
rescue
|
||||
render_404
|
||||
end
|
||||
#是不是课程的老师
|
||||
def teacher_of_course
|
||||
render_403 unless User.current.allowed_to?(:as_teacher,@course)
|
||||
end
|
||||
end
|
|
@ -1,6 +1,9 @@
|
|||
class StudentWorkController < ApplicationController
|
||||
layout "base_courses"
|
||||
before_filter :find_homework, :only => [:new, :index]
|
||||
before_filter :find_homework, :only => [:new, :index, :create]
|
||||
before_filter :find_work, :only => [:edit, :update, :show, :destroy]
|
||||
before_filter :member_of_course, :only => [:index, :new, :create, :show]
|
||||
before_filter :author_of_work, :only => [:edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
respond_to do |format|
|
||||
|
@ -9,7 +12,6 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
|
@ -27,6 +29,14 @@ class StudentWorkController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
#获取作业
|
||||
def find_homework
|
||||
|
@ -42,4 +52,16 @@ class StudentWorkController < ApplicationController
|
|||
rescue
|
||||
render_404
|
||||
end
|
||||
|
||||
#是不是当前课程的成员
|
||||
#当前课程成员才可以看到作品列表
|
||||
def member_of_course
|
||||
render_403 unless User.current.member_of_course? @course
|
||||
end
|
||||
|
||||
#判断是不是当前作品的提交者
|
||||
#提交者可以编辑作品
|
||||
def author_of_work
|
||||
render_403 unless User.current.id == @work.user_id
|
||||
end
|
||||
end
|
|
@ -2,7 +2,7 @@
|
|||
module HomeworkCommonHelper
|
||||
#获取匿评相关连接代码
|
||||
def homework_anonymous_comment homework
|
||||
if homework.homework_type == 2 && homework.homework_detail_manual #匿评作业
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
|
||||
if homework.student_works.count >= 2 #作业份数大于2
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
|
@ -35,7 +35,7 @@ module HomeworkCommonHelper
|
|||
end
|
||||
|
||||
def student_anonymous_comment homework
|
||||
if homework.homework_type == 2
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
"<span class='fr mr10 pr_join_span '>未开启匿评</span>".html_safe
|
||||
|
@ -44,9 +44,9 @@ module HomeworkCommonHelper
|
|||
when 3
|
||||
"<span class='fr mr10 pr_join_span '>匿评已结束</span>".html_safe
|
||||
end
|
||||
elsif homework.homework_type == 1
|
||||
elsif homework.homework_type == 0
|
||||
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
|
||||
elsif homework.homework_type == 3
|
||||
elsif homework.homework_type == 2
|
||||
"<span class='fr mr10 pr_join_span '>编程作业</span>".html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2">编辑作品</h2>
|
||||
</div>
|
||||
<div class="Newwork">
|
||||
<div id="tb_" class="hwork_tb_">
|
||||
<ul>
|
||||
<li id="tb_1" class="hwork_hovertab" onclick="x:HoverLi(1);" >
|
||||
课程名称课程名称课程名</li>
|
||||
<li id="tb_2" class="hwork_normaltab" onclick="i:HoverLi(2);">
|
||||
成员</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="hwork_ctt">
|
||||
<div class="hwork_dis" id="tbc_01">
|
||||
<div class="N_con">
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品名称 :</label>
|
||||
<input id="" type="text" name="" class=" bo mb10 fl" placeholder="作品名称">
|
||||
<a href="#" class="fl ml10 mt3" onclick="show_project();" >项目信息<img class="ml5 " src="../images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。"></a>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p id="about_project" class="about_project" >
|
||||
<label class="fl"> 关联项目 :</label>
|
||||
<select name="" id="" class=" bo02 mb10">
|
||||
<option value="1">没有可选项目,请直接为本作品创建一个项目</option>
|
||||
<option value="2">M</option>
|
||||
</select>
|
||||
<a class=" ml10 mt3 c_orange" href="javascript:void(0)" onClick="show_window();">快速创建</a>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品描述 :</label>
|
||||
<textarea id="" name="" placeholder="最多3000个汉字(或6000个英文字符)" class="w620 hwork_txt mb10 " ></textarea>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label> 添加附件 :</label>
|
||||
<input type="submit" name="" value="文件浏览" class="sub_btn" > <span class="c_grey">-文件不超过200MB</span>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p class="ml80 ">
|
||||
<a href="#" target="_blank" class="blue_btn fl c_white">提交作品</a><a href="#" target="_blank" class="blue_btn grey_btn fl c_white">重 置</a>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div><!---创建作业内容结束-->
|
||||
|
||||
</div>
|
||||
<div class="hwork_undis" id="tbc_02">
|
||||
<div class="members_left">
|
||||
<ul style=" border-bottom:none;">
|
||||
<li><span class="w150 f_b" >用户</span><span class="w150 f_b">角色</span><span></span></li>
|
||||
<li ><a href="#" class="w150 c_orange fl">gugu01</a><span class="w150 fl">发布人员</span><a href="#" class="c_dblue w90 fl">删除</a></li>
|
||||
<li ><a href="#" class="w150 c_orange fl">gugu01</a><span class="w150 fl">发布人员</span><a href="#" class="c_dblue w90 fl">删除</a></li>
|
||||
<li ><a href="#" class="w150 c_orange fl">gugu01</a><span class="w150 fl">发布人员</span><a href="#" class="c_dblue w90 fl">删除</a></li>
|
||||
<li ><a href="#" class="w150 c_orange fl">gugu01</a><span class="w150 fl">发布人员</span><a href="#" class="c_dblue w90 fl">删除</a></li>
|
||||
<li ><a href="#" class="w150 c_orange fl">gugu01</a><span class="w150 fl">发布人员</span><a href="#" class="c_dblue w90 fl">删除</a></li>
|
||||
</ul>
|
||||
</div><!-- 左边-->
|
||||
<div class="members_right">
|
||||
<p class="c_blue fb mt10 mb5">添加成员</p>
|
||||
<div class="member_search">
|
||||
<input class="member_search_input fl" type="text" name="" value="输入用户名称搜索好友"><a class="invi_search_btn fl c_white" >搜索</a>
|
||||
<div class="cl"></div>
|
||||
<ul class="mb5">
|
||||
<li><input type="checkbox" name="" checked=""> <label >suntao</label> </li>
|
||||
<li><input type="checkbox" name="" > <label >suntaoalibb</label> </li>
|
||||
<li><input type="checkbox" name="" > <label >用户名称</label> </li>
|
||||
<li><input type="checkbox" name="" > <label >suntao</label> </li>
|
||||
<li><input type="checkbox" name="" checked=""> <label >suntao</label> </li>
|
||||
<li><input type="checkbox" name="" > <label >suntaoalibb</label> </li>
|
||||
<li><input type="checkbox" name="" > <label >用户名称</label> </li>
|
||||
<li><input type="checkbox" name="" > <label >suntao</label> </li>
|
||||
<li><input type="checkbox" name="" > <label >用户名称</label> </li>
|
||||
<li><input type="checkbox" name="" > <label >suntao</label> </li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<ul class="wlist mr40" >
|
||||
<li><a href="#">下一页</a></li>
|
||||
<li><a href="#">...</a></li>
|
||||
<li><a href="#">2</a></li>
|
||||
<li class="wlist_select" ><a href="#">1</a></li>
|
||||
<li><a href="#">上一页</a></li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<ul class="rolebox mb10 mt10">
|
||||
<li class="fb">角色: </li>
|
||||
<li ><input class="fl" type="checkbox" name="" checked=""> <label >Manager</label> </li>
|
||||
<li ><input type="checkbox" name="" > <label >Developer</label> </li>
|
||||
<li ><input type="checkbox" name="" > <label >Reporter</label> </li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="#" class="member_btn">新增成员</a>
|
||||
</div>
|
||||
</div><!-- 右边 end-->
|
||||
</div><!---成员结束-->
|
||||
</div>
|
||||
</div>
|
||||
</div><!--新建作业结束-->
|
||||
<div class="cl"></div>
|
|
@ -1 +1,41 @@
|
|||
新建作品
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">创建作品</h2>
|
||||
</div>
|
||||
<div class="Newwork">
|
||||
<div class="hwork_ctt">
|
||||
<div class="hwork_dis" id="tbc_01">
|
||||
<div class="N_con">
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品名称 :</label>
|
||||
<input id="" type="text" name="" class=" bo mb10 fl" placeholder="作品名称">
|
||||
<a href="#" class="fl ml10 mt3" onclick="show_project();" >项目信息<img class="ml5 " src="../images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。"></a>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p id="about_project" class="about_project" >
|
||||
<label class="fl"> 关联项目 :</label>
|
||||
<select name="" id="" class=" bo02 mb10">
|
||||
<option value="1">没有可选项目,请直接为本作品创建一个项目</option>
|
||||
<option value="2">M</option>
|
||||
</select>
|
||||
<!--a class=" ml10 mt3 c_orange" href="javascript:void(0)" onClick="show_window();">快速创建</a-->
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品描述 :</label>
|
||||
<textarea id="" name="" placeholder="最多3000个汉字(或6000个英文字符)" class="w620 hwork_txt mb10 " ></textarea>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label> 添加附件 :</label>
|
||||
<input type="submit" name="" value="文件浏览" class="sub_btn" > <span class="c_grey">-文件不超过200MB</span>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p class="ml80 ">
|
||||
<a href="#" target="_blank" class="blue_btn fl c_white">提交作品</a><a href="#" target="_blank" class="blue_btn grey_btn fl c_white">重 置</a>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div><!---创建作业内容结束-->
|
||||
</div>
|
||||
</div>
|
||||
</div><!--新建作业结束-->
|
||||
<div class="cl"></div>
|
Loading…
Reference in New Issue