diff --git a/app/controllers/admins/shixun_feedback_messages_controller.rb b/app/controllers/admins/shixun_feedback_messages_controller.rb index 27c3f4225..31fcc468c 100644 --- a/app/controllers/admins/shixun_feedback_messages_controller.rb +++ b/app/controllers/admins/shixun_feedback_messages_controller.rb @@ -3,6 +3,12 @@ class Admins::ShixunFeedbackMessagesController < Admins::BaseController def index default_sort('created_at', 'desc') @params_page = params[:page] || 1 - @discusses = paginate Discuss.where(:dis_type => 'Shixun').preload(:user) + if params[:keyword] + discusses = Discuss.find_by_sql("select * from discusses join shixuns on discusses.dis_id = shixuns.id where discusses.dis_type='Shixun' AND + shixuns.name like '%#{params[:keyword]}%'") + else + discusses = Discuss.where(:dis_type => 'Shixun').includes(:user, :dis) + end + @discusses = paginate discusses end end \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/index.js.erb b/app/views/admins/shixun_feedback_messages/index.js.erb index 38c393589..6eab9be54 100644 --- a/app/views/admins/shixun_feedback_messages/index.js.erb +++ b/app/views/admins/shixun_feedback_messages/index.js.erb @@ -1 +1,2 @@ -$(".shixun_feedback_messages-list-container").html("<%= j render partial: "admins/shixun_feedback_messages/shared/list", locals: {shixun_settings:@discusses} %>") \ No newline at end of file +$(".shixun_feedback_messages-list-container") + .html("<%= j render partial: "admins/shixun_feedback_messages/shared/list", locals: {discusses: @discusses} %>") \ No newline at end of file diff --git a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb index 7737d1a47..af81f9e58 100644 --- a/app/views/admins/shixun_feedback_messages/shared/_list.html.erb +++ b/app/views/admins/shixun_feedback_messages/shared/_list.html.erb @@ -13,8 +13,8 @@ <% discusses.each_with_index do |discuss, index| %> <%= (@params_page.to_i - 1) * 20 + index + 1 %> - <%# identifier = Game.find_by(challenge_id: discuss.challenge_id) %> - <%= discuss.dis.name %> + <% identifier = Game.find_by(challenge_id: discuss.challenge_id, user_id: discuss.user_id)&.identifier %> + <%= link_to discuss.dis.name, "/tasks/#{identifier}", target: '_blank'%> <%= content_safe discuss.content %> <%= discuss.user.show_real_name %> <%= format_time discuss.created_at %>