From 14d8a248d71fc607e35f87508dcb5f287f86fb04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Mon, 24 Oct 2022 17:37:53 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E8=B5=84=E8=AE=AF=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E6=8A=A5=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform_communicates_controller.rb | 17 ++++++++- .../platform_communicates/_list.html.erb | 3 ++ .../_users_list.html.erb | 38 +++++++++++++++++++ .../platform_communicates/show.html.erb | 32 ++++++++++++++++ .../admins/platform_communicates/show.js.erb | 1 + .../topic/applet_banners/_list.html.erb | 3 +- 6 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 app/views/admins/platform_communicates/_users_list.html.erb create mode 100644 app/views/admins/platform_communicates/show.html.erb create mode 100644 app/views/admins/platform_communicates/show.js.erb diff --git a/app/controllers/admins/platform_communicates_controller.rb b/app/controllers/admins/platform_communicates_controller.rb index aa545559e..7b0acb637 100644 --- a/app/controllers/admins/platform_communicates_controller.rb +++ b/app/controllers/admins/platform_communicates_controller.rb @@ -1,5 +1,5 @@ class Admins::PlatformCommunicatesController < Admins::BaseController - before_action :get_communicate, only: [:edit, :update, :destroy] + before_action :get_communicate, only: [:edit, :update, :destroy, :show] def index sort_by = PlatformCommunicate.column_names.include?(params[:sort_by]) ? params[:sort_by] : 'order_index' sort_direction = %w(desc asc).include?(params[:sort_direction]) ? params[:sort_direction] : 'desc' @@ -8,6 +8,21 @@ class Admins::PlatformCommunicatesController < Admins::BaseController @communicates = kaminari_paginate(communicates) end + def show + watchers = @communicate.watchers + if params[:search].present? + like_sql = 'users.lastname LIKE :keyword OR users.nickname LIKE :keyword OR users.mail LIKE :keyword OR users.phone LIKE :keyword OR users.login LIKE :keyword OR users.company_name LIKE :keyword' + watchers = watchers.left_joins(:user).where(like_sql, keyword: "%#{params[:search]}%") + end + if params[:user_type].present? + watchers = watchers.left_joins(:user).where("users.user_type = ?", params[:user_type]) + end + if params[:professional_field].present? + watchers = watchers.left_joins(:user).where("users.professional_field = ?", params[:professional_field]) + end + @watchers = kaminari_paginate watchers + end + def new @communicate = PlatformCommunicate.new end diff --git a/app/views/admins/platform_communicates/_list.html.erb b/app/views/admins/platform_communicates/_list.html.erb index 1833f5ade..f47adca69 100644 --- a/app/views/admins/platform_communicates/_list.html.erb +++ b/app/views/admins/platform_communicates/_list.html.erb @@ -7,6 +7,7 @@
| 序号 | +昵称 | +邮件地址 | +手机号码 | +用户类型 | +专业领域 | +单位 | +报名时间 | +
|---|---|---|---|---|---|---|---|
| <%= list_index_no((params[:page] || 1).to_i, index) %> | ++ <%= link_to "/#{watch.user.login}", target: '_blank' do %> + <%= overflow_hidden_span watch.user.real_name, width: 100 %> + <% end %> + | +<%= overflow_hidden_span display_text(watch.user.mail), width: 150 %> | +<%= overflow_hidden_span display_text(watch.user.phone), width: 100 %> | +<%= watch.user.try(:user_type).blank? ? "" : ["事业单位", "企业单位", "科研人员", "高校教师", "高校学生", "程序员", "其他"][user.try(:user_type).to_i] %> | +<%= watch.user.try(:professional_field).blank? ? "" : "#{Site.dict_str("professional_field", "#{user.professional_field}")}" %> | +<%= watch.user.try(:company_name) %> | +<%= display_text(watch.created_at&.strftime('%Y-%m-%d %H:%M')) %> | +