Author: Jonathan.Wage
Date: 2010-01-11 00:11:15 +0100 (Mon, 11 Jan 2010)
New Revision: 26460

Removed:
   
plugins/sfSympalPlugin/trunk/lib/form/doctrine/sfSympalInlineEditContentForm.class.php
Modified:
   plugins/sfSympalPlugin/trunk/config/app.yml
   
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentSlot.class.php
   plugins/sfSympalPlugin/trunk/test/fixtures/project/data/fresh_test_db.sqlite
   plugins/sfSympalPlugin/trunk/test/unit/DataGridTest.php
   plugins/sfSympalPlugin/trunk/test/unit/ThemeTest.php
Log:
[1.4][sfSympalPlugin][1.0] Making inline edit forms more configurable


Modified: plugins/sfSympalPlugin/trunk/config/app.yml
===================================================================
--- plugins/sfSympalPlugin/trunk/config/app.yml 2010-01-10 22:23:05 UTC (rev 
26459)
+++ plugins/sfSympalPlugin/trunk/config/app.yml 2010-01-10 23:11:15 UTC (rev 
26460)
@@ -1,5 +1,9 @@
 all:
   sympal_config:
+    # Configure default forms used for inline editing slots
+    default_inline_edit_column_form: sfSympalInlineEditContentColumnForm
+    default_inline_edit_slot_form: sfSympalInlineEditContentSlotForm
+
     # Configure the default rendering module and action
     default_rendering_module: sympal_content_renderer
     default_rendering_action: index
@@ -28,6 +32,7 @@
     # Configure the available content templates for the different content types
     # Every content type must have a template named "default_view"
     sfSympalPage:
+      default_inline_edit_column_form: sfSympalPageForm
       content_templates:
         default_view:
           template: sympal_page/view

Deleted: 
plugins/sfSympalPlugin/trunk/lib/form/doctrine/sfSympalInlineEditContentForm.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/form/doctrine/sfSympalInlineEditContentForm.class.php
      2010-01-10 22:23:05 UTC (rev 26459)
+++ 
plugins/sfSympalPlugin/trunk/lib/form/doctrine/sfSympalInlineEditContentForm.class.php
      2010-01-10 23:11:15 UTC (rev 26460)
@@ -1,6 +0,0 @@
-<?php
-
-class sfSympalInlineEditContentForm extends BasesfSympalContentForm
-{
-
-}
\ No newline at end of file

Modified: 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentSlot.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentSlot.class.php
 2010-01-10 22:23:05 UTC (rev 26459)
+++ 
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentSlot.class.php
 2010-01-10 23:11:15 UTC (rev 26460)
@@ -30,7 +30,8 @@
     {
       return $this->_getContentSlotColumnForm();
     } else {
-      return new sfSympalContentSlotForm($this);
+      $className = sfSympalConfig::get('default_inline_edit_slot_form', null, 
'sfSympalInlineEditContentSlotForm');
+      return new $className($this);
     }
   }
 
@@ -41,7 +42,8 @@
 
     if ($contentTable->hasField($this->name))
     {
-      $form = new sfSympalInlineEditContentForm($content);
+      $formClass = sfSympalConfig::get('default_inline_edit_column_form');
+      $form = new $formClass($content);
       $form->useFields(array($this->name));
     }
 
@@ -50,13 +52,14 @@
       $contentTranslationTable = 
Doctrine::getTable('sfSympalContentTranslation');
       if ($contentTranslationTable->hasField($this->name))
       {
-        $form = new sfSympalInlineEditContentForm($content);
+        $formClass = sfSympalConfig::get('default_inline_edit_column_form');
+        $form = new $formClass($content);
         
$form->useFields(array(sfContext::getInstance()->getUser()->getCulture()));
       }      
     }
 
     $contentTypeClassName = $content->getContentTypeClassName();
-    $contentTypeFormClassName = $contentTypeClassName.'Form';
+    $contentTypeFormClassName = sfSympalConfig::get($contentTypeClassName, 
'default_inline_edit_column_form', $contentTypeClassName.'Form');
     $contentTypeTable = Doctrine_Core::getTable($contentTypeClassName);
     if ($contentTypeTable->hasField($this->name))
     {
@@ -67,7 +70,7 @@
     if (sfSympalConfig::isI18nEnabled($contentTypeClassName))
     {
       $contentTypeTranslationClassName = $contentTypeClassName.'Translation';
-      $contentTypeTranslationFormClassName = 
$contentTypeTranslationClassName.'Form';
+      $contentTypeTranslationFormClassName = 
sfSympalConfig::get($contentTypeTranslationClassName, 
'default_inline_edit_column_form', $contentTypeTranslationClassName.'Form');
       $contentTypeTranslationTable = 
Doctrine_Core::getTable($contentTypeTranslationClassName);
       if ($contentTypeTranslationTable->hasField($this->name))
       {

Modified: 
plugins/sfSympalPlugin/trunk/test/fixtures/project/data/fresh_test_db.sqlite
===================================================================
(Binary files differ)

Modified: plugins/sfSympalPlugin/trunk/test/unit/DataGridTest.php
===================================================================
--- plugins/sfSympalPlugin/trunk/test/unit/DataGridTest.php     2010-01-10 
22:23:05 UTC (rev 26459)
+++ plugins/sfSympalPlugin/trunk/test/unit/DataGridTest.php     2010-01-10 
23:11:15 UTC (rev 26460)
@@ -36,6 +36,8 @@
       'c.default_path' => '/pages/:slug',
       'c.theme' => NULL,
       'c.template' => 'default_view',
+      'c.module' => 'sympal_content_renderer',
+      'c.action' => 'index',
       'c.slug' => 'page',
     )
   )

Modified: plugins/sfSympalPlugin/trunk/test/unit/ThemeTest.php
===================================================================
--- plugins/sfSympalPlugin/trunk/test/unit/ThemeTest.php        2010-01-10 
22:23:05 UTC (rev 26459)
+++ plugins/sfSympalPlugin/trunk/test/unit/ThemeTest.php        2010-01-10 
23:11:15 UTC (rev 26460)
@@ -31,16 +31,16 @@
 $t->is($theme->getLayoutPath(), 
$dir.'/test/fixtures/project/apps/sympal/templates/test.php');
 $t->is($theme->getStylesheets(), array('test'));
 $t->is($theme->getJavascripts(), array());
-$t->is(count($sympalContext->getThemeObjects()), 3);
+$t->is(count($sympalContext->getThemeObjects()), 4);
 $theme = $sympalContext->getThemeObject('test');
-$t->is(count($sympalContext->getThemeObjects()), 3);
+$t->is(count($sympalContext->getThemeObjects()), 4);
 try {
   $theme = $sympalContext->getThemeObject('test2');
   $t->fail('Should have thrown exception');
 } catch (Exception $e) {
   $t->pass();
 }
-$t->is(count($sympalContext->getThemeObjects()), 3);
+$t->is(count($sympalContext->getThemeObjects()), 4);
 
 $adminTheme = $sympalContext->getThemeObject('admin');
 $t->is($adminTheme->getStylesheets(), array(

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.


Reply via email to