diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 85dff69a..05f04630 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -42,13 +42,16 @@ class WelcomeController < ApplicationController # 运营引流个人数据展示 def user_agents - @user_agents = UserAgent.find_by_key(params[:edu]) + @user_agents = UserAgent.where(key: params[:edu]) @agents_count = @user_agents.count limit = 20 @agents_pages = Paginator.new @agents_count, limit, params['page'] || 1 @offset ||= @agents_pages.offset @user_agents = paginateHelper @user_agents, limit - + respond_to do |format| + format.js + format.html{ render :layout=>'users_base'} + end end diff --git a/app/views/welcome/_user_agent_list.html.erb b/app/views/welcome/_user_agent_list.html.erb index d16787a9..34792244 100644 --- a/app/views/welcome/_user_agent_list.html.erb +++ b/app/views/welcome/_user_agent_list.html.erb @@ -15,7 +15,7 @@ <%= link_to ua.key, user_path(ua.key), :target => "_blank" %> <%= link_to user.try(:show_real_name), user_path(user), target:'_blank' %> <%= register_info(ua) %> - <%= user.agent_type.to_i == UserAgent::USER_COMPETITION ? "已报名" : "未报名" %> + <%= ua.agent_type.to_i == UserAgent::USER_COMPETITION ? "已报名" : "未报名" %> <%= ua.ip %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 427b4744..c967e51f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -297,6 +297,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 get 'welcome/shixun_to_local' => 'welcome#shixun_to_local' get 'welcome/local_to_shixun' => 'welcome#local_to_shixun' get 'welcome/local_init' => 'welcome#local_init' + get 'welcome/user_agents' => 'welcome#user_agents' # get 'competitions/home' => 'competitions#home' # get 'competitions/hn' => 'competitions#index'