FIx templates + showing /contact form see BT#11076

ofaj
Julio 9 years ago
parent 9e9930c035
commit 0f2fb59f01
  1. 11
      src/Chamilo/ContactBundle/Controller/ContactController.php
  2. 5
      src/Chamilo/ContactBundle/Entity/Category.php
  3. 19
      src/Chamilo/ContactBundle/Form/Type/ContactType.php
  4. 1
      src/Chamilo/ContactBundle/Resources/views/index.html.twig
  5. 16
      src/Chamilo/ThemeBundle/Resources/views/Layout/base-layout.html.twig
  6. 20
      src/Chamilo/ThemeBundle/Resources/views/Layout/footer.js.twig
  7. 14
      src/Chamilo/ThemeBundle/Resources/views/Layout/header.js.twig

@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Response;
class ContactController extends Controller
{
/**
* @Route("/")
* @Route("/", name="contact")
*
* @param Request $request
* @return mixed
@ -47,25 +47,26 @@ class ContactController extends Controller
->setTo($category->getEmail())
->setBody(
$this->renderView(
'ChamiloContact:contact.html.twig',
'@ChamiloContact/contact.html.twig',
array(
'ip' => $request->getClientIp(),
'firstname' => $form->get('firstname')->getData(),
'lastname' => $form->get('lastname')->getData(),
'subject' => $form->get('subject')->getData(),
'email' => $form->get('email')->getData(),
'message' => $form->get('message')->getData()
)
)
);
$this->get('mailer')->send($message);
$request->getSession()->getFlashBag()->add(
$this->addFlash(
'success',
'Your email has been sent! Thanks!'
);
return $this->redirect($this->generateUrl('index'));
return $this->redirect($this->generateUrl('contact'));
}
}

@ -38,6 +38,11 @@ class Category
*/
protected $email;
public function __toString()
{
return (string) $this->getName();
}
/**
* @return string
*/

@ -11,6 +11,7 @@ use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
/**
* Class ContactType
@ -25,13 +26,12 @@ class ContactType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('category')
->add('firstname')
->add('category', EntityType::class, ['class' => 'Chamilo\ContactBundle\Entity\Category'])
->add('firstname')
->add('lastname')
->add('email')
->add('subject')
->add('message')
->add('message', 'textarea')
->add('save', SubmitType::class)
;
}
@ -42,8 +42,15 @@ class ContactType extends AbstractType
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$collectionConstraint = new Collection(array(
'name' => array(
new NotBlank(array('message' => 'Name should not be blank.')),
'category' => array(
new NotBlank(array('message' => 'Category should not be blank.'))
),
'firstname' => array(
new NotBlank(array('message' => 'firstname should not be blank.')),
new Length(array('min' => 2))
),
'lastname' => array(
new NotBlank(array('message' => 'lastname should not be blank.')),
new Length(array('min' => 2))
),
'email' => array(

@ -1,5 +1,6 @@
{% extends '@ChamiloTheme/Layout/base-layout.html.twig' %}
{% block sonata_page_container %}
{{ form_start(form) }}
{{ form_widget(form) }}
{% endblock %}

@ -74,6 +74,8 @@
<script src="{{ asset('assets/modernizr/modernizr.js') }}"></script>
<script src="{{ asset('assets/moment/moment.js') }}"></script>
{# Check chamilo_js key in assetic.yml #}
{% block javascripts %}
{#{%- javascripts '@chamilo_js' -%}#}
@ -93,12 +95,12 @@
{#'@MopaBootstrapBundle/Resources/public/js/eyecon-bootstrap-datepicker.js'#}
{% javascripts
'bundles/mopabootstrap/js/mopabootstrap-collection.js'
'bundles/mopabootstrap/js/mopabootstrap-subnav.js'
%}
<script type="text/javascript" src="{{ asset_url | replace({'/app_dev.php': ''}) }}"></script>
{% endjavascripts %}
{#{% javascripts#}
{#'bundles/mopabootstrap/js/mopabootstrap-collection.js'#}
{#'bundles/mopabootstrap/js/mopabootstrap-subnav.js'#}
{#%}#}
{#<script type="text/javascript" src="{{ asset_url | replace({'/app_dev.php': ''}) }}"></script>#}
{#{% endjavascripts %}#}
</head>
{#<body class="{{ admin_skin|default('skin-blue')}}">#}
<body>
@ -222,6 +224,8 @@
{#</header>#}
{% endblock %}
{% include 'SonataCoreBundle:FlashMessage:render.html.twig' %}
{% block chamilo_content %}
{#Check sonata_block.yml settings#}
{#{% include 'SonataSeoBundle:Block:_facebook_sdk.html.twig' %}#}

@ -3,17 +3,17 @@
$(document).ready( function() {
// Date time settings.
moment.locale('{{ app.request.locale }}');
$.datepicker.setDefaults($.datepicker.regional["{{ app.request.locale }}"]);
$.datepicker.regional["local"] = $.datepicker.regional["{{ app.request.locale }}"];
//$.datepicker.setDefaults($.datepicker.regional["{{ app.request.locale }}"]);
//$.datepicker.regional["local"] = $.datepicker.regional["{{ app.request.locale }}"];
// Chosen select
$(".chzn-select").chosen({
disable_search_threshold: 10,
no_results_text: '{{ 'SearchNoResultsFound' | trans }}',
placeholder_text_multiple: '{{ 'SelectSomeOptions' | trans }}',
placeholder_text_single: '{{ 'SelectAnOption' | trans }}',
width: "100%"
});
{#$(".chzn-select").chosen({#}
{#disable_search_threshold: 10,#}
{#no_results_text: '{{ 'SearchNoResultsFound' | trans }}',#}
{#placeholder_text_multiple: '{{ 'SelectSomeOptions' | trans }}',#}
{#placeholder_text_single: '{{ 'SelectAnOption' | trans }}',#}
{#width: "100%"#}
{#});#}
// Bootstrap tabs.
$('.tab-wrapper a').click(function (e) {
@ -69,7 +69,7 @@
$(".jp-jplayer audio").addClass('skip');
// Mediaelement
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */);
//jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */);
// Table highlight.
$("form .data_table input:checkbox").click(function () {

@ -126,12 +126,12 @@ $(document).ready(function() {
});
}
$(".accordion_jquery").accordion({
autoHeight: false,
active: false, // all items closed by default
collapsible: true,
header: ".accordion-heading"
});
{#$(".accordion_jquery").accordion({#}
{#autoHeight: false,#}
{#active: false, // all items closed by default#}
{#collapsible: true,#}
{#header: ".accordion-heading"#}
{#});#}
// Global popup
$('body').on('click', 'a.ajax', function(e) {
@ -212,7 +212,7 @@ $(document).ready(function() {
);
/* Make responsive image maps */
$('map').imageMapResize();
// $('map').imageMapResize();
jQuery.fn.filterByText = function(textbox) {
return this.each(function() {

Loading…
Cancel
Save