课程大纲列表展开收起js

This commit is contained in:
Tim 2016-07-01 13:54:00 +08:00
parent 10f52f110f
commit 7633761bbe
2 changed files with 24 additions and 19 deletions

View File

@ -17,9 +17,9 @@
<div class="cl"></div>
</div>
<div class="syllabus_courses_box">
<% if @syllabus.any? %>
<% @syllabus.each_with_index do |syllabus, index|%>
<div class="syllabus_courses_box">
<% courses = @courses.where("syllabus_id = #{syllabus.id}").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS time").order("time desc") %>
<div class="syllabus_courses_list">
<div class="<%=index == 0 ? 'sy_courses_open' : 'sy_courses_close' %>">
@ -68,6 +68,7 @@
<%=link_to '', syllabus_path(syllabus.id), :class => 'icons_sy_setting fr', :title => '管理课程' %>
</div>
<% end %>
<div>
<ul class="wlist" id="pages" >
@ -78,7 +79,6 @@
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div>
</div>
<script type="text/javascript">
@ -91,22 +91,27 @@
var tmpHeight = $(".syllabus_box").height() + diffHeight;
$(".syllabus_box").css("height", tmpHeight);
}
$(".syllabus_courses_list").toggle(function(){
$(this).next().hide();
$(this).children(":first-child").children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open");
//$(this).parent().next().show();
},function(){
$(this).next().show();
$(this).children(":first-child").children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close");
});
$(".sy_courses_close").toggle(function(){
//$(this).hide();
$(this).next().show();
$(this).children(":first-child").children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close");
//$(this).parent().next().show();
},function(){
$(this).next().hide();
$(this).children(":first-child").children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open");
$(".syllabus_courses_list").each(function(){
var syStaust = $(this).children(":first-child");
if (syStaust.hasClass("sy_courses_open")){
$(this).toggle(function(){
$(this).next().hide();
$(this).children(":first-child").children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open");
},function(){
$(this).next().show();
$(this).children(":first-child").children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close");
});
}else{
$(this).toggle(function(){
$(this).next().show();
$(this).children(":first-child").children(":first-child").addClass("icons_sy_open").removeClass("icons_sy_close");
},function(){
$(this).next().hide();
$(this).children(":first-child").children(":first-child").addClass("icons_sy_close").removeClass("icons_sy_open");
});
}
});
});
</script>

View File

@ -19,7 +19,7 @@
<%= form_for('new_form',:url => leave_user_message_path(@user.id), :html =>{:id => "user_feedback_new"}, :method => "post") do |f|%>
<%=render :partial => "jour_form", :locals => {:f => f} %>
<input id="private_flag" name="private" type="hidden" value="0"/>
<a href="javascript:void(0);" class="blue_n_btn fr" id="submit_feedback_user" style="margin-top:6px;" >留言</a>
<a href="javascript:void(0);" class="blue_n_btn fr mt5" id="submit_feedback_user" >留言</a>
<a href="javascript:void(0);" class="greyBtn2 postReplySubmit mt5 mr15" id="private_submit_feedback_user">私信</a>
<% end %>
</div>