超级管理员页面增加添加管理员的功能

dev_aliyun
daiao 5 years ago
parent 579537709e
commit ac54319542

@ -220,6 +220,9 @@ class ManagementsController < ApplicationController
@user.nickname = params[:nickname]
@user.lastname = params[:lastname]
@user.business = params[:business].to_i
if params[:admin]
@user.admin = params[:admin].to_i
end
@user.firstname = ""
@user.mail = params[:mail].strip == "" ? nil : params[:mail]
@user.phone = params[:phone].strip == "" ? nil : params[:phone]

@ -190,6 +190,14 @@
<input type="checkbox" <%= @user.business? ? "checked" : "" %> name="business" value="<%= @user.business? ? "1" : "0" %>" id="person_business" class="magic-checkbox" style="float:left; margin-top: 8px;">
<label for="person_business"></label>
</span>
<% if User.current.admin? %>
<label class="panel-form-label fl mr18">管理员:</label>
<span class="fl">
<input type="checkbox" <%= @user.admin? ? "checked" : "" %> name="admin" value="<%= @user.admin? ? "1" : "0" %>" id="person_admin" class="magic-checkbox" style="float:left; margin-top: 8px;">
<label for="person_admin"></label>
</span>
<% end %>
</li>
<li class="clearfix mb10 hascontont">
<label class="panel-form-label fl mr18">职业:</label>
@ -625,7 +633,14 @@
}else{
document.getElementById('person_business').value = "0";
}
<% if User.current.admin? %>
var admin_check = document.getElementById('person_admin').checked;
if (admin_check) {
document.getElementById('person_admin').value = "1";
} else {
document.getElementById('person_admin').value = "0";
}
<% end %>
my_account_form_submit();
});
function my_account_form_submit(){

Loading…
Cancel
Save