Context search v1 is finished. Context allowing various configuration is set. Css and templates are clearly set.
authorcavaliet
Thu, 17 Nov 2011 12:07:53 +0100
changeset 36 540607cf3447
parent 35 92ddb5488eb4
child 37 9ba15af20acc
Context search v1 is finished. Context allowing various configuration is set. Css and templates are clearly set.
Controller/WikiTagController.php
DependencyInjection/Configuration.php
Resources/public/css/wikiTag.css
Resources/views/WikiTag/contextSearchDiv.html.twig
Resources/views/WikiTag/documentTags.html.twig
--- a/Controller/WikiTagController.php	Thu Nov 17 11:37:05 2011 +0100
+++ b/Controller/WikiTagController.php	Thu Nov 17 12:07:53 2011 +0100
@@ -71,7 +71,16 @@
         // which is gotten by the jQuery call $('#wikitag_document_id').val() in the page.
         // So the page holding this context search MUST have a input value with this id.
         // We add the reactive selectors
-        $reactive_selectors = $this->container->getParameter("wiki_tag.reactive_selectors");
+        $reac_sel_array = $this->container->getParameter("wiki_tag.reactive_selectors");
+        $reactive_selectors = null;
+        if(array_key_exists($context_name, $reac_sel_array)){
+            if($reac_sel_array[$context_name][0]=='document'){
+                $reactive_selectors = 'document';
+            }
+            else{
+                $reactive_selectors = '"'.join('","',$reac_sel_array[$context_name]).'"';
+            }
+        }
         return $this->render('WikiTagBundle:WikiTag:javascriptForContextSearch.html.twig', array('reactive_selectors' => $reactive_selectors));
     }
 
--- a/DependencyInjection/Configuration.php	Thu Nov 17 11:37:05 2011 +0100
+++ b/DependencyInjection/Configuration.php	Thu Nov 17 12:07:53 2011 +0100
@@ -2,6 +2,8 @@
 
 namespace IRI\Bundle\WikiTagBundle\DependencyInjection;
 
+use Symfony\Component\Config\Definition\ScalarNode;
+
 use Symfony\Component\Config\Definition\Builder\TreeBuilder;
 use Symfony\Component\Config\Definition\ConfigurationInterface;
 
@@ -23,7 +25,6 @@
         $rootNode
             ->children()
                 ->scalarNode('route_for_documents_by_tag')->defaultNull()->end()
-                ->scalarNode('reactive_selectors')->defaultNull()->end()
                 ->scalarNode('document_class')->isRequired()->end()
                 ->scalarNode('document_id_column')->defaultValue('id')->end()
             ->end()
@@ -52,6 +53,11 @@
                         ->end()
                     ->end()
                 ->end()
+                ->arrayNode('reactive_selectors')
+                    ->treatNullLike(array())
+                    ->useAttributeAsKey('name')
+                    ->prototype('variable')
+                    ->end()
             ->end();
         
         return $treeBuilder;
--- a/Resources/public/css/wikiTag.css	Thu Nov 17 11:37:05 2011 +0100
+++ b/Resources/public/css/wikiTag.css	Thu Nov 17 12:07:53 2011 +0100
@@ -88,13 +88,20 @@
 
 
 /* Styles for hidden context div, displayed on text selected */
-#wikitag_context_div {
-    width: 260px;
-    border: 2px;
-    background: #97fefd;
+/* These styles are not meant to be changed. There are needed in order to place and display the context div. */
+.wikitag_context_static {
     display: none;
     float: none;
     position: absolute;
 }
+/* These styles can be changed. */
+.wikitag_context_change {
+    width: 260px;
+    border: 2px;
+    background: #97fefd;
+}
+.wikitag_context_change input {
+    width: 250px;
+}
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/views/WikiTag/contextSearchDiv.html.twig	Thu Nov 17 12:07:53 2011 +0100
@@ -0,0 +1,5 @@
+{# partial display for context search div #}
+<div id="wikitag_context_div" class="wikitag_context_static wikitag_context_change">
+<p>Choisissez le tag à ajouter<span style="float:right" class="wikitag_hand_cursor" id="wikitag_context_close" ><b>X</b></p>
+<p><input type="text" name="wikitag_wp_search_context" id="wikitag_wp_search_context" /></p>
+</div>
\ No newline at end of file
--- a/Resources/views/WikiTag/documentTags.html.twig	Thu Nov 17 11:37:05 2011 +0100
+++ b/Resources/views/WikiTag/documentTags.html.twig	Thu Nov 17 12:07:53 2011 +0100
@@ -10,8 +10,4 @@
 <div id="wikitag_table_container" style="float:left; width: 100%">
   {% include 'WikiTagBundle:WikiTag:tagTable.html.twig' %}
 </div>
-<div id="wikitag_context_div">
-<p>Choisissez le tag à ajouter<span style="float:right" class="wikitag_hand_cursor" id="wikitag_context_close" ><b>X</b></p>
-<p><input type="text" name="wikitag_wp_search_context" id="wikitag_wp_search_context" size="35" /></p>
-</div>
 {% endblock %}