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); + } } } }