correct document profile propagation in ajax call
authorcavaliet
Tue, 17 Jul 2012 12:22:46 +0200
changeset 104 af79031ee002
parent 102 d1af10ee0aa5
child 105 f370e32d6b96
correct document profile propagation in ajax call
Controller/WikiTagController.php
Resources/views/WikiTag/documentTags.html.twig
--- a/Controller/WikiTagController.php	Mon Jul 16 18:17:21 2012 +0200
+++ b/Controller/WikiTagController.php	Tue Jul 17 12:22:46 2012 +0200
@@ -109,7 +109,7 @@
         
         $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
         //$ordered_tags = null;
-        return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array));
+        return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array, 'profile_name' => $profile_name));
     }
 
     /**
@@ -151,7 +151,7 @@
         }
         // Save datas.
         $em->flush();
-
+        
         return $this->renderDocTags($id_doc, $req->get('wikitag_document_profile'));
     }
 
@@ -389,11 +389,16 @@
      * Generic render partial template
      * @param unknown_type $id_doc
      */
-    public function renderDocTags($id_doc)
+    public function renderDocTags($id_doc, $profile_name="")
     {
-        // Get tags and render the table
+        // Management of profiles for the list of displayed columns and reorder tag button
+        $profile_array = $this->container->getParameter("wiki_tag.document_list_profile");
+        $columns_array = null;
+        if($profile_array!=null && $profile_name!=null && $profile_name!=""){
+            $columns_array = $profile_array[$profile_name];
+        }
         $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
-        return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc));
+        return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array, 'profile_name' => $profile_name));
     }
 
 
--- a/Resources/views/WikiTag/documentTags.html.twig	Mon Jul 16 18:17:21 2012 +0200
+++ b/Resources/views/WikiTag/documentTags.html.twig	Tue Jul 17 12:22:46 2012 +0200
@@ -15,8 +15,8 @@
      {% endif %}
       <span>Ajouter un tag : <input type="text" name="wikitag_wp_search" id="wikitag_wp_search" size="35" /> <span id="wikitag_ok_search" class="wikitag_hand_cursor"><b>OK</b></span></span>
     </div>
-    <input type="hidden" name="wikitag_document_id" value="{{ doc_id }}" id="wikitag_document_id" />
-    <!--input type="hidden" name="wikitag_document_profile" value="profile_name" id="wikitag_document_profile" /-->
+    <input type="hidden" name="wikitag_document_id" value="{{doc_id}}" id="wikitag_document_id" />
+    <input type="hidden" name="wikitag_document_profile" value="{{profile_name}}" id="wikitag_document_profile" />
 </div>
 <div id="wikitag_table_container" class="wikitag_document_table">
   {% include 'WikiTagBundle:WikiTag:tagTable.html.twig' %}