First step to add context search to a page. Works fine but needs to be improved with several list of selectors.
--- a/.hgsubstate Wed Nov 09 16:28:46 2011 +0100
+++ b/.hgsubstate Tue Nov 15 12:27:02 2011 +0100
@@ -1,1 +1,1 @@
-d2fba1e3b94b958bf762c43dc0bcd8184437675a vendor/bundles/IRI/Bundle/WikiTagBundle
+6c87166b819cb05e9969e532dfb8e4c8b52be0cc vendor/bundles/IRI/Bundle/WikiTagBundle
--- a/app/config/config.yml Wed Nov 09 16:28:46 2011 +0100
+++ b/app/config/config.yml Tue Nov 15 12:27:02 2011 +0100
@@ -76,4 +76,10 @@
description:
type: text
weight: 0.5
+ # reactive_selectors is a list of jQuery selectors meant to let appear tag context search by selecting text.
+ # Example of list : '".any_class", "#any_div .p_class", "#another_selector"'. Write 'document' if you want the whole document/page to be reactive.
+ # Do not define reactive_selectors if you want nothing to be reactive.
+ #reactive_selectors: '".left_sheet", "#p_title .sheet_title", "#p_description"'
+ reactive_selectors: '"#p_title .sheet_title", "#p_description"'
+ #reactive_selectors: 'document'
--- a/src/Company/BaseBundle/Resources/views/Index/tag_embedder.html.twig Wed Nov 09 16:28:46 2011 +0100
+++ b/src/Company/BaseBundle/Resources/views/Index/tag_embedder.html.twig Tue Nov 15 12:27:02 2011 +0100
@@ -9,6 +9,7 @@
{% block js_declaration %}
{{ parent() }}
{% render "WikiTagBundle:WikiTag:addJavascript" %}
+{% render "WikiTagBundle:WikiTag:addJavascriptForContextSearch" with {'context_name': "my_context"} %}
{% endblock %}
{% block content %}
@@ -18,8 +19,8 @@
<div class="left_sheet">
<p><b>HERE ARE THE INFORMATIONS ABOUT A DOCUMENT</b><br/></p>
<p><b>doc id</b><br/>{{doc.id}}</p>
- <p><b>Titre</b><br><span class="sheet_title">{{doc.title}}</span></p>
- <p><b>Description</b><br/>{{doc.description}}</p>
+ <p id="p_title"><b>Titre</b><br><span class="sheet_title">{{doc.title}}</span></p>
+ <p id="p_description"><b>Description</b><br/>{{doc.description}}</p>
</div>
<div class="right_sheet">
<p style="float:right;"><a href="{{ url('document_with_tags', { 'idDoc': (doc.id-1) }) }}"> < </a> - <a href="{{ url('document_with_tags', { 'idDoc': (doc.id+1) }) }}"> > </a></p>