-
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.
Merge pull request #213 from tvdeyen/use-resource-table-component
Use new resource_table component for user list
- Loading branch information
Showing
9 changed files
with
81 additions
and
39 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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require: standard | ||
|
||
AllCops: | ||
TargetRubyVersion: 3.0 | ||
TargetRubyVersion: 3.1 | ||
|
||
inherit_gem: | ||
standard: config/base.yml |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
parallel: true | ||
ruby_version: 3.1 | ||
ignore: | ||
- "spec/dummy/**/*" |
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
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
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| %> | ||
<% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<table class="list" id="user_list"> | ||
<thead> | ||
<tr> | ||
<th class="icon"></th> | ||
<th class="login"> | ||
<%= sort_link @query, :login, hide_indicator: true %> | ||
</th> | ||
<th class="name"> | ||
<%= sort_link @query, :firstname, hide_indicator: true %> | ||
</th> | ||
<th> | ||
<%= sort_link @query, :lastname, hide_indicator: true %> | ||
</th> | ||
<th class="email"> | ||
<%= sort_link @query, :email, hide_indicator: true %> | ||
</th> | ||
<th><%= Alchemy::User.human_attribute_name('language') %></th> | ||
<th> | ||
<%= sort_link @query, :last_sign_in_at, hide_indicator: true %> | ||
</th> | ||
<th class="role"><%= Alchemy::User.human_attribute_name('roles') %></th> | ||
<th class="tools"></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<%= render partial: "user", collection: @users %> | ||
</tbody> | ||
</table> |
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