Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update user table by removing org information #4453

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Admin::UsersController < AdminController

def index
@filterrific = initialize_filterrific(
User.includes(:organization).alphabetized,
User.includes(roles: :resource).alphabetized,
params[:filterrific],
available_filters: [:search_name, :search_email]
) || return
Expand Down
12 changes: 10 additions & 2 deletions app/views/admin/users/_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<table class="table">
<thead>
<tr>
<th>Organization</th>
<th>Banks and Partners</th>
<th>Name</th>
<th>Email</th>
<th class="text-right">Actions</th>
Expand All @@ -10,7 +10,15 @@
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.organization&.name %></td>
<td>
<% user.roles.each do |role| %>
<% if role.resource_type == 'Organization' %>
<%= role.resource.name %>
<% elsif role.resource_type == 'Partner' %>
, <%= role.resource.name %>
cancelei marked this conversation as resolved.
Show resolved Hide resolved
<% end %>
<% end %>
</td>
<td><%= user.display_name %></td>
<td><%= user.email %></td>
<td class="text-right">
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/users/_user_form_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
<%= f.input :email, label: "E-mail", wrapper: :input_group, required: true do %>
<span class="input-group-text"><%= fa_icon "envelope" %></span>
<%= f.input_field :email, class: "form-control" %>
<% end %>
<% end %>
4 changes: 0 additions & 4 deletions app/views/admin/users/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
<div class="card-body">
<%= simple_form_for @user, url: admin_user_path, html: {id: "quickForm"} do |f| %>
<div class="form-inputs">
<%= f.input :organization_id, label: "Organization", wrapper: :input_group, required: true, autofocus: true do %>
<span class="input-group-text"><%= fa_icon "building" %></span>
<%= f.input_field :organization_id, collection: @organizations, class: "form-control" %>
<% end %>
<%= render 'admin/users/user_form_fields', f: f %>
</div>
</div>
Expand Down
4 changes: 0 additions & 4 deletions app/views/admin/users/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@

<%= simple_form_for @user, url: admin_users_path do |f| %>
<div class="form-inputs">
<%= f.input :organization_id, label: "Organization", wrapper: :input_group, required: true, autofocus: true do %>
<span class="input-group-text"><%= fa_icon "building" %></span>
<%= f.input_field :organization_id, collection: @organizations, class: "form-control" %>
<% end %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ticket suggested not making changes to New, just Edit.

Copy link
Collaborator

@cielf cielf Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true. I'm trying to find the issue that past CL failed to link to in this issue. (i.e. why it is a separate thing) (it's still in our backlog, but part of a larger being able to add more types of users -- including superadmins).

New doesn't currently have the role and resource part of the form -- removing the organization without other changes will simply break it.

<%= render 'admin/users/user_form_fields', f: f %>

</div>
Expand Down
Loading