From 1fe7c709555cf4871c7364b1e103c86f32407c1a Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 27 May 2015 09:29:27 +0800
Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=AF=84=E4=BB=B7=E4=BD=9C=E5=93=81?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=98=85=E7=BB=93=E6=9E=9C=E7=9A=84?=
=?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=8E=E6=98=BE=E7=A4=BA=202=E3=80=81?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B=E7=9A=84=E6=98=B5=E7=A7=B0?=
=?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E6=97=A0=E6=B3=95=E6=AD=A3=E5=B8=B8?=
=?UTF-8?q?=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../_student_work_attachment_form.html.erb | 23 +++++++++-
public/javascripts/course.js | 43 ++++++++++---------
2 files changed, 45 insertions(+), 21 deletions(-)
diff --git a/app/views/student_work/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb
index 5290ad9bb..dd1793034 100644
--- a/app/views/student_work/_student_work_attachment_form.html.erb
+++ b/app/views/student_work/_student_work_attachment_form.html.erb
@@ -1,6 +1,27 @@
-
+ <% if defined?(score) && score && score.saved_attachments %>
+ <% score.attachments.each_with_index do |attachment, i| %>
+
+ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%>
+ <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
+ <%= l(:field_is_public)%>:
+ <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
+ <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
+ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
+
+ <% end %>
+ <% score.saved_attachments.each_with_index do |attachment, i| %>
+
+ <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
+ <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
+ <%= l(:field_is_public)%>:
+ <%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
+ <%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
+ <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
+
+ <% end %>
+ <% end %>
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index 6eb213eef..5ed25ab6c 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -735,28 +735,31 @@ var s;
function goTopEx() {
var obj = document.getElementById("goTopBtn");
- var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
- function getScrollTop() {
- var xsun = document.documentElement.scrollTop;
- if (Sys.chrome) {
- xsun=document.body.scrollTop;
- }
- return xsun;
- }
- function setScrollTop(value) {
- if (Sys.chrome) {
- document.body.scrollTop = value;
+ if(obj != null)
+ {
+ var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
+ function getScrollTop() {
+ var xsun = document.documentElement.scrollTop;
+ if (Sys.chrome) {
+ xsun=document.body.scrollTop;
+ }
+ return xsun;
}
- else {
- document.documentElement.scrollTop = value;
+ function setScrollTop(value) {
+ if (Sys.chrome) {
+ document.body.scrollTop = value;
+ }
+ else {
+ document.documentElement.scrollTop = value;
+ }
}
- }
- window.onscroll = function () { getScrollTop() > 0 ? obj.style.display = "" : obj.style.display = "none"; };
- obj.onclick = function () {
- var goTop = setInterval(scrollMove, 10);
- function scrollMove() {
- setScrollTop(getScrollTop() / 1.1);
- if (getScrollTop() < 1) clearInterval(goTop);
+ window.onscroll = function () { getScrollTop() > 0 ? obj.style.display = "" : obj.style.display = "none"; };
+ obj.onclick = function () {
+ var goTop = setInterval(scrollMove, 10);
+ function scrollMove() {
+ setScrollTop(getScrollTop() / 1.1);
+ if (getScrollTop() < 1) clearInterval(goTop);
+ }
}
}
}