ucb_rails_user 8.0.1 → 8.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -1
- data/app/assets/stylesheets/ucb_rails_user/components/users_table.css +16 -3
- data/app/controllers/concerns/ucb_rails_user/users_controller_concerns.rb +19 -3
- data/app/views/ucb_rails_user/users/_user.html.erb +1 -3
- data/app/views/ucb_rails_user/users/edit.html.erb +4 -2
- data/app/views/ucb_rails_user/users/index.html.erb +100 -30
- data/app/views/ucb_rails_user/users/new.html.erb +6 -3
- data/app/views/ucb_rails_user/users/search.html.erb +16 -0
- data/config/importmap.rb +2 -0
- data/lib/ucb_rails_user/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 918695706c657e124473ab9b924deba0613340af5fec3de9db28c8e67cbe5512
|
4
|
+
data.tar.gz: a53245a84b4150f134b84bf72cece17e2da3b71d565ba4b1ad2e48424558e3d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 126345f6c3015d8fe72e8f6ed957c8b34e2546ef171db042d3878652ef3381e52a4bef61f007eafa066c015e7b7cd18741bbaa4e1e49d75aa310cf0f954ff8cd
|
7
|
+
data.tar.gz: ebcbb49bbfc56404249408beeea6ee80d2d999c712efbc23e6e32fd64d9079189235066edfdd9afc83efb2d67e632426b7a64393c4e8c7532cd71c0547932221
|
data/README.md
CHANGED
@@ -89,7 +89,23 @@ And in `application.js` add this line:
|
|
89
89
|
//= require ucb_rails_user/scripts
|
90
90
|
```
|
91
91
|
|
92
|
-
9.
|
92
|
+
9. Enable Turbo (required for admin user search functionality)
|
93
|
+
|
94
|
+
The admin user search uses Turbo Frames for seamless searching without page reloads. Add this to your application layout (typically `app/views/layouts/application.html.erb`):
|
95
|
+
|
96
|
+
```erb
|
97
|
+
<%= turbo_include_tags %>
|
98
|
+
```
|
99
|
+
|
100
|
+
Also update any `data-turbolinks-track` attributes to use `data-turbo-track` instead:
|
101
|
+
|
102
|
+
```erb
|
103
|
+
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
104
|
+
```
|
105
|
+
|
106
|
+
If your app doesn't already include Turbo, make sure the `turbo-rails` gem is in your Gemfile (it's included as a dependency of this gem).
|
107
|
+
|
108
|
+
10. Restart your host app as usual
|
93
109
|
|
94
110
|
You should be able to access the following routes:
|
95
111
|
|
@@ -290,3 +306,5 @@ There is a new session timeout gem that can be used as well. It has a nice Javas
|
|
290
306
|
## Version 8+
|
291
307
|
|
292
308
|
This version removes both the emailing setup functionality as well as the error reporting functionality. Those are both in the [UcbRailsDefaults] (https://gitlab.com/ucb-bit/cad/aa/ucb_rails_defaults) gem. This gem's dependencies have been slimmed down so that only the basics to run the gem are required. This makes it easier to upgrade the including apps.
|
309
|
+
|
310
|
+
Versions 8.0.x use the new standard of Turbo, importmaps, and propshaft. The 8.0.x versions do not have the latest CAS upgrades in them and are used for Rails 8 apps that are in maintenance mode.
|
@@ -1,13 +1,26 @@
|
|
1
1
|
.ucb-rails-users-table-header {
|
2
2
|
margin-top: 16px;
|
3
|
-
margin-bottom:
|
3
|
+
margin-bottom: 8px; }
|
4
4
|
|
5
5
|
.ucb-rails-users-table-header a {
|
6
|
-
margin-top:
|
6
|
+
margin-top: 0px; }
|
7
|
+
|
8
|
+
.ucb-rails-users-table-header form {
|
9
|
+
display: flex !important;
|
10
|
+
gap: 15px;
|
11
|
+
align-items: center;
|
12
|
+
flex-direction: row;
|
13
|
+
}
|
14
|
+
|
15
|
+
.ucb-rails-users-table-header form span,
|
16
|
+
.ucb-rails-users-table-header form select,
|
17
|
+
.ucb-rails-users-table-header form input {
|
18
|
+
vertical-align: middle;
|
19
|
+
}
|
7
20
|
|
8
21
|
table.ucb-rails-users-table {
|
9
22
|
border-spacing: 0px;
|
10
|
-
margin-top:
|
23
|
+
margin-top: 8px;
|
11
24
|
}
|
12
25
|
|
13
26
|
table.ucb-rails-users-table th {
|
@@ -9,7 +9,20 @@ module UcbRailsUser::UsersControllerConcerns
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def index
|
12
|
-
@
|
12
|
+
@sort = params[:sort] || "last_name"
|
13
|
+
@sort_dir = params[:dir] || "asc"
|
14
|
+
|
15
|
+
# Build the query
|
16
|
+
users = if !params[:query].blank?
|
17
|
+
search_user_table(params[:query])
|
18
|
+
else
|
19
|
+
UcbRailsUser.user_class.all
|
20
|
+
end
|
21
|
+
|
22
|
+
# Apply sorting
|
23
|
+
users = users.order("#{@sort} #{@sort_dir}")
|
24
|
+
|
25
|
+
@pagy, @users = pagy(users, limit: params[:count])
|
13
26
|
end
|
14
27
|
|
15
28
|
def search
|
@@ -91,7 +104,6 @@ module UcbRailsUser::UsersControllerConcerns
|
|
91
104
|
@lps_existing_uids = UcbRailsUser.user_class.where(ldap_uid: uid_strings).pluck(:uid)
|
92
105
|
render 'ucb_rails_user/lps/search'
|
93
106
|
end
|
94
|
-
|
95
107
|
end
|
96
108
|
|
97
109
|
def typeahead_search
|
@@ -111,6 +123,11 @@ module UcbRailsUser::UsersControllerConcerns
|
|
111
123
|
|
112
124
|
private
|
113
125
|
|
126
|
+
def search_user_table(query)
|
127
|
+
UcbRailsUser.user_class.where('lower(first_name) like lower(:q) or lower(last_name) like lower(:q) or ldap_uid like :q or employee_id like :q',
|
128
|
+
q: '%' + query + '%')
|
129
|
+
end
|
130
|
+
|
114
131
|
def user_params(extra_params = [])
|
115
132
|
params.require(:user).permit([
|
116
133
|
:superuser_flag,
|
@@ -130,5 +147,4 @@ module UcbRailsUser::UsersControllerConcerns
|
|
130
147
|
def find_user
|
131
148
|
@user ||= UcbRailsUser.user_class.find(params.fetch(:id))
|
132
149
|
end
|
133
|
-
|
134
150
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
<%= turbo_frame_tag "users" do %>
|
2
1
|
<tr id="user_<%=user.id%>" class="user">
|
3
2
|
<td><%= checkmark(user.superuser?) %></td>
|
4
3
|
<td><%= checkmark(user.inactive?) %></td>
|
@@ -9,10 +8,9 @@
|
|
9
8
|
<td class="min"><%= user.ldap_uid %></td>
|
10
9
|
<td class="min"><%= user.employee_id %></td>
|
11
10
|
<td>
|
12
|
-
<%= link_to 'edit', edit_admin_user_path(user), class: 'btn btn-
|
11
|
+
<%= link_to 'edit', edit_admin_user_path(user), class: 'btn btn-primary', id: dom_id(user, 'edit'), role: 'button', data: { turbo_frame: "users" } %>
|
13
12
|
</td>
|
14
13
|
<td>
|
15
14
|
<%= button_to 'delete', admin_user_path(user), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %>
|
16
15
|
</td>
|
17
16
|
</tr>
|
18
|
-
<% end %>
|
@@ -1,34 +1,104 @@
|
|
1
|
-
<div class="ucb-rails-users-table-header
|
1
|
+
<div class="ucb-rails-users-table-header">
|
2
2
|
<h1>Users</h1>
|
3
|
+
<%= link_to "Add User", new_admin_user_path, class: "btn btn-primary", style: "float: right;" %>
|
3
4
|
</div>
|
4
5
|
|
5
|
-
<%=
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<th>Employee ID</th>
|
23
|
-
<th class="min unsorted">Edit</th>
|
24
|
-
<th class="min unsorted">Delete</th>
|
25
|
-
</tr>
|
26
|
-
</thead>
|
27
|
-
<tbody class="highlight">
|
28
|
-
<%= render partial: "ucb_rails_user/users/user", collection: @users %>
|
29
|
-
</tbody>
|
30
|
-
</table>
|
31
|
-
<div class="ucb-rails-user">
|
32
|
-
<%= pagy_nav(@pagy).html_safe %>
|
6
|
+
<%= turbo_frame_tag "users" do %>
|
7
|
+
<div style="margin-top: 10px; overflow: auto; margin-bottom: 10px; vertical-align: middle; ">
|
8
|
+
<%= form_with url: "", method: :get, data: { turbo_frame: "users" }, style: "display: flex; gap: 10px; align-items: center; flex-grow: 1;" do |form| %>
|
9
|
+
<%= form.hidden_field :sort, value: @sort %>
|
10
|
+
<%= form.hidden_field :dir, value: @sort_dir %>
|
11
|
+
<div style="float: left; padding-right: 15px">
|
12
|
+
Show <%= form.select :count, options_for_select([10, 25, 50, 100], selected: params[:count]), {}, { onchange: "this.form.requestSubmit()" } %>
|
13
|
+
</div>
|
14
|
+
<div style="float: left;">
|
15
|
+
Search <%= form.search_field :query, value: params[:query], id: "user_search_field", placeholder: "Search users...", oninput: "
|
16
|
+
clearTimeout(window.searchTimer);
|
17
|
+
window.searchTimer = setTimeout(() => {
|
18
|
+
this.form.requestSubmit();
|
19
|
+
}, 300);
|
20
|
+
" %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
33
23
|
</div>
|
34
|
-
|
24
|
+
<div class="table-responsive ucb-rails-users-table-wrapper">
|
25
|
+
<table class="table table-striped table-bordered table-hover ucb-rails-users-table">
|
26
|
+
<thead>
|
27
|
+
<tr>
|
28
|
+
<th class="min">
|
29
|
+
<%= link_to admin_users_path(sort: "superuser_flag", dir: @sort == "superuser_flag" && @sort_dir == "asc" ? "desc" : "asc", query: params[:query], count: params[:count]), data: { turbo_frame: "users" }, style: "text-decoration: none; color: inherit;" do %>
|
30
|
+
Superuser?
|
31
|
+
<% if @sort == "superuser_flag" %>
|
32
|
+
<%= @sort_dir == "asc" ? "▲" : "▼" %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
</th>
|
36
|
+
<th class="min">
|
37
|
+
<%= link_to admin_users_path(sort: "inactive_flag", dir: @sort == "inactive_flag" && @sort_dir == "asc" ? "desc" : "asc", query: params[:query], count: params[:count]), data: { turbo_frame: "users" }, style: "text-decoration: none; color: inherit;" do %>
|
38
|
+
Inactive?
|
39
|
+
<% if @sort == "inactive_flag" %>
|
40
|
+
<%= @sort_dir == "asc" ? "▲" : "▼" %>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
</th>
|
44
|
+
<th>
|
45
|
+
<%= link_to admin_users_path(sort: "first_name", dir: @sort == "first_name" && @sort_dir == "asc" ? "desc" : "asc", query: params[:query], count: params[:count]), data: { turbo_frame: "users" }, style: "text-decoration: none; color: inherit;" do %>
|
46
|
+
First Name
|
47
|
+
<% if @sort == "first_name" %>
|
48
|
+
<%= @sort_dir == "asc" ? "▲" : "▼" %>
|
49
|
+
<% end %>
|
50
|
+
<% end %>
|
51
|
+
</th>
|
52
|
+
<th>
|
53
|
+
<%= link_to admin_users_path(sort: "last_name", dir: @sort == "last_name" && @sort_dir == "asc" ? "desc" : "asc", query: params[:query], count: params[:count]), data: { turbo_frame: "users" }, style: "text-decoration: none; color: inherit;" do %>
|
54
|
+
Last Name
|
55
|
+
<% if @sort == "last_name" %>
|
56
|
+
<%= @sort_dir == "asc" ? "▲" : "▼" %>
|
57
|
+
<% end %>
|
58
|
+
<% end %>
|
59
|
+
</th>
|
60
|
+
<th>
|
61
|
+
<%= link_to admin_users_path(sort: "email", dir: @sort == "email" && @sort_dir == "asc" ? "desc" : "asc", query: params[:query], count: params[:count]), data: { turbo_frame: "users" }, style: "text-decoration: none; color: inherit;" do %>
|
62
|
+
Email
|
63
|
+
<% if @sort == "email" %>
|
64
|
+
<%= @sort_dir == "asc" ? "▲" : "▼" %>
|
65
|
+
<% end %>
|
66
|
+
<% end %>
|
67
|
+
</th>
|
68
|
+
<th class="dt">
|
69
|
+
<%= link_to admin_users_path(sort: "last_login_at", dir: @sort == "last_login_at" && @sort_dir == "asc" ? "desc" : "asc", query: params[:query], count: params[:count]), data: { turbo_frame: "users" }, style: "text-decoration: none; color: inherit;" do %>
|
70
|
+
Last Login
|
71
|
+
<% if @sort == "last_login_at" %>
|
72
|
+
<%= @sort_dir == "asc" ? "▲" : "▼" %>
|
73
|
+
<% end %>
|
74
|
+
<% end %>
|
75
|
+
</th>
|
76
|
+
<th>
|
77
|
+
<%= link_to admin_users_path(sort: "ldap_uid", dir: @sort == "ldap_uid" && @sort_dir == "asc" ? "desc" : "asc", query: params[:query], count: params[:count]), data: { turbo_frame: "users" }, style: "text-decoration: none; color: inherit;" do %>
|
78
|
+
UID
|
79
|
+
<% if @sort == "ldap_uid" %>
|
80
|
+
<%= @sort_dir == "asc" ? "▲" : "▼" %>
|
81
|
+
<% end %>
|
82
|
+
<% end %>
|
83
|
+
</th>
|
84
|
+
<th>
|
85
|
+
<%= link_to admin_users_path(sort: "employee_id", dir: @sort == "employee_id" && @sort_dir == "asc" ? "desc" : "asc", query: params[:query], count: params[:count]), data: { turbo_frame: "users" }, style: "text-decoration: none; color: inherit;" do %>
|
86
|
+
Employee ID
|
87
|
+
<% if @sort == "employee_id" %>
|
88
|
+
<%= @sort_dir == "asc" ? "▲" : "▼" %>
|
89
|
+
<% end %>
|
90
|
+
<% end %>
|
91
|
+
</th>
|
92
|
+
<th class="min unsorted">Edit</th>
|
93
|
+
<th class="min unsorted">Delete</th>
|
94
|
+
</tr>
|
95
|
+
</thead>
|
96
|
+
<tbody class="highlight">
|
97
|
+
<%= render partial: "ucb_rails_user/users/user", collection: @users %>
|
98
|
+
</tbody>
|
99
|
+
</table>
|
100
|
+
<div class="ucb-rails-user">
|
101
|
+
<%= pagy_nav(@pagy, pagy_url_for: ->(page, pagy) { admin_users_path(page: page, count: params[:count], query: params[:query], sort: @sort, dir: @sort_dir) }).html_safe %>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
<% end %>
|
@@ -1,6 +1,9 @@
|
|
1
|
-
<
|
1
|
+
<div class="ucb-rails-users-table-header">
|
2
|
+
<h1>Users</h1>
|
3
|
+
<h2>Add New User</h2>
|
4
|
+
</div>
|
2
5
|
|
3
|
-
<%= form_tag admin_user_search_path, method: :get,
|
6
|
+
<%= form_tag admin_user_search_path, method: :get, class: "form-inline user-search-form" do %>
|
4
7
|
<%= text_field_tag :first_name, "", placeholder: "First name", class: "form-control" %>
|
5
8
|
<%= text_field_tag :last_name, "", placeholder: "Last name", class: "form-control" %>
|
6
9
|
<%= text_field_tag :employee_id, "", placeholder: "Employee ID", class: "form-control" %>
|
@@ -8,7 +11,7 @@
|
|
8
11
|
<%= link_to "Cancel", admin_users_path, class: "btn btn-default" %>
|
9
12
|
<% end %>
|
10
13
|
|
11
|
-
<div class="ucb-rails-user-loader">
|
14
|
+
<div class="ucb-rails-user-loader" style="display: none;">
|
12
15
|
Loading...
|
13
16
|
</div>
|
14
17
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class="ucb-rails-users-table-header">
|
2
|
+
<h1>Users</h1>
|
3
|
+
<h2>Add New User</h2>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<%= form_tag admin_user_search_path, method: :get, class: "form-inline user-search-form" do %>
|
7
|
+
<%= text_field_tag :first_name, params[:first_name], placeholder: "First name", class: "form-control" %>
|
8
|
+
<%= text_field_tag :last_name, params[:last_name], placeholder: "Last name", class: "form-control" %>
|
9
|
+
<%= text_field_tag :employee_id, params[:employee_id], placeholder: "Employee ID", class: "form-control" %>
|
10
|
+
<%= submit_tag "Search", class: "btn btn-primary" %>
|
11
|
+
<%= link_to "Cancel", admin_users_path, class: "btn btn-default" %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="search-results">
|
15
|
+
<%= render "search_results" %>
|
16
|
+
</div>
|
data/config/importmap.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ucb_rails_user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.
|
4
|
+
version: 8.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Downey
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2025-
|
16
|
+
date: 2025-10-01 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: rails
|
@@ -396,7 +396,9 @@ files:
|
|
396
396
|
- app/views/ucb_rails_user/users/edit.html.erb
|
397
397
|
- app/views/ucb_rails_user/users/index.html.erb
|
398
398
|
- app/views/ucb_rails_user/users/new.html.erb
|
399
|
+
- app/views/ucb_rails_user/users/search.html.erb
|
399
400
|
- app/views/ucb_rails_user/users/search.js.erb
|
401
|
+
- config/importmap.rb
|
400
402
|
- config/initializers/simple_form.rb
|
401
403
|
- config/initializers/simple_form_bootstrap.rb
|
402
404
|
- config/locales/simple_form.en.yml
|