	{# 	
	Keosu is an open source CMS for mobile app
	Copyright (C) 2014  Vincent Le Borgne, Pockeit

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    #}
{% extends 'KeosuCoreBundle:MainViews:page.html.twig' %}

{% block title %}Edit Page{% endblock %}

{% block content %}

<script type="text/javascript">
	$(document).ready(function() {
		$( "#form_icon .radio" ).each(function(index) {
            var label = $(this).find('label');
			var input = $(this).find('input');
            var iconPath = '{{ url_base }}/' + label.text().trim();
            var img = '<img src="'+iconPath+'" style="height: 16px;" />';
			label.attr('for', input.attr('id'));
			label.text('');
            label.append(input);
            label.append(img);
		});

		templateButton("{{url_base}}", "{{templateDir}}", "");
	});
</script>
<div class="panel">
	<h1>Edit page</h1>

	{{ form_start(form) }}
		{{ form_errors(form) }}
		{{ form_row(form.name) }}
		{{ form_row(form.icon) }}
		{{ form_row(form.isMain) }}
		<div class="imgTemplate">
		{{ form_row(form.templateId) }}
		</div> 


		<br class="clear"/><br class="clear"/>
		<input type="submit" class="btn btn-success" />&nbsp;<a class="confirmModal" href="javascript:history.go(-1);" ><button type="button" class="btn btn-danger">Cancel</button></a>
	{{ form_end(form) }}
</div>

{% endblock %}
