提交作品时立马弹框

This commit is contained in:
cxt 2015-11-09 11:16:19 +08:00
parent 4e62dd1219
commit 463262e838
6 changed files with 66 additions and 8 deletions

View File

@ -221,24 +221,36 @@ class StudentWorkController < ApplicationController
def update
if params[:student_work]
@submit_result = true
@work.name = params[:student_work][:name]
@work.description = params[:student_work][:description]
@work.project_id = params[:student_work][:project]
@work.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@work)
if @work.save
=begin
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_edit)
redirect_to student_work_index_url(:homework => @homework.id)
}
=end
@student_work = @work
respond_to do |format|
format.js
end
return
end
end
=begin
respond_to do |format|
format.html{redirect_to edit_student_work_url(@work)}
end
=end
@submit_result = false
respond_to do |format|
format.js
end
end
def show

View File

@ -26,7 +26,7 @@
<div class="cl"></div>
<div class="HomeWorkCon mt15">
<%= labelled_form_for @work,:html => { :multipart => true } do |f|%>
<%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%>
<div class=" c_red mb10">
提示:作品名称和描述中不要出现真实的姓名信息
</div>
@ -52,7 +52,7 @@
</div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="edit_student_work(<%= @work.id%>);">确定</a>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();edit_student_work(<%= @work.id%>);">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%>
</div>
@ -60,3 +60,12 @@
<% end%>
</div><!----HomeWorkCon end-->
</div>
<script type="text/javascript">
function popupRegex(){
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
</script>

View File

@ -111,11 +111,20 @@
</div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="new_student_work();">确定</a>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();new_student_work();">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消", user_homeworks_user_path(User.current.id), :class => "fr mr10 mt3"%>
</div>
<div class="cl"></div>
<% end%>
</div><!----HomeWorkCon end-->
</div>
</div>
<script type="text/javascript">
function popupRegex(){
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
</script>

View File

@ -0,0 +1,16 @@
<% if @submit_result%>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
<% else %>
window.location.href = '<%= edit_student_work_url(@work)%>';
<% end %>
function clickCanel() {
hideModal('#popbox02');
window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>';
}

View File

@ -954,13 +954,19 @@ function regexStudentWorkDescription()
function new_student_work()
{
if(regexStudentWorkName()&&regexStudentWorkDescription())
{$("#new_student_work").submit();}
{
$("#new_student_work").submit();
$("#ajax-indicator").hide();
}
}
function edit_student_work(id)
{
if(regexStudentWorkName()&&regexStudentWorkDescription())
{$("#edit_student_work_" + id).submit();}
{
$("#edit_student_work_" + id).submit();
$("#ajax-indicator").hide();
}
}
//

View File

@ -250,13 +250,19 @@ function regex_evaluation_num(){
function new_student_work()
{
if(regexStudentWorkName()&&regexStudentWorkDescription())
{$("#new_student_work").submit();}
{
$("#new_student_work").submit();
$("#ajax-indicator").hide();
}
}
function edit_student_work(id)
{
if(regexStudentWorkName()&&regexStudentWorkDescription())
{$("#edit_student_work_" + id).submit();}
{
$("#edit_student_work_" + id).submit();
$("#ajax-indicator").hide();
}
}
//验证作品名称