Merge branch 'master' of github.com:gergelypolonkai/gergelypolonkaiweb
Conflicts: composer.lock src/GergelyPolonkai/FrontBundle/Resources/views/Default/front_base.html.twig
This commit is contained in:
commit
f1e0205232
@ -1,13 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
|
||||||
{% block stylesheets %}{% endblock %}
|
|
||||||
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
{% block body %}{% endblock %}
|
|
||||||
{% block javascripts %}{% endblock %}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -45,9 +45,6 @@
|
|||||||
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
|
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
|
||||||
"bin-dir": "bin"
|
|
||||||
},
|
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"extra": {
|
"extra": {
|
||||||
"symfony-app-dir": "app",
|
"symfony-app-dir": "app",
|
||||||
|
440
composer.lock
generated
440
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -55,7 +55,7 @@ class AdminController extends Controller
|
|||||||
* @Route("/blog/post/{id}", name="GergelyPolonkaiFrontBundle_adminEditBlogPost", defaults={"id": null})
|
* @Route("/blog/post/{id}", name="GergelyPolonkaiFrontBundle_adminEditBlogPost", defaults={"id": null})
|
||||||
* @Template
|
* @Template
|
||||||
*/
|
*/
|
||||||
public function newBlogPostAction($id = null)
|
public function editBlogPostAction($id = null)
|
||||||
{
|
{
|
||||||
if (is_numeric($id)) {
|
if (is_numeric($id)) {
|
||||||
$post = $this->getDoctrine()->getRepository('GergelyPolonkaiFrontBundle:Post')->findOneById($id);
|
$post = $this->getDoctrine()->getRepository('GergelyPolonkaiFrontBundle:Post')->findOneById($id);
|
||||||
@ -73,8 +73,8 @@ class AdminController extends Controller
|
|||||||
if ($request->getMethod() === 'POST') {
|
if ($request->getMethod() === 'POST') {
|
||||||
$form->bind($request);
|
$form->bind($request);
|
||||||
if ($form->isValid()) {
|
if ($form->isValid()) {
|
||||||
if (($tags = $form->get('tags')->getData()) != '') {
|
|
||||||
$tagManager = $this->get('fpn_tag.tag_manager');
|
$tagManager = $this->get('fpn_tag.tag_manager');
|
||||||
|
if (($tags = $form->get('tags')->getData()) != '') {
|
||||||
$tagNames = $tagManager->splitTagNames($tags);
|
$tagNames = $tagManager->splitTagNames($tags);
|
||||||
$tagList = $tagManager->loadOrCreateTags($tagNames);
|
$tagList = $tagManager->loadOrCreateTags($tagNames);
|
||||||
$tagManager->addTags($tagList, $post);
|
$tagManager->addTags($tagList, $post);
|
||||||
|
@ -4,9 +4,11 @@ namespace GergelyPolonkai\FrontBundle\Controller;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||||
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||||
use Doctrine\ORM\Tools\Pagination\Paginator;
|
use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||||
|
|
||||||
use GergelyPolonkai\FrontBundle\Entity\Post;
|
use GergelyPolonkai\FrontBundle\Entity\Post;
|
||||||
|
use GergelyPolonkai\FrontBundle\Entity\Tag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of BlogController
|
* Description of BlogController
|
||||||
@ -17,6 +19,9 @@ use GergelyPolonkai\FrontBundle\Entity\Post;
|
|||||||
*/
|
*/
|
||||||
class BlogController extends Controller
|
class BlogController extends Controller
|
||||||
{
|
{
|
||||||
|
// TODO: Make this a config parameter
|
||||||
|
private $postsPerPage = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/", name="GergelyPolonkaiFrontBundle_blogListing")
|
* @Route("/", name="GergelyPolonkaiFrontBundle_blogListing")
|
||||||
* @Route("/page/{cPage}", name="GergelyPolonkaiFrontBundle_blogListingPage", requirements={"cPage": "\d+"})
|
* @Route("/page/{cPage}", name="GergelyPolonkaiFrontBundle_blogListingPage", requirements={"cPage": "\d+"})
|
||||||
@ -24,16 +29,14 @@ class BlogController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function listAction($cPage = 1)
|
public function listAction($cPage = 1)
|
||||||
{
|
{
|
||||||
// TODO: Make this a config parameter
|
|
||||||
$postsPerPage = 10;
|
|
||||||
--$cPage;
|
--$cPage;
|
||||||
|
|
||||||
$query = $this
|
$query = $this
|
||||||
->getDoctrine()
|
->getDoctrine()
|
||||||
->getEntityManager()
|
->getEntityManager()
|
||||||
->createQuery("SELECT p FROM GergelyPolonkaiFrontBundle:Post p WHERE p.draft = FALSE ORDER BY p.createdAt DESC")
|
->createQuery("SELECT p FROM GergelyPolonkaiFrontBundle:Post p WHERE p.draft = FALSE ORDER BY p.createdAt DESC")
|
||||||
->setFirstResult($cPage * $postsPerPage)
|
->setFirstResult($cPage * $this->postsPerPage)
|
||||||
->setMaxResults($postsPerPage);
|
->setMaxResults($this->postsPerPage);
|
||||||
|
|
||||||
$paginator = new Paginator($query, $fetchJoinCollection = true);
|
$paginator = new Paginator($query, $fetchJoinCollection = true);
|
||||||
$tagManager = $this->get('fpn_tag.tag_manager');
|
$tagManager = $this->get('fpn_tag.tag_manager');
|
||||||
@ -42,13 +45,13 @@ class BlogController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$count = $paginator->count();
|
$count = $paginator->count();
|
||||||
$pageCount = ceil($count / $postsPerPage);
|
$pageCount = ceil($count / $this->postsPerPage);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'cpage' => $cPage,
|
'cpage' => $cPage,
|
||||||
'count' => $pageCount,
|
'count' => $pageCount,
|
||||||
'posts' => $paginator,
|
'posts' => $paginator,
|
||||||
'perPage' => $postsPerPage,
|
'perPage' => $this->postsPerPage,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,4 +96,43 @@ class BlogController extends Controller
|
|||||||
'posts' => $posts,
|
'posts' => $posts,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/tag/{name}/", name="GergelyPolonkaiFrontBundle_blogTagList")
|
||||||
|
* @Route("/tag/{name}/page/{cPage}", name="GergelyPolonkaiFrontBundle_blogTagListingPage", requirements={"cPage": "\d+"})
|
||||||
|
* @Template("GergelyPolonkaiFrontBundle:Blog:list.html.twig")
|
||||||
|
* @ParamConverter("tag")
|
||||||
|
*/
|
||||||
|
public function tagListAction(Tag $tag, $cPage = 1)
|
||||||
|
{
|
||||||
|
$tagRepository = $this->getDoctrine()->getRepository('GergelyPolonkaiFrontBundle:Tag');
|
||||||
|
|
||||||
|
$ids = $tagRepository->getResourceIdsForTag('gergelypolonkaifront_post', $tag->getName());
|
||||||
|
|
||||||
|
--$cPage;
|
||||||
|
|
||||||
|
$query = $this
|
||||||
|
->getDoctrine()
|
||||||
|
->getEntityManager()
|
||||||
|
->createQuery("SELECT p FROM GergelyPolonkaiFrontBundle:Post p WHERE p.draft = FALSE AND p.id IN (:idList) ORDER BY p.createdAt DESC")
|
||||||
|
->setParameter('idList', $ids)
|
||||||
|
->setFirstResult($cPage * $this->postsPerPage)
|
||||||
|
->setMaxResults($this->postsPerPage);
|
||||||
|
|
||||||
|
$paginator = new Paginator($query, $fetchJoinCollection = true);
|
||||||
|
$tagManager = $this->get('fpn_tag.tag_manager');
|
||||||
|
foreach ($paginator as $post) {
|
||||||
|
$tagManager->loadTagging($post);
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = $paginator->count();
|
||||||
|
$pageCount = ceil($count / $this->postsPerPage);
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'cpage' => $cPage,
|
||||||
|
'count' => $pageCount,
|
||||||
|
'posts' => $paginator,
|
||||||
|
'perPage' => $this->postsPerPage,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,4 +94,13 @@ class DefaultController extends Controller
|
|||||||
'code_chunk' => $codeChunk,
|
'code_chunk' => $codeChunk,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/google150e54bda5f96d97.html")
|
||||||
|
* @Template
|
||||||
|
*/
|
||||||
|
public function webmasterToolsAction()
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ use FPN\TagBundle\Entity\Tag as BaseTag;
|
|||||||
*
|
*
|
||||||
* @author polesz
|
* @author polesz
|
||||||
*
|
*
|
||||||
* @ORM\Entity
|
* @ORM\Entity(repositoryClass="DoctrineExtensions\Taggable\Entity\TagRepository")
|
||||||
* @ORM\Table(name="tags")
|
* @ORM\Table(name="tags")
|
||||||
*/
|
*/
|
||||||
class Tag extends BaseTag
|
class Tag extends BaseTag
|
||||||
|
@ -71,18 +71,44 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#menu {
|
#menu {
|
||||||
|
background-color: #f18137;
|
||||||
|
height: 39px;
|
||||||
|
margin-top: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tagcloud-button {
|
||||||
|
float: left;
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-left: 6px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu ul {
|
#menu ul {
|
||||||
margin: 0;
|
margin: 8px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
text-align: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu ul li {
|
#menu ul li {
|
||||||
display: inline;
|
float: right;
|
||||||
|
margin-top: 1px;
|
||||||
|
margin-bottom: 10px;
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul li.active {
|
||||||
|
background-image: url('../images/arrow-up.png');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul li a {
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
@ -166,3 +192,48 @@ dd p {
|
|||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#tag-cloud {
|
||||||
|
position: absolute;
|
||||||
|
width: 600px;
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px solid black;
|
||||||
|
background-color: #303030;
|
||||||
|
margin-left: 5px;
|
||||||
|
margin-top: 2px;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tag-cloud a {
|
||||||
|
color: #b3b3b3;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tag-cloud .size0 {
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tag-cloud .size1 {
|
||||||
|
font-size: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tag-cloud .size2 {
|
||||||
|
font-size: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tag-cloud .size3 {
|
||||||
|
font-size: 110%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tag-cloud .size4 {
|
||||||
|
font-size: 130%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tag-cloud .size5 {
|
||||||
|
font-size: 150%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear {
|
||||||
|
clear: both;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 228 B |
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -19,7 +19,7 @@
|
|||||||
<link>{{ app.request.scheme }}://{{app.request.host }}{{ path('GergelyPolonkaiFrontBundle_blogViewPost', {year: post.createdAt|date('Y'), month: post.createdAt|date('m'), day: post.createdAt|date('d'), slug: post.slug }) }}</link>
|
<link>{{ app.request.scheme }}://{{app.request.host }}{{ path('GergelyPolonkaiFrontBundle_blogViewPost', {year: post.createdAt|date('Y'), month: post.createdAt|date('m'), day: post.createdAt|date('d'), slug: post.slug }) }}</link>
|
||||||
<comments>{{ app.request.scheme }}://{{app.request.host }}{{ path('GergelyPolonkaiFrontBundle_blogViewPost', {year: post.createdAt|date('Y'), month: post.createdAt|date('m'), day: post.createdAt|date('d'), slug: post.slug }) }}#comments</comments>
|
<comments>{{ app.request.scheme }}://{{app.request.host }}{{ path('GergelyPolonkaiFrontBundle_blogViewPost', {year: post.createdAt|date('Y'), month: post.createdAt|date('m'), day: post.createdAt|date('d'), slug: post.slug }) }}#comments</comments>
|
||||||
<pubDate>{{ post.createdAt|date('r') }}</pubDate>
|
<pubDate>{{ post.createdAt|date('r') }}</pubDate>
|
||||||
<description><![CDATA[{{post.content}}]]></description>
|
<description><![CDATA[{{ post.content|remove_code_chunks }}]]></description>
|
||||||
<guid>{{ app.request.scheme }}://{{app.request.host }}{{ path('GergelyPolonkaiFrontBundle_blogViewPost', {year: post.createdAt|date('Y'), month: post.createdAt|date('m'), day: post.createdAt|date('d'), slug: post.slug }) }}</guid>
|
<guid>{{ app.request.scheme }}://{{app.request.host }}{{ path('GergelyPolonkaiFrontBundle_blogViewPost', {year: post.createdAt|date('Y'), month: post.createdAt|date('m'), day: post.createdAt|date('d'), slug: post.slug }) }}</guid>
|
||||||
{#
|
{#
|
||||||
<category><![CDATA[Cat1]]></category>
|
<category><![CDATA[Cat1]]></category>
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ block('paginator') }}
|
{{ block('paginator') }}
|
||||||
|
{% if posts|length == 0 %}
|
||||||
|
No posts found.
|
||||||
|
{% endif %}
|
||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
{% include 'GergelyPolonkaiFrontBundle:Blog:postViewer.html.twig' with {'post': post, 'title_links': true} %}
|
{% include 'GergelyPolonkaiFrontBundle:Blog:postViewer.html.twig' with {'post': post, 'title_links': true} %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{% if post.tags|length > 0 %}
|
{% if post.tags|length > 0 %}
|
||||||
<p class="article-tags">Tags:
|
<p class="article-tags">Tags:
|
||||||
{% for tag in post.tags %}
|
{% for tag in post.tags %}
|
||||||
{{ tag.name }}
|
<a href="{{ path('GergelyPolonkaiFrontBundle_blogTagList', { name: tag.name }) }}">{{ tag.name }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -4,4 +4,5 @@
|
|||||||
<h3>Disclaimer</h3>
|
<h3>Disclaimer</h3>
|
||||||
<p>The articles and thoughts on this site all originate from me, unless otherwise stated. Please use them with this statement in your mind. If you use anything, please put a backlink on your site to the given article(s) or the main page.</p>
|
<p>The articles and thoughts on this site all originate from me, unless otherwise stated. Please use them with this statement in your mind. If you use anything, please put a backlink on your site to the given article(s) or the main page.</p>
|
||||||
<p>The social media icons on the right are from <a href="http://komodomedia.com/"><img src="{{ asset('bundles/gergelypolonkaifront/images/komodomedia_azure_16.png') }}" alt="komodomedia.com" target="_blank" /> komodomedia.com</a>.</p>
|
<p>The social media icons on the right are from <a href="http://komodomedia.com/"><img src="{{ asset('bundles/gergelypolonkaifront/images/komodomedia_azure_16.png') }}" alt="komodomedia.com" target="_blank" /> komodomedia.com</a>.</p>
|
||||||
|
<p>Some design ideas, like the arrows under the menu items are from a friend, <a href="http://www.d4untless.com/">Judit Pásti</a>.
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Gergely Polonkai{% block title %}{% endblock %}</title>
|
<title>Gergely Polonkai{% block title %}{% endblock %}</title>
|
||||||
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
|
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
|
||||||
{% stylesheets 'bundles/gergelypolonkaifront/css/*' filter='cssrewrite' output='css/gergelypolonkaiweb.css' %}
|
{% stylesheets 'bundles/gergelypolonkaifront/css/*' filter='cssrewrite' output='css/gergelypolonkaiweb.css' %}
|
||||||
@ -23,7 +24,7 @@
|
|||||||
<a href="http://www.linkedin.com/in/gergelypolonkai" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/linkedin_16.png') }}" alt="LinkedIn profile" /></a>
|
<a href="http://www.linkedin.com/in/gergelypolonkai" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/linkedin_16.png') }}" alt="LinkedIn profile" /></a>
|
||||||
<a href="skype:w00dhun" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/skype_16.png') }}" alt="Skype" /></a>
|
<a href="skype:w00dhun" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/skype_16.png') }}" alt="Skype" /></a>
|
||||||
<a href="http://facebook.com/Polesz" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/facebook_16.png') }}" alt="Facebook profile" /></a>
|
<a href="http://facebook.com/Polesz" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/facebook_16.png') }}" alt="Facebook profile" /></a>
|
||||||
<a href="/https://plus.google.com/u/1/105740970718293884702about" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/google_plus_16.png') }}" alt="Google+ profile" /></a>
|
<a href="https://plus.google.com/u/1/105740970718293884702/about" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/google_plus_16.png') }}" alt="Google+ profile" /></a>
|
||||||
<a href="gtalk:chat?jid=gergely@polonkai.eu" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/googletalk_16.png') }}" alt="Google Talk" /></a>
|
<a href="gtalk:chat?jid=gergely@polonkai.eu" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/googletalk_16.png') }}" alt="Google Talk" /></a>
|
||||||
<a href="http://twitter.com/W00d5t0ck" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/twitter_16.png') }}" alt="Twitter" /></a>
|
<a href="http://twitter.com/W00d5t0ck" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/twitter_16.png') }}" alt="Twitter" /></a>
|
||||||
<a href="http://tumblr.w00d5t0ck.info" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/tumblr_16.png') }}" alt="Tumblr" /></a>
|
<a href="http://tumblr.w00d5t0ck.info" target="_blank"><img src="{{ asset('bundles/gergelypolonkaifront/images/tumblr_16.png') }}" alt="Tumblr" /></a>
|
||||||
@ -32,15 +33,24 @@
|
|||||||
<a href="{{ path('GergelyPolonkaiFrontBundle_blogFeed') }}"><img src="{{ asset('bundles/gergelypolonkaifront/images/rss_16.png') }}" alt="RSS Feed" /></a>
|
<a href="{{ path('GergelyPolonkaiFrontBundle_blogFeed') }}"><img src="{{ asset('bundles/gergelypolonkaifront/images/rss_16.png') }}" alt="RSS Feed" /></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
|
||||||
<div id="content-padding"></div>
|
<div id="content-padding"></div>
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
|
<div id="tagcloud-button"><img alt="" src="{{ asset('bundles/gergelypolonkaifront/images/tagcloud.png') }}" /></div>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{{ path('GergelyPolonkaiFrontBundle_about') }}">About me</a></li>
|
<li {% if currentMenu == 'resume' %} class="active"{% endif %}><a href="{{ path('GergelyPolonkaiFrontBundle_resume', { _format: 'html' }) }}">Resume</a></li>
|
||||||
<li><a href="{{ path('GergelyPolonkaiFrontBundle_blogListing') }}">Blog</a></li>
|
<li {% if currentMenu == 'blog' %} class="active"{% endif %}><a href="{{ path('GergelyPolonkaiFrontBundle_blogListing') }}">Blog</a></li>
|
||||||
<li><a href="{{ path('GergelyPolonkaiFrontBundle_resume', { _format: 'html' }) }}">Resume</a></li>
|
<li {% if currentMenu == 'about' %} class="active"{% endif %}><a href="{{ path('GergelyPolonkaiFrontBundle_about') }}">About me</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<br class="clear" />
|
||||||
</div>
|
</div>
|
||||||
|
{% if tagCloud|length > 0 %}
|
||||||
|
<div id="tag-cloud">
|
||||||
|
{% for cloudItem in tagCloud %}
|
||||||
|
<a href="{{ path('GergelyPolonkaiFrontBundle_blogTagList', { name: cloudItem.name }) }}" class="size{{ cloudItem.size }}">{{ cloudItem.name }}</a>{% if not loop.last %} | {% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div id="content">
|
||||||
{% block content %}{% endblock content %}
|
{% block content %}{% endblock content %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -53,8 +63,13 @@
|
|||||||
<a href="https://github.com/gergelypolonkai" id="github-ribbon" target="_blank"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_orange_ff7600.png" alt="Fork me on GitHub"></a>
|
<a href="https://github.com/gergelypolonkai" id="github-ribbon" target="_blank"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_orange_ff7600.png" alt="Fork me on GitHub"></a>
|
||||||
<iframe src="http://githubbadge.appspot.com/badge/gergelypolonkai?s=1&a=0" style="border: 0; height: 142px; width: 200px; overflow: hidden; display: none; position: absolute; top: 100px; left: 100px;" frameBorder="0" id="github-badge"></iframe>
|
<iframe src="http://githubbadge.appspot.com/badge/gergelypolonkai?s=1&a=0" style="border: 0; height: 142px; width: 200px; overflow: hidden; display: none; position: absolute; top: 100px; left: 100px;" frameBorder="0" id="github-badge"></iframe>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
$('.at-obfuscation').html('@');
|
$('.at-obfuscation').html('@');
|
||||||
|
|
||||||
|
$('#tagcloud-button').click(function() {
|
||||||
|
$('#tag-cloud').toggle('slow');
|
||||||
|
});
|
||||||
|
|
||||||
$('#github-ribbon').mouseover(function() {
|
$('#github-ribbon').mouseover(function() {
|
||||||
$('#github-badge').fadeIn();
|
$('#github-badge').fadeIn();
|
||||||
});
|
});
|
||||||
@ -69,6 +84,7 @@
|
|||||||
left: e.pageX + 5
|
left: e.pageX + 5
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var po = document.createElement('script');
|
var po = document.createElement('script');
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
google-site-verification: google150e54bda5f96d97.html
|
@ -46,6 +46,7 @@ class CodeChunk extends \Twig_Extension
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'insert_code_chunks' => new \Twig_Filter_Method($this, 'insertCodeChunks', array('is_safe' => array('html'))),
|
'insert_code_chunks' => new \Twig_Filter_Method($this, 'insertCodeChunks', array('is_safe' => array('html'))),
|
||||||
|
'remove_code_chunks' => new \Twig_Filter_Method($this, 'removeCodeChunks', array('is_safe' => array('html'))),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +107,40 @@ class CodeChunk extends \Twig_Extension
|
|||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeCodeChunks($string)
|
||||||
|
{
|
||||||
|
$m = array();
|
||||||
|
$chunkRepo = $this->doctrine->getRepository('GergelyPolonkaiFrontBundle:CodeChunk');
|
||||||
|
|
||||||
|
while (
|
||||||
|
preg_match(
|
||||||
|
'/\\[\\$ code:([^:]+):([^ ]+) \\$\\]/i',
|
||||||
|
$string, $m, PREG_OFFSET_CAPTURE)
|
||||||
|
) {
|
||||||
|
$start = $m[0][1];
|
||||||
|
$fullTag = $m[0][0];
|
||||||
|
$len = strlen($fullTag);
|
||||||
|
$replacement = '';
|
||||||
|
|
||||||
|
$string = substr_replace($string, $replacement, $start, $len);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (
|
||||||
|
preg_match(
|
||||||
|
'/\\[\\$ code:([^:]+):(.+?) \\$\\]/is',
|
||||||
|
$string, $m, PREG_OFFSET_CAPTURE)
|
||||||
|
) {
|
||||||
|
$start = $m[0][1];
|
||||||
|
$fullTag = $m[0][0];
|
||||||
|
$len = strlen($fullTag);
|
||||||
|
$replacement = '';
|
||||||
|
|
||||||
|
$string = substr_replace($string, $replacement, $start, $len);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return "code_chunk";
|
return "code_chunk";
|
||||||
|
55
src/GergelyPolonkai/FrontBundle/Twig/CurrentMenu.php
Normal file
55
src/GergelyPolonkai/FrontBundle/Twig/CurrentMenu.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
namespace GergelyPolonkai\FrontBundle\Twig;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
use JMS\DiExtraBundle\Annotation as DI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of CurrentMenu
|
||||||
|
*
|
||||||
|
* @author Gergely Polonkai
|
||||||
|
*
|
||||||
|
* @DI\Service
|
||||||
|
* @DI\Tag(name="twig.extension")
|
||||||
|
*/
|
||||||
|
class CurrentMenu extends \Twig_Extension
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Symfony\Component\DependencyInjection\ContainerInterface $container
|
||||||
|
*/
|
||||||
|
private $container;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @DI\InjectParams({
|
||||||
|
* "container" = @DI\Inject("service_container")
|
||||||
|
* })
|
||||||
|
*/
|
||||||
|
public function __construct(ContainerInterface $container)
|
||||||
|
{
|
||||||
|
$this->container = $container;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGlobals()
|
||||||
|
{
|
||||||
|
$controller = $this->container->get('request')->get('_controller');
|
||||||
|
$route = $this->container->get('request')->get('_route');
|
||||||
|
|
||||||
|
$currentMenu = 'none';
|
||||||
|
if (preg_match('/BlogController/', $controller)) {
|
||||||
|
$currentMenu = 'blog';
|
||||||
|
} elseif (preg_match('/_homepage$/', $route)) {
|
||||||
|
$currentMenu = 'blog';
|
||||||
|
} elseif (preg_match('/_resume$/', $route)) {
|
||||||
|
$currentMenu = 'resume';
|
||||||
|
} elseif (preg_match('/_about$/', $route)) {
|
||||||
|
$currentMenu = 'about';
|
||||||
|
}
|
||||||
|
return array(
|
||||||
|
'currentMenu' => $currentMenu,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return 'gergelypolonkaifront_currentmenu';
|
||||||
|
}
|
||||||
|
}
|
62
src/GergelyPolonkai/FrontBundle/Twig/TagCloud.php
Normal file
62
src/GergelyPolonkai/FrontBundle/Twig/TagCloud.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
namespace GergelyPolonkai\FrontBundle\Twig;
|
||||||
|
|
||||||
|
use Symfony\Bridge\Doctrine\RegistryInterface;
|
||||||
|
use JMS\DiExtraBundle\Annotation as DI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description of tagCloud
|
||||||
|
*
|
||||||
|
* @author polesz
|
||||||
|
*
|
||||||
|
* @DI\Service
|
||||||
|
* @DI\Tag("twig.extension")
|
||||||
|
*/
|
||||||
|
class TagCloud extends \Twig_Extension
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Symfony\Bridge\Doctrine\RegistryInterface $doctrine
|
||||||
|
*/
|
||||||
|
private $doctrine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @DI\InjectParams()
|
||||||
|
*/
|
||||||
|
public function __construct(RegistryInterface $doctrine)
|
||||||
|
{
|
||||||
|
$this->doctrine = $doctrine;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function orderTags($a, $b)
|
||||||
|
{
|
||||||
|
return strcasecmp($a['name'], $b['name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getGlobals()
|
||||||
|
{
|
||||||
|
$tagCloudQuery = $this->doctrine->getEntityManager()->createQuery('SELECT t, count(tg) ct FROM GergelyPolonkaiFrontBundle:Tag t LEFT JOIN t.tagging tg GROUP BY t.id ORDER BY ct DESC');
|
||||||
|
$tagCloudList = $tagCloudQuery->getResult();
|
||||||
|
$tagCloud = array();
|
||||||
|
if (count($tagCloudList) > 0) {
|
||||||
|
$tMax = $tagCloudList[0]['ct'];
|
||||||
|
$tMin = 1;
|
||||||
|
}
|
||||||
|
foreach ($tagCloudList as $cloudElement) {
|
||||||
|
$tag = $cloudElement[0];
|
||||||
|
$tagCount = $cloudElement['ct'];
|
||||||
|
if ($tagCount >= $tMin) {
|
||||||
|
$size = floor((5.0 * ($tagCount - $tMin)) / ($tMax - $tMin));
|
||||||
|
$tagCloud[] = array('name' => $tag->getName(), 'size' => $size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
usort($tagCloud, array($this, 'orderTags'));
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'tagCloud' => $tagCloud,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName() {
|
||||||
|
return 'gergelypolonkaifront_tagcloud';
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user