parent
e90da9d812
commit
0feb1280fd
|
@ -159,6 +159,10 @@ class OrganizationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def teachers
|
def teachers
|
||||||
|
unless @organization.allow_set_teachers
|
||||||
|
render_403
|
||||||
|
return
|
||||||
|
end
|
||||||
q = params[:search].nil? ? "" : "#{params[:search].strip}"
|
q = params[:search].nil? ? "" : "#{params[:search].strip}"
|
||||||
if params[:type] == "courses" || params[:type].nil?
|
if params[:type] == "courses" || params[:type].nil?
|
||||||
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
|
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
|
||||||
|
@ -169,6 +173,9 @@ class OrganizationsController < ApplicationController
|
||||||
elsif params[:type] == "resources"
|
elsif params[:type] == "resources"
|
||||||
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from attachments where attachments.author_id = u.id) as course_count
|
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from attachments where attachments.author_id = u.id) as course_count
|
||||||
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
|
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
|
||||||
|
elsif params[:type] == "famous"
|
||||||
|
@org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
|
||||||
|
from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc")
|
||||||
end
|
end
|
||||||
limit = 10
|
limit = 10
|
||||||
# @is_remote = true
|
# @is_remote = true
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<div class="sn-teacher-wrap" style="display:<%= field.hide == 0?'block':'none' %>;">
|
<div class="sn-teacher-wrap" style="display:<%= field.hide == 0?'block':'none' %>;">
|
||||||
<h2 class="h2-title sn-mb5">名师风采<a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
|
<h2 class="h2-title sn-mb5"><%= field.name %>
|
||||||
|
<%= link_to "更多", teachers_organization_path(@organization, :type => "famous"), :target => "_blank", :class => "more" %>
|
||||||
|
</h2>
|
||||||
<% excellent_teachers.each do |teacher| %>
|
<% excellent_teachers.each do |teacher| %>
|
||||||
<div class="sn-teacher-list">
|
<div class="sn-teacher-list">
|
||||||
<%= 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 image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sn-fl", :style => "display:block;"), user_path(teacher), :alt => "用户头像", :target => '_blank' %>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="block-slice"></div>
|
<div class="block-slice"></div>
|
||||||
<div class="teacher-social-block">
|
<div class="teacher-social-block">
|
||||||
<div class="block-num"><%= org_teacher.my_students %>500</div>
|
<div class="block-num"><%= org_teacher.my_students %></div>
|
||||||
<div class="block-title">学生数</div>
|
<div class="block-title">学生数</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="block-slice"></div>
|
<div class="block-slice"></div>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<!--<option value="3">资源数</option>-->
|
<!--<option value="3">资源数</option>-->
|
||||||
<!--</select>-->
|
<!--</select>-->
|
||||||
<div class="sn-font-grey fr">
|
<div class="sn-font-grey fr">
|
||||||
<%= link_to "名师列表", teachers_organization_path(@organization), :class => "fontGrey" %>
|
<%= link_to "名师列表", teachers_organization_path(@organization, :type => "famous"), :class => "fontGrey" %>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue