ArctosDB / arctos

Arctos is a museum collections management system
https://arctos.database.museum
60 stars 13 forks source link

"define" links need to be altered to make use of the new urls created by the "link" function #3857

Closed Jegelewicz closed 2 years ago

Jegelewicz commented 3 years ago

@dustymc how does the getCTdoc thingee work? Right now links to terms when using the "define" function don't take you to the term in question because the url generated includes an "=" instead of a "#". Also, I'd like to use this in some other places, but am not 100% sure how to make it work. (Specifically right now for taxonomy source and taxonomy terms).

dustymc commented 3 years ago

getCTdoc(table,value), value is optional - function updated

Jegelewicz commented 3 years ago

Trying to make this work here

image

but it doesn't DO anything. What am I doing wrong?

<span class="infoLink" onclick="getCtDoc('cttaxonomy_source');">Define</span>
dustymc commented 3 years ago

Woops - reload.

Jegelewicz commented 3 years ago

Noice. I am going to run the options for "defining" this stuff by the taxonomy committee tomorrow. I like this one the best because it is responsive and if we really start using it everywhere people might get to know it better.

Jegelewicz commented 3 years ago

OK - but I need to add a value if I want this be responsive? Tried this, but it doesn't work.

<span class="infoLink" onclick="getCtDoc('cttaxonomy_source',SpecData.souce.value);">Define</span>
dustymc commented 3 years ago

add a value

Yea it's worth doing - doesn't matter if there are ~a dozen to sort through, this could realistically grow to where the anchor is necessary.

document.getElementById("fld_id").value

or if you like jquery

$("#fld_id").val()

I've probably got antique form.field.... references hanging around, if possible everything should get modernized to have and use IDs.

Jegelewicz commented 3 years ago

OK - me being dense, but I tried

<span class="infoLink" onclick="getCtDoc('cttaxonomy_source', document.getElementById("fld_id").value)";>Define</span>

and

<span class="infoLink" onclick="getCtDoc('cttaxonomy_source', document.getElementById("source").value)";>Define</span>

but that doesn't work.

dustymc commented 3 years ago

what form are you on?

dustymc commented 3 years ago

first example you need actual ID

second youre mixing ' and "

Jegelewicz commented 3 years ago

mixing ' and "

hope that's it! fixed to using '

what form are you on?

clone classification into a new name

Jegelewicz commented 3 years ago

OK, finally got this to work, but it only works sporadically. Once you use the "Define" with any given term, the next time you use it (without exiting the form) you just get the code table, not the specific term you are looking at.

dustymc commented 3 years ago
Screen Shot 2021-08-17 at 2 05 41 PM

Devtools shows a mangled compile, which is about always invalid syntax.

            <span class="infoLink" onclick="getCtDoc('cttaxonomy_source', document.getElementById('taxonomy_source').value)";>Define</span>

the semicolon is lost

    <span class="infoLink" onclick="getCtDoc('cttaxonomy_source', document.getElementById('taxonomy_source').value);">Define</span>
Jegelewicz commented 3 years ago

Thank you! I have learned a ton the last two days!!!

Jegelewicz commented 3 years ago

Should I make it my mission to get all of these working consistently? And perhaps adding them where they are missing?

dustymc commented 3 years ago

Here's a lesson: sometimes I'm full of crap....

getElementById is wonky with selects, I changed it to jquery which is what I usually use - it abstracts the details. Now my replace is being weird with multiple not-alphanumeric, but I think the html parts are happy.

Jegelewicz commented 3 years ago

Coolio - so now this is the path?

<span class="infoLink" onclick="getCtDoc('cttaxonomy_source', $('##source').val());">Define</span>
dustymc commented 3 years ago

path

Err - until its not.....

I threw together a new function that should be a little less convoluted to use, and will be easier to update when it turns out we needed to sanitize or something.

<span class="infoLink" onclick="getCtDocVal('cttaxonomy_source','source');">Define</span>

cttaxonomy_source is the code table, same as the old

source is the ID of the element

should work the same as the old, just avoids the need to pass values around. It does rely on ID, so don't use it in any antique forms that don't have that.

As far as sprinkling this around, I want to emphatically say "yes" BUT I don't know if anyone uses them. (I suppose we should have a creepy click-tracker, but we don't.) We've spent a ridiculous amount of effort getting good documentation and making it easy to access, and I really have no idea if any of that's been effective or not. So still yes, unless you have a better idea for making the documentation hard to avoid, I suppose.

Jegelewicz commented 3 years ago

don't use it in any antique forms that don't have that.

How can I identify forms that don't?

As far as sprinkling this around, I want to emphatically say "yes" BUT I don't know if anyone uses them.

I'm going to discuss this with taxonomy committee tomorrow and if I can fit it in I'll try to get code table committee to look too. If people think this is a nice thing, then a newsletter article and the occasional Tweet about it might get it used more often. I think it is really great to have that code table pop up, but I may be one of the few who ever looks at the code tables....

Jegelewicz commented 3 years ago

BTW - this isn't working in either of these places:

<span class="infoLink" onclick="getCtDocVal('cttaxon_name_type', 'taxon_name_type');">Define</span>

image

<span class="infoLink" onclick="getCtDocVal('cttaxon_relation', 'TAXON_RELATIONSHIP');">Define</span>

image

Possibly because I don't know the correct thing to use in "value". Also, does capitalization matter? Previously some things were caps and some not, but either they were working or nobody noticed they weren't.

dustymc commented 3 years ago
Screen Shot 2021-08-18 at 8 29 08 AM

https://www.oreilly.com/library/view/javascript-the-definitive/0596000480/ch02s02.html