Skip to content

Commit

Permalink
Merge pull request #1950 from datadryad/roles
Browse files Browse the repository at this point in the history
Fix user roles display issues
  • Loading branch information
alinvetian authored Dec 18, 2024
2 parents a89fce4 + 181a202 commit a6613bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<td>
<div class="c-lined-table__with-actions">
<div class="c-lined-table__data" id="user_role_<%= u.id %>">
<%= u.roles.present? ? u.roles.admin_roles.map{|r| "#{r.role_object_type&.delete_prefix("StashEngine::")&.sub('JournalOrganization', 'Publisher')} #{r.role}".strip.capitalize }.join(", ") : "User" %>
<%= u.roles&.admin_roles.present? ? u.roles.admin_roles.map{|r| "#{r.role_object_type&.delete_prefix("StashEngine::")&.sub('JournalOrganization', 'Publisher')} #{r.role}".strip.capitalize }.join(", ") : "User" %>
</div>
<% if policy([:stash_engine, :user]).set_role? %>
<div class="c-lined-table__actions">
Expand Down
2 changes: 1 addition & 1 deletion app/views/stash_engine/user_admin/edit.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ when 'tenant_id'
end %>";
<% if @field == 'tenant_id' %>
$('#edit_roles_form').html("<%= escape_javascript(render partial: 'admin_role_form', locals: { user: @user }) %>");
document.getElementById('user_role_<%= @user.id %>').innerHTML = "<%= @user.roles.present? ? @user.roles.map{|r| "#{r.role_object_type&.delete_prefix("StashEngine::")&.sub('JournalOrganization', 'Publisher')} #{r.role}".strip.capitalize }.join(", ") : "User" %>";
document.getElementById('user_role_<%= @user.id %>').innerHTML = "<%= @user.roles&.admin_roles.present? ? @user.roles.admin_roles.map{|r| "#{r.role_object_type&.delete_prefix("StashEngine::")&.sub('JournalOrganization', 'Publisher')} #{r.role}".strip.capitalize }.join(", ") : "User" %>";
<% end %>
document.getElementById('genericModalDialog').close();

0 comments on commit a6613bd

Please sign in to comment.