-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project aliases #2644
base: main
Are you sure you want to change the base?
Project aliases #2644
Conversation
Thanks Nimmo! This is much better. More work to go, but this feels like a good first cut. |
|
Will this PR:
|
@JoeCohen This PR is just going to do the basic CRUD for ProjectAliases and apply them to values in project field slips when they get saved. Once we're sure they are reasonable, then adding a facility for bulk creation of users with aliases for a specific project makes sense. I'm not sure about whether it's worth doing the type ahead bit since the point is to make these aliases short enough that they are really easy to type. For example, if the walks at "1", "2", ... "15" and the users are "NJW", "JDC", and "NS" is there any need for type ahead? |
I was thinking about people not entering the the alias on the Field Slip:
- Field slip has "Collector: Richard Bingly"
- Recorder types something like "Richard Bingl" and type ahead shows
"Richard Bingle".
Also thinking about adding aliases on the fly.
- Recorder types Collector name as it appears (or seems to appear).
- Type ahead shows nothing
- Recorder consults a reliable list of participants, finds that
participant, adds an alias.
…On Sat, Jan 18, 2025 at 3:24 AM Nathan Wilson ***@***.***> wrote:
@JoeCohen <https://github.com/JoeCohen> This PR is just going to do the
basic CRUD for ProjectAliases and apply them to values in project field
slips when they get saved. Once we're sure they are reasonable, then adding
a facility for bulk creation of users with aliases for a specific project
makes sense. I'm not sure about whether it's worth doing the type ahead bit
since the point is to make these aliases short enough that they are really
easy to type. For example, if the walks at "1", "2", ... "15" and the users
are "NJW", "JDC", and "NS" is there any need for type ahead?
—
Reply to this email directly, view it on GitHub
<#2644 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALDFFFMLP454ARWYZQJUL2LI2YLAVCNFSM6AAAAABU6PSMFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJZGY3TQMJYGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
action: "autocompleter#swap" }) %> | ||
</div> | ||
|
||
<%= autocompleter_hidden_field(form:, type:) %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs the arg hidden_value: @project.location_id
or whichever should be prefilled.
I anticipate an issue here, because if I understand correctly you're asking for the stimulus controller to do something magical that it does not yet have the ability to do. There is only ever one hidden field and one field in the HTML, and although the type can swap only the initial values can be prefilled.
If you want each type's default option (whether Location or User) to be prefilled if the user changes back and forth in the select, it seems we will need to store both of these hidden prefill values as data attributes on the Stimulus root autocompleter element, as something like data-hidden-value-location
and data-hidden-value-user
.
Then we will need to add a mechanism to the Stimulus autocompleter controller swap
function that checks for the appropriate prefill value of the new autocompleter type when swapping, and fills it in the hidden field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using:
<%= autocompleter_hidden_field(form:, type:, hidden_value: project_alias.target_id) %>
which seems to be working fine. If you think there's still an issue, let me know how to see it.
@JoeCohen I don't understand your "Richard Bingl" case. Are there two users? Or are you saying that the completed names shows somehow? For example if I type "NJW" somewhere it shows "Nathan Wilson". My worry about adding complexity here is that my own experience and the experience from Jess Evans is that the UI is already too slow. I've been thinking about how to speed it up. It might work out since one of my thoughts is to send the browser the info all the aliases when the page loads so the browser side could display the full name/login without a round trip to the server. Nimmo and I did look at this at the current autocompleter is not behaving as expected since it does a server round trip every time you add a letter. I think this is the main source of slowness on this form. Regarding adding "aliases on the fly", that's a good idea. I need to think about how that would work in the UI. I am thinking about listing the aliases on the Members and Locations tabs. I've realized that users and locations can and may often have more than one alias. |
"Richard Bing" case.
|
I think the described "Richard Bing" behavior is already implemented now that the default user format is "Full Name (login)". However, the problem this creates is that now you cannot autocomplete using the login. For example Bill Yule is "Bill (boletebill)". To get the autocompleter to find him you need to type "Bill (bol" and it is unlikely that that info is going to be on the field slip. Aliases at least help with this since we could create aliases for him for "BY" and "Bill Yule". It turns out that his login already operates as an alias. I do think the translation of an alias should show up in the UI via JavaScript, but I haven't implemented that yet. Is there more to your suggestion that I'm missing? |
@@ -212,6 +212,7 @@ export default class extends Controller { | |||
// to refresh the primer (as with location_containing a changed lat/lng). | |||
// | |||
swap({ detail }) { | |||
console.log("swap called"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this Stimulus controller has a method verbose
. If you switch your
console.log("swap called")
to
this.verbose("swap called")
and then uncomment the actual method body of verbose
, it will log a whole trace of what it's executing (as defined by wherever Jason and I left lines that say this.verbose("Say something");
However that may give you more info than you want.
This implements a feature where project admins can define a set of "aliases" for users and locations. E.g.,
NJW
represents the usernathan
orWalk 10
represents the locationUSA, Massachusetts, Wellfleet, Marconi Beach
. The aliases only work in the context of the project (specifically when filling in field slip forms).