49 lines
1.6 KiB
Plaintext
49 lines
1.6 KiB
Plaintext
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
|
<!-- <#%= stylesheet_link_tag 'css', :media => 'all' %> -->
|
|
<div class="project_r_h">
|
|
<h2 class="project_h2">用户留言</h2>
|
|
</div>
|
|
|
|
<%= render :partial => 'courses_jours',
|
|
:locals => { :contest => @contest, :journals => @jour, :state => false}
|
|
%>
|
|
|
|
<% html_title(l(:label_user_response)) -%>
|
|
<script>
|
|
var W3CDOM = document.createElement && document.getElementsByTagName;
|
|
|
|
window.onload = 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('span');
|
|
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;
|
|
}
|
|
|
|
</script>
|
|
<% html_title(l(:label_course_feedback)) -%> |