[annotator-dev] How to bypass AnnotateIt and use local storage
David Fox
dvdfox at gmail.com
Fri Aug 22 13:41:20 UTC 2014
Hi Randall,
Thanks very much for your response. It is now writing to my Elasticsearch
instance, though I think this just raised about a dozen more questions for
me regarding the Auth plugin. I've turned it off for now. Here's where I
ended up:
jQuery(function ($)
{
$('#content').annotator().annotator('setupPlugins',
{},
{
Auth: false,
Store:
{
prefix: 'http://localhost:5000',
annotationData:
{
'uri': 'http://localhost/test'
},
loadFromSearch:
{
'limit': 20,
'uri': 'http://localhost/test'
},
urls:
{
create: '/annotations',
update: '/annotations/:id',
destroy: '/annotations/:id',
search: '/search'
}
}
}).data('annotator');
});
If I want to add another plugin - do I follow the same method by just
adding it after Store and overriding the default settings?
Again, thank you - I was very happy to see my annotations in the database.
Very cool.
David
--David
On Thu, Aug 21, 2014 at 8:07 PM, Randall Leeds <tilgovi at hypothes.is> wrote:
> I think the issue is that `setupPlugins`, which comes from the kitchensink
> plugin, is setting up a group of default plugins and options. The Store
> plugin is already loaded by the time you try to load it explicitly, with
> the default settings for annotateit.
>
> These are the defaults:
>
> ```
> pluginConfig
> =
>
> Tags:
> {}
>
>
> Filter:
>
> filters:
> [
>
> {label: Annotator._t('User'), property:
> 'user'}
>
> {label: Annotator._t('Tags'), property:
> 'tags'}
>
>
> ]
>
> Auth:
> tokenUrl: config.tokenUrl or 'http://annotateit.org/api/token'
> Store:
> prefix: config.storeUrl or 'http://annotateit.org/api'
> annotationData:
> uri: uri
> loadFromSearch:
> uri: uri
> ```
>
> You can pass an additional argument to that `setupPlugins` call with a
> `storeUrl` property, or you could override the entire set of Store options
> by specifying a third argument, an options object that will get merged with
> this config, where you could set prefix directly in a `Store` property.
>
>
> On Thu, Aug 21, 2014 at 1:41 PM, David Fox <dvdfox at gmail.com> wrote:
>
>> Hello all,
>>
>> I'm having trouble getting the Store plugin up and running. Here's what
>> I've managed to do so far:
>>
>> - Downloaded annotator-full.1.2.7
>> - Installed annotator-store and pointed it at my local Elasticsearch
>> - Verified that all of the Storage API endpoints are working, e.g.
>> http://localhost:5000/search
>> - Added the plugin to the page with the following javascript
>>
>> jQuery(function ($) {
>> var content =
>> $('#content').annotator().annotator('setupPlugins').data('annotator');
>> content.annotator('addPlugin', 'Store', {
>> prefix: 'http://localhost:5000',
>> annotationData: {
>> 'uri': 'http://localhost/test'
>> },
>> loadFromSearch: {
>> 'limit': 20,
>> 'uri': 'http://localhost/test'
>> },
>> urls: {
>> create: '/annotations',
>> update: '/annotations/:id',
>> destroy: '/annotations/:id',
>> search: '/search'
>> }
>> });
>> });
>>
>> And here's what works:
>>
>> - I can make annotations to my content
>> - The navigate and filter menus appear on my page
>> - If I'm logged into my AnnotateIt account my annotations are saved
>> with my AnnotateIt account and can be retrieved
>>
>> It's this last point that I'm struggling with - I'm not sure why it is
>> defaulting to AnnotateIt storage. If I log out of my AnnotateIt account it
>> will no longer allow me to create annotations. I thought all I needed to do
>> was to point the Plugin at my Search API via the prefix property, but
>> evidently I missed a step. Any ideas what I'm missing?
>>
>> Please forgive me if the Javascript is way off; it's not something I'm
>> totally comfortable with yet.
>>
>> Thanks for the help!
>> David Fox
>>
>> _______________________________________________
>> annotator-dev mailing list
>> annotator-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/annotator-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140822/31a54d67/attachment-0004.html>
More information about the annotator-dev
mailing list