<commit_before><script type="text/javascript" src="{{ asset('bundles/fosjsrouting/js/routing.js') }}"></script>
<script type="text/javascript" src="{{ path('fos_js_routing_js') }}"></script>

<script src="{{ asset('bundles/symfonycmftree/js/jstree/jquery.jstree.js') }}" type="text/javascript"></script>

<script type="text/javascript">
    
    (function ($) {
        $.phpcrbrowser = {};
        
        $.phpcrbrowser.getUrl = function (target, node_id) {
            {% set token = <PASSWORD>@@' %}
            
            var base_urls = {
                "create":   "{% block create_base_url %}{% endblock %}",
                "delete":   "{% block delete_base_url %}{% endblock %}",
                "edit":     "{% block edit_base_url %}{% endblock %}",
            }

            return base_urls[target].replace("{{ token | url_encode }}", node_id);
        }
    })(jQuery);

    function initTree(selector) {

        jQuery(selector).jstree({ 
            "plugins" :     [ "contextmenu", "themes", "types", "ui", "json_data" ],
            "json_data": {
                "ajax": {
                    url:    "{{ path('symfony_cmf_phpcr_browser_children') }}",
                    data:   function (node) {
                        return { 'root' : jQuery(node).attr('id') };
                    }
                }
            },
            "types": {
                "max_depth":        -2,
                "max_children":     -2,
                "valid_children":  [ "folder" ],
                "types": {
                    "default": {
                        "valid_children": "none",
                        "icon": {
                            "image": "{{ asset('bundles/symfonycmftree/images/document.png') }}"
                        }
                    },
                    "folder": {
                        "valid_children": [ "default", "folder" ],
                        "icon": {
                            "image": "{{ asset('bundles/symfonycmftree/images/folder.png') }}"
                        }
                    }
                }
            },
            "contextmenu": {
                "items": {
                    "rename":   null,
                    "remove":   null,
                    "ccp":      null,
                    "create": {
                        "label":    "Create",
                        "action":   function (node) {
                                        window.location = jQuery.phpcrbrowser.getUrl('create', node.attr("id"));
                                    }
                    },
                    "delete": {
                        "label":    "Delete",
                        "action":   function (node) {
                                        window.location = jQuery.phpcrbrowser.getUrl('delete', node.attr("id"));
                                    }
                    }
                }
            }
        })
        .bind("select_node.jstree", function (event, data) {
            window.location = jQuery.phpcrbrowser.getUrl('edit', data.rslt.obj.attr("id"));
        })
        .delegate("a", "click", function (event, data) { event.preventDefault(); });
    }

    $(document).ready(function() {
        initTree("{% block selector %}{% endblock %}");
    });

</script><commit_msg>Reduced impact of server-side computed routes. Still some tweaking needed: not every route has been removed; one route does not work.<commit_after><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 src="{{ asset('bundles/symfonycmftree/js/jstree/jquery.jstree.js') }}" type="text/javascript"></script>

<script type="text/javascript">
    
    function initTree(selector) {

        jQuery(selector).jstree({ 
            "plugins" :     [ "contextmenu", "themes", "types", "ui", "json_data" ],
            "json_data": {
                "ajax": {
                    url:    Routing.generate('symfony_cmf_phpcr_browser_children'),
                    data:   function (node) {
                        return { 'root' : jQuery(node).attr('id') };
                    }
                }
            },
            "types": {
                "max_depth":        -2,
                "max_children":     -2,
                "valid_children":  [ "folder" ],
                "types": {
                    "default": {
                        "valid_children": "none",
                        "icon": {
                            "image": "{{ asset('bundles/symfonycmftree/images/document.png') }}"
                        }
                    },
                    "folder": {
                        "valid_children": [ "default", "folder" ],
                        "icon": {
                            "image": "{{ asset('bundles/symfonycmftree/images/folder.png') }}"
                        }
                    }
                }
            },
            "contextmenu": {
                "items": {
                    "rename":   null,
                    "remove":   null,
                    "ccp":      null,
                    "create": {
                        "label":    "Create",
                        "action":   function (node) {
                                        window.location = Routing.generate('admin_sandbox_main_editablestaticcontent_create', { "id": node.attr("id") })
                                    }
                    },
                    "delete": {
                        "label":    "Delete",
                        "action":   function (node) {
                                        window.location = Routing.generate('admin_sandbox_main_editablestaticcontent_delete', { "id": node.attr("id") })
                                    }
                    }
                }
            }
        })
        .bind("select_node.jstree", function (event, data) {
            window.location = Routing.generate('admin_sandbox_main_editablestaticcontent_edit', { "id": data.rslt.obj.attr("id") });
        })
        .delegate("a", "click", function (event, data) { event.preventDefault(); });
    }

    $(document).ready(function() {
        initTree("{% block selector %}{% endblock %}");
    });

</script>
{'fraction_non_alphanumeric': 0.14939987365761212, 'fraction_numerical': 0.0006317119393556538, 'mean_word_length': 1.1959084604715673, 'pattern_counts': {'":': 59, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4233031', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1586, 'n_words': 255}