From 467ee6065772ae1131057e6ed1dafb7f8f304fbc Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 15:37:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8D=E5=B8=88=E9=BB=98=E8=AE=A4=E6=98=BE?= =?UTF-8?q?=E7=A4=BA5=E4=B8=AA=EF=BC=8C=E6=B2=A1=E6=9C=89=E5=88=99?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/organizations_helper.rb | 2 +- .../_org_subfield_rightM2.html.erb | 61 ++++++++++--------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 6463bf854..882892822 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -183,7 +183,7 @@ module OrganizationsHelper end def excellent_teachers - User.where("excellent_teacher =?",true) + User.where("excellent_teacher =?",true).first(5) end end diff --git a/app/views/organizations/_org_subfield_rightM2.html.erb b/app/views/organizations/_org_subfield_rightM2.html.erb index 86b69ac05..7a2003629 100644 --- a/app/views/organizations/_org_subfield_rightM2.html.erb +++ b/app/views/organizations/_org_subfield_rightM2.html.erb @@ -1,30 +1,33 @@ -
-

<%= field.name %> - <%= link_to "更多", teachers_organization_path(@organization, :type => "famous"), :target => "_blank", :class => "more" %> -

- <% excellent_teachers.each do |teacher| %> -
- <%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sn-fl", :style => "display:block;"), user_path(teacher), :alt => "用户头像", :target => '_blank' %> - -
- <%=link_to teacher.try(:realname) ? teacher.try(:realname) :teacher.try(:login), user_path(teacher), :class => "sn-teacher-name sn-hidden", :title => '', :target => '_blank' %> - <%= teacher.my_workplace %>
-
- <% unless teacher.my_blogs_count == 0 %> - 博客 <%= teacher.my_blogs_count %> - <% end %> - <% unless teacher.courses.count == 0 %> - 课程 <%= teacher.courses.count %> - <% end %> - <% unless teacher.my_students == 0 %> - 学生 <%= teacher.my_students %> - <% end %> -
-
-
- <% end %> -
+<% unless excellent_teachers.count == 0 %> +
+

<%= field.name %> + <%= link_to "更多", teachers_organization_path(@organization, :type => "famous"), :target => "_blank", :class => "more" %> +

+ <% excellent_teachers.each do |teacher| %> +
+ <%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sn-fl", :style => "display:block;"), user_path(teacher), :alt => "用户头像", :target => '_blank' %> + +
+ <%=link_to teacher.try(:realname) ? teacher.try(:realname) :teacher.try(:login), user_path(teacher), :class => "sn-teacher-name sn-hidden", :title => '', :target => '_blank' %> + <%= teacher.my_workplace %>
+
+ <% unless teacher.my_blogs_count == 0 %> + 博客 <%= teacher.my_blogs_count %> + <% end %> + <% unless teacher.courses.count == 0 %> + 课程 <%= teacher.courses.count %> + <% end %> + <% unless teacher.my_students == 0 %> + 学生 <%= teacher.my_students %> + <% end %> +
+
+
+ <% end %> +
+ + +<% end %> -