Added jmikola/js-assets-helper-bundle

This bundle is now used instead of old webRoot hack.

Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely POLONKAI (W00d5t0ck) 2012-08-25 23:06:45 +02:00
parent 78bf4d61b7
commit 4c5b2880b7
6 changed files with 16 additions and 6 deletions

View File

@ -24,6 +24,7 @@ class AppKernel extends Kernel
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Io\TcpdfBundle\IoTcpdfBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new Jmikola\JsAssetsHelperBundle\JmikolaJsAssetsHelperBundle(),
// Own bundles
new KekRozsak\FrontBundle\KekRozsakFrontBundle(),
new KekRozsak\SecurityBundle\KekRozsakSecurityBundle(),

View File

@ -8,6 +8,9 @@ jms_di_extra:
bundles: [ KekRozsakFrontBundle, KekRozsakSecurityBundle ]
directories: [ "%kernel.root_dir%/../src" ]
jmikola_js_assets_helper:
packages_to_expose: [ KekRozsakFrontBundle ]
framework:
#esi: ~
#translator: { fallback: %locale% }
@ -17,7 +20,10 @@ framework:
form: true
csrf_protection: true
validation: { enable_annotations: true }
templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
templating:
engines: ['twig']
packages:
KekRozsakFrontBundle: ~
default_locale: %locale%
trust_proxy_headers: false # Should Request object should trust proxy headers (X_FORWARDED_FOR/HTTP_CLIENT_IP)
session: ~

View File

@ -1,6 +1,9 @@
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
jmikola_js_assets_helper_routing:
resource: "@JmikolaJsAssetsHelperBundle/Resources/config/routing/routing.xml"
KekRozsakAdminBundle:
resource: "@KekRozsakAdminBundle/Controller/"
type: annotation

View File

@ -27,6 +27,7 @@
"doctrine/doctrine-migrations-bundle": "dev-master",
"egeloen/ckeditor-bundle": "dev-master",
"friendsofsymfony/jsrouting-bundle": "dev-master",
"jmikola/js-assets-helper-bundle": "dev-master",
"gergelypolonkai/tcpdfbundle": "dev-master"
},
"scripts": {

View File

@ -25,7 +25,7 @@ function favouriteOn()
url: url
}).done(function() {
elem.find('img').attr('alt', '[Kedvenc]');
elem.find('img').attr('src', webRoot + '/bundles/kekrozsakfront/images/penta-yellow-24.png');
elem.find('img').attr('src', AssetsHelper.getURL('bundles/kekrozsakfront/images/penta-yellow-24.png'));
elem.removeClass('favourite-topic-button');
elem.addClass('unfavourite-topic-button');
elem.attr('id', 'unfavourite-topic-button-' + topicSlug);
@ -60,7 +60,7 @@ function favouriteOff()
url: url
}).done(function() {
elem.find('img').attr('alt', '[Nem kedvenc]');
elem.find('img').attr('src', webRoot + '/bundles/kekrozsakfront/images/penta-blue-24.png');
elem.find('img').attr('src', AssetsHelper.getUrl('/bundles/kekrozsakfront/images/penta-blue-24.png'));
elem.removeClass('unfavourite-topic-button');
elem.addClass('favourite-topic-button');
elem.attr('id', 'favourite-topic-button-' + topicSlug);

View File

@ -17,12 +17,11 @@
<script type="text/javascript" src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script type="text/javascript" src="{{ path('fos_js_routing_js', {callback: 'fos.Router.setData'}) }}"></script>
<script type="text/javascript" src="{{ asset('js/jquery-form/jquery.form.js') }}"></script>
<script type="text/javascript" src="{{ asset('bundles/jmikolajsassetshelper/js/asset_helper.js') }}"></script>
<script type="text/javascript" src="{{ path('jmikola_js_assets_helper_js') }}"></script>
{% javascripts 'bundles/kekrozsakfront/js/*' output='js/kekrozsak.js' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
<script type="text/javascript">
var webRoot = '{{ asset('') }}';
</script>
{% block additional_js %}{% endblock %}
</head>
<body>