添加一个参数控制

在课程首页设置大纲不跳转
在大纲展示页面设置大纲,跳转大纲页面
This commit is contained in:
lizanle 2015-10-30 11:51:09 +08:00
parent 8dc730cd3e
commit 4d7ca63a12
6 changed files with 11 additions and 5 deletions

View File

@ -715,6 +715,7 @@ class CoursesController < ApplicationController
def course_outline def course_outline
@teacher = User.find(@course.tea_id) @teacher = User.find(@course.tea_id)
@blog_articles = @teacher.blog.articles @blog_articles = @teacher.blog.articles
@is_in_show_outline_page = params[:is_in_show_outline_page]
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -732,6 +733,7 @@ class CoursesController < ApplicationController
def set_course_outline def set_course_outline
@course.outline = params[:outline_id] @course.outline = params[:outline_id]
@course.save @course.save
@is_in_show_outline_page = params[:is_in_show_outline_page]
respond_to do |format| respond_to do |format|
format.js format.js
end end

View File

@ -10,6 +10,7 @@
</div> </div>
<span class="f12 c_red fl mb8" id="course_outline_hint" style="display: none">未搜索到对应大纲,请重新输入</span> <span class="f12 c_red fl mb8" id="course_outline_hint" style="display: none">未搜索到对应大纲,请重新输入</span>
<%= form_tag(url_for(:controller=>'courses',:action=>'set_course_outline',:id=>course.id),:method=>'post',:remote=>'true') do %> <%= form_tag(url_for(:controller=>'courses',:action=>'set_course_outline',:id=>course.id),:method=>'post',:remote=>'true') do %>
<input name="is_in_show_outline_page" value="<%= show_page %>" type="hidden" />
<div class="blogBlock fl" id="course_outline_list" > <div class="blogBlock fl" id="course_outline_list" >
<% unless articles.blank? %> <% unless articles.blank? %>
<% articles.each do |article|%> <% articles.each do |article|%>

View File

@ -1,4 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'course_outlines_list',:locals => {:articles=>@blog_articles,:course=>@course}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'course_outlines_list',:locals => {:articles=>@blog_articles,:course=>@course,:show_page=>@is_in_show_outline_page}) %>');
showModal('ajax-modal', '300px'); showModal('ajax-modal', '300px');
//$('#ajax-modal').css('height','250px'); //$('#ajax-modal').css('height','250px');
$('#ajax-modal').css('padding-top','0px'); $('#ajax-modal').css('padding-top','0px');
@ -6,4 +6,4 @@ $('#ajax-modal').siblings().remove();
$('#ajax-modal').before(' <a href="javascript:void(0);" onclick="hideModal()" class="resourceClose" style="margin-left: 285px"></a>'); $('#ajax-modal').before(' <a href="javascript:void(0);" onclick="hideModal()" class="resourceClose" style="margin-left: 285px"></a>');
$('#ajax-modal').parent().css("top","30%").css("left","50%"); $('#ajax-modal').parent().css("top","30%").css("left","50%");
$('#ajax-modal').parent().addClass("courseOutlinePopup"); $('#ajax-modal').parent().addClass("courseOutlinePopup");
$('#ajax-modal').css("padding-left","16px")//.css("padding-bottom","16px"); $('#ajax-modal').css("padding-left","16px")//.css("padding-bottom","16px");

View File

@ -3,3 +3,6 @@ hideModal();
<% else %> <% else %>
$("#course_outline_bar").html('<a href="<%=show_course_outline_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>') $("#course_outline_bar").html('<a href="<%=show_course_outline_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>')
<%end %> <%end %>
<%if @is_in_show_outline_page && @is_in_show_outline_page == 'Y'%>
window.location.href='<%=show_course_outline_course_path(@course) %>';
<% end %>

View File

@ -51,7 +51,7 @@
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText"> <ul class="homepagePostSettiongText">
<li> <li>
<a class="postOptionLink " onclick="course_outline('<%= @course.id%>')" >重设大纲</a> <a class="postOptionLink " onclick="course_outline('<%= @course.id%>','Y')" >重设大纲</a>
</li> </li>
<li> <li>
<%= link_to( <%= link_to(

View File

@ -1224,10 +1224,10 @@ var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
change(); change();
}; };
//课程大纲选择请求 //课程大纲选择请求,第二个参数是可选的,判断当前页面是大纲显示页面还是 课程首页
function course_outline(id){ function course_outline(id){
$.get( $.get(
' /courses/'+id+'/course_outline' ' /courses/'+id+'/course_outline'+"?is_in_show_outline_page="+(arguments[1] ? arguments[1] : 'N')
) )
} }
//$(function(){ //$(function(){