socialforge/app/views/courses/private_or_public.js.erb

25 lines
1.5 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.

<% if params[:user_page].nil? %>
$("#project_info_<%=@course.id %>").html('<%=escape_javascript(render :partial=>'layouts/course_base_info') %>');
if(document.getElementById("course_is_public")) {
<% if @course.is_public == 0%>
$("#course_is_public").attr("checked",false);
<% elsif @course.is_public == 1 %>
$("#course_is_public").attr("checked",true);
<% end %>
}
if(document.getElementById("course_list")) {
window.location.href = "<%=course_files_path(@course) %>";
}
<% else %>
if($("#syllabus_course_ul_<%=@syllabus.id %>").length > 0){
window.location.href = "<%= user_courselist_user_path(User.current)%>";
} else{
<% if @course.is_public? %>
$("#show_course_<%= @course.id %>").attr("title","公开班级:<%= @course.name %><%= @course.time.to_s+ @course.term %>");
<% else %>
$("#show_course_<%= @course.id %>").attr("title","私有班级:<%= @course.name %><%= @course.time.to_s+ @course.term %>");
<% end %>
$("#set_course_public_<%= @course.id %>").replaceWith('<%= escape_javascript(link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => "courses", :action => "private_or_public", :id => @course,:user_page => true},
:id => "set_course_public_#{@course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗") %>');
}
<% end %>