socialforge/app/views/student_work/edit.html.erb

118 lines
5.7 KiB
Plaintext

<div class="homepageRightBanner mb10">
<div class="NewsBannerName">编辑作品</div>
</div>
<div class="cl"></div>
<div class="HomeWork" id="users_setting">
<div class="HomeWorkBox">
<div class="">
<div class="homepagePostTitle fl m_w530 hidden">
<%= @homework.name%>(作业名称)
</div>
<span class="fr c_grey">
截止时间:<%= @homework.end_time%>
</span>
<div class="cl"></div>
<a href="javascript:void(0);" class="c_blue">
<%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%>
</a>
<div class="cl"></div>
<div class="HomeWorkP">
<%= @homework.description.html_safe %>
</div>
</div>
</div><!----HomeWorkBox end-->
<div class="cl"></div>
<div class="HomeWorkCon mt15">
<%= labelled_form_for @work,:html => { :multipart => true },:remote=>true do |f|%>
<div class=" c_red mb10">
提示:作品名称和描述中不要出现真实的姓名信息
</div>
<div class="cl"></div>
<% if @homework.homework_type == 3 %>
<span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span>
<span id="max_num_member" style="display: none"><%=@homework.homework_detail_group.max_num %></span>
<% str = User.current.id.to_s%>
<% @work.student_work_projects.where("is_leader = ?", 0).each do |pro| %>
<% str += ','+pro.user_id.to_s %>
<% end %>
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>str %>
<% end %>
<div>
<input type="text" name="student_work[name]" id="student_work_name" placeholder="请输入作品名称" class="InputBox W700" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
<div class="cl"></div>
<p id="student_work_name_span" class="c_red mb10"></p>
</div>
<div class="mt10">
<textarea name="student_work[description]" id="student_work_description" placeholder="请输入作品描述" class="InputBox W700 H150" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea>
<script>
var text = document.getElementById("student_work_description");
autoTextarea(text);// 调用
</script>
<div class="cl"></div>
<p id="student_work_description_textarea" class="c_red mb10"></p>
</div>
<div id="homework_attachments">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %>
</div>
<% if @homework.homework_type == 3 %>
<div class="mt5 fl">
<a href="javascript:void(0);" class="memberBtn fl mt3 mr15" title="请添加小组的其他成员" onclick="show_group_member();">合作成员</a>
</div>
<% end %>
<div class="mt5">
<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>
<div class="cl"></div>
<% end%>
</div><!----HomeWorkCon end-->
</div>
<script type="text/javascript">
<% if @homework.homework_detail_group %>
$(function(){
<%members = @work.student_work_projects.where("is_leader =?",0) %>
var str = $('#group_members_show').html();
<% members.each do |member| %>
str += '、<%= (User.find member.user_id).show_name %>';
<% end %>
$('#group_members_show').html(str);
$('span.group_detail_info').text('分组人数:<%=@homework.homework_detail_group.min_num %>-<%=@homework.homework_detail_group.max_num %> 人');
});
<% end %>
// 添加组成员
function show_group_member() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/choose_group_member',:locals => {:homework=>@homework,:edit_mode => true}) %>');
showModal('ajax-modal', '528px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("addMemberCP");
}
function popupRegex(){
if(regexStudentWorkName()&&regexStudentWorkDescription())
{
if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$('#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","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
}
} else {
$('#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","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("anonymos");
}
}
}
</script>