parent
20d97848e7
commit
37bd338311
|
@ -230,7 +230,7 @@ class BidsController < ApplicationController
|
|||
case @bid.reward_type
|
||||
when 3
|
||||
html_title(l(:label_question_student))
|
||||
layout_file = 'base_homework'
|
||||
layout_file = 'base_courses'
|
||||
when 1
|
||||
layout_file = 'base_bids'
|
||||
else
|
||||
|
@ -307,7 +307,7 @@ class BidsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
render :layout => 'base_courses'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
|
@ -333,7 +333,7 @@ class BidsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
render :layout => 'base_courses'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
|
@ -361,7 +361,7 @@ class BidsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
render :layout => 'base_courses'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
|
@ -439,7 +439,7 @@ class BidsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
render :layout => 'base_courses'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
|
@ -533,7 +533,7 @@ class BidsController < ApplicationController
|
|||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
html_title(l(:label_homework_info))
|
||||
render :layout => 'base_homework'
|
||||
render :layout => 'base_courses'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
|
@ -565,7 +565,7 @@ class BidsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if @bid.reward_type == 3
|
||||
format.html {
|
||||
render :layout => 'base_homework'
|
||||
render :layout => 'base_courses'
|
||||
}
|
||||
elsif @bid.reward_type == 1
|
||||
format.html {
|
||||
|
@ -879,7 +879,7 @@ class BidsController < ApplicationController
|
|||
#render html to prepare create submit homework
|
||||
find_bid
|
||||
find_bid
|
||||
render :layout => 'base_homework'
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
|
||||
def add_homework
|
||||
|
@ -942,12 +942,12 @@ class BidsController < ApplicationController
|
|||
@homework_type = false
|
||||
end
|
||||
@user = @bid.author
|
||||
render :layout => 'base_homework'
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
|
||||
def homework_respond
|
||||
@user = @bid.author
|
||||
render :layout => 'base_homework'
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
|
||||
def more
|
||||
|
@ -1070,6 +1070,7 @@ class BidsController < ApplicationController
|
|||
if params[:id]
|
||||
@bid = Bid.find(params[:id], :include => [{:homeworks => :user}])
|
||||
@user = @bid.author
|
||||
@course = @bid.courses.first
|
||||
end
|
||||
rescue
|
||||
render_404
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class HomeworkAttachController < ApplicationController
|
||||
layout "course_base"
|
||||
layout "base_courses"
|
||||
include CoursesHelper
|
||||
include HomeworkAttachHelper
|
||||
helper :words
|
||||
|
|
|
@ -8,33 +8,33 @@
|
|||
<ul>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:field_name)%> :</label>
|
||||
<input type="text" name="bid[name]" id="bid_name" class="hwork_input" maxlength="<%= Bid::NAME_LENGTH_LIMIT%>" onkeyup="regex_bid_name();" value="<%= @homework.name%>" >
|
||||
<input type="text" name="bid[name]" id="bid_name" class="hwork_input" maxlength="<%= Bid::NAME_LENGTH_LIMIT%>" onkeyup="regex_bid_name();" value="<%= bid.name%>" >
|
||||
<p id="bid_name_span" class="c_red" style="padding-left: 55px;"></p>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label class="fl" > <%= l(:field_quote)%> :</label>
|
||||
<textarea name="bid[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl"><%= @homework.description%></textarea>
|
||||
<textarea name="bid[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl"><%= bid.description%></textarea>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml21">
|
||||
<label><span class="c_red">*</span> <%= l(:label_limit_time)%> :</label>
|
||||
<input type="text" name="bid[deadline]" id="bid_deadline" class="hwork_input02" onchange="regexDeadLine();" readonly="readonly" value="<%= @homework.deadline%>" >
|
||||
<input type="text" name="bid[deadline]" id="bid_deadline" class="hwork_input02" onchange="regexDeadLine();" readonly="readonly" value="<%= bid.deadline%>" >
|
||||
<%= calendar_for('bid_deadline')%>
|
||||
</li>
|
||||
<li class=" mb5 ml30">
|
||||
<label ><%= l(:label_open_anonymous_evaluation)%> :</label>
|
||||
<input type="checkbox" name="bid[open_anonymous_evaluation]" id="bid_open_anonymous_evaluation" checked="<%= @homework.open_anonymous_evaluation == 1 ? 'checked' : ''%>" >
|
||||
<input type="checkbox" name="bid[open_anonymous_evaluation]" id="bid_open_anonymous_evaluation" checked="<%= bid.open_anonymous_evaluation == 1 ? 'checked' : ''%>" >
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="ml9">
|
||||
<label><span class="c_red">*</span> <%= l(:field_evaluation_num)%> :</label>
|
||||
<input type="text" name="bid[evaluation_num]" id="bid_evaluation_num" class="hwork_input02" onkeyup="regex_evaluation_num();" value="<%= @homework.evaluation_num%>">
|
||||
<input type="text" name="bid[evaluation_num]" id="bid_evaluation_num" class="hwork_input02" onkeyup="regex_evaluation_num();" value="<%= bid.evaluation_num%>">
|
||||
<span><%= l(:label_evaluation_description)%></span>
|
||||
<p id="bid_evaluation_num_span" class="c_red" style="padding-left: 90px;"></p>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label> <%= l(:label_attachment_plural) %> :</label>
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @homework} %>
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => bid} %>
|
||||
</li>
|
||||
<li class=" ml90" >
|
||||
<a class="blue_btn fl c_white" onclick="submit_new_bid('<%= bid_id%>');" href="#"><%= l(:button_create)%></a>
|
||||
|
|
|
@ -1,129 +1,3 @@
|
|||
<script type="text/javascript">
|
||||
function regexName()
|
||||
{
|
||||
var name = $.trim($("#bid_name").val());
|
||||
|
||||
if(name=="")
|
||||
{
|
||||
$("#bid_name_span").text("名称不能为空");
|
||||
$("#bid_name_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#bid_name_span").text("填写正确");
|
||||
$("#bid_name_span").css('color','#008000');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function regexDeadLine()
|
||||
{
|
||||
var deadline = $.trim($("#bid_deadline").val());
|
||||
var regex = /^\d{4}-\d{2}-\d{2}$/;
|
||||
if(deadline=="")
|
||||
{
|
||||
$("#bid_deadline_span").text("截止日期不能为空");
|
||||
$("#bid_deadline_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
else if(regex.test(deadline))
|
||||
{
|
||||
$("#bid_deadline_span").text("填写正确");
|
||||
$("#bid_deadline_span").css('color','#008000');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#bid_deadline_span").text("截止日期格式错误");
|
||||
$("#bid_deadline_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function regexEvaluationNum()
|
||||
{
|
||||
var evaluation_num = $.trim($("#bid_evaluation_num").val());
|
||||
var regex = /^\d+$/;
|
||||
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
||||
{
|
||||
if(evaluation_num=="")
|
||||
{
|
||||
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
|
||||
$("#bid_evaluation_num_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
else if(regex.test(evaluation_num))
|
||||
{
|
||||
if(evaluation_num > 0)
|
||||
{
|
||||
$("#bid_evaluation_num_span").text("填写正确");
|
||||
$("#bid_evaluation_num_span").css('color','#008000');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
|
||||
$("#bid_evaluation_num_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
|
||||
$("#bid_evaluation_num_span").css('color','#ff0000');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$("#bid_open_anonymous_evaluation").click(function(){
|
||||
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
||||
{
|
||||
$("#evaluation_num_p").slideDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#evaluation_num_p").slideUp();
|
||||
}
|
||||
});
|
||||
});
|
||||
$(function(){
|
||||
$("#bid_open_anonymous_evaluation").click(function(){
|
||||
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
|
||||
{
|
||||
$("#evaluation_num_p").slideDown();
|
||||
$("#open_anonymous_evaluation_span").slideUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#evaluation_num_p").slideUp();
|
||||
$("#open_anonymous_evaluation_span").slideDown();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function submitHomework(id)
|
||||
{
|
||||
if(regexDeadLine()&®exName()&®exEvaluationNum())
|
||||
{
|
||||
$("#edit_bid_" + id).submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<h3><%= l(:label_edit_homework) %></h3>
|
||||
|
||||
<%= labelled_form_for @bid do |f| %>
|
||||
<div class="box tabular">
|
||||
<%#= render :partial => 'homework_form', :locals => { :f => f } %>
|
||||
<%= render :partial => 'homework_form', :locals => { :f => f } %>
|
||||
<!--<input type="button" onclick="submitHomework(<%#= @bid.id%>);" value="<%#= l(:button_create)%>" class="enterprise">-->
|
||||
<a href="#" onclick="submitHomework(<%= @bid.id%>);" class="ButtonColor m3p10" >
|
||||
<%= l(:button_create)%>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}"} %>
|
||||
<% end %>
|
|
@ -1,3 +1,3 @@
|
|||
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
|
||||
<%= render :partial => 'bids/new_homework_form', :locals => { :bid_id => "new_bid" } %>
|
||||
<%= render :partial => 'bids/new_homework_form', :locals => { :bid => @homework,:bid_id => "new_bid" } %>
|
||||
<% end %>
|
|
@ -44,11 +44,11 @@ a:hover.tb_all{ background:#eaeaea; text-decoration:none;}
|
|||
.dis ul li.wping{margin-left:12px; }
|
||||
.dis ul li.wping a{ margin-top:18px; margin-bottom:3px; width:43px; height:23px; background:#15bccf; color:#fff; text-align:center; padding-top:3px;}
|
||||
.dis ul li.wping a:hover{ background-color:#03a1b3;}
|
||||
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
|
||||
.wlist span{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;}
|
||||
.wlist a{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;}
|
||||
.wlist a:hover{ background:#15bccf; color:#fff; text-decoration:none;}
|
||||
.wlist_select { background-color:#64bdd9; color:#fff; padding:0 5px; margin-left:3px; border:1px solid #64bdd9;}
|
||||
/*ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }*/
|
||||
/*.wlist span{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;}*/
|
||||
/*.wlist a{ border:1px solid #15bccf; padding:0 5px; margin-left:3px;}*/
|
||||
/*.wlist a:hover{ background:#15bccf; color:#fff; text-decoration:none;}*/
|
||||
/*.wlist_select { background-color:#64bdd9; color:#fff; padding:0 5px; margin-left:3px; border:1px solid #64bdd9;}*/
|
||||
.code_list{ float:right; font-size:12px; color:#484848; padding:5px 3px; border-bottom:2px solid #15bccf; width:687px; }
|
||||
.code_list a{ color:#787878;}
|
||||
.fr{ float:right;}
|
||||
|
|
Loading…
Reference in New Issue