Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support for show action (with_show: true)

  • Loading branch information...
commit 8111e1280589d972fd53f50896b9e5d1f879f4a2 1 parent 12226b1
@colinux colinux authored
Showing with 364 additions and 3 deletions.
  1. +6 −0 data/generator/sfDoctrineModule/twitter/parts/actionsConfiguration.php
  2. +2 −0  data/generator/sfDoctrineModule/twitter/parts/configuration.php
  3. +19 −1 data/generator/sfDoctrineModule/twitter/parts/fieldsConfiguration.php
  4. +5 −0 data/generator/sfDoctrineModule/twitter/parts/showAction.php
  5. +41 −0 data/generator/sfDoctrineModule/twitter/parts/showConfiguration.php
  6. +1 −0  data/generator/sfDoctrineModule/twitter/skeleton/config/generator.yml
  7. +4 −0 data/generator/sfDoctrineModule/twitter/template/actions/actions.class.php
  8. +3 −0  data/generator/sfDoctrineModule/twitter/template/templates/_list_td_actions.php
  9. +20 −0 data/generator/sfDoctrineModule/twitter/template/templates/_show.php
  10. +28 −0 data/generator/sfDoctrineModule/twitter/template/templates/_show_actions.php
  11. +12 −0 data/generator/sfDoctrineModule/twitter/template/templates/_show_fieldset.php
  12. +36 −0 data/generator/sfDoctrineModule/twitter/template/templates/showSuccess.php
  13. +6 −0 data/generator/sfPropelModule/twitter/parts/actionsConfiguration.php
  14. +2 −0  data/generator/sfPropelModule/twitter/parts/configuration.php
  15. +19 −1 data/generator/sfPropelModule/twitter/parts/fieldsConfiguration.php
  16. +5 −0 data/generator/sfPropelModule/twitter/parts/showAction.php
  17. +41 −0 data/generator/sfPropelModule/twitter/parts/showConfiguration.php
  18. +1 −0  data/generator/sfPropelModule/twitter/skeleton/config/generator.yml
  19. +4 −0 data/generator/sfPropelModule/twitter/template/actions/actions.class.php
  20. +3 −0  data/generator/sfPropelModule/twitter/template/templates/_list_td_actions.php
  21. +20 −0 data/generator/sfPropelModule/twitter/template/templates/_show.php
  22. +28 −0 data/generator/sfPropelModule/twitter/template/templates/_show_actions.php
  23. +12 −0 data/generator/sfPropelModule/twitter/template/templates/_show_fieldset.php
  24. +36 −0 data/generator/sfPropelModule/twitter/template/templates/showSuccess.php
  25. +6 −1 lib/generator/sfTwitterModelGeneratorHelper.class.php
  26. +4 −0 web/css/style.css
  27. BIN  web/images/show_icon.png
View
6 data/generator/sfDoctrineModule/twitter/parts/actionsConfiguration.php
@@ -39,3 +39,9 @@ public function getListBatchActions()
return <?php echo $this->asPhp(isset($this->config['list']['batch_actions']) ? $this->config['list']['batch_actions'] : array('_delete' => null)) ?>;
<?php unset($this->config['list']['batch_actions']) ?>
}
+
+ public function getShowActions()
+ {
+ return <?php echo $this->asPhp(isset($this->config['show']['actions']) ? $this->config['show']['actions'] : array('_delete' => null, '_list' => null, '_edit' => null)) ?>;
+<?php unset($this->config['show']['actions']) ?>
+ }
View
2  data/generator/sfDoctrineModule/twitter/parts/configuration.php
@@ -41,6 +41,8 @@ public function getFilterFormClass()
<?php unset($this->config['filter']['class']) ?>
}
+<?php include dirname(__FILE__).'/showConfiguration.php' ?>
+
<?php include dirname(__FILE__).'/paginationConfiguration.php' ?>
<?php include dirname(__FILE__).'/sortingConfiguration.php' ?>
View
20 data/generator/sfDoctrineModule/twitter/parts/fieldsConfiguration.php
@@ -28,6 +28,12 @@ public function getNewTitle()
<?php unset($this->config['new']['title']) ?>
}
+ public function getShowTitle()
+ {
+ return '<?php echo $this->escapeString(isset($this->config['show']['title']) ? $this->config['show']['title'] : 'Show '.sfInflector::humanize($this->getModuleName())) ?>';
+<?php unset($this->config['show']['title']) ?>
+ }
+
public function getFilterDisplay()
{
return <?php echo $this->asPhp(isset($this->config['filter']['display']) ? $this->config['filter']['display'] : array()) ?>;
@@ -64,6 +70,18 @@ public function getListDisplay()
<?php unset($this->config['list']['display'], $this->config['list']['hide']) ?>
}
+ public function getShowDisplay()
+ {
+<?php if (isset($this->config['show']['display'])): ?>
+ return <?php echo $this->asPhp($this->config['show']['display']) ?>;
+<?php elseif (isset($this->config['show']['hide'])): ?>
+ return <?php echo $this->asPhp(array_diff($this->getAllFieldNames(false), $this->config['show']['hide'])) ?>;
+<?php else: ?>
+ return <?php echo $this->asPhp($this->getAllFieldNames(false)) ?>;
+<?php endif; ?>
+<?php unset($this->config['show']['display'], $this->config['show']['hide']) ?>
+ }
+
public function getFieldsDefault()
{
return array(
@@ -73,7 +91,7 @@ public function getFieldsDefault()
);
}
-<?php foreach (array('list', 'filter', 'form', 'edit', 'new') as $context): ?>
+<?php foreach (array('list', 'filter', 'form', 'edit', 'new', 'show') as $context): ?>
public function getFields<?php echo ucfirst($context) ?>()
{
return array(
View
5 data/generator/sfDoctrineModule/twitter/parts/showAction.php
@@ -0,0 +1,5 @@
+ public function executeShow(sfWebRequest $request)
+ {
+ $this-><?php echo $this->getSingularName() ?> = $this->getRoute()->getObject();
+ $this->form = $this->configuration->getForm($this-><?php echo $this->getSingularName() ?>);
+ }
View
41 data/generator/sfDoctrineModule/twitter/parts/showConfiguration.php
@@ -0,0 +1,41 @@
+ protected function getConfig()
+ {
+ $configuration = parent::getConfig();
+ $configuration['show'] = $this->getFieldsShow();
+ return $configuration;
+ }
+
+ protected function compile()
+ {
+ parent::compile();
+
+ $config = $this->getConfig();
+
+ // add configuration for the show view
+ $this->configuration['show'] = array( 'fields' => array(),
+ 'title' => $this->getShowTitle(),
+ 'actions' => $this->getShowActions(),
+ ) ;
+
+ foreach ($this->getShowDisplay() as $name)
+ {
+ list($field, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
+ $field = new sfModelGeneratorConfigurationField($field, array_merge(
+ array('type' => 'Text', 'label' => sfInflector::humanize(sfInflector::underscore($field))),
+ isset($config['default'][$field]) ? $config['default'][$field] : array(),
+ isset($config['show'][$field]) ? $config['show'][$field] : array(),
+ array('flag' => $flag)
+ ));
+
+ $field->setFlag($flag);
+ $this->configuration['show']['fields'][$name] = $field;
+ $this->configuration['show']['display'][$name] = $field;
+ }
+
+ foreach ($this->configuration['show']['actions'] as $action => $parameters)
+ {
+ $this->configuration['show']['actions'][$action] = $this->fixActionParameters($action, $parameters);
+ }
+
+ $this->parseVariables('show', 'title');
+ }
View
1  data/generator/sfDoctrineModule/twitter/skeleton/config/generator.yml
@@ -11,3 +11,4 @@ generator:
form: ~
edit: ~
new: ~
+ show: ~
View
4 data/generator/sfDoctrineModule/twitter/template/actions/actions.class.php
@@ -32,6 +32,10 @@ public function preExecute()
<?php include dirname(__FILE__).'/../../parts/filterAction.php' ?>
<?php endif; ?>
+<?php if (isset($this->params['with_show']) && $this->params['with_show'] == true ): ?>
+<?php include dirname(__FILE__).'/../../parts/showAction.php' ?>
+<?php endif; ?>
+
<?php include dirname(__FILE__).'/../../parts/newAction.php' ?>
<?php include dirname(__FILE__).'/../../parts/createAction.php' ?>
View
3  data/generator/sfDoctrineModule/twitter/template/templates/_list_td_actions.php
@@ -7,6 +7,9 @@
<?php elseif ('_edit' == $name): ?>
<?php echo $this->addCredentialCondition('[?php echo $helper->linkToEdit($'.$this->getSingularName().', '.$this->asPhp($params).') ?]', $params) ?>
+<?php elseif ('_show' == $name): ?>
+ <?php echo $this->addCredentialCondition('[?php echo $helper->linkToShow($'.$this->getSingularName().', '.$this->asPhp($params).') ?]', $params) ?>
+
<?php else: ?>
<li class="sf_admin_action_<?php echo $params['class_suffix'] ?>">
<?php echo $this->addCredentialCondition($this->getLinkToAction($name, $params, true), $params) ?>
View
20 data/generator/sfDoctrineModule/twitter/template/templates/_show.php
@@ -0,0 +1,20 @@
+[?php include_stylesheets_for_form($form) ?]
+[?php include_javascripts_for_form($form) ?]
+
+<div class="sf_admin_show">
+[?php foreach ($configuration->getFormFields($form, 'show') as $fieldset => $fields): ?]
+
+ [?php if (true == sfTwitterBootstrap::getProperty('top_link_to_fieldset') && 'NONE' != $fieldset): ?]
+ <a name="[?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)) ?]"></a>
+ [?php endif; ?]
+
+ <fieldset id="sf_fieldset_[?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)) ?]">
+ [?php if ('NONE' != $fieldset): ?]
+ <legend>[?php echo __($fieldset, array(), '<?php echo $this->getI18nCatalogue() ?>') ?]</legend>
+ [?php endif; ?]
+
+ [?php include_partial('<?php echo $this->getModuleName() ?>/show_fieldset', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
+
+ </fieldset>
+[?php endforeach; ?]
+</div>
View
28 data/generator/sfDoctrineModule/twitter/template/templates/_show_actions.php
@@ -0,0 +1,28 @@
+<ul class="actions">
+<?php foreach ($this->configuration->getValue('show.actions') as $name => $params): ?>
+<?php if ('_delete' == $name): ?>
+ <?php echo $this->addCredentialCondition('[?php echo $helper->linkToDeleteBtn($'.$this->getSingularName().', '.$this->asPhp($params).') ?]', $params) ?>
+
+<?php elseif ('_edit' == $name): ?>
+ <?php
+ $params['params'] = is_array($params['params']) ? array_merge($params['params'], array('class' => 'btn mlm primary')) : array('class' => 'btn mlm primary');
+ echo $this->addCredentialCondition('[?php echo $helper->linkToEdit($'.$this->getSingularName().', '.$this->asPhp($params).') ?]', $params) ?>
+
+<?php elseif ('_list' == $name): ?>
+ <?php echo $this->addCredentialCondition('[?php echo $helper->linkToList('.$this->asPhp($params).') ?]', $params) ?>
+
+<?php else: ?>
+ <li>
+[?php if (method_exists($helper, 'linkTo<?php echo $method = ucfirst(sfInflector::camelize($name)) ?>')): ?]
+ <?php echo $this->addCredentialCondition('[?php echo $helper->linkTo'.$method.'($'.$this->getSingularName().'), '.$this->asPhp($params).') ?]', $params) ?>
+
+[?php else: ?]
+ <?php
+ $params['params'] = is_array($params['params']) ? array_merge($params['params'], array('class' => 'btn mlm')) : array('class' => 'btn mlm') ;
+ echo $this->addCredentialCondition($this->getLinkToAction($name, $params, true), $params) ?>
+
+[?php endif; ?]
+ </li>
+<?php endif; ?>
+<?php endforeach; ?>
+</ul>
View
12 data/generator/sfDoctrineModule/twitter/template/templates/_show_fieldset.php
@@ -0,0 +1,12 @@
+<?php $catalogue = $this->getI18nCatalogue() ?>
+<?php foreach ($this->configuration->getValue('show.display') as $name => $field): ?>
+<?php echo $this->addCredentialCondition(sprintf(<<<EOF
+
+<div class="row sf_admin_row">
+ <label>[?php echo __('%s', array(),'%s') ?]</label>
+ <div class="offset2">[?php echo %s ?]</div>
+</div>
+
+EOF
+, $field->getConfig('label', '', true), $catalogue, $this->renderField($field)), $field->getConfig()) ?>
+<?php endforeach ?>
View
36 data/generator/sfDoctrineModule/twitter/template/templates/showSuccess.php
@@ -0,0 +1,36 @@
+[?php use_helper('I18N', 'Date') ?]
+[?php include_partial('<?php echo $this->getModuleName() ?>/assets') ?]
+
+<div id="sf_admin_container">
+ <?php if($this->configuration->hasEditPartial()) : ?>
+ <div class="sf_admin_right_column">
+ <?php foreach($this->configuration->getEditPartial() as $partial): ?>
+ [?php include_partial('<?php echo $partial ?>', array('form' => $form, '<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'helper' => $helper, 'configuration' => $configuration)) ?]
+ <?php endforeach; ?>
+ </div>
+ <div class="sf_admin_with_right_colum">
+ <?php endif; ?>
+
+ <h2 class="mbl">
+ [?php echo <?php echo $this->getI18NString('show.title') ?> ?]
+
+ [?php if(true == sfTwitterBootstrap::getProperty('top_link_to_fieldset')): ?]
+ [?php foreach ($configuration->getFormFields($form, 'edit') as $fieldset => $fields): ?]
+ [?php if ('NONE' != $fieldset): ?]
+ [?php $fieldset_name = __($fieldset, array(), '<?php echo $this->getI18nCatalogue() ?>') ?]
+ <small>- <a class="link-to-fieldset" href="#[?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)) ?]">[?php echo $fieldset_name ?]</a></small>
+ [?php endif; ?]
+ [?php endforeach; ?]
+ [?php endif; ?]
+ </h2>
+
+ <div id="sf_admin_content">
+ [?php include_partial('show', array('form' => $form, '<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'configuration' => $configuration)) ?]
+ </div>
+
+ [?php include_partial('show_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'configuration' => $configuration, 'helper' => $helper)) ?]
+
+<?php if($this->configuration->hasEditPartial()) : ?>
+ </div>
+<?php endif; ?>
+</div>
View
6 data/generator/sfPropelModule/twitter/parts/actionsConfiguration.php
@@ -39,3 +39,9 @@ public function getListBatchActions()
return <?php echo $this->asPhp(isset($this->config['list']['batch_actions']) ? $this->config['list']['batch_actions'] : array('_delete' => null)) ?>;
<?php unset($this->config['list']['batch_actions']) ?>
}
+
+ public function getShowActions()
+ {
+ return <?php echo $this->asPhp(isset($this->config['show']['actions']) ? $this->config['show']['actions'] : array('_delete' => null, '_list' => null, '_edit' => null)) ?>;
+<?php unset($this->config['show']['actions']) ?>
+ }
View
2  data/generator/sfPropelModule/twitter/parts/configuration.php
@@ -41,6 +41,8 @@ public function getFilterFormClass()
<?php unset($this->config['filter']['class']) ?>
}
+<?php include dirname(__FILE__).'/showConfiguration.php' ?>
+
<?php include dirname(__FILE__).'/paginationConfiguration.php' ?>
<?php include dirname(__FILE__).'/sortingConfiguration.php' ?>
View
20 data/generator/sfPropelModule/twitter/parts/fieldsConfiguration.php
@@ -28,6 +28,12 @@ public function getNewTitle()
<?php unset($this->config['new']['title']) ?>
}
+ public function getShowTitle()
+ {
+ return '<?php echo $this->escapeString(isset($this->config['show']['title']) ? $this->config['show']['title'] : 'Show '.sfInflector::humanize($this->getModuleName())) ?>';
+<?php unset($this->config['show']['title']) ?>
+ }
+
public function getFilterDisplay()
{
return <?php echo $this->asPhp(isset($this->config['filter']['display']) ? $this->config['filter']['display'] : array()) ?>;
@@ -64,6 +70,18 @@ public function getListDisplay()
<?php unset($this->config['list']['display'], $this->config['list']['hide']) ?>
}
+ public function getShowDisplay()
+ {
+<?php if (isset($this->config['show']['display'])): ?>
+ return <?php echo $this->asPhp($this->config['show']['display']) ?>;
+<?php elseif (isset($this->config['show']['hide'])): ?>
+ return <?php echo $this->asPhp(array_diff($this->getAllFieldNames(false), $this->config['show']['hide'])) ?>;
+<?php else: ?>
+ return <?php echo $this->asPhp($this->getAllFieldNames(false)) ?>;
+<?php endif; ?>
+<?php unset($this->config['show']['display'], $this->config['show']['hide']) ?>
+ }
+
public function getFieldsDefault()
{
return array(
@@ -73,7 +91,7 @@ public function getFieldsDefault()
);
}
-<?php foreach (array('list', 'filter', 'form', 'edit', 'new') as $context): ?>
+<?php foreach (array('list', 'filter', 'form', 'edit', 'new', 'show') as $context): ?>
public function getFields<?php echo ucfirst($context) ?>()
{
return array(
View
5 data/generator/sfPropelModule/twitter/parts/showAction.php
@@ -0,0 +1,5 @@
+ public function executeShow(sfWebRequest $request)
+ {
+ $this-><?php echo $this->getSingularName() ?> = $this->getRoute()->getObject();
+ $this->form = $this->configuration->getForm($this-><?php echo $this->getSingularName() ?>);
+ }
View
41 data/generator/sfPropelModule/twitter/parts/showConfiguration.php
@@ -0,0 +1,41 @@
+ protected function getConfig()
+ {
+ $configuration = parent::getConfig();
+ $configuration['show'] = $this->getFieldsShow();
+ return $configuration;
+ }
+
+ protected function compile()
+ {
+ parent::compile();
+
+ $config = $this->getConfig();
+
+ // add configuration for the show view
+ $this->configuration['show'] = array( 'fields' => array(),
+ 'title' => $this->getShowTitle(),
+ 'actions' => $this->getShowActions(),
+ ) ;
+
+ foreach ($this->getShowDisplay() as $name)
+ {
+ list($field, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
+ $field = new sfModelGeneratorConfigurationField($field, array_merge(
+ array('type' => 'Text', 'label' => sfInflector::humanize(sfInflector::underscore($field))),
+ isset($config['default'][$field]) ? $config['default'][$field] : array(),
+ isset($config['show'][$field]) ? $config['show'][$field] : array(),
+ array('flag' => $flag)
+ ));
+
+ $field->setFlag($flag);
+ $this->configuration['show']['fields'][$name] = $field;
+ $this->configuration['show']['display'][$name] = $field;
+ }
+
+ foreach ($this->configuration['show']['actions'] as $action => $parameters)
+ {
+ $this->configuration['show']['actions'][$action] = $this->fixActionParameters($action, $parameters);
+ }
+
+ $this->parseVariables('show', 'title');
+ }
View
1  data/generator/sfPropelModule/twitter/skeleton/config/generator.yml
@@ -11,3 +11,4 @@ generator:
form: ~
edit: ~
new: ~
+ show: ~
View
4 data/generator/sfPropelModule/twitter/template/actions/actions.class.php
@@ -32,6 +32,10 @@ public function preExecute()
<?php include dirname(__FILE__).'/../../parts/filterAction.php' ?>
<?php endif; ?>
+<?php if (isset($this->params['with_show']) && $this->params['with_show'] == true ): ?>
+<?php include dirname(__FILE__).'/../../parts/showAction.php' ?>
+<?php endif; ?>
+
<?php include dirname(__FILE__).'/../../parts/newAction.php' ?>
<?php include dirname(__FILE__).'/../../parts/createAction.php' ?>
View
3  data/generator/sfPropelModule/twitter/template/templates/_list_td_actions.php
@@ -7,6 +7,9 @@
<?php elseif ('_edit' == $name): ?>
<?php echo $this->addCredentialCondition('[?php echo $helper->linkToEdit($'.$this->getSingularName().', '.$this->asPhp($params).') ?]', $params) ?>
+<?php elseif ('_show' == $name): ?>
+ <?php echo $this->addCredentialCondition('[?php echo $helper->linkToShow($'.$this->getSingularName().', '.$this->asPhp($params).') ?]', $params) ?>
+
<?php else: ?>
<li class="sf_admin_action_<?php echo $params['class_suffix'] ?>">
<?php echo $this->addCredentialCondition($this->getLinkToAction($name, $params, true), $params) ?>
View
20 data/generator/sfPropelModule/twitter/template/templates/_show.php
@@ -0,0 +1,20 @@
+[?php include_stylesheets_for_form($form) ?]
+[?php include_javascripts_for_form($form) ?]
+
+<div class="sf_admin_show">
+[?php foreach ($configuration->getFormFields($form, 'show') as $fieldset => $fields): ?]
+
+ [?php if (true == sfTwitterBootstrap::getProperty('top_link_to_fieldset') && 'NONE' != $fieldset): ?]
+ <a name="[?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)) ?]"></a>
+ [?php endif; ?]
+
+ <fieldset id="sf_fieldset_[?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)) ?]">
+ [?php if ('NONE' != $fieldset): ?]
+ <legend>[?php echo __($fieldset, array(), '<?php echo $this->getI18nCatalogue() ?>') ?]</legend>
+ [?php endif; ?]
+
+ [?php include_partial('<?php echo $this->getModuleName() ?>/show_fieldset', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
+
+ </fieldset>
+[?php endforeach; ?]
+</div>
View
28 data/generator/sfPropelModule/twitter/template/templates/_show_actions.php
@@ -0,0 +1,28 @@
+<ul class="actions">
+<?php foreach ($this->configuration->getValue('show.actions') as $name => $params): ?>
+<?php if ('_delete' == $name): ?>
+ <?php echo $this->addCredentialCondition('[?php echo $helper->linkToDeleteBtn($'.$this->getSingularName().', '.$this->asPhp($params).') ?]', $params) ?>
+
+<?php elseif ('_edit' == $name): ?>
+ <?php
+ $params['params'] = is_array($params['params']) ? array_merge($params['params'], array('class' => 'btn mlm primary')) : array('class' => 'btn mlm primary');
+ echo $this->addCredentialCondition('[?php echo $helper->linkToEdit($'.$this->getSingularName().', '.$this->asPhp($params).') ?]', $params) ?>
+
+<?php elseif ('_list' == $name): ?>
+ <?php echo $this->addCredentialCondition('[?php echo $helper->linkToList('.$this->asPhp($params).') ?]', $params) ?>
+
+<?php else: ?>
+ <li>
+[?php if (method_exists($helper, 'linkTo<?php echo $method = ucfirst(sfInflector::camelize($name)) ?>')): ?]
+ <?php echo $this->addCredentialCondition('[?php echo $helper->linkTo'.$method.'($'.$this->getSingularName().'), '.$this->asPhp($params).') ?]', $params) ?>
+
+[?php else: ?]
+ <?php
+ $params['params'] = is_array($params['params']) ? array_merge($params['params'], array('class' => 'btn mlm')) : array('class' => 'btn mlm') ;
+ echo $this->addCredentialCondition($this->getLinkToAction($name, $params, true), $params) ?>
+
+[?php endif; ?]
+ </li>
+<?php endif; ?>
+<?php endforeach; ?>
+</ul>
View
12 data/generator/sfPropelModule/twitter/template/templates/_show_fieldset.php
@@ -0,0 +1,12 @@
+<?php $catalogue = $this->getI18nCatalogue() ?>
+<?php foreach ($this->configuration->getValue('show.display') as $name => $field): ?>
+<?php echo $this->addCredentialCondition(sprintf(<<<EOF
+
+<div class="row sf_admin_row">
+ <label>[?php echo __('%s', array(),'%s') ?]</label>
+ <div class="offset2">[?php echo %s ?]</div>
+</div>
+
+EOF
+, $field->getConfig('label', '', true), $catalogue, $this->renderField($field)), $field->getConfig()) ?>
+<?php endforeach ?>
View
36 data/generator/sfPropelModule/twitter/template/templates/showSuccess.php
@@ -0,0 +1,36 @@
+[?php use_helper('I18N', 'Date') ?]
+[?php include_partial('<?php echo $this->getModuleName() ?>/assets') ?]
+
+<div id="sf_admin_container">
+ <?php if($this->configuration->hasEditPartial()) : ?>
+ <div class="sf_admin_right_column">
+ <?php foreach($this->configuration->getEditPartial() as $partial): ?>
+ [?php include_partial('<?php echo $partial ?>', array('form' => $form, '<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'helper' => $helper, 'configuration' => $configuration)) ?]
+ <?php endforeach; ?>
+ </div>
+ <div class="sf_admin_with_right_colum">
+ <?php endif; ?>
+
+ <h2 class="mbl">
+ [?php echo <?php echo $this->getI18NString('show.title') ?> ?]
+
+ [?php if(true == sfTwitterBootstrap::getProperty('top_link_to_fieldset')): ?]
+ [?php foreach ($configuration->getFormFields($form, 'edit') as $fieldset => $fields): ?]
+ [?php if ('NONE' != $fieldset): ?]
+ [?php $fieldset_name = __($fieldset, array(), '<?php echo $this->getI18nCatalogue() ?>') ?]
+ <small>- <a class="link-to-fieldset" href="#[?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($fieldset)) ?]">[?php echo $fieldset_name ?]</a></small>
+ [?php endif; ?]
+ [?php endforeach; ?]
+ [?php endif; ?]
+ </h2>
+
+ <div id="sf_admin_content">
+ [?php include_partial('show', array('form' => $form, '<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'configuration' => $configuration)) ?]
+ </div>
+
+ [?php include_partial('show_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'configuration' => $configuration, 'helper' => $helper)) ?]
+
+<?php if($this->configuration->hasEditPartial()) : ?>
+ </div>
+<?php endif; ?>
+</div>
View
7 lib/generator/sfTwitterModelGeneratorHelper.class.php
@@ -17,7 +17,7 @@ public function linkToNew($params)
public function linkToEdit($object, $params)
{
- return '<li class="edit">'.link_to(__($params['label'], array(), 'sf_admin'), $this->getUrlForAction('edit'), $object).'</li>';
+ return '<li class="edit">'.link_to(__($params['label'], array(), 'sf_admin'), $this->getUrlForAction('edit'), $object, $params['params']).'</li>';
}
public function linkToDelete($object, $params)
@@ -70,6 +70,11 @@ public function linkToSaveAndAdd($object, $params)
return '<li><input class="btn success mlm" type="submit" value="'.__($params['label'], array(), 'sf_admin').'" name="_save_and_add" /></li>';
}
+ public function linkToShow($object, $params)
+ {
+ return '<li class="show">'.link_to(__($params['label'], array(), 'sf_admin'), $this->getUrlForAction('show'), $object, $params['params']).'</li>';
+ }
+
protected function generateDeleteConfirm($confirm)
{
$confirmMsg = __($confirm, array(), 'sf_admin');
View
4 web/css/style.css
@@ -68,6 +68,7 @@ body > div.container-fluid { padding-bottom: 20px; }
.table-action li { display:inline-block;}
.table-action .edit { background:url("../images/edit_icon.png") no-repeat top left; padding-left: 20px; }
.table-action .delete { background:url("../images/delete_icon.png") no-repeat top left; padding-left: 20px; }
+.table-action .show { background:url("../images/show_icon.png") no-repeat top left; padding-left: 20px; }
.close { line-height: 18.5px; }
@@ -282,3 +283,6 @@ Partial
.item-information{font-size:0.8em;font-style: italic; text-align:right;}
.item-record{margin-top:1em; padding-top: 0.5em;}
.item-record.other{border-top: 1px solid #D5D8D8; }
+
+.sf_admin_show label { padding-top:0; }
+.sf_admin_show .row { margin-bottom: 18px; margin-left: 0; line-height: 18px; }
View
BIN  web/images/show_icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.