WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org
View all threadsHi all,
I'm trying to add a "broader context" field in the miniview of the autocomplete field (for Places authority).
To do so, I've modified Demand.js in the UI as follow:
fluid.demands("cspace.autocomplete.popup.miniView.renderer", ["cspace.autocomplete.popup.miniView", "place-miniView"], {
options: {
protoTree: {
displayName: {
target: "${miniView-link}",
linktext: "${fields.termDisplayName}"
},
field1:"${fields.broaderContext}" --> line added
}
}
});
So long so good, but problem is that I get the urn value (urn:cspace:smk.dk:placeauthorities:name(place):item:name(broaderplace1381324065669)'broaderplace') ...
instead of the actual value (''broaderplace").
My idea was simply to split the urn value in order to extract the actual value.
I tried to insert some javascript code in Fluid code, in various places (also in Autocomplete.js) but without success - and the documentation available on Fluid is scarce.
Does anyone of you have an idea how to solve this quite simple(?) problem?
Thank you by advance for your help!
Have a nice day.
Cheers,
Sébastien
Hi Sébastien,
We need to do something similar (not using broaderContext, but another
field that contains a refname), so I'll be looking into this in the next
week or two. I'll post to the list what I find.
Thanks,
Ray
On Thu, Oct 10, 2013 at 1:57 AM, Sébastien Brossard <
Sebastien.Brossard@smk.dk> wrote:
Hi all,****
I’m trying to add a “broader context” field in the miniview of the
autocomplete field (for Places authority).****
To do so, I’ve modified Demand.js in the UI as follow:****
fluid.demands("cspace.autocomplete.popup.miniView.renderer",
["cspace.autocomplete.popup.miniView", "place-miniView"], {****
options: {****
protoTree: {****
displayName: {****
target: "${miniView-link}",****
linktext: "${fields.termDisplayName}"****
}, ****
*field1:"${fields.broaderContext}" **à** line added*
}****
}****
});****
So long so good, but problem is that I get the urn value (*
urn:cspace:smk.dk:
placeauthorities:name(place):item:name(broaderplace1381324065669)'broaderplace'
) …***
instead of the actual value (‘’broaderplace”).****
My idea was simply to split the urn value in order to extract the actual
value.****
I tried to insert some javascript code in Fluid code, in various places
(also in Autocomplete.js) but without success – and the documentation
available on Fluid is scarce.****
Does anyone of you have an idea how to solve this quite simple(?) problem?
Thank you by advance for your help!****
Have a nice day.****
Cheers,****
Sébastien****
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Hi Sébastien,
For the configuration you showed above, this should work:
fluid.demands("cspace.autocomplete.popup.miniView.renderer",
["cspace.autocomplete.popup.miniView", "place-miniView"], {
options: {
protoTree: {
displayName: {
target: "${miniView-link}",
linktext: "${fields.termDisplayName}"
},
The documentation around this is truly terrible. The Fluid docs on
ProtoTrees (http://wiki.fluidproject.org/display/docs/ProtoComponent+Types)
shows how to bind a value to a field, which is what this line was doing:
field1: "${fields.broaderContext}"
Nowhere does it say that you can do the same thing in an expanded form:
field1: {
value: "${fields.broaderContext}"
}
I stumbled on that in the documentation about decorators (
http://wiki.fluidproject.org/display/docs/Renderer+Decorators), in the
first example on the page. Once you have that expanded form, you can add a
decorator to the field, in addition to binding a value:
field1: {
value: "${fields.broaderContext}",
decorators: {
type: "fluid",
func: "cspace.util.urnToStringFieldConverter"
}
}
Unfortunately there's no CSpace UI documentation to tell you that the
cspace.util.urnToStringFieldConverter component exists, or that it converts
a refname to a display name. I was vaguely aware that something like that
existed, so I was able to find it.
Ray
On Sun, Oct 13, 2013 at 8:31 PM, Ray Lee rhlee@berkeley.edu wrote:
Hi Sébastien,
We need to do something similar (not using broaderContext, but another
field that contains a refname), so I'll be looking into this in the next
week or two. I'll post to the list what I find.
Thanks,
Ray
On Thu, Oct 10, 2013 at 1:57 AM, Sébastien Brossard <
Sebastien.Brossard@smk.dk> wrote:
Hi all,****
I’m trying to add a “broader context” field in the miniview of the
autocomplete field (for Places authority).****
To do so, I’ve modified Demand.js in the UI as follow:****
fluid.demands("cspace.autocomplete.popup.miniView.renderer",
["cspace.autocomplete.popup.miniView", "place-miniView"], {****
options: {****
protoTree: {****
displayName: {****
target: "${miniView-link}",****
linktext: "${fields.termDisplayName}"****
}, ****
*field1:"${fields.broaderContext}" **à** line added*
}****
}****
});****
So long so good, but problem is that I get the urn value (*
urn:cspace:smk.dk:
placeauthorities:name(place):item:name(broaderplace1381324065669)'broaderplace'
) …***
instead of the actual value (‘’broaderplace”).****
My idea was simply to split the urn value in order to extract the actual
value.****
I tried to insert some javascript code in Fluid code, in various places
(also in Autocomplete.js) but without success – and the documentation
available on Fluid is scarce.****
Does anyone of you have an idea how to solve this quite simple(?) problem?
Thank you by advance for your help!****
Have a nice day.****
Cheers,****
Sébastien****
Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org
Hi Ray,
Fantastic!
Thank you some much for time and your answer.
Cheers,
Sébastien
Fra: Ray Lee [mailto:rhlee@berkeley.edu]
Sendt: 17. oktober 2013 01:25
Til: Sébastien Brossard
Cc: talk@lists.collectionspace.org
Emne: Re: [Talk] Autocomplete, mini-view and Fluid
Hi Sébastien,
For the configuration you showed above, this should work:
fluid.demands("cspace.autocomplete.popup.miniView.renderer", ["cspace.autocomplete.popup.miniView", "place-miniView"], {
options: {
protoTree: {
displayName: {
target: "${miniView-link}",
linktext: "${fields.termDisplayName}"
},
field1: {
value: "${fields.broaderContext}",
decorators: {
type: "fluid",
func: "cspace.util.urnToStringFieldConverter"
}
}
}
}
});
The documentation around this is truly terrible. The Fluid docs on ProtoTrees (http://wiki.fluidproject.org/display/docs/ProtoComponent+Types) shows how to bind a value to a field, which is what this line was doing:
field1: "${fields.broaderContext}"
Nowhere does it say that you can do the same thing in an expanded form:
field1: {
value: "${fields.broaderContext}"
}
I stumbled on that in the documentation about decorators (http://wiki.fluidproject.org/display/docs/Renderer+Decorators), in the first example on the page. Once you have that expanded form, you can add a decorator to the field, in addition to binding a value:
field1: {
value: "${fields.broaderContext}",
decorators: {
type: "fluid",
func: "cspace.util.urnToStringFieldConverter"
}
}
Unfortunately there's no CSpace UI documentation to tell you that the cspace.util.urnToStringFieldConverter component exists, or that it converts a refname to a display name. I was vaguely aware that something like that existed, so I was able to find it.
Ray
On Sun, Oct 13, 2013 at 8:31 PM, Ray Lee <rhlee@berkeley.edumailto:rhlee@berkeley.edu> wrote:
Hi Sébastien,
We need to do something similar (not using broaderContext, but another field that contains a refname), so I'll be looking into this in the next week or two. I'll post to the list what I find.
Thanks,
Ray
On Thu, Oct 10, 2013 at 1:57 AM, Sébastien Brossard <Sebastien.Brossard@smk.dkmailto:Sebastien.Brossard@smk.dk> wrote:
Hi all,
I'm trying to add a "broader context" field in the miniview of the autocomplete field (for Places authority).
To do so, I've modified Demand.js in the UI as follow:
fluid.demands("cspace.autocomplete.popup.miniView.renderer", ["cspace.autocomplete.popup.miniView", "place-miniView"], {
options: {
protoTree: {
displayName: {
target: "${miniView-link}",
linktext: "${fields.termDisplayName}"
},
field1:"${fields.broaderContext}" --> line added
}
}
});
So long so good, but problem is that I get the urn value (urn:cspace:smk.dk:placeauthorities:name(place):item:name(broaderplace1381324065669)'broaderplace') ...
instead of the actual value (''broaderplace").
My idea was simply to split the urn value in order to extract the actual value.
I tried to insert some javascript code in Fluid code, in various places (also in Autocomplete.js) but without success - and the documentation available on Fluid is scarce.
Does anyone of you have an idea how to solve this quite simple(?) problem?
Thank you by advance for your help!
Have a nice day.
Cheers,
Sébastien
Talk mailing list
Talk@lists.collectionspace.orgmailto:Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists.collectionspace.org