@ -23,7 +23,7 @@
<% 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' %>">
<span class="<%=index == 0 ? 'icons_sy_open' : 'icons_sy_close' %> fl mr5"></span>
<span class="<%=index == 0 && !courses.empty? ? 'icons_sy_open' : 'icons_sy_close' %> fl mr5"></span>
<h3 class="syllabus_courses_title fl"><%=syllabus.title %></h3>
</div>
<p class="fl sy_p_grey">更新时间:<%=format_date syllabus.updated_at %>
@ -66,8 +66,20 @@
</ul>
</div><!--syllabus_class_box end-->
<%=link_to '', syllabus_path(syllabus.id), :class => 'icons_sy_setting fr',:target =>'_blank', :title => '查看课程' %>
<div class="homepagePostSetting">
<ul>
<li class="icons_sy_setting">
<ul class="homepagePostSettiongText">
<li>
<%=link_to '查看课程', syllabus_path(syllabus.id), :class => 'postOptionLink',:target =>'_blank', :title => '查看课程' %>
</li>
<% if User.current == syllabus.user %>
<li><%=link_to '删除', delete_syllabus_syllabus_path(syllabus), :class => 'postOptionLink', :remote => 'true'%></li>
<% end %>
</ul>
</li>
</ul>
</div>
</div>
<% end %>
<div>
@ -94,23 +106,26 @@
$(".syllabus_courses_list").each(function(){
var syStaust = $(this).children(":first-child");
var classNum = $(this).next().children().children("li").size();
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");
});
if(classNum>0){
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");
});
}
}
});
});