Browse Source

Added online fields to CmsED

Jeroen De Meerleer 1 year ago
parent
commit
f519a07c78

+ 2 - 0
src/JeroenED/CmsEDBundle/Form/Type/PageType.php

@@ -4,6 +4,7 @@ namespace JeroenED\CmsEDBundle\Form\Type;
 
 
 use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
 use Symfony\Component\Form\FormBuilderInterface;
 use Symfony\Component\OptionsResolver\OptionsResolverInterface;
 use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -18,6 +19,7 @@ class PageType extends AbstractType {
     
     public function buildForm(FormBuilderInterface $builder, array $options) {
         $builder->add('title', TextType::Class, array('label' => 'Title'));
+        $builder->add('online', CheckboxType::class, array('label' => 'Online?', 'required' => false));
         $builder->add('download', TextType::Class, array('label' => 'Download', 'required' => false, 'attr' => array('class' => 'typefile')));
         $builder->add('html', TextareaType::Class, array('label' => 'Html'));
         $builder->add('slug', TextType::Class, array('label' => 'Slug'));

+ 2 - 1
src/JeroenED/CmsEDBundle/Resources/views/Pages/create.html.twig

@@ -10,8 +10,9 @@
 {% endif %}
 
 <p>{{ form_label(form.title) }}{{form_widget(form.title)}}</p>
+<p>{{ form_label(form.online) }}{{form_widget(form.online)}}</p>
 <p>{{ form_label(form.download) }}{{form_widget(form.download)}}</p>
-<p>{{form_widget(form.html)}}</p>
+<p>{{ form_widget(form.html) }}</p>
 <p>{{ form_label(form.slug) }}{{form_widget(form.slug)}} <a href="javascript:void(0);" class="addPage">Add a slug</a>
 <p>{{ form_widget(form.register)}}</p>
 

+ 3 - 3
src/JeroenED/CmsEDBundle/Resources/views/Pages/details.html.twig

@@ -1,6 +1,6 @@
 {% extends 'JeroenEDCmsEDBundle::base.html.twig' %}
 {% block body %}
-<h1>{{ page.title}}</h1>
-<p>{{ page.html}}</p>
-<p>Slug: {{ page.slug}}</p>
+<h1>{{ page.title }} (Online: {{ page.online }})</h1>
+<p>{{ page.html }}</p>
+<p>Slug: {{ page.slug }}</p>
 {% endblock %}

+ 1 - 1
src/JeroenED/CmsEDBundle/Resources/views/Pages/edit.html.twig

@@ -8,8 +8,8 @@
         {% endfor %}
     </ul>
 {% endif %}
-
 <p>{{ form_label(form.title) }}{{form_widget(form.title)}}</p>
+<p>{{ form_label(form.online) }}{{form_widget(form.online)}}</p>
 <p>{{ form_label(form.download) }}{{form_widget(form.download)}}</p>
 <p>{{ form_widget(form.html)}} </p>
 <p>{{ form_label(form.slug) }}{{form_widget(form.slug)}} <a href="javascript:void(0);" class="addPage">Add a slug</a></p>