Skip to content

Commit

Permalink
Merge branch '2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
bamarni committed Nov 15, 2012
2 parents 070a4f9 + 7d2f82c commit 940d14c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion Resources/doc/tips/form_prototype.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Prototype usage within form collections

WARNING : This is currently only available for chosen, select2 and uploadify.
WARNING : This is currently not available for all types, please open an issue or
a PR if it doesn't work for your type.

If you dynamically add one of our field in your template using the Symfony protoype feature,
you'd probably notify that it doesn't show up correctly. Indeed, most of our types require some javascript,
Expand Down
28 changes: 17 additions & 11 deletions Resources/views/Form/jquery_layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,23 @@

{% block genemu_jquerydate_javascript %}
{% spaceless %}
{% if configs.buttonImage is defined %}
{% set configs = configs|merge({
"buttonImage": asset(configs.buttonImage)
}) %}
{% endif %}

{% if culture == "en" %}
{% set culture = "en-GB" %}
{% endif %}

<script type="text/javascript">
jQuery(document).ready(function($) {
$field = $('#{{ id }}');
{% block genemu_jquerydate_javascript_prototype %}
{% if configs.buttonImage is defined %}
{% set configs = configs|merge({
"buttonImage": asset(configs.buttonImage)
}) %}
{% endif %}
{% if culture == "en" %}
{% set culture = "en-GB" %}
{% endif %}
var $configs = $.extend({
minDate: new Date({{ min_year }}, 0, 1),
maxDate: new Date({{ max_year }}, 11, 31)
Expand All @@ -104,11 +109,12 @@
}
{% endif %}
$('#{{ id }}').datepicker($configs);
$field.datepicker($configs);
{% endblock %}
});
</script>
{% endspaceless %}
{% endblock genemu_jquerydate_javascript %}
{% endblock %}

{% block genemu_jqueryslider_javascript %}
{% spaceless %}
Expand Down

0 comments on commit 940d14c

Please sign in to comment.