Added basic book adding functionality
Signed-off-by: Gergely POLONKAI <polesz@w00d5t0ck.info>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
{# vim: ft=htmljinja
|
||||
#}
|
||||
{% extends 'KekRozsakFrontBundle:Default:main_template.html.twig' %}
|
||||
|
||||
{% block title %} - Könyvtár{% endblock %}
|
||||
|
||||
{% block buttonlist %}
|
||||
[Új könyv]
|
||||
<span class="gomb new-book-button">[Új könyv]</span>
|
||||
{% if books|length > 0 %}
|
||||
[Saját könyveim]
|
||||
[Nálam lévő kölcsönzött könyvek]
|
||||
@@ -168,5 +169,27 @@ $('.book-row').click(function() {
|
||||
|
||||
doPopup('', 'Betöltés...', bookUrl, 400, 300, bookCallback);
|
||||
});
|
||||
|
||||
function setupAjaxBookForm()
|
||||
{
|
||||
$('#new-book-form').ajaxForm();
|
||||
}
|
||||
|
||||
$('.new-book-button').click(function() {
|
||||
creatorUrl = Routing.generate('KekRozsakFrontBundle_bookNew');
|
||||
doPopup('Új könyv', 'Betöltés...', creatorUrl, 500, 400, setupAjaxBookForm);
|
||||
});
|
||||
|
||||
$('#new-book-form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
$(this).ajaxSubmit({
|
||||
target: '#new-book-form-result',
|
||||
replaceTarget: true,
|
||||
success: function(data) {
|
||||
alert(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock bottomscripts %}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
{% form_theme form 'KekRozsakFrontBundle:Form:user_form.html.twig' %}
|
||||
<div id="new-book-form-result">
|
||||
<form method="POST" action="{{ path('KekRozsakFrontBundle_bookNew') }}" id="new-book-form">
|
||||
<table>
|
||||
{{ form_widget(form) }}
|
||||
</table>
|
||||
<button id="new-book-save-button" type="submit">Mentés</button>
|
||||
</form>
|
||||
</div>
|
@@ -16,6 +16,7 @@
|
||||
<script type="text/javascript" src="{{ asset('js/jquery.tinyscrollbar.min.js') }}"></script>
|
||||
<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>
|
||||
{% javascripts 'bundles/kekrozsakfront/js/*' output='js/kekrozsak.js' %}
|
||||
<script type="text/javascript" src="{{ asset_url }}"></script>
|
||||
{% endjavascripts %}
|
||||
|
Reference in New Issue
Block a user