caxy/annotation-bundle

Implementation of Annotator(http://okfnlabs.org/annotator/)

Installs: 4 366

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 38

Forks: 2

Open Issues: 1

Type:symfony-bundle

dev-master 2015-06-23 19:39 UTC

This package is auto-updated.

Last update: 2024-12-22 07:43:26 UTC


README

Implementation of Annotator (http://okfnlabs.org/annotator/)

Prerequisites

This version of the bundle requires Symfony 2.2, jQuery, and Doctrine.

Installation

  1. Download CaxyAnnotationBundle using composer
  2. Enable the Bundle
  3. Configure the CaxyAnnotationBundle
  4. Import CaxyAnnotationBundle routing
  5. Update your database schema
  6. Initialize CaxyAnnotation on the pages needed

Step 1: Download CaxyAnnotationBundle using composer

Add CaxyAnnotationBundle in your composer.json:

{
    "require": {
        "caxy/annotation-bundle": "dev-master"
    }
}

Now tell composer to download the bundle by running the command:

$ php composer.phar update caxy/annotation-bundle

Composer will install the bundle to your project's vendor/caxy directory.

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Caxy\AnnotationBundle\CaxyAnnotationBundle(),
    );
}

Step 3: Configure the CaxyAnnotationBundle

app/config/caxy/annotation.yml

caxy_annotation:
    selector: ".annotation"
    plugins: ['store']
  • plugins is optional and currently only the store plugin is supported

Step 4: Import CaxyAnnotationBundle routing files

Import the config file for the annotation

# app/config/config.yml

- { resource: caxy/annotation.yml }

Next import the CaxyAnnotationBundle routing files.

In YAML:

# app/config/routing.yml

caxy_annotation:
    resource: "@CaxyAnnotationBundle/Resources/config/routing/routing.yml"

Step 5: Update your database schema

  • Updating your schema is only needed if you are using the store plugin. If you aren't, skip to Step 6.

Now that the bundle is configured, the last thing you need to do is update your database schema.

For ORM run the following command.

$ php app/console doctrine:schema:update --force

Step 6: Initialize CaxyAnnotation on the pages needed.

Now that the CaxyAnnotationBundle is activated and configured, you can use it by adding the following to any twig view:

{{ annotation_init() }}

And add an html container with the selector added to the config in Step 3 ex:

  • If using the store plugin enabled in the config, custom metadata can be added and passed with the regular data
  • ex: {{ annotation_init({'metadata': {'productId': 11}}) }}