Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
5 changes: 5 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ def send_welcome_instructions
notice: "Invitation sent to #{@user.email}."
end

# Visual reference for admins triaging user account challenges
def flow_diagram
authorize!
end

# =========================================================
# PRIVATE
# =========================================================
Expand Down
3 changes: 3 additions & 0 deletions app/frontend/javascript/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ application.register("tags-combination-highlight", TagsCombinationHighlightContr
import TimeframeController from "./timeframe_controller"
application.register("timeframe", TimeframeController)

import ToggleDetailsController from "./toggle_details_controller"
application.register("toggle-details", ToggleDetailsController)

import ToggleLockController from "./toggle_lock_controller"
application.register("toggle-lock", ToggleLockController)

Expand Down
13 changes: 13 additions & 0 deletions app/frontend/javascript/controllers/toggle_details_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
static targets = ["toggleBtn"]

toggleAll() {
const details = this.element.querySelectorAll("details")
const allOpen = Array.from(details).every(d => d.open)

details.forEach(d => d.open = !allOpen)
this.toggleBtnTarget.textContent = allOpen ? "Expand all" : "Collapse all"
}
}
1 change: 1 addition & 0 deletions app/policies/user_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def process_email_change? = admin?
def confirm_email_manual? = admin?
def process_email_manual? = admin?
def send_welcome_instructions? = admin?
def flow_diagram? = admin?
def search? = admin?
def change_password? = authenticated?
def update_password? = authenticated?
Expand Down
465 changes: 465 additions & 0 deletions app/views/users/flow_diagram.html.erb

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion app/views/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
</h1>
</div>
<div>
<div class="flex gap-2">
<div class="flex gap-2 items-center">
<%= link_to flow_diagram_users_path, class: "text-sm text-gray-500 hover:text-gray-700" do %>
<i class="fa-solid fa-diagram-project"></i> Account flow diagram
<% end %>
<% if allowed_to?(:new?, User) %>
<%= link_to "New #{User.model_name.human.downcase}",
new_user_path,
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
resources :users, only: [ :new, :index, :show, :edit, :update, :create, :destroy ] do
collection do
get :check_duplicates
get :flow_diagram
end
member do
post :send_reset_password_instructions
Expand Down
1 change: 1 addition & 0 deletions spec/views/page_bg_class_alignment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"app/views/admin/ahoy_activities/index.html.erb" => "admin-only bg-blue-100",
"app/views/admin/analytics/index.html.erb" => "admin-only bg-blue-100",
"app/views/bookmarks/tally.html.erb" => "admin-only bg-blue-100",
"app/views/users/flow_diagram.html.erb" => "admin-only bg-blue-100",
"app/views/dedupes/index.html.erb" => "admin-only bg-blue-100",
"app/views/dedupes/preview.html.erb" => "admin-only bg-blue-100",
"app/views/taggings/matrix.html.erb" => "admin-only bg-blue-100",
Expand Down