{% extends 'base.navigation.html.twig' %}
{% block content %}
{#call_webservice path="details/TraitOfProject" data=["trait_type_id"=>$trait_type_id, "dbversion"=>$DbVersion, "internal_project_id" => $internal_project_id] assign='data'#}
<h2 class="page-header">{{ trait.name }}</h2>
<div class='row'>
    {% if trait.trait_format == 'categorical_free' %}
    <div class='col-xs-12'>
        <button class="btn btn-primary" id="add-trait-to-project-button">Add trait to project</button>
        <div id='pieChart'></div>
        <script>
            var internalProjectId = '{{ internal_project_id }}';
            var biom = function(){
                var Biom = require('biojs-io-biom').Biom;
                var biomObject = {{ project['projects'][internal_project_id]['biom']|raw }};
                return new Biom(biomObject);
            }();
            var traitValues = {{ trait.values|json_encode()|raw }};
            var counts = _.countBy(condenseTraitValues(traitValues));
            counts['NA'] = biom.shape[0] - _.sum(Object.values(counts));
            drawPieChart(counts);
        </script>
    </div>
    {% else %}
    <div class='col-xs-12'>
        <h1>Unknown trait type</h1>
    </div>
    {% endif %}
</div>
{% endblock %}
{% extends 'base.navigation.html.twig' %}
{% block content %}
{#call_webservice path="details/TraitOfProject" data=["trait_type_id"=>$trait_type_id, "dbversion"=>$DbVersion, "internal_project_id" => $internal_project_id] assign='data'#}
<h2 class="page-header">{{ trait.name }}</h2>
<div class='row'>
    {% if trait.trait_format == 'categorical_free' %}
    <div class='col-xs-12'>
        <button class="btn btn-primary" id="add-trait-to-project-button">Add trait to project</button>
        <div id='pieChart'></div>
        <script>
            var internalProjectId = '{{ internal_project_id }}';
            var biom = function(){
                var Biom = require('biojs-io-biom').Biom;
                var biomObject = {{ project['projects'][internal_project_id]['biom']|raw }};
                return new Biom(biomObject);
            }();
            var traitName = '{{ trait.name }}';
            var traitValues = condenseTraitValues({{ trait.values|json_encode()|raw }});
            var counts = _.countBy(traitValues);
            counts['NA'] = biom.shape[0] - _.sum(Object.values(counts));
            drawPieChart(counts);
        </script>
        <script src="{{ asset('assets/js/project/traitDetails.js') }}"></script>
    </div>
    {% else %}
    <div class='col-xs-12'>
        <h1>Unknown trait type</h1>
    </div>
    {% endif %}
</div>
{% endblock %}
Add more semi-global variables and include script
Add more semi-global variables and include script
