Merge branch 'szzh' into dev_hjq
This commit is contained in:
commit
c9bedb2362
|
@ -137,6 +137,7 @@ class HomeworkCommonController < ApplicationController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@user = User.current
|
@user = User.current
|
||||||
|
@is_in_course = params[:is_in_course]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html{render :layout => 'new_base_user'}
|
format.html{render :layout => 'new_base_user'}
|
||||||
end
|
end
|
||||||
|
@ -173,15 +174,25 @@ class HomeworkCommonController < ApplicationController
|
||||||
if @homework.save
|
if @homework.save
|
||||||
@homework_detail_manual.save if @homework_detail_manual
|
@homework_detail_manual.save if @homework_detail_manual
|
||||||
@homework_detail_programing.save if @homework_detail_programing
|
@homework_detail_programing.save if @homework_detail_programing
|
||||||
|
if params[:is_in_course] == "1"
|
||||||
|
redirect_to homework_common_index_path(:course => @course.id)
|
||||||
|
else
|
||||||
redirect_to user_homeworks_user_path(User.current.id)
|
redirect_to user_homeworks_user_path(User.current.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if @homework.destroy
|
if @homework.destroy
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {redirect_to user_homeworks_user_path(User.current.id)}
|
format.html {
|
||||||
|
if params[:is_in_course] == "1"
|
||||||
|
redirect_to homework_common_index_path(:course => @course.id)
|
||||||
|
else
|
||||||
|
redirect_to user_homeworks_user_path(User.current.id)
|
||||||
|
end
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require 'zip'
|
require 'zip'
|
||||||
class ZipdownController < ApplicationController
|
class ZipdownController < ApplicationController
|
||||||
#查找项目(课程)
|
#查找项目(课程)
|
||||||
before_filter :find_project_by_bid_id, :only => [:assort]
|
before_filter :find_project_by_bid_id, :only => [:assort]
|
||||||
|
|
|
@ -2368,7 +2368,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def student_anonymous_comment homework
|
def student_anonymous_comment homework
|
||||||
if homework.homework_type == 1 && homework.homework_detail_manual
|
if homework.homework_detail_manual
|
||||||
case homework.homework_detail_manual.comment_status
|
case homework.homework_detail_manual.comment_status
|
||||||
when 1
|
when 1
|
||||||
"<span class='fr mr10 pr_join_span '>未开启匿评</span>".html_safe
|
"<span class='fr mr10 pr_join_span '>未开启匿评</span>".html_safe
|
||||||
|
@ -2377,10 +2377,6 @@ module ApplicationHelper
|
||||||
when 3
|
when 3
|
||||||
"<span class='fr mr10 pr_join_span '>匿评已结束</span>".html_safe
|
"<span class='fr mr10 pr_join_span '>匿评已结束</span>".html_safe
|
||||||
end
|
end
|
||||||
elsif homework.homework_type == 0
|
|
||||||
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
|
|
||||||
elsif homework.homework_type == 2
|
|
||||||
"<span class='fr mr10 pr_join_span '> 编程作业 </span>".html_safe
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<!-- 老师身份才可以发布作业 -->
|
<!-- 老师身份才可以发布作业 -->
|
||||||
<div class="HomeWork mb10">
|
<div class="HomeWork mb10">
|
||||||
<%= form_for @homework do |f| %>
|
<%= form_for @homework do |f| %>
|
||||||
|
<input type="text" name="is_in_course" class="none" value="<%= @is_in_course%>"/>
|
||||||
<div id="HomeWorkCon">
|
<div id="HomeWorkCon">
|
||||||
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
|
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
</p>
|
</p>
|
||||||
<% if @is_teacher%>
|
<% if @is_teacher%>
|
||||||
<%= homework_anonymous_comment(homework)%>
|
<%= homework_anonymous_comment(homework)%>
|
||||||
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %>
|
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework,:is_in_course => 1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %>
|
||||||
<%= link_to(l(:button_edit),edit_homework_common_path(homework), :class => "fr mr10 work_edit") %>
|
<%= link_to(l(:button_edit),edit_homework_common_path(homework,:is_in_course => 1), :class => "fr mr10 work_edit") %>
|
||||||
<% elsif @is_student%>
|
<% elsif @is_student%>
|
||||||
<%= student_anonymous_comment homework %>
|
<%= student_anonymous_comment homework %>
|
||||||
<%= student_new_homework homework %>
|
<%= student_new_homework homework %>
|
||||||
|
|
|
@ -12,13 +12,38 @@
|
||||||
<% end %> TO <!--+"(课程名称)" -->
|
<% end %> TO <!--+"(课程名称)" -->
|
||||||
<%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
|
<%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
|
||||||
</div>
|
</div>
|
||||||
<div class="homepagePostTitle break_word"> <!--+"(作业名称)"-->
|
<div class="homepagePostTitle hidden m_w530 fl"> <!--+"(作业名称)"-->
|
||||||
<%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
|
<%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
|
||||||
</div>
|
</div>
|
||||||
|
<% if activity.homework_detail_manual.comment_status == 1%>
|
||||||
|
<span class="grey_btn_cir ml10">未开启匿评</span>
|
||||||
|
<% elsif activity.homework_detail_manual.comment_status == 2%>
|
||||||
|
<span class="green_btn_cir ml10">匿评中</span>
|
||||||
|
<% elsif activity.homework_detail_manual.comment_status == 3%>
|
||||||
|
<span class="grey_btn_cir ml10">匿评已结束</span>
|
||||||
|
<% end%>
|
||||||
<div class="homepagePostSubmitContainer">
|
<div class="homepagePostSubmitContainer">
|
||||||
<div class="homepagePostSubmit">
|
<div class="homepagePostSubmit">
|
||||||
<%= student_work_activity_submit_status(homework: activity) %>
|
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
|
||||||
|
<%= user_for_homework_common activity,is_teacher %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% if activity.homework_type == 2 && is_teacher%>
|
||||||
|
<div class="homepagePostSubmit">
|
||||||
|
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if activity.homework_type == 2%>
|
||||||
|
<div class="homepagePostDeadline mr15">
|
||||||
|
语言:
|
||||||
|
<% if activity.homework_detail_programing.language.to_i == 1%>
|
||||||
|
C
|
||||||
|
<% elsif activity.homework_detail_programing.language.to_i == 2%>
|
||||||
|
C++
|
||||||
|
<% end%>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %></div>
|
<div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>">
|
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>">
|
||||||
|
|
|
@ -59,10 +59,10 @@
|
||||||
<li class="homepagePostSettingIcon">
|
<li class="homepagePostSettingIcon">
|
||||||
<ul class="homepagePostSettiongText">
|
<ul class="homepagePostSettiongText">
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:button_edit),edit_homework_common_path(homework_common), :class => "postOptionLink"%>
|
<%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => 0), :class => "postOptionLink"%>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
|
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => 0),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= homework_anonymous_comment homework_common %>
|
<%= homework_anonymous_comment homework_common %>
|
||||||
|
|
|
@ -4,5 +4,6 @@ class NormalHomeworkType < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
|
HomeworkCommon.where("homework_type = 0").update_all(:homework_type => 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue