diff --git a/app/controllers/admins/identity_verifications_controller.rb b/app/controllers/admins/identity_verifications_controller.rb index f5d5a11e3..51d5e423c 100644 --- a/app/controllers/admins/identity_verifications_controller.rb +++ b/app/controllers/admins/identity_verifications_controller.rb @@ -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 diff --git a/app/queries/admins/identity_verification_query.rb b/app/queries/admins/identity_verification_query.rb index a0064ec0a..7c0fd669d 100644 --- a/app/queries/admins/identity_verification_query.rb +++ b/app/queries/admins/identity_verification_query.rb @@ -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 diff --git a/app/views/admins/identity_verifications/edit.html.erb b/app/views/admins/identity_verifications/edit.html.erb index 99f9f02a9..580c86f3f 100644 --- a/app/views/admins/identity_verifications/edit.html.erb +++ b/app/views/admins/identity_verifications/edit.html.erb @@ -99,16 +99,10 @@ -
-
- -
- - <% unless @identity_verification.state == "已通过" %>
- <%= f.radio_button :state, '已通过' %> 通过   - <%= f.radio_button :state, '已拒绝' %> 拒绝 + <%= radio_button_tag("identity_verification[state]","已通过", required: 'required') %>通过   + <%= radio_button_tag("identity_verification[state]","已拒绝", required: 'required') %>拒绝

diff --git a/app/views/admins/identity_verifications/index.html.erb b/app/views/admins/identity_verifications/index.html.erb index d5aef6dc6..245ac94bd 100644 --- a/app/views/admins/identity_verifications/index.html.erb +++ b/app/views/admins/identity_verifications/index.html.erb @@ -6,7 +6,7 @@ <%= form_tag(admins_identity_verifications_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
- <% state_options = [['全部',nil], ['待审核', 0], ['已通过', 1], ['已拒绝', 2]] %> + <% state_options = [['待审核', 0], ['全部',"all"], ['已通过', 1], ['已拒绝', 2]] %> <%= select_tag(:state, options_for_select(state_options), class: 'form-control') %>
diff --git a/app/views/admins/identity_verifications/shared/_info_list.html.erb b/app/views/admins/identity_verifications/shared/_info_list.html.erb index 486a4ec5d..8ab17ad42 100644 --- a/app/views/admins/identity_verifications/shared/_info_list.html.erb +++ b/app/views/admins/identity_verifications/shared/_info_list.html.erb @@ -1,4 +1,4 @@ - +
diff --git a/app/views/admins/site_pages/shared/_info_list.html.erb b/app/views/admins/site_pages/shared/_info_list.html.erb index fdae0e882..f8279be7f 100644 --- a/app/views/admins/site_pages/shared/_info_list.html.erb +++ b/app/views/admins/site_pages/shared/_info_list.html.erb @@ -11,7 +11,7 @@ - +
序号建站工具 主题上次构建时间上次部署时间 <%= sort_tag('创建于', name: 'created_at', path: admins_site_pages_path) %>