forked from wallabag/wallabag
Comment work with annotator v2
- add missing annotator.js file and fix typo - edit & delete routes, started tests - basic tests
This commit is contained in:
committed by
Jeremy Benoist
parent
d3f1a9dc1a
commit
f38e03dc02
@ -9,6 +9,7 @@ use JMS\Serializer\Annotation\Groups;
|
||||
use JMS\Serializer\Annotation\XmlRoot;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Wallabag\UserBundle\Entity\User;
|
||||
use Wallabag\CommentBundle\Entity\Comment;
|
||||
|
||||
/**
|
||||
* Entry.
|
||||
@ -98,11 +99,10 @@ class Entry
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\OneToMany(targetEntity="Wallabag\CommentBundle\Entity\Comment", mappedBy="entry", cascade={"persist", "remove"})
|
||||
* @ORM\JoinTable
|
||||
*
|
||||
* @ORM\Column(name="comments", type="text", nullable=true)
|
||||
*
|
||||
* @Groups({"export_all"})
|
||||
* @Groups({"entries_for_user", "export_all"})
|
||||
*/
|
||||
private $comments;
|
||||
|
||||
@ -366,7 +366,7 @@ class Entry
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return ArrayCollection<Comment>
|
||||
*/
|
||||
public function getComments()
|
||||
{
|
||||
@ -374,11 +374,11 @@ class Entry
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $comments
|
||||
* @param Comment $comment
|
||||
*/
|
||||
public function setComments($comments)
|
||||
public function setComment(Comment $comment)
|
||||
{
|
||||
$this->comments = $comments;
|
||||
$this->comments[] = $comment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
25
src/Wallabag/CoreBundle/Resources/public/themes/_global/js/annotator.min.js
vendored
Normal file
25
src/Wallabag/CoreBundle/Resources/public/themes/_global/js/annotator.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -38,11 +38,13 @@
|
||||
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{{ asset('bundles/wallabagcore/themes/_global/img/appicon/favicon.ico') }}">
|
||||
|
||||
{% block css %}{% endblock %}
|
||||
{% block css %}
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ asset('bundles/wallabagcore/themes/_global/js/jquery-2.0.3.min.js') }}"></script>
|
||||
<script src="{{ asset('bundles/wallabagcore/themes/_global/js/jquery.cookie.js') }}"></script>
|
||||
<script src="{{ asset('bundles/wallabagcore/themes/_global/js/bookmarklet.js') }}"></script>
|
||||
<script src="{{ asset('bundles/wallabagcore/themes/_global/js/annotator.min.js') }}"></script>
|
||||
{% endblock %}
|
||||
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
|
||||
@ -177,6 +177,32 @@ main {
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var app = new annotator.App();
|
||||
app.include(annotator.ui.main, {
|
||||
element: document.querySelector('article')
|
||||
});
|
||||
app.include(annotator.storage.http, {
|
||||
prefix: '',
|
||||
urls: {
|
||||
create: '{{ path('annotations_post_annotation', { 'entry': entry.id }) }}',
|
||||
update: '{{ path('annotations_put_annotation', { 'comment': 'idComment' }) }}',
|
||||
destroy: '{{ path('annotations_delete_annotation', { 'comment': 'idComment' }) }}',
|
||||
search: '{{ path('annotations_get_annotations', { 'entry': entry.id }) }}'
|
||||
}
|
||||
});
|
||||
app
|
||||
.start()
|
||||
.then(function () {
|
||||
app.annotations.load({entry: {{ entry.id }}});
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
Reference in New Issue
Block a user