2014-11-04 18:30:45 +08:00
|
|
|
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
|
|
|
|
<%= stylesheet_link_tag 'css', :media => 'all' %>
|
|
|
|
|
|
|
|
<%= render :partial => 'courses_jours',
|
|
|
|
:locals => { :contest => @contest, :journals => @jour, :state => false}
|
|
|
|
%>
|
|
|
|
|
|
|
|
<% html_title(l(:label_user_response)) -%>
|
2014-06-05 15:42:49 +08:00
|
|
|
<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('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;
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
2014-10-16 15:07:36 +08:00
|
|
|
<% html_title(l(:label_course_feedback)) -%>
|