Skip to content

Commit

Permalink
Merge branch 'master' into migration-2.1
Browse files Browse the repository at this point in the history
Conflicts:
	app/autoload.php
  • Loading branch information
rdohms committed Oct 24, 2012
2 parents afef66c + a3fe61b commit df91a3a
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 37 deletions.
9 changes: 3 additions & 6 deletions app/Resources/views/base.html.twig
Expand Up @@ -31,6 +31,7 @@
</script>
</head>
<body class="yui3-skin-sam">
<a href="https://github.com/protalk/protalk"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<div id="panel"></div>
<div id="headerContainer" class="contentContainer">
<header>
Expand Down Expand Up @@ -67,11 +68,6 @@
<div class="contentContainer">
{% block moreContent %}{% endblock %}
</div>

<div class="contentContainer">
<p id="githubrow"><a href="https://github.com/protalk/protalk"><img id="githubicon" src="{{ asset('images/githubIcon.png') }}" alt="Github Icon"/>Fork us on github!</a></p>
</div>


<div id="footerStrip">
<div class="contentContainer">
Expand All @@ -80,6 +76,7 @@
<div id="followUs">
<p>FOLLOW US</p>
<nav>
<a href="https://github.com/protalk/"><img src="{{ asset('images/githubIcon.png') }}" alt="Github Icon"/></a>
<a href="http://www.facebook.com/pages/ProTalk/216612481777731"><img src="{{ asset('images/facebookIcon.png') }}" alt="Facebook Icon"/></a>
<a href="http://twitter.com/pro_talk"><img src="{{ asset('images/twitterIcon.png') }}" alt="Twitter Icon"/></a>
<a href="mailto:info@protalk.me"><img src="{{ asset('images/mailIcon.png') }}" alt="Mail Icon"/></a>
Expand All @@ -101,4 +98,4 @@

{% block javascripts %}{% endblock %}
</body>
</html>
</html>
5 changes: 5 additions & 0 deletions app/config/config.yml
Expand Up @@ -115,6 +115,11 @@ services:
tags:
- { name: sonata.admin, manager_type: orm, group: protalk_media, label: Rating }
arguments: [null, Protalk\MediaBundle\Entity\Rating, null]
protalk.media.admin.page:
class: Protalk\AdminBundle\Admin\PageAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: protalk_media, label: Page }
arguments: [null, Protalk\PageBundle\Entity\Page, null]

fos_user:
db_driver: orm
Expand Down
47 changes: 47 additions & 0 deletions src/Protalk/AdminBundle/Admin/PageAdmin.php
@@ -0,0 +1,47 @@
<?php

/**
* ProTalk
*
* Copyright (c) 2012, Steffan Harries <contact@steffanharries.me.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Protalk\AdminBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\AdminBundle\Form\FormMapper;

class PageAdmin extends Admin
{
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->add('url')->add('pageTitle')->add('title')->add('content');
}

protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper->add('pageTitle');
}

protected function configureListFields(ListMapper $listMapper)
{
$listMapper->addIdentifier('title')->add('url');
}

public function validate(ErrorElement $errorElement, $object)
{
$errorElement
->with('pageTitle')
->assertMaxLength(array('limit' => 100))
->end()
->with('url')
->assertMaxLength(array('limit' => 100))
->end();
}
}
13 changes: 8 additions & 5 deletions src/Protalk/AdminBundle/Admin/TagAdmin.php
Expand Up @@ -21,21 +21,24 @@ class TagAdmin extends Admin
{
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->add('name');
$formMapper->add('name')->add('slug');
}

protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper->add('name');
$datagridMapper->add('name')->add('slug');
}

protected function configureListFields(ListMapper $listMapper)
{
$listMapper->addIdentifier('name');
$listMapper->addIdentifier('name')->add('slug');
}

public function validate(ErrorElement $errorElement, $object)
{
$errorElement->with('name')->assertMaxLength(array('limit' => 50))->end();
$errorElement
->with('name')
->assertMaxLength(array('limit' => 50))
->end();
}
}
}
14 changes: 14 additions & 0 deletions src/Protalk/MediaBundle/Controller/ContributionController.php
Expand Up @@ -17,6 +17,8 @@
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Swift_Message;
use Swift_Mail;

class ContributionController extends Controller
{
Expand All @@ -38,6 +40,8 @@ public function newAction(Request $request)
$em->persist($contribution);
$em->flush();

$this->sendMail($contribution);

$this->get('session')->setFlash('contribution-notice', 'Thank you! Your contribution has been received.');

return $this->redirect($this->generateUrl('contribute_new'));
Expand All @@ -47,4 +51,14 @@ public function newAction(Request $request)
return $this->render('ProtalkMediaBundle:Contribution:new.html.twig', array('form' => $form->createView()));
}

private function sendMail($contribution)
{
$message = Swift_Message::newInstance()
->setSubject('ProTalk - You have new contribution from: ' . $contribution->getEmail())
->setFrom('no-reply@protalk.me')
->setTo('info@protalk.me')
->setBody($this->renderView('ProtalkMediaBundle:Contribution:email.txt.twig', array('contribution' => $contribution)))
;
$this->get('mailer')->send($message);
}
}
16 changes: 12 additions & 4 deletions src/Protalk/MediaBundle/Entity/Tag.php
Expand Up @@ -136,12 +136,21 @@ public function setSlug($slug)
$this->slug = $slug;
}

/*
* Maps to getSlugFields()
*
* Exists because the backend makes a call to getSlug()
* when creating/updating tags.
*/
public function getSlug() {
return $this->getSlugFields();
}

/*
* Get slug fields
*
* @return string
*/

public function getSlugFields() {
return $this->getName();
}
Expand All @@ -151,11 +160,10 @@ public function getSlugFields() {
*/
public function updateSlug()
{

$slugger = new Slugger();
$slugger = new Slugger(' ', ',');

$slug = $slugger->getSlug($this->getSlugFields());

return $this->setSlug($slug);
}
}
}
@@ -0,0 +1,13 @@
The new contribution details:

Id: {{ contribution.id }}
Category: {{ contribution.category }}
Name: {{ contribution.name }}
Email: {{ contribution.email }}
HostUrl: {{ contribution.hostUrl }}
HostName: {{ contribution.hostName }}
Title: {{ contribution.title }}
SlidesUrl: {{ contribution.slidesUrl }}
Speaker: {{ contribution.speaker }}
Description: {{ contribution.description }}
Tags: {{ contribution.tags }}
24 changes: 21 additions & 3 deletions src/Protalk/MediaBundle/Resources/views/Home/index.html.twig
Expand Up @@ -29,8 +29,17 @@
</header>
<p>{{ media.getTruncatedDescription() }}</p>
<footer>
<p><img src="{{ asset('images/binoculars.png') }}" alt="Binoculars Image" /> <span class="metadata">{{ media.visits }} views | </span>
<span class="metadata">Rating: {% render "ProtalkMediaBundle:Rating:index" with {'rating' : media.rating } %}</span></p>
<p>
<img src="{{ asset('images/binoculars.png') }}" alt="Binoculars Image" />
<span class="metadata">
{% if media.visits == 1 %}
{{ media.visits }} view
{% else %}
{{ media.visits }} views
{% endif %}
| </span>
<span class="metadata">Rating: {% render "ProtalkMediaBundle:Rating:index" with {'rating' : media.rating } %}</span>
</p>
</footer>
</div>
</article>
Expand Down Expand Up @@ -61,7 +70,16 @@
</header>

<footer>
<p><img src="{{ asset('images/binoculars.png') }}" alt="Binoculars Image"/><span class="metadata"> {{ media.visits }} views</span></p>
<p>
<img src="{{ asset('images/binoculars.png') }}" alt="Binoculars Image"/>
<span class="metadata">
{% if media.visits == 1 %}
{{ media.visits }} view
{% else %}
{{ media.visits }} views
{% endif %}
</span>
</p>
</footer>
</div>
</article>
Expand Down
19 changes: 0 additions & 19 deletions web/css/main.css
Expand Up @@ -1008,23 +1008,4 @@ form ul {
width:165px;
left:0;
margin-bottom:10px;
}

#githubrow {
padding-left: 20px;
float: left;
}

#githubrow a {
font-size: 1.3em;
color: #3a668b;
}

#githubrow a:hover {
font-size: 1.3em;
color: #0096ff;
}

img#githubicon {
float: left;
}
Binary file modified web/images/githubIcon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit df91a3a

Please sign in to comment.