Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Genemu form sf5 #455

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/FormPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function process(ContainerBuilder $container)
$resources = $container->getParameter('twig.form.resources');

foreach (array('div', 'jquery', 'stylesheet') as $template) {
$resources[] = 'GenemuFormBundle:Form:' . $template . '_layout.html.twig';
$resources[] = '@GenemuForm/Form/' . $template . '_layout.html.twig';
}

$container->setParameter('twig.form.resources', $resources);
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('genenu_form');
$treeBuilder = new TreeBuilder('genenu_form');
$rootNode = $treeBuilder->getRootNode();

$this->addCaptcha($rootNode);
$this->addRecaptcha($rootNode);
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/GenemuFormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

namespace Genemu\Bundle\FormBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ChildDefinition;

/**
* GenemuFormExtension.
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/imagine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="genemu.gd.captcha" class="Genemu\Bundle\FormBundle\Gd\Type\Captcha">
<service id="genemu.gd.captcha" class="Genemu\Bundle\FormBundle\Gd\Type\Captcha" public="true">
<argument type="service" id="session" />
<argument>%kernel.secret%</argument>
</service>
Expand Down
6 changes: 3 additions & 3 deletions Resources/config/routing/base64.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="genemu_captcha_refresh" path="/genemu-captcha-refresh">
<default key="_controller">GenemuFormBundle:Base64:refreshCaptcha</default>
<default key="_controller">Genemu\Bundle\FormBundle\Controller\Base64Controller:refreshCaptchaAction</default>
</route>

<route id="genemu_base64" path="/genemu_base64">
<default key="_controller">GenemuFormBundle:Base64:base64</default>
<default key="_controller">Genemu\Bundle\FormBundle\Controller\Base64Controller:base64Action</default>
</route>

</routes>
</routes>
4 changes: 2 additions & 2 deletions Resources/config/routing/image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="genemu_form_image" path="/genemu_change_image">
<default key="_controller">GenemuFormBundle:Image:change</default>
<default key="_controller">Genemu\Bundle\FormBundle\Controller\ImageController:changeAction</default>
</route>

</routes>
</routes>
4 changes: 2 additions & 2 deletions Resources/config/routing/upload.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

<route id="genemu_upload" path="/genemu_upload">
<default key="_controller">GenemuFormBundle:Upload:upload</default>
<default key="_controller">Genemu\Bundle\FormBundle\Controller\UploadController:uploadAction</default>
</route>

</routes>
</routes>
24 changes: 0 additions & 24 deletions Resources/views/Form/div_layout.html.twig
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
{% block genemu_captcha_widget %}
{% spaceless %}
<img src="{{ src }}" width="{{ width }}" height="{{ height }}" title="{{ name|trans }}" alt="{{ name|trans }}" />
{{ block("form_widget_simple") }}
{% endspaceless %}
{% endblock %}

{% block genemu_recaptcha_widget %}
{% spaceless %}
<div id="{{ id }}_div" style="display: none;"></div>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k={{ public_key }}" width="500" height="300" frameborder="0"></iframe>
<br />
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge" />
</noscript>
{% endspaceless %}
{% endblock genemu_recaptcha_widget %}

{% block genemu_jquerydate_widget %}
{% spaceless %}
{% if widget == "single_text" %}
{{ block("form_widget_simple") }}
{% else %}
Expand All @@ -36,59 +31,47 @@
{{ block("hidden_widget") }}
</div>
{% endif %}
{% endspaceless %}
{% endblock genemu_jquerydate_widget %}

{% block genemu_jqueryslider_widget %}
{% spaceless %}
{{ block("hidden_widget") }}
<div id="{{ id }}_slider"></div>
{% endspaceless %}
{% endblock genemu_jqueryslider_widget %}

{% block genemu_jqueryautocompleter_widget %}
{% spaceless %}
{{ block("hidden_widget") }}

{% set id = "autocompleter_" ~ id %}
{% set full_name = "autocompleter_" ~ full_name %}
{% set value = autocompleter_value %}
{{ block("form_widget_simple") }}
{% endspaceless %}
{% endblock genemu_jqueryautocompleter_widget %}

{% block genemu_jquerychosen_widget %}
{% spaceless %}
{% set attr = {
"data-placeholder": empty_value,
"class": "chzn-select"
}|merge(attr) %}
{{ block("choice_widget") }}
{% endspaceless %}
{% endblock genemu_jquerychosen_widget %}

{% block genemu_jquerygeolocation_widget %}
{% spaceless %}
{{ form_rest(form) }}

{% if map is same as(true) %}
<div id="{{ id }}_map">&nbsp;</div>
{% endif %}
{% endspaceless %}
{% endblock genemu_jquerygeolocation_widget %}

{% block genemu_jqueryfile_widget %}
{% spaceless %}
{{ block("hidden_widget") }}
<div id="{{ id }}_upload"></div>
<div class="queue">
<div id="{{ id }}_queue"></div>
</div>
{% endspaceless %}
{% endblock genemu_jqueryfile_widget %}

{% block genemu_jquerycolor_widget %}
{% spaceless %}
{% if widget == "image" %}
<div id="{{ id }}_color" {{ block("widget_container_attributes") }}>
<div{% if value %} style="background-color: #{{ value }};"{% endif %}>&nbsp;</div>
Expand All @@ -97,21 +80,17 @@
{% else %}
{{ block("form_widget_simple") }}
{% endif %}
{% endspaceless %}
{% endblock genemu_jquerycolor_widget %}

{% block genemu_jqueryrating_widget %}
{% spaceless %}
<div {{ block("widget_container_attributes") }}>
{% for child in form %}
{{ form_widget(child) }}
{% endfor %}
</div>
{% endspaceless %}
{% endblock genemu_jqueryrating_widget %}

{% block genemu_jqueryimage_widget %}
{% spaceless %}
<div id="{{ id }}_container">
<div class="left">
<div id="{{ id }}_preview">
Expand Down Expand Up @@ -145,18 +124,15 @@
</div>
</div>
</div>
{% endspaceless %}
{% endblock genemu_jqueryimage_widget %}

{% block genemu_jquerytokeninput_widget %}
{% spaceless %}
{{ block("hidden_widget") }}

{% set id = "tokeninput_" ~ id %}
{% set full_name = "tokeninput_" ~ full_name %}
{% set value = tokeninput_value %}
{{ block("form_widget_simple") }}
{% endspaceless %}
{% endblock genemu_jquerytokeninput_widget %}

{% block genemu_plain_widget %}
Expand Down
30 changes: 0 additions & 30 deletions Resources/views/Form/jquery_layout.html.twig
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{% block form_javascript %}
{% spaceless %}
{% for child in form %}
{{ form_javascript(child) }}
{% endfor %}
{% endspaceless %}
{% endblock form_javascript %}

{% block field_javascript "" %}

{% block button_javascript "" %}

{% block genemu_captcha_javascript %}
{% spaceless %}
<!--[if lte IE 7]>
<script type="text/javascript">
$(function () {
Expand All @@ -27,11 +24,9 @@
});
</script>
<![endif]-->
{% endspaceless %}
{% endblock genemu_captcha_javascript %}

{% block genemu_recaptcha_javascript %}
{% spaceless %}
<script type="text/javascript" src="{{ asset("https://www.google.com/recaptcha/api/js/recaptcha_ajax.js") }}"></script>
<script type="text/javascript">
function genemu_recaptcha_load()
Expand All @@ -47,11 +42,9 @@
window.onload = genemu_recaptcha_load;
}
</script>
{% endspaceless %}
{% endblock genemu_recaptcha_javascript %}

{% block genemu_tinymce_javascript %}
{% spaceless %}
{% if configs.script_url is defined %}
{% set configs = configs|merge({
"script_url": asset(configs.script_url)
Expand Down Expand Up @@ -83,11 +76,9 @@

});
</script>
{% endspaceless %}
{% endblock genemu_tinymce_javascript %}

{% block genemu_jquerydate_javascript %}
{% spaceless %}
<script type="text/javascript">
jQuery(document).ready(function($) {
$field = $('#{% if widget != "single_text" %}datepicker_{% endif %}{{ id }}');
Expand Down Expand Up @@ -125,11 +116,9 @@
{% endblock %}
});
</script>
{% endspaceless %}
{% endblock %}

{% block genemu_jqueryslider_javascript %}
{% spaceless %}
<script type="text/javascript">
jQuery(document).ready(function($) {
var $field = $('#{{ id }}');
Expand All @@ -143,11 +132,9 @@
$('#{{ id }}_slider').slider($configs);
});
</script>
{% endspaceless %}
{% endblock genemu_jqueryslider_javascript %}

{% block genemu_jquerycolor_javascript %}
{% spaceless %}
<script type="text/javascript">
jQuery(document).ready(function($) {
var $field = $('#{{ id }}');
Expand Down Expand Up @@ -181,21 +168,17 @@
{% endif %}
});
</script>
{% endspaceless %}
{% endblock genemu_jquerycolor_javascript %}

{% block genemu_jqueryrating_javascript %}
{% spaceless %}
<script type="text/javascript">
jQuery(document).ready(function($) {
$('[name="{{ full_name }}"]').rating({{ configs|json_encode|raw }});
});
</script>
{% endspaceless %}
{% endblock genemu_jqueryrating_javascript %}

{% block genemu_jquerytokeninput_javascript %}
{% spaceless %}
<script type="text/javascript">
jQuery(document).ready(function($) {
var $field = $('#{{ id }}');
Expand Down Expand Up @@ -239,11 +222,9 @@
);
});
</script>
{% endspaceless %}
{% endblock genemu_jquerytokeninput_javascript %}

{% block genemu_jqueryautocompleter_javascript %}
{% spaceless %}
<script type="text/javascript">
jQuery(document).ready(function($) {
var $field = $('#{{ id }}');
Expand Down Expand Up @@ -311,11 +292,9 @@
{% endif %}
});
</script>
{% endspaceless %}
{% endblock genemu_jqueryautocompleter_javascript %}

{% block genemu_jqueryautocomplete_javascript %}
{% spaceless %}
<script type="text/javascript">
jQuery(document).ready(function($) {
var $autocompleter = $('#{{ id }}');
Expand All @@ -340,11 +319,9 @@
{% endif %}
});
</script>
{% endspaceless %}
{% endblock %}

{% block genemu_jquerychosen_javascript %}
{% spaceless %}
<script type="text/javascript">
jQuery(document).ready(function($) {
$field = $('#{{ id }}');
Expand All @@ -358,11 +335,9 @@
{% endblock %}
});
</script>
{% endspaceless %}
{% endblock %}

{% block genemu_jquerygeolocation_javascript %}
{% spaceless %}
{# Elements generation #}
{% if map is same as(true) %}
{% set elements = elements|merge({"map": "#" ~ id ~ "_map"}) %}
Expand Down Expand Up @@ -403,11 +378,9 @@
{% endif %}
});
</script>
{% endspaceless %}
{% endblock genemu_jquerygeolocation_javascript %}

{% block genemu_jqueryfile_javascript %}
{% spaceless %}
<script type="text/javascript">
jQuery(document).ready(function($) {
var $field = $('#{{ id }}_upload');
Expand Down Expand Up @@ -481,11 +454,9 @@
{% endblock %}
});
</script>
{% endspaceless %}
{% endblock %}

{% block genemu_jqueryimage_javascript %}
{% spaceless %}
<script type="text/javascript">
jQuery(document).ready(function($) {
var $field = $('#{{ id }}_upload');
Expand Down Expand Up @@ -649,7 +620,6 @@
{% endblock %}
});
</script>
{% endspaceless %}
{% endblock %}

{% block genemu_jqueryselect2_javascript %}
Expand Down
Loading