项目社区/课程社区:如图将项目“设为公开/私有”,项目列表中状态没有自动刷新
This commit is contained in:
parent
b42f7bd704
commit
14652ea6ff
|
@ -661,6 +661,7 @@ class CoursesController < ApplicationController
|
||||||
course_status.destroy if course_status
|
course_status.destroy if course_status
|
||||||
course_status = CourseStatus.create(:course_id => @course.id, :grade => 0)
|
course_status = CourseStatus.create(:course_id => @course.id, :grade => 0)
|
||||||
end
|
end
|
||||||
|
@syllabus = @course.syllabus
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
window.location.href = "<%=course_files_path(@course) %>";
|
window.location.href = "<%=course_files_path(@course) %>";
|
||||||
}
|
}
|
||||||
<% else %>
|
<% else %>
|
||||||
|
if($("#syllabus_course_ul_<%=@syllabus.id %>").length > 0){
|
||||||
|
window.location.href = "<%= user_courselist_user_path(User.current)%>";
|
||||||
|
} else{
|
||||||
<% if @course.is_public? %>
|
<% if @course.is_public? %>
|
||||||
$("#show_course_<%= @course.id %>").attr("title","公开班级:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)");
|
$("#show_course_<%= @course.id %>").attr("title","公开班级:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)");
|
||||||
<% else %>
|
<% else %>
|
||||||
|
@ -18,4 +21,5 @@
|
||||||
<% end %>
|
<% 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},
|
$("#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 ? "公开" : "私有")+"吗") %>');
|
:id => "set_course_public_#{@course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗") %>');
|
||||||
|
}
|
||||||
<% end %>
|
<% end %>
|
|
@ -48,7 +48,7 @@
|
||||||
<% if hidden_unproject_infos %>
|
<% if hidden_unproject_infos %>
|
||||||
<ul class="users_accordion mb10">
|
<ul class="users_accordion mb10">
|
||||||
<li id="user_01" class="user_icons_course">
|
<li id="user_01" class="user_icons_course">
|
||||||
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list" %>
|
<%= link_to '班级',user_courselist_user_path(@user), :id => "user_course_list" %>
|
||||||
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %></font>
|
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %></font>
|
||||||
<% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
|
<% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
|
||||||
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
|
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
<% if @project.is_public? %>
|
if($("#collect_project_icon_<%= @project.id %>").length > 0){
|
||||||
|
window.location.href = "<%= user_projectlist_user_path(User.current)%>";
|
||||||
|
} else {
|
||||||
|
<% if @project.is_public? %>
|
||||||
$("#show_project_<%= @project.id %>").attr("title","公开项目:<%= @project.name %>");
|
$("#show_project_<%= @project.id %>").attr("title","公开项目:<%= @project.name %>");
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#show_project_<%= @project.id %>").attr("title","私有项目:<%= @project.name %>");
|
$("#show_project_<%= @project.id %>").attr("title","私有项目:<%= @project.name %>");
|
||||||
<% end %>
|
<% end %>
|
||||||
$("#set_project_public_<%= @project.id %>").replaceWith('<%= escape_javascript(link_to @project.is_public? ? "设为私有" : "设为公开", {:controller => "projects", :action => "set_public_or_private", :id => @project.id,:user_page => true},
|
$("#set_project_public_<%= @project.id %>").replaceWith('<%= escape_javascript(link_to @project.is_public? ? "设为私有" : "设为公开", {:controller => "projects", :action => "set_public_or_private", :id => @project.id,:user_page => true},
|
||||||
:id => "set_project_public_"+ @project.id.to_s,:method => "post",:remote=>true,:confirm=>"您确定要设置为"+(@project.is_public? ? "私有" : "公开")+"吗") %>');
|
:id => "set_project_public_"+ @project.id.to_s,:method => "post",:remote=>true,:confirm=>"您确定要设置为"+(@project.is_public? ? "私有" : "公开")+"吗") %>');
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue