The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Added Help button functionality.

Signed-off-by: Gergely POLONKAI <polesz@w00d5t0ck.info>
master
Gergely POLONKAI 10 years ago
parent aed588e5e2
commit 528c373ad9
  1. 9
      src/KekRozsak/FrontBundle/Controller/BookController.php
  2. 5
      src/KekRozsak/FrontBundle/Resources/public/css/main.css
  3. 10
      src/KekRozsak/FrontBundle/Resources/public/js/kekrozsak.js
  4. 5
      src/KekRozsak/FrontBundle/Resources/views/Book/listHelp.html.twig
  5. 4
      src/KekRozsak/FrontBundle/Resources/views/Default/main_template.html.twig
  6. 69
      src/KekRozsak/FrontBundle/Twig/HelpUrlExtension.php

@ -28,6 +28,15 @@ class BookController extends Controller
);
}
/**
* @Route("/sugo/konyvtar-lista.html", name="KekRozsakFrontBundle_bookListHelp")
* @Template()
*/
public function listHelpAction()
{
return array();
}
/**
* @Route("/konyvadat/{id}/ajax.{_format}", name="KekRozsakFrontBundle_bookAjaxData", defaults={"_format": "html"}, options={"expose": true})
* @Template()

@ -92,3 +92,8 @@ h3 a {
clear: both;
float: none;
}
#help-button {
display: block;
float: right;
}

@ -25,7 +25,7 @@ function doPopup(title, content, url, w, h, callback)
}
}).error(function()
{
$('#popup-content').html('Nem sikerült betölteni a könyv adatait.');
$('#popup-content').html('Szerver-oldali hiba!');
});
}
@ -102,4 +102,12 @@ $(document).ready(function() {
$('#news-button').show();
resizeBoxes();
});
$('#help-button a').click(function()
{
helpUrl = $(this).attr('href');
doPopup('Súgó', null, helpUrl, 400, 300, null);
return false;
})
});

@ -0,0 +1,5 @@
<p>
A könyvek részletes adatait a szerzőre, címre vagy a kiadás évére kattintva
tudhatod meg. Az ekkor felbukkanó ablakban tudod bejelölni, ha neked is van
egy példányod, vagy ha pl. szeretnél kölcsönkérni egyet.
<p>

@ -56,6 +56,7 @@
</div>
<div id="wrapper">
<div id="menu">
{# TODO: Dynamically generate menu #}
<ul>
<li><a href="{{ path('KekRozsakFrontBundle_homepage') }}">Főoldal - Aktuális</a></li>
<li><a href="{{ path('KekRozsakFrontBundle_articleView', { slug: 'rolunk' }) }}">Rólunk</a></li>
@ -75,6 +76,9 @@
<div id="content-wrapper">
<div id="content-outline">
<div id="content">
{% if helpUrl is not null %}
<span id="help-button"><a href="{{ helpUrl }}">[Súgó]</a></span><br class="clear" />
{% endif %}
{% block content %}{% endblock %}
</div>
</div>

@ -0,0 +1,69 @@
<?php
namespace KekRozsak\FrontBundle\Twig;
use JMS\DiExtraBundle\Annotation as DI;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
/**
* Description of HelpUrlExtension
*
* @author Gergely Polonkai
*
* @DI\Service
* @DI\Tag("twig.extension")
*/
class HelpUrlExtension 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() {
parent::getGlobals();
$request = $this->container->get('request');
$router = $this->container->get('router');
$currentRoute = $request->get('_route');
$m = array();
$helpRoutes = array($currentRoute . 'Help');
$helpUrl = null;
if (preg_match('/^([^_]+)_([a-z]+)/', $currentRoute, $m)) {
$helpRoutes[] = $m[1] . '_' . $m[2] . 'Help';
}
foreach ($helpRoutes as $helpRoute) {
try {
$helpUrl = $router->generate($helpRoute);
} catch (RouteNotFoundException $e) {
$helpUrl = null;
}
if ($helpUrl !== null) {
break;
}
}
return array(
'helpUrl' => $helpUrl,
);
}
public function getName()
{
return 'HelpUrl';
}
}
Loading…
Cancel
Save