forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate agents, users, groups, and categories tables to table component
- Loading branch information
1 parent
218d2fc
commit ddd67f5
Showing
11 changed files
with
89 additions
and
92 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
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
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
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,45 +1,44 @@ | ||
= turbo_frame_tag 'users-list' do | ||
%div.my-1 | ||
= render_alerts_container | ||
%table#adminUsers.zebra{:cellpadding => "0", :cellspacing => "0", :width => "100%"} | ||
%thead | ||
%tr | ||
%th First name | ||
%th Last name | ||
%th Username | ||
%th Email | ||
%th Roles | ||
%th Ontologies | ||
%th Project | ||
%th Created At | ||
%th Actions | ||
%tbody#users_table_content | ||
- @users.each do |user| | ||
%tr.human{:id => user.id.split('/').last} | ||
= render TableComponent.new(id: 'admin_users', custom_class: 'border rounded p-1') do |t| | ||
- t.header do |h| | ||
- h.th {'First name'} | ||
- h.th {'Last name'} | ||
- h.th {'Username'} | ||
- h.th {'Email'} | ||
- h.th {'Roles'} | ||
- h.th {'Ontologies'} | ||
- h.th {'Project'} | ||
- h.th {'Created At'} | ||
- h.th {'Actions'} | ||
- @users.each do |user| | ||
- t.row(id: user.id.split('/').last) do |r| | ||
- r.td {user.firstName} | ||
- r.td {user.lastName} | ||
- r.td {user.username} | ||
- r.td {user.email} | ||
- r.td {user.role.join(', ')} | ||
- r.td {(user.ontologies&.size || 0).to_s} | ||
- r.td {(user.projects&.size || 0).to_s} | ||
- r.td {Date.parse(user.created).to_s} | ||
- r.td do | ||
- count = (user.ontologies&.size || 0) + (user.projects&.size || 0) | ||
%td= user.firstName | ||
%td= user.lastName | ||
%td= user.username | ||
%td= user.email | ||
%td= user.role.join(', ') | ||
%td= user.ontologies&.size || 0 | ||
%td= user.projects&.size || 0 | ||
%td= Date.parse(user.created) | ||
%td | ||
%div.d-flex.align-items-center{style: 'width: 250px'} | ||
%span.mx-1 | ||
= link_to 'Detail', "/accounts/#{user.username}", {data: {turbo_frame: '_top'}} | ||
%span.mx-1 | ||
- if count.zero? | ||
= button_to "Delete", CGI.unescape(user_path(user.id.split('/').last)), method: :delete, class: 'btn btn-link', form: {data: { turbo: true, turbo_confirm: "Are you sure?", turbo_frame: '_top'}} | ||
- else | ||
%span{data: { controller: 'tooltip' }, title: "Can't delete this user because still used"} | ||
= link_to "Delete", "", class: 'btn btn-link disabled' | ||
%span.mx-1 | ||
= link_to 'Login as', "login_as/#{user.username}", {data: {turbo_frame: '_top'}} | ||
%tr.empty-state | ||
%td.text-center{:colspan => "6"} There are currently no agents. | ||
%div.d-flex.align-items-center{style: 'width: 250px'} | ||
%span.mx-1 | ||
= link_to 'Detail', "/accounts/#{user.username}", {data: {turbo_frame: '_top'}} | ||
%span.mx-1 | ||
- if count.zero? | ||
= button_to "Delete", CGI.unescape(user_path(user.id.split('/').last)), method: :delete, class: 'btn btn-link', form: {data: { turbo: true, turbo_confirm: "Are you sure?", turbo_frame: '_top'}} | ||
- else | ||
%span{data: { controller: 'tooltip' }, title: "Can't delete this user because still used"} | ||
= link_to "Delete", "", class: 'btn btn-link disabled' | ||
%span.mx-1 | ||
= link_to 'Login as', "login_as/#{user.username}", {data: {turbo_frame: '_top'}} | ||
%tr.empty-state | ||
%td.text-center{:colspan => "6"} There are currently no agents. | ||
|
||
:javascript | ||
$.fn.dataTable.ext.errMode = 'none'; | ||
$("#adminUsers").dataTable() | ||
$("#admin_users").dataTable() | ||
|
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