课程大纲的修改

This commit is contained in:
cxt 2016-07-01 15:25:30 +08:00
parent afe16cc99c
commit 25b5d74a42
5 changed files with 6 additions and 15 deletions

View File

@ -3187,9 +3187,6 @@ class UsersController < ApplicationController
sort_name = "updated_at"
sort_type = @c_sort == 1 ? "asc" : "desc"
# @courses = @user.courses.visible.where("is_delete =?", 0).order("#{sort_name} #{sort_type}")
#@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
@courses = @user.courses.visible.where("is_delete =?", 0)
syllabus_ids = @courses.empty? ? '(-1)' : "(" + @courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
@syllabus = Syllabus.where("id in #{syllabus_ids} or user_id = #{User.current.id}").order("#{sort_name} #{sort_type}")
@ -3197,12 +3194,6 @@ class UsersController < ApplicationController
#根据 作业+资源数排序
if @order.to_i == 2
@type = 2
# @courses.each do |course|
# course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count)
# if course[:infocount] < 0
# course[:infocount] = 0
# end
# end
@syllabus.each do |syllabus|
count = 0
courses = @courses.where("syllabus_id = #{syllabus.id}")

View File

@ -12,7 +12,7 @@
<span><%=@syllabus.title %></span>
<input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" />
<% end %>
<span class="c_red" id="new_syllabus_notice" style="display: none;">请选择课程大纲</span>
<span class="c_red" id="new_syllabus_notice" style="display: none;">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(), :class => 'ml5 green_btn_share c_white'%></span>
</li>
<div class="cl"></div>
<li class="ml45">

View File

@ -9,11 +9,11 @@
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
</div>
<div class="pr_info_id fl f14">
<span class="hidden fl" style="max-width: 90px;" title="<%= @course.name %>"><%= @course.name %></span><span class="fl"><%=@course.is_public == 1 ? '(私有)' : '公开' %></span>
<span class="hidden fl" style="max-width: 80px;" title="<%= @course.name %><%=@course.is_public == 0 ? '(私有)' : '(公开)' %>"><%= @course.name %></span><span class="fl"><%=@course.is_public == 0 ? '(私有)' : '(公开)' %></span>
</br>
<div class="cl"></div>
<% if @course.syllabus%>
<a class="pr_info_name fb c_dark fl hidden" style="max-width: 120px;" href="<%= Setting.protocol%>://<%= Setting.host_name%>/syllabuses/<%= @course.syllabus_id%>" target="_blank">
<a class="pr_info_name fb c_dark fl hidden" title="<%=@course.syllabus.title %>" style="max-width: 120px;" href="<%= Setting.protocol%>://<%= Setting.host_name%>/syllabuses/<%= @course.syllabus_id%>" target="_blank">
<%=@course.syllabus.title %>
</a>
<% end %>

View File

@ -5,7 +5,7 @@
<%= image_tag("../images/syllabus.jpg",width:"60px", height: "60px") %>
</div>
<div class="fl ml15">
<p class="homepageImageName mb5"><%=@syllabus.title %></p>
<p class="homepageImageName mb5" title="<%=@syllabus.title %>"><%=@syllabus.title %></p>
<div class="cl"></div>
</div>
<div class="cl"></div>

View File

@ -13,11 +13,11 @@
<div class="syllabusbox_tishi">
<% if User.current == @syllabus.user %>
<p >您建立的课程还未创建班级,请
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "syllabusbox_a_blue", :target => '_blank'%>
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "syllabusbox_a_blue", :target => '_blank'%>
</p>
<% elsif User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<p >本课程下还未创建班级,请
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "syllabusbox_a_blue", :target => '_blank'%>
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "syllabusbox_a_blue", :target => '_blank'%>
</p>
<% else %>
<p >本课程下还未创建班级,敬请期待。