设置课程/项目的公开私有属性,使用局部刷新

This commit is contained in:
ouyangxuhua 2016-01-13 16:59:48 +08:00
parent 897eabd57a
commit 582880e54d
4 changed files with 13 additions and 5 deletions

View File

@ -8,5 +8,9 @@
<% end %>
}
<% else %>
location.reload();
<% if @course.is_public? %>
$("#set_course_public_<%= @course.id %>").text("设为私有");
<% else %>
$("#set_course_public_<%= @course.id %>").text("设为公开");
<% end %>
<% end %>

View File

@ -57,7 +57,7 @@
<% if User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
<li class="subNavRow">
<%= link_to course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => course,:user_page => true},
:remote=>true,:confirm=>"您确定要设置为"+(course.is_public == 0 ? "公开" : "私有")+"吗"%>
:id => "set_course_public_#{course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(course.is_public == 0 ? "公开" : "私有")+"吗"%>
<div class="cl"></div>
</li>
<% end %>

View File

@ -11,7 +11,7 @@
<div class="cl"></div>
</li>
<li class="subNavRow">
<%=link_to "资源", project_files_path(project),:remote => true,:class => 'fl fontGrey2 w48' %>
<%=link_to "资源", project_files_path(project),:class => 'fl fontGrey2 w48' %>
<%=link_to "+", upload_files_menu_path(:project_id => project.id),:remote => true,:class => 'fr fb',:title => '上传资源'%>
<div class="cl"></div>
</li>
@ -39,7 +39,7 @@
<% if User.current.logged? && (User.current.admin? || is_project_manager?(User.current,project)) %>
<li class="subNavRow">
<%= link_to project.is_public? ? "设为私有" : "设为公开", {:controller => 'projects', :action => 'set_public_or_private', :id => project.id,:user_page => true},
:method => 'post',:remote=>true,:confirm=>"您确定要设置为"+(project.is_public? ? "私有" : "公开")+"吗"%>
:id => 'set_project_public_'+ project.id.to_s,:method => 'post',:remote=>true,:confirm=>"您确定要设置为"+(project.is_public? ? "私有" : "公开")+"吗"%>
<div class="cl"></div>
</li>
<% end %>

View File

@ -1 +1,5 @@
location.reload();
<% if @project.is_public? %>
$("#set_project_public_<%= @project.id %>").text("设为私有");
<% else %>
$("#set_project_public_<%= @project.id %>").text("设为公开");
<% end %>