用户审核详情调整

This commit is contained in:
呱呱呱 2023-08-28 11:36:00 +08:00
parent d22a18a8fe
commit d4d6751dc0
6 changed files with 13 additions and 17 deletions

View File

@ -3,9 +3,7 @@ class Admins::IdentityVerificationsController < Admins::BaseController
def index
params[:sort_by] = params[:sort_by].presence || 'created_at'
params[:sort_direction] = params[:sort_direction].presence || 'desc'
identity_verifications = Admins::IdentityVerificationQuery.call(params)
@identity_verifications = paginate identity_verifications.preload(:user)
end
@ -16,9 +14,13 @@ class Admins::IdentityVerificationsController < Admins::BaseController
end
def update
@identity_verification.update(update_params)
flash[:success] = '保存成功'
render 'edit'
if @identity_verification.update(update_params)
redirect_to admins_identity_verifications_path
flash[:success] = "更新成功"
else
redirect_to admins_identity_verifications_path
flash[:danger] = "更新失败"
end
end
private

View File

@ -10,7 +10,7 @@ class Admins::IdentityVerificationQuery < ApplicationQuery
end
def call
state = params[:state].blank? ? [0,1,2] : params[:state].to_i
state = params[:state] == "all" ? [0,1,2] : params[:state].nil? ? [0] : params[:state].to_i
applies = IdentityVerification.where(state: state)
custom_sort(applies, params[:sort_by], params[:sort_direction])
end

View File

@ -99,16 +99,10 @@
</td>
</div>
</br>
<div class="form-row">
<label><b>是否通过身份证审核: </b></label>
</div>
<b>
<% unless @identity_verification.state == "已通过" %>
<div class="form-row">
<%= f.radio_button :state, '已通过' %> 通过  
<%= f.radio_button :state, '已拒绝' %> 拒绝
<%= radio_button_tag("identity_verification[state]","已通过", required: 'required') %>通过  
<%= radio_button_tag("identity_verification[state]","已拒绝", required: 'required') %>拒绝
</div>
</br>
<div class="form-row">

View File

@ -6,7 +6,7 @@
<%= form_tag(admins_identity_verifications_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
<div class="form-group mr-2">
<label for="state">状态:</label>
<% state_options = [['全部',nil], ['待审核', 0], ['已通过', 1], ['已拒绝', 2]] %>
<% state_options = [['待审核', 0], ['全部',"all"], ['已通过', 1], ['已拒绝', 2]] %>
<%= select_tag(:state, options_for_select(state_options), class: 'form-control') %>
</div>

View File

@ -1,4 +1,4 @@
<table class="table table-hover identity-verifications-list-table">
<table class="table table-hover identity-verifications-list-table">
<thead class="thead-light">
<tr>
<th width="10%">序号</th>

View File

@ -11,7 +11,7 @@
<th width="5%" class="text-left">建站工具</th>
<th width="10%" class="text-left">主题</th>
<th width="10%" class="text-left">上次构建时间</th>
<th width="10%" class="text-left">上次部署时间</th>
<th width="10%"><%= sort_tag('创建于', name: 'created_at', path: admins_site_pages_path) %></th>