Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
viewing sections
Browse files Browse the repository at this point in the history
  • Loading branch information
rlbaltha committed Jan 22, 2016
1 parent 84b977b commit bbac5aa
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
/composer.lock
.idea
/components/
/uploads/
/uploads/
7 changes: 4 additions & 3 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions .idea/misc.xml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Sustain/AppBundle/Controller/SectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function newAction()
/**
* Finds and displays a Section entity.
*
* @Route("/{id}", name="section_show")
* @Route("/{id}/", name="section_show")
* @Method("GET")
* @Template()
*/
Expand Down
30 changes: 30 additions & 0 deletions src/Sustain/AppBundle/Entity/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ class Section
*/
private $info;

/**
* @var boolean $display
*
* @ORM\Column(name="display", type="boolean", nullable=true)
*/
private $display = false;

/**
* @ORM\OneToMany(targetEntity="Page", mappedBy="section")
* @ORM\OrderBy({"sortorder" = "ASC"})
Expand Down Expand Up @@ -136,4 +143,27 @@ public function getPages()
{
return $this->pages;
}

/**
* Set display
*
* @param boolean $display
* @return Section
*/
public function setDisplay($display)
{
$this->display = $display;

return $this;
}

/**
* Get display
*
* @return boolean
*/
public function getDisplay()
{
return $this->display;
}
}
3 changes: 3 additions & 0 deletions src/Sustain/AppBundle/Form/SectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder
->add('name','text', array('attr' => array('class' => 'text form-control', 'placeholder' => 'Name of the Section'),))
->add('info', 'ckeditor', array('config_name' => 'editor_simple',))
->add('display', 'choice', array('choices' => array(true => 'Yes', false => 'No'),'required' => true,
'label' => 'Display in menu:',
'expanded' => true,'attr' => array('class' => 'radio'),))
;
}

Expand Down
13 changes: 11 additions & 2 deletions src/Sustain/AppBundle/Resources/views/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,26 @@


{% block sidebar %}
{% if 'event' in app.request.attributes.get('_route') or 'opportunity' in app.request.attributes.get('_route') or 'page' in app.request.attributes.get
('_route') %}
{% if 'event' in app.request.attributes.get('_route') or 'opportunity' in app.request.attributes.get('_route') or 'page' in app.request.attributes.get('_route') %}
<ul class="nav nav-sidebar list-unstyled" style="margin-top: 20px;">
<li><a href="{{ path('event') }}">Events</a></li>
<li><a href="{{ path('opportunity', {'type': 'service'}) }}">Partners</a></li>
<li><a href="{{ path('opportunity', {'type': 'intern'} ) }}">Internships</a></li>
<li><a href="{{ path('page_show', { 'id': 10 }) }}">Service Learning</a></li>
<li><a href="{{ path('page_stories') }}">Stories</a></li>

{% if 'page_show' in app.request.attributes.get('_route') %}
<hr/>
{{ entity.section.name }}
{% for page in entity.section.pages %}
<li><a href="{{ path('page_show', { 'id': page.id }) }}">{{ page.menuName }}</a></li>
{% endfor %}
{% endif %}
</ul>
{% endif %}



{% if categories is defined %}
<h2 style="font-size: medium">Labels</h2>
{% for category in categories %}
Expand Down

0 comments on commit bbac5aa

Please sign in to comment.