-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new resource_table component for user list
If the new component is available we use that for rendering the user list in the admin.
- Loading branch information
Showing
3 changed files
with
41 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ def ransackable_attributes(_auth_object = nil) | |
firstname | ||
lastname | ||
login | ||
last_sign_in_at | ||
] | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<%= render Alchemy::Admin::Resource::Table.new(@users, query: @query) do |table| %> | ||
Check notice Code scanning / Brakeman Render path contains parameter value. Note
Render path contains parameter value.
|
||
<% table.icon_column do |user| %> | ||
<%= render_icon(:user, style: user.logged_in? ? "solid" : "regular") %> | ||
<% end %> | ||
<% table.column :login, sortable: true do |user| %> | ||
<% if can?(:edit, user) %> | ||
<%= link_to_dialog user.login, | ||
alchemy.edit_admin_user_path(user), { | ||
title: Alchemy.t(:edit_user), | ||
overflow: true, | ||
size: "430x560" | ||
}, | ||
title: Alchemy.t(:edit_user) %> | ||
<% else %> | ||
<%= user.login %> | ||
<% end %> | ||
<% end %> | ||
<% table.column :firstname, class_name: "name", sortable: true %> | ||
<% table.column :lastname, sortable: true %> | ||
<% table.column :email, sortable: true %> | ||
<% table.column :language do |user| %> | ||
<%= Alchemy.t(user.language, scope: :translations, default: Alchemy.t(:unknown)) %> | ||
<% end %> | ||
<% table.column :last_sign_in_at, sortable: true do |user| %> | ||
<%= user.last_sign_in_at.present? ? l(user.last_sign_in_at, format: :"alchemy.default") : Alchemy.t(:unknown) %> | ||
<% end %> | ||
<% table.column :role, header: Alchemy::User.human_attribute_name(:alchemy_roles) do |user| %> | ||
<%= user.human_roles_string %> | ||
<% end %> | ||
<% table.delete_button tooltip: Alchemy.t(:delete_user), confirm_message: Alchemy.t(:confirm_to_delete_user) %> | ||
<% table.edit_button tooltip: Alchemy.t(:edit_user), dialog_size: "430x560" %> | ||
<% end %> | ||
|
||
<%= paginate @users, theme: "alchemy" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters