添加课程学期

This commit is contained in:
huang 2016-06-03 14:28:12 +08:00
parent 1f43ecb8ed
commit fa2437cdf6
2 changed files with 17 additions and 1 deletions

View File

@ -247,4 +247,20 @@ module OrganizationsHelper
org.org_subfields.where(:field_type => "Compstu").first.hide
end
#当前学期(2015春季学期)
def current_time_and_term course
str = ""
term = cur_course_term
if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
str = course.time.to_s + course.term.to_s
elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
str = course.time.to_s + course.term.to_s
elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
str = course.end_time.to_s + course.end_term.to_s
else
str = Time.now.year.to_s + cur_course_term.to_s
end
str
end
end

View File

@ -202,7 +202,7 @@
<%= link_to course.name, course_path(course.id), :target => '_blank', :class => "por_course_title link-black", :title => course.name %>
<%= link_to image_tag(url_to_avatar(course),:width => "140", :height => "100"), course_path(course), :target => "_blank", :class => "fl" %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => course.id, :content=> course.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now course.updated_at %></span>
<span class=" por_course_time"><%= current_time_and_term course %></span>
</div>
<% end %>
<% end %>