Open gr- opened 8 years ago
investigating "suggest" feature... work in progress
Hey, I wonder if you have any comments after your investigation about the "suggest" feature. I'd also be interested in using it. Cheers!
Once again, most of the required development has been done beforehand. Actually, I (almost) only substituted the following nightmarish piece of code:
if ! tool_config.nil? && ! tool_config['options'].nil? && tool_config['options'].respond_to?('each') && ! (subtool_index = tool_config['options'].find_index { |h| (! h['value'].nil?) && h['value'].to_s == field_name }).nil?
tool_config['options'][subtool_index]['tool_config']
else
tool_config
end
to the existing one in the tool_config_for_field
method of the models/workflow_task.rb
file. The key point is that options are arrays rather than hashes (don't know why). This code allows for indexing terms (at least for me) and then retrieving suggestions as soon as you ask for ('suggest'='common'
).
It is probably straightforward to retrieve suggestions from a url (let say, a separate database document), since you have only to provide with a new basic model (like term
), populate it (by hand?), declare a new route (like the one for classifications#terms
) and glue the pieces of the puzzle like for the common
strategy.
Thank you for this! I needed to use only the arrays option and I did some hacking of my own inside app/assets/javascript/components/transcribe/tools/text-tool/index.cjsx
I'll post a bit later what I did. This is such a useful project, pity that the sources are not well documented.
Is there any way to provide with completion from a finite set of predefined values (e.g. list of author names) as a transcription tool? Ultimately, it would also be possible to add new entries on the fly. It would greatly help the user to converge to the right transcription in many situations.