<% define_admin_breadcrumbs do add_admin_breadcrumb('用户管理', admins_users_path) add_admin_breadcrumb('用户详情') end %>
<%= link_to "/users/#{@user.login}", class: 'user-info-avatar col-md-1', target: '_blank', data: { toggle: 'tooltip', title: '个人中心' } do %> <% end %>
<%= simple_form_for(@user, url: admins_user_path(@user)) do |f| %>
基本信息
<%= f.input :lastname, label: '姓名', wrapper_html: { class: 'col-md-3' }, input_html: { class: 'col-md-11', value: @user.only_real_name } %>
<%= f.input :nickname, label: '昵称', wrapper_html: { class: 'col-md-3' }, input_html: { class: 'col-md-11' } %> <%= f.input :gender, as: :radio_buttons, label: '性别', collection: [%w(男 0), %w(女 1)], wrapper_html: { class: 'col-md-3' } %>
<%= f.label :identity, label: '职业' %> <%= select_tag('user[identity]', [], class: 'form-control identity-select optional', 'data-value': @user.user_extension&.identity, 'data-first-title': '请选择') %>
<%= f.label :technical_title, label: '职称' %> <%= select_tag('user[technical_title]', [], class: 'form-control technical-title-select optional', 'data-value': @user.technical_title) %>
<%= f.input :student_id, as: :tel, label: '学号', wrapper_html: { class: 'col-md-2', style: @user.user_extension.student? ? '' : 'display:none;' }, input_html: { class: 'student-id-input' } %>
<%= f.input :mail, as: :email, label: '邮箱地址', wrapper_html: { class: 'col-md-3' }, input_html: { class: 'col-sm-11' } %> <%= f.input :phone, as: :tel, label: '手机号', wrapper_html: { class: 'col-md-3' }, input_html: { class: 'col-sm-11', autocomplete: 'off' } %>
<%= f.label :location, label: '省份' %> <%= select_tag('user[location]', [], class: 'form-control province-select optional', 'data-value': @user.location, 'data-first-title': '请选择') %>
<%= f.label :location_city, label: '城市' %> <%= select_tag('user[location_city]', [], class: 'form-control city-select optional', 'data-value': @user.location_city) %>
<%= f.input :school_id, as: :hidden %> <%= f.input :department_id, as: :hidden %>
<%= f.label :school_name, label: '所属学校/单位' %> <%= f.select :school_name, [@user.school_id], {}, class: 'form-control school-select optional' %>
<%= f.label :department_name, label: '所属学院/部门' %> <%= f.select :department_name, [@user.department_id], {}, class: 'form-control department-select optional' %>
管理
<% if current_user.admin? %>
<%= f.label :role, label: '角色' %>
<%= f.input :admin, as: :boolean, label: '管理员', checked_value: 1, unchecked_value: 0 %> <%= f.input :business, as: :boolean, label: '运营人员', wrapper_html: { class: 'ml-3' }, checked_value: 1, unchecked_value: 0 %> <%= f.input :is_test, as: :boolean, label: '测试账号', wrapper_html: { class: 'ml-3' }, checked_value: 1, unchecked_value: 0 %>
<% end %>
<%= f.label :role, label: '认证信息' %>
<%= f.input :professional_certification, as: :boolean, label: '职业认证', checked_value: 1, unchecked_value: 0 %> <%= f.input :authentication, as: :boolean, label: '实名认证', wrapper_html: { class: 'ml-3' }, checked_value: 1, unchecked_value: 0 %>
<%= f.input :password, as: :password, label: '修改密码', wrapper_html: { class: 'col-md-3' }, input_html: { class: 'col-sm-11', autocomplete: 'new-password' } %> <%= f.input :password_confirmation, as: :password, label: '确认密码', wrapper_html: { class: 'col-md-3' }, input_html: { class: 'col-sm-11', autocomplete: 'new-password' } %>
<%= f.button :submit, value: '保存', class: 'btn-primary mr-3 px-4' %> <%= link_to '取消', admins_users_path, class: 'btn btn-secondary px-4' %>
<% end %>