talk@lists.collectionspace.org

WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org

View all threads

Using new term lists to add/replace fields in UI

PT
Peter Tucker
Wed, May 30, 2018 5:52 PM

Hi everyone,

I've been researching to find how to do the following actions related to
term-lists/vocabulary:

  • Editing a regular String field in the UI to instead be a dropdown
    selector that uses a term list for possible values.

  • Having dropdown selectors using specific vocabularies based on the
    selected value of a specific field:
    o For example, in the Cataloging record in the Repatriation and
    NAGPRA Compliance Information section. For 'NAGPRA inventory'
    field, if you picked 'Inventory 1' , then only certain values
    would show up in 'Museum's NAGPRA category det.' rather than the
    full list of values you see now by default.
    o The best guess I have is to make multiple term lists, one for
    "if Inventory 1 is selected" and one for "if Inventory 2 is
    selected", and use jquery/javascript to check on which term list
    to use, I just don't know where to implement this (and again a
    rough guess)
    o I also looked up this:
    https://wiki.collectionspace.org/display/DOC/How+to+add+a+dynamic+term+list

      + This shows how to add new lists that can be viewed in the
        Term List Management section, but I didn't see anything on
        how to apply these new lists to fields in Cataloging.
    

Has anyone already done this? Wondering what the best practice is for
accomplishing these tasks.

Thank you,
Peter Tucker
Granite Horizon

Hi everyone, I've been researching to find how to do the following actions related to term-lists/vocabulary: * Editing a regular String field in the UI to instead be a dropdown selector that uses a term list for possible values. * Having dropdown selectors using specific vocabularies based on the selected value of a specific field: o For example, in the Cataloging record in the Repatriation and NAGPRA Compliance Information section. For 'NAGPRA inventory' field, if you picked 'Inventory 1' , then only certain values would show up in 'Museum's NAGPRA category det.' rather than the full list of values you see now by default. o The best guess I have is to make multiple term lists, one for "if Inventory 1 is selected" and one for "if Inventory 2 is selected", and use jquery/javascript to check on which term list to use, I just don't know where to implement this (and again a rough guess) o I also looked up this: https://wiki.collectionspace.org/display/DOC/How+to+add+a+dynamic+term+list + This shows how to add new lists that can be viewed in the Term List Management section, but I didn't see anything on how to apply these new lists to fields in Cataloging. Has anyone already done this? Wondering what the best practice is for accomplishing these tasks. Thank you, Peter Tucker Granite Horizon
RL
Ray Lee
Thu, May 31, 2018 11:12 PM

Hi Peter,
What version of CollectionSpace are you using?

Ray

On Wed, May 30, 2018 at 10:53 AM Peter Tucker <
peter.tucker@granitehorizon.com> wrote:

Hi everyone,

I've been researching to find how to do the following actions related to
term-lists/vocabulary:

- Editing a regular String field in the UI to instead be a dropdown
selector that uses a term list for possible values.
- Having dropdown selectors using specific vocabularies based on the
selected value of a specific field:
   - For example, in the Cataloging record in the Repatriation and
   NAGPRA Compliance Information section. For 'NAGPRA inventory' field, if you
   picked 'Inventory 1' , then only certain values would show up in 'Museum's
   NAGPRA category det.' rather than the full list of values you see now by
   default.
   - The best guess I have is to make multiple term lists, one for "if
   Inventory 1 is selected" and one for "if Inventory 2 is selected", and use
   jquery/javascript to check on which term list to use, I just don't know
   where to implement this (and again a rough guess)
   - I also looked up this:
   https://wiki.collectionspace.org/display/DOC/How+to+add+a+dynamic+term+list

   - This shows how to add new lists that can be viewed in the Term
      List Management section, but I didn't see anything on how to apply these
      new lists to fields in Cataloging.

Has anyone already done this? Wondering what the best practice is for
accomplishing these tasks.

Thank you,
Peter Tucker
Granite Horizon


Talk mailing list
Talk@lists.collectionspace.org

http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org

Hi Peter, What version of CollectionSpace are you using? Ray On Wed, May 30, 2018 at 10:53 AM Peter Tucker < peter.tucker@granitehorizon.com> wrote: > Hi everyone, > > I've been researching to find how to do the following actions related to > term-lists/vocabulary: > > - Editing a regular String field in the UI to instead be a dropdown > selector that uses a term list for possible values. > - Having dropdown selectors using specific vocabularies based on the > selected value of a specific field: > - For example, in the Cataloging record in the Repatriation and > NAGPRA Compliance Information section. For 'NAGPRA inventory' field, if you > picked 'Inventory 1' , then only certain values would show up in 'Museum's > NAGPRA category det.' rather than the full list of values you see now by > default. > - The best guess I have is to make multiple term lists, one for "if > Inventory 1 is selected" and one for "if Inventory 2 is selected", and use > jquery/javascript to check on which term list to use, I just don't know > where to implement this (and again a rough guess) > - I also looked up this: > https://wiki.collectionspace.org/display/DOC/How+to+add+a+dynamic+term+list > > - This shows how to add new lists that can be viewed in the Term > List Management section, but I didn't see anything on how to apply these > new lists to fields in Cataloging. > > Has anyone already done this? Wondering what the best practice is for > accomplishing these tasks. > > Thank you, > Peter Tucker > Granite Horizon > _______________________________________________ > Talk mailing list > Talk@lists.collectionspace.org > > http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org >
PT
Peter Tucker
Fri, Jun 1, 2018 6:10 PM

Hi Ray,

I am using 4.5 right now, but I imagine I might do something similar in
the near future for 5.0 as well

-Peter

On 05/31/2018 04:12 PM, Ray Lee wrote:

Hi Peter,
What version of CollectionSpace are you using?

Ray

On Wed, May 30, 2018 at 10:53 AM Peter Tucker
<peter.tucker@granitehorizon.com
mailto:peter.tucker@granitehorizon.com> wrote:

 Hi everyone,

 I've been researching to find how to do the following actions
 related to term-lists/vocabulary:

   * Editing a regular String field in the UI to instead be a
     dropdown selector that uses a term list for possible values.
   * Having dropdown selectors using specific vocabularies based on
     the selected value of a specific field:
       o For example, in the Cataloging record in the Repatriation
         and NAGPRA Compliance Information section. For 'NAGPRA
         inventory' field, if you picked 'Inventory 1' , then only
         certain values would show up in 'Museum's NAGPRA category
         det.' rather than the full list of values you see now by
         default.
       o The best guess I have is to make multiple term lists, one
         for "if Inventory 1 is selected" and one for "if Inventory
         2 is selected", and use jquery/javascript to check on
         which term list to use, I just don't know where to
         implement this (and again a rough guess)
       o I also looked up this:
         https://wiki.collectionspace.org/display/DOC/How+to+add+a+dynamic+term+list

           + This shows how to add new lists that can be viewed in
             the Term List Management section, but I didn't see
             anything on how to apply these new lists to fields in
             Cataloging.

 Has anyone already done this? Wondering what the best practice is
 for accomplishing these tasks.

 Thank you,
 Peter Tucker
 Granite Horizon

 _______________________________________________
 Talk mailing list
 Talk@lists.collectionspace.org <mailto:Talk@lists.collectionspace.org>
 http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Hi Ray, I am using 4.5 right now, but I imagine I might do something similar in the near future for 5.0 as well -Peter On 05/31/2018 04:12 PM, Ray Lee wrote: > Hi Peter, > What version of CollectionSpace are you using? > > Ray > > On Wed, May 30, 2018 at 10:53 AM Peter Tucker > <peter.tucker@granitehorizon.com > <mailto:peter.tucker@granitehorizon.com>> wrote: > > Hi everyone, > > I've been researching to find how to do the following actions > related to term-lists/vocabulary: > > * Editing a regular String field in the UI to instead be a > dropdown selector that uses a term list for possible values. > * Having dropdown selectors using specific vocabularies based on > the selected value of a specific field: > o For example, in the Cataloging record in the Repatriation > and NAGPRA Compliance Information section. For 'NAGPRA > inventory' field, if you picked 'Inventory 1' , then only > certain values would show up in 'Museum's NAGPRA category > det.' rather than the full list of values you see now by > default. > o The best guess I have is to make multiple term lists, one > for "if Inventory 1 is selected" and one for "if Inventory > 2 is selected", and use jquery/javascript to check on > which term list to use, I just don't know where to > implement this (and again a rough guess) > o I also looked up this: > https://wiki.collectionspace.org/display/DOC/How+to+add+a+dynamic+term+list > > + This shows how to add new lists that can be viewed in > the Term List Management section, but I didn't see > anything on how to apply these new lists to fields in > Cataloging. > > Has anyone already done this? Wondering what the best practice is > for accomplishing these tasks. > > Thank you, > Peter Tucker > Granite Horizon > > _______________________________________________ > Talk mailing list > Talk@lists.collectionspace.org <mailto:Talk@lists.collectionspace.org> > http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org >
RL
Ray Lee
Mon, Jun 4, 2018 5:41 AM

Hi Peter,
In 4.5 you'll need to configure the application layer:
https://wiki.collectionspace.org/display/DOC/Configuring+CollectionSpace%27s+Application+Layer+-+An+Overview

For the field you want to change, add the autocomplete and ui-type
attributes. autocomplete should be set to the id of the vocabulary, and
ui-type should be set to enum. Here's an example of how a field that uses a
term list is configured:
https://github.com/collectionspace/application/blob/master/tomcat-main/src/main/resources/defaults/base-procedure-valuationcontrol.xml#L57.
You'll want to change the configuration of the field you're interested in
to look like that.

In 5.0 you'll start by doing the same application layer config as in 4.5,
and add a bit of additional UI config.

In 4.5 making the term list change based on other field values will be
pretty involved. You'll probably want to start by looking at TermList.js in
the ui code. What you want to do has some similarities to computed fields,
which are fields where the value is computed from the value of other
fields; you want the id of the bound term list to be computed from the
value of other fields. So ComputedField.js might be helpful to see how to
observe changes in field values. If/when you want to do this in 5.0, I can
offer more guidance, since I know that code better.

Ray

On Fri, Jun 1, 2018 at 11:10 AM Peter Tucker <
peter.tucker@granitehorizon.com> wrote:

Hi Ray,

I am using 4.5 right now, but I imagine I might do something similar in
the near future for 5.0 as well

-Peter

On 05/31/2018 04:12 PM, Ray Lee wrote:

Hi Peter,
What version of CollectionSpace are you using?

Ray

On Wed, May 30, 2018 at 10:53 AM Peter Tucker <
peter.tucker@granitehorizon.com> wrote:

Hi everyone,

I've been researching to find how to do the following actions related to
term-lists/vocabulary:

- Editing a regular String field in the UI to instead be a dropdown
selector that uses a term list for possible values.
- Having dropdown selectors using specific vocabularies based on the
selected value of a specific field:
   - For example, in the Cataloging record in the Repatriation and
   NAGPRA Compliance Information section. For 'NAGPRA inventory' field, if you
   picked 'Inventory 1' , then only certain values would show up in 'Museum's
   NAGPRA category det.' rather than the full list of values you see now by
   default.
   - The best guess I have is to make multiple term lists, one for
   "if Inventory 1 is selected" and one for "if Inventory 2 is selected", and
   use jquery/javascript to check on which term list to use, I just don't know
   where to implement this (and again a rough guess)
   - I also looked up this:
   https://wiki.collectionspace.org/display/DOC/How+to+add+a+dynamic+term+list

   - This shows how to add new lists that can be viewed in the Term
      List Management section, but I didn't see anything on how to apply these
      new lists to fields in Cataloging.

Has anyone already done this? Wondering what the best practice is for
accomplishing these tasks.

Thank you,
Peter Tucker
Granite Horizon


Talk mailing list
Talk@lists.collectionspace.org

http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org

Hi Peter, In 4.5 you'll need to configure the application layer: https://wiki.collectionspace.org/display/DOC/Configuring+CollectionSpace%27s+Application+Layer+-+An+Overview For the field you want to change, add the autocomplete and ui-type attributes. autocomplete should be set to the id of the vocabulary, and ui-type should be set to enum. Here's an example of how a field that uses a term list is configured: https://github.com/collectionspace/application/blob/master/tomcat-main/src/main/resources/defaults/base-procedure-valuationcontrol.xml#L57. You'll want to change the configuration of the field you're interested in to look like that. In 5.0 you'll start by doing the same application layer config as in 4.5, and add a bit of additional UI config. In 4.5 making the term list change based on other field values will be pretty involved. You'll probably want to start by looking at TermList.js in the ui code. What you want to do has some similarities to computed fields, which are fields where the value is computed from the value of other fields; you want the id of the bound term list to be computed from the value of other fields. So ComputedField.js might be helpful to see how to observe changes in field values. If/when you want to do this in 5.0, I can offer more guidance, since I know that code better. Ray On Fri, Jun 1, 2018 at 11:10 AM Peter Tucker < peter.tucker@granitehorizon.com> wrote: > Hi Ray, > > I am using 4.5 right now, but I imagine I might do something similar in > the near future for 5.0 as well > > -Peter > > On 05/31/2018 04:12 PM, Ray Lee wrote: > > Hi Peter, > What version of CollectionSpace are you using? > > Ray > > On Wed, May 30, 2018 at 10:53 AM Peter Tucker < > peter.tucker@granitehorizon.com> wrote: > >> Hi everyone, >> >> I've been researching to find how to do the following actions related to >> term-lists/vocabulary: >> >> - Editing a regular String field in the UI to instead be a dropdown >> selector that uses a term list for possible values. >> - Having dropdown selectors using specific vocabularies based on the >> selected value of a specific field: >> - For example, in the Cataloging record in the Repatriation and >> NAGPRA Compliance Information section. For 'NAGPRA inventory' field, if you >> picked 'Inventory 1' , then only certain values would show up in 'Museum's >> NAGPRA category det.' rather than the full list of values you see now by >> default. >> - The best guess I have is to make multiple term lists, one for >> "if Inventory 1 is selected" and one for "if Inventory 2 is selected", and >> use jquery/javascript to check on which term list to use, I just don't know >> where to implement this (and again a rough guess) >> - I also looked up this: >> https://wiki.collectionspace.org/display/DOC/How+to+add+a+dynamic+term+list >> >> - This shows how to add new lists that can be viewed in the Term >> List Management section, but I didn't see anything on how to apply these >> new lists to fields in Cataloging. >> >> Has anyone already done this? Wondering what the best practice is for >> accomplishing these tasks. >> >> Thank you, >> Peter Tucker >> Granite Horizon >> _______________________________________________ >> Talk mailing list >> Talk@lists.collectionspace.org >> >> http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org >> > >