Skip to content

Commit 38de172

Browse files
committed
Merge remote-tracking branch 'origin/main' into sethherr/passwordless-users
# Conflicts: # app/components/admin/bikes_table/component.rb # app/components/admin/users_table/component.rb # app/components/registrations/show/wrapper/component.rb # app/components/ui/alerts/base/component.html.erb # app/components/ui/alerts/flash_message/component.rb
2 parents c349ee6 + 0776d52 commit 38de172

42 files changed

Lines changed: 1146 additions & 390 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/pr/SKILL.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ Scope specs the same way — the ones covering what the branch changed, never a
3232

3333
Then review the changed files against the repo's `CLAUDE.md` (root and any nested ones in touched directories) and fix anything that doesn't conform — code-style guidelines (functional style, no argument mutation, omitted hash values like `{x:}`, private methods, unabbreviated names, pithy comments), testing conventions, and frontend rules. Only touch lines this branch already changed; don't reformat unrelated code.
3434

35+
Then check the branch's translations for a hardcoded "bike" where the string means the registration's cycle type — a registration is as often an e-scooter, a stroller or a wheelchair:
36+
37+
```bash
38+
git diff "origin/$BASE"...HEAD -- '*.en.yml' 'config/locales/en.yml' | grep -in '^+.*bike'
39+
```
40+
41+
Read each hit. Key names (`about_this_bike:`), the product name ("Bike Index"), and copy that really is bike-only are fine; a value saying "bike" about the registration is not. Fix it by interpolating `%{bike_type}` in the value and passing `bike_type: bike.type` at the call site — `Registrations::Show::CurrentAlerts::ClaimImpound` and `Registrations::Show::WrapperConsumer` are the pattern, and `spec/components/registrations/show/current_alerts/claim_impound/component_spec.rb` shows how to cover it. After hand-editing a `component.en.yml`, run `bundle exec rails prepare_translations``bin/lint` doesn't normalize YAML.
42+
3543
Commit these edits before continuing — step 1's `git merge` needs a clean working tree, and committing here is what lets the step 0 edits ride along the merge as ordinary branch commits (which step 3 then pushes).
3644

3745
### 0.5. Determine the base branch

app/components/admin/bikes_table/component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module BikesTable
88
# checkboxes, and skip_user to drop the owner column.
99
class Component < ApplicationComponent
1010
# Digest of the markup inside the row cache — the cached_markup_digest spec keeps it current
11-
MARKUP_DIGEST = "bf42b49bc8da"
11+
MARKUP_DIGEST = "1556da37892e"
1212

1313
def initialize(bikes:, no_show_header: false, show_serial: false, render_sortable: false,
1414
skip_user: false, render_multi_check: false)

app/components/admin/users_table/component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module UsersTable
66
# render_deleted to show the deleted_at column.
77
class Component < ApplicationComponent
88
# Digest of the markup inside the row cache — the cached_markup_digest spec keeps it current
9-
MARKUP_DIGEST = "ad8db631b5f9"
9+
MARKUP_DIGEST = "d9337123b3b7"
1010

1111
def initialize(users:, render_sortable: false, render_deleted: false)
1212
@users = users

app/components/application_component_preview.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ def lookbook_organization
2424

2525
private
2626

27+
def production_notice(rendered)
28+
render(UI::Alerts::Base::Component.new(kind: :error,
29+
text: "This preview renders a real #{rendered}, so it's disabled in production."))
30+
end
31+
32+
def missing_notice(needed)
33+
render(UI::Alerts::Base::Component.new(kind: :warning,
34+
text: "Nothing to preview — this environment has no #{needed}."))
35+
end
36+
2737
def template
2838
ActionView::Base.new(
2939
ActionView::LookupContext.new(ActionController::Base.view_paths),

app/components/org/search_results/bikes_table/component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module BikesTable
99
# registrations on the show page). Pass render_sortable to enable sort links.
1010
class Component < ApplicationComponent
1111
# Digest of the markup inside the row cache — the cached_markup_digest spec keeps it current
12-
MARKUP_DIGEST = "1d6fe7e5f29d"
12+
MARKUP_DIGEST = "bc3a3249ac5f"
1313

1414
delegate :additional_registration_fields, :column_renames, to: :settings_component
1515

app/components/registrations/show/claim_impound/component.en.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/components/registrations/show/claim_impound/component.html.erb

Lines changed: 0 additions & 47 deletions
This file was deleted.

app/components/registrations/show/claim_impound/component.rb

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
en:
3+
components:
4+
registrations:
5+
show:
6+
current_alerts:
7+
claim_impound:
8+
add_a_stolen_bike: add a stolen %{bike_type}
9+
choose_stolen_bike: Choose stolen %{bike_type}
10+
claim_found_bike: Claim found %{bike_type}
11+
claim_impounded_bike: Claim impounded %{bike_type}
12+
claim_submitted: This claim was submitted
13+
claim_was_status: Your claim was %{status} — you should have received
14+
an email with next steps.
15+
claim_with_this_bike_type: You have a %{status} claim with this %{bike_type}.
16+
does_this_look_like_your_bike: Does this look like your %{bike_type}?
17+
need_stolen_bike_html: You need a stolen %{bike_type} registered to file
18+
a claim — %{add_link}.
19+
no_editing_after_submitting: After submitting, you won't be able to edit
20+
the claim.
21+
open_claim: Open claim
22+
prove_its_yours: Verify your ownership — add details that prove this %{bike_type}
23+
is yours
24+
save_message: Save message
25+
select_your_stolen_bike: Select the stolen %{bike_type} you own that matches
26+
this impound
27+
submit_claim: Submit claim
28+
view_claimed_bike_type: view the claimed %{kind} %{bike_type}
29+
your_claim: Your claim
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<%= render(UI::Alerts::Base::Component.new(kind: alert_kind, header: heading, margin_classes: "")) do %>
2+
<% if impound_claim.present? %>
3+
<% if impound_claim.unsubmitted? %>
4+
<%= form_with(model: impound_claim, url: impound_claim_path(impound_claim), builder: BikeIndexFormBuilder, data: {controller: "csrf-refresh"}) do |form| %>
5+
<%# Required in the browser only - nothing server-side turns an empty claim away %>
6+
<%= render(UI::Forms::Group::Component.new(form_builder: form, attribute: :message, kind: :text_area,
7+
label_text: translation(".prove_its_yours", bike_type: impound_claim.bike_type), required: true,
8+
html_options: {rows: 4})) %>
9+
10+
<%= render(UI::Button::Component.new(text: translation(".save_message"), color: :secondary, kind: :submit)) %>
11+
12+
<%# The same form, so submitting sends the message rather than dropping an unsaved one %>
13+
<div class="tw:mt-4">
14+
<%= render(UI::Button::Component.new(text: translation(".submit_claim"), color: :purple, kind: :submit,
15+
name: form.field_name(:status), value: "submitting")) %>
16+
</div>
17+
18+
<p class="tw:mt-1 tw:text-sm tw:opacity-65">
19+
<%= translation(".no_editing_after_submitting") %>
20+
</p>
21+
<% end %>
22+
<% else %>
23+
<p>
24+
<%= translation(".claim_submitted") %>
25+
<%= render(UI::Time::Component.new(time: impound_claim.submitted_at)) %>
26+
</p>
27+
<% if impound_claim.successful? %>
28+
<p class="tw:mt-2">
29+
<%= translation(".claim_was_status", status: impound_claim.status_humanized) %>
30+
</p>
31+
<% end %>
32+
<% end %>
33+
<% elsif submitting_impound_claim.present? %>
34+
<p>
35+
<%= translation(".claim_with_this_bike_type", status: submitting_impound_claim.status_humanized, bike_type: @bike.type) %>
36+
</p>
37+
<% if submitting_impound_claim.bike_claimed.present? %>
38+
<p class="tw:mt-2">
39+
<%= link_to translation(".view_claimed_bike_type", kind: submitting_impound_claim.kind, bike_type: submitting_impound_claim.bike_claimed.type),
40+
registration_path(submitting_impound_claim.bike_claimed), class: "twlink" %>
41+
</p>
42+
<% end %>
43+
<% elsif sign_in_redirect %>
44+
<%= render(UI::ButtonLink::Component.new(href: sign_in_redirect, text: claim_button_text, color: :purple)) %>
45+
<% elsif stolen_record_options.any? %>
46+
<div
47+
data-controller="ui--collapse"
48+
data-ui--collapse-param-value="contact_owner"
49+
>
50+
<%= render(UI::Button::Component.new(
51+
text: claim_button_text,
52+
color: :purple,
53+
aria: {expanded: false},
54+
data: {"ui--collapse-target": "trigger", action: "ui--collapse#toggle"}
55+
)) %>
56+
57+
<div data-ui--collapse-target="content" class="tw:hidden">
58+
<%= form_with(model: new_impound_claim, url: impound_claims_path, builder: BikeIndexFormBuilder, data: {controller: "csrf-refresh"}) do |form| %>
59+
<%= form.hidden_field :impound_record_id, value: impound_record.id %>
60+
61+
<%= render(UI::Forms::Group::Component.new(form_builder: form, attribute: :stolen_record_id,
62+
label_text: translation(".select_your_stolen_bike", bike_type: @bike.type), required: true)) do %>
63+
<%= render(UI::Forms::Select::Component.new(form_builder: form, attribute: :stolen_record_id,
64+
option_tags: stolen_record_options,
65+
options: {prompt: translation(".choose_stolen_bike", bike_type: @bike.type)},
66+
required: true)) %>
67+
<% end %>
68+
69+
<%= render(UI::Button::Component.new(text: translation(".open_claim"), color: :purple, kind: :submit)) %>
70+
<% end %>
71+
</div>
72+
</div>
73+
<% else %>
74+
<p class="tw:text-sm tw:opacity-65">
75+
<%# underlined because it sits in a text block, where color alone doesn't distinguish it %>
76+
<%= translation(".need_stolen_bike_html", bike_type: @bike.type, add_link: link_to(translation(".add_a_stolen_bike", bike_type: @bike.type), new_register_path(status: "status_stolen"), class: "twlink tw:underline", target: "_blank", rel: "noopener")) %>
77+
</p>
78+
<% end %>
79+
<% end %>

0 commit comments

Comments
 (0)