From 946755f9e09278d1c2dc5b8c891931e9cdea57cb Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 3 Apr 2019 18:03:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AE=A1=E7=90=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/cooperates_controller.rb | 4 +- app/models/school.rb | 4 + .../_partner_item.html.erb} | 33 ++++--- app/views/cooperates/partner_list.html.erb | 42 +++++++++ app/views/cooperates/partner_list.js.erb | 2 + app/views/managements/users_list.html.erb | 86 ------------------- config/routes.rb | 10 +++ 7 files changed, 75 insertions(+), 106 deletions(-) rename app/views/{managements/_users_list.html.erb => cooperates/_partner_item.html.erb} (54%) create mode 100644 app/views/cooperates/partner_list.js.erb delete mode 100644 app/views/managements/users_list.html.erb diff --git a/app/controllers/cooperates_controller.rb b/app/controllers/cooperates_controller.rb index 1f43fcaa..09895193 100644 --- a/app/controllers/cooperates_controller.rb +++ b/app/controllers/cooperates_controller.rb @@ -2,11 +2,11 @@ class CooperatesController < ApplicationController def partner_list search = params[:search] - @schools = School.where(id: [179, 3181, 3216]).where("name like ?", "'%#{search}%'") + @schools = School.where(id: [117, 179, 3181, 3216]) @all_count = @schools.size unless search.blank? - @schools = @schools.where("name like ?", "'%#{search}%'") + @schools = @schools.where("name like ?", "%#{search}%") end @search_count = @schools.size @schools = paginateHelper @schools, 15 diff --git a/app/models/school.rb b/app/models/school.rb index 2d69bf00..98158c5d 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -58,4 +58,8 @@ class School < ActiveRecord::Base myshixun_id !=0").first.try(:sw_count) end + def statistic_url + dep = departments.where("identifier is not null").first + url = dep.present? ? "/colleges/#{dep.identifier}/statistics" : "" + end end diff --git a/app/views/managements/_users_list.html.erb b/app/views/cooperates/_partner_item.html.erb similarity index 54% rename from app/views/managements/_users_list.html.erb rename to app/views/cooperates/_partner_item.html.erb index 993c6db3..a094c452 100644 --- a/app/views/managements/_users_list.html.erb +++ b/app/views/cooperates/_partner_item.html.erb @@ -9,29 +9,26 @@ 使用详情

+