socialforge/app/views/homework_attach/_show.html.erb

137 lines
5.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<script type="text/javascript" language="javascript">
var W3CDOM = document.createElement && document.getElementsByTagName;
// window.onload = setMaxLength;
$(document).ready(setMaxLength());
function setMaxLength() {
if (!W3CDOM) return;
var textareas = document.getElementsByTagName('textarea');
for (var i=0;i<textareas.length;i++) {
var textarea = textareas[i];
setMaxLengthItem(textareas[i]);
}
}
function setMaxLengthItem(textarea){
if (textarea.getAttribute('maxlength')) {
var counter = document.createElement('div');
counter.className = 'counter';
var counterClone = counter.cloneNode(true);
counterClone.innerHTML = '<span>0</span>/'+textarea.getAttribute('maxlength');
textarea.parentNode.insertBefore(counterClone,textarea.nextSibling);
textarea.relatedElement = counterClone.getElementsByTagName('span')[0];
textarea.onkeyup = textarea.onchange = checkMaxLength;
textarea.onkeyup();
}
}
function checkMaxLength() {
var maxLength = this.getAttribute('maxlength');
var currentLength = this.value.length;
if (currentLength > maxLength)
this.relatedElement.className = 'toomuch';
else
this.relatedElement.className = '';
this.relatedElement.firstChild.nodeValue = currentLength;
}
function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
}
function ChoseStars(num)
{
for (var i = num + 1; i <= 5; i++) {$("#star0" + i).css("background-position","-2px 0");}
for (var i = num; i >= 0; i--) {$("#star0" + i).css("background-position","-24px 0px");}
$("#stars_value").val(num);
}
</script>
<div id="popbox">
<div class="ping_con">
<h2><%= @homework.name %></h2>
<ul>
<li><%= l(:label_create_person) %>
<span class="c_grey">
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<%= l(:label_anonymous) %>
<% else %>
<%= link_to @homework.user, user_path(@homework.user)%>
<% end %>
</span>
</li>
<li style=" margin-left:130px;">
<%= l(:label_activity_time) %>
<span class="c_grey" >
<%=format_time @homework.created_at %>
</span>
</li>
</ul>
<div class="cl"></div>
<% if @homework.users.count > 0 %>
<div>
<%= l(:label_participation_person) %>
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<%= l(:label_anonymous) %>
<%else%>
<% @homework.users.each do |homework_user| %>
<span class="c_grey">
<%= link_to homework_user, user_path(homework_user)%>
</span>
<% if @homework.users.count > 1 && homework_user != @homework.users.last %>
、&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
<% end %>
<% end %>
</div>
<% end %>
<p>
<% if @homework.description != nil && @homework.description != "" %>
<%= @homework.description %>
<% else %>
<div style="font-size: 15px;color: #15BCCC;vertical-align:middle;padding-top: 10px;padding-left: 10px ">
<strong>
<%= l(:label_homework_without_description) %>
</strong>
</div>
<% end %>
</p>
<p style=" border-bottom:none; color:#333; margin-top:8px;">
<strong>
<%= l(:label_attachment) %>
</strong>
<span>
<% if @homework.attachments.empty?%>
<span style="color: #999999">尚未提交附件</span>
<% else%>
<% options = {:author => true } %>
<%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %>
<% end%>
</span>
</p>
<div class="ping_star" id="star_score">
<% if @is_comprehensive_evaluation == 3 || User.current == homework.user%>
<!-- 如果是留言,或者是作业创建者进入,不显示打星 -->
<% else @is_comprehensive_evaluation == 2 %>
<!-- 学生匿评或者教师评价 -->
<%= l(:label_work_rating) %>
<%= render :partial => 'show_star',:locals => {start_score:@m_score} %>
<% end %>
</div>
<div class="cl"></div>
<div id="add_jour">
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %>
</div>
<div class="cl"></div>
</div><!---ping_con end--->
<%= render :partial => 'histoey_new' %>
</div>
</div>