commit
7c721e5915
@ -0,0 +1,6 @@
|
||||
json.count @users.total_count
|
||||
json.users do
|
||||
json.array! @users.each do |user|
|
||||
json.extract! user, :id, :login, :real_name, :identity, :school_name, :hidden_phone
|
||||
end
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
<% define_breadcrumbs do %>
|
||||
<% add_breadcrumb('用户列表') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container user-list-form">
|
||||
<%= form_tag(cooperative_users_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
||||
<div class="form-group mr-2">
|
||||
<label for="identity">职业:</label>
|
||||
<% identity_options = [['全部', ''], ['教师', 0], ['学生', 1], ['专业人士', 2]] %>
|
||||
<%= select_tag(:identity, options_for_select(identity_options), class: 'form-control') %>
|
||||
</div>
|
||||
|
||||
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: 'ID/姓名/邮箱/手机号检索') %>
|
||||
<%= text_field_tag(:school_name, params[:school_name], class: 'form-control col-sm-2', placeholder: '学校/单位检索') %>
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="box cooperative-list-container user-list-container">
|
||||
<%= render partial: 'cooperative/users/shared/list', locals: { users: @users } %>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
$('.user-list-container').html("<%= j(render partial: 'cooperative/users/shared/list', locals: { users: @users }) %>");
|
@ -0,0 +1,40 @@
|
||||
<table class="table table-hover user-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="10%" class="text-left">真实姓名</th>
|
||||
<th width="16%">邮件地址</th>
|
||||
<th width="10%">手机号码</th>
|
||||
<th width="18%">单位</th>
|
||||
<th width="10%">角色</th>
|
||||
<th width="14%"><%= sort_tag('创建于', name: 'created_on', path: cooperative_users_path) %></th>
|
||||
<th width="14%"><%= sort_tag('最后登录', name: 'last_login_on', path: cooperative_users_path) %></th>
|
||||
<th width="6%"><%= sort_tag('经验值', name: 'experience', path: cooperative_users_path) %></th>
|
||||
<th width="6%"><%= sort_tag('金币', name: 'grade', path: cooperative_users_path) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if users.present? %>
|
||||
<% users.each do |user| %>
|
||||
<tr class="user-item-<%= user.id %>">
|
||||
<td class="text-left">
|
||||
<%= link_to "/users/#{user.login}", target: '_blank' do %>
|
||||
<%= overflow_hidden_span user.real_name, width: 100 %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= overflow_hidden_span display_text(user.mail), width: 150 %></td>
|
||||
<td><%= overflow_hidden_span display_text(user.phone), width: 100 %></td>
|
||||
<td><%= overflow_hidden_span display_text(user.school_name), width: 150 %></td>
|
||||
<td><%= user.identity %></td>
|
||||
<td><%= display_text(user.created_on&.strftime('%Y-%m-%d %H:%M')) %></td>
|
||||
<td><%= display_text(user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %></td>
|
||||
<td><%= user.experience.to_i %></td>
|
||||
<td class="grade-content"><%= user.grade.to_i %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'cooperative/shared/paginate', locals: { objects: users } %>
|
@ -0,0 +1,5 @@
|
||||
class AddLaboratoryIdToUsers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_reference :users, :laboratory
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddLaboratoryIdToLibraries < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_reference :libraries, :laboratory
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class TransferLaboratoryData < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
Course.where(laboratory_id: nil).update_all(laboratory_id: 1)
|
||||
Competition.where(laboratory_id: nil).update_all(laboratory_id: 1)
|
||||
Library.where(laboratory_id: nil).update_all(laboratory_id: 1)
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue