Skip to content

Commit

Permalink
Merge pull request #774 from openstax/role-editing
Browse files Browse the repository at this point in the history
Added field with dropdown for editing user roles
  • Loading branch information
edwoodward authored Mar 13, 2020
2 parents 61b39e6 + d6238d9 commit 0bf25e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def change_salesforce_contact
def update_user
@user.is_administrator = params[:user][:is_administrator]
@user.is_test = params[:user][:is_test]
@user.role = params[:user][:role] if params[:user][:role]
@user.faculty_status = params[:user][:faculty_status] if params[:user][:faculty_status]
@user.school_type = params[:user][:school_type] if params[:user][:school_type]
if @user.external_uuids.any? && params[:user][:keep_external_uuids] == '0'
Expand Down
9 changes: 8 additions & 1 deletion app/views/admin/users/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@
</div>
</div>

<div class="form-group">
<%= f.label :role, class: "col-sm-2 control-label" %>
<div class="col-sm-10">
<% roles = User.roles.keys.sort.map{ |key| [key.humanize, key] } %>
<%= f.select :role, roles, {:selected => @user.role}, {class: "form-control"} %>
</div>
</div>

<div class="form-group">
<%= f.label :faculty_status, class: "col-sm-2 control-label" %>
<div class="col-sm-10">
Expand Down Expand Up @@ -237,5 +245,4 @@

</div>


<% end %>

0 comments on commit 0bf25e0

Please sign in to comment.