清理页面代码

This commit is contained in:
sw 2014-08-11 13:37:54 +08:00
parent 8c6160f496
commit 8724b79296
3 changed files with 39 additions and 135 deletions

View File

@ -0,0 +1,28 @@
<% course_list.map do |course| %>
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
<div class='avatar'>
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div class='desc_item'>
<span class=''>
<% if (course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %>
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
<% end %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
</span>
</div>
<div class='desc_item text_nowrap'>
[<%= get_course_term course %>]
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
(<%= "#{memberCount(course)}人" %>)
<% files_count = course.attachments.count.to_s %>
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div>
</li>
<% end %>

View File

@ -0,0 +1,5 @@
<h1></h1>
<p id="errorExplanation">
该学校未开设任何课程,您可以查看其他学校课程
</p>
<h1></h1>

View File

@ -88,74 +88,13 @@
<span><%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => nil} %></span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
</ul>
<ul class="d-p-projectlist">
<% if User.current.logged? %>
<h1></h1>
<p id="errorExplanation">
该学校未开设任何课程,您可以查看其他学校课程
</p>
<h1></h1>
<% find_all_new_hot_course(9, @school_id).map do |course| %>
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
<div class='avatar'>
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div class='desc_item'>
<span class=''>
<% if (course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %>
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
<% end %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
</span>
</div>
<div class='desc_item text_nowrap'>
[<%= get_course_term course %>]
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
(<%= "#{memberCount(course)}人" %>)
<% files_count = course.attachments.count.to_s %>
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div>
</li>
<% end %>
<%= render "welcome/no_course_title"%>
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9, @school_id)} %>
<% else %>
<% find_all_new_hot_course(10, @school_id).map do |course| %>
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
<div class='avatar'>
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div class='desc_item'>
<span class=''>
<% if (course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %>
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
<% end %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
</span>
</div>
<div class='desc_item text_nowrap'>
[<%= get_course_term course %>]
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
(<%= "#{memberCount(course)}人" %>)
<% files_count = course.attachments.count.to_s %>
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div>
</li>
<% end %>
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(10, @school_id)} %>
<% end %>
</ul>
</div>
@ -171,80 +110,12 @@
<% end %>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
</ul>
<ul class="d-p-projectlist">
<% school_course.map do |course| %>
<% if course.school%>
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
<div class='avatar'>
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div class='desc_item'>
<span class=''>
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
</span>
</div>
<div class='desc_item text_nowrap'>
[<%= get_course_term course %>]
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
(<%= "#{memberCount(course)}人" %>)
<% files_count = course.attachments.count.to_s %>
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div>
<!--
<div class='join_course_link'>
<%# if !course_endTime_timeout?(course) %>
<div>
<%#= join_in_course(course, User.current) %>
</div>
<%# end %>
</div>
-->
</li>
<%end%>
<% end; reset_cycle %>
<%= render :partial => 'course_list', :locals => {:course_list => school_course} %>
<% if school_course.count < 10 %>
<li>
<h1></h1>
<p id="errorExplanation">
该学校开设课程较少,您可以查看其他学校课程
</p>
<%= render "welcome/no_course_title"%>
</li>
<% find_all_new_hot_course(10 - school_course.count, @school_id).map do |course| %>
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
<div class='avatar'>
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div class='desc_item'>
<span class=''>
<% if (course.school == nil) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% else %>
<!-- modified by zjc 添加超链接 -->
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
<% end %>
</span>
<span class='font_bolder'>
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
</span>
</div>
<div class='desc_item text_nowrap'>
[<%= get_course_term course %>]
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
(<%= "#{memberCount(course)}人" %> )
<% files_count = course.attachments.count.to_i.to_s %>
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div>
</li>
<% end %>
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(10 - school_course.count - 1, @school_id)} %>
<% end %>
</ul>
</div>