<commit_before><#--
    ModelWrapper's covariate list page, to add and edit covariate files.
    Copyright (c) 2014 University of Oxford
-->
<#import "shared/layout/common.ftl" as c/>
<#import "shared/layout/form.ftl" as f/>
<#import "shared/layout/table.ftl" as t/>
<#import "shared/layout/panel.ftl" as p/>
<#assign bootstrapData>
    <script type="text/javascript">
        // bootstrapped data for js viewmodels
        var initialData = ${initialData};
    </script>
</#assign>

<#assign templates>
    <@t.tableTemplates numberOfColumns=4 plural="files">
        <tr>
            <td data-bind="event: { mouseover: function() { mouseOver(true) }, mouseout: function() { mouseOver(false) } }">
                <input type="text" data-bind="formValue: name, attr: { title: name }, css: { 'transparent-input': !mouseOver() }" placeholder="No name given" >
            </td>
            <td><input type="text" data-bind="formValue: path, attr: { title: path }" readonly="true" class="transparent-input" ></td>
            <td><input type="checkbox" data-bind="formChecked: state"></td>
            <td>
                <button class="btn btn-default fa fa-lg fa-trash-o" style="float: right" data-bind="popover: { title: 'Delete file?', trigger: 'focus', placement: 'bottom', template: 'file-list-delete-template'}, click: function(data, event) { event.preventDefault(); }, bootstrapDisable: $parent.isSubmitting()"></button>
                    <span data-bind="if: info">
                        <i class="fa fa-lg fa-info-circle text-info" data-bind="tooltip: { title: info, placement: 'bottom' }"></i>&nbsp;
                    </span>
            </td>
        </tr>
    </@t.tableTemplates>
    <script type="text/html" id="file-list-delete-template">
        <p>This file is currently used in <span data-bind="text: usageCount"></span> <span data-bind="text: usageCount() === 1 ? 'disease' : 'diseases'"></span>. Are you sure you want to delete it?</p><br>
        <p style="text-align:center;">
            <span class="btn btn-default" data-bind="click: function () { hide(true) }" data-dismiss="popover">Confirm<span>
        </p>
    </script>
</#assign>

<@c.page title="ABRAID-MP ModelWrapper" mainjs="/js/kickstart/covariates" bootstrapData=bootstrapData templates=templates>
<div class="container">
    <@p.panel "add-covariate-body" "Add Covariate File" true>
        <p>Use the fields below to add new covariate files to the system.</p>
        <@f.form "add-covariate-form" "Upload" "Uploading..."><commit_msg>Change placeholder text on covariate name field<commit_after><#--
    ModelWrapper's covariate list page, to add and edit covariate files.
    Copyright (c) 2014 University of Oxford
-->
<#import "shared/layout/common.ftl" as c/>
<#import "shared/layout/form.ftl" as f/>
<#import "shared/layout/table.ftl" as t/>
<#import "shared/layout/panel.ftl" as p/>
<#assign bootstrapData>
    <script type="text/javascript">
        // bootstrapped data for js viewmodels
        var initialData = ${initialData};
    </script>
</#assign>

<#assign templates>
    <@t.tableTemplates numberOfColumns=4 plural="files">
        <tr>
            <td data-bind="event: { mouseover: function() { mouseOver(true) }, mouseout: function() { mouseOver(false) } }">
                <input type="text" data-bind="formValue: name, attr: { title: name }, css: { 'transparent-input': !mouseOver() }" placeholder="A name must be provided" >
            </td>
            <td><input type="text" data-bind="formValue: path, attr: { title: path }" readonly="true" class="transparent-input" ></td>
            <td><input type="checkbox" data-bind="formChecked: state"></td>
            <td>
                <button class="btn btn-default fa fa-lg fa-trash-o" style="float: right" data-bind="popover: { title: 'Delete file?', trigger: 'focus', placement: 'bottom', template: 'file-list-delete-template'}, click: function(data, event) { event.preventDefault(); }, bootstrapDisable: $parent.isSubmitting()"></button>
                    <span data-bind="if: info">
                        <i class="fa fa-lg fa-info-circle text-info" data-bind="tooltip: { title: info, placement: 'bottom' }"></i>&nbsp;
                    </span>
            </td>
        </tr>
    </@t.tableTemplates>
    <script type="text/html" id="file-list-delete-template">
        <p>This file is currently used in <span data-bind="text: usageCount"></span> <span data-bind="text: usageCount() === 1 ? 'disease' : 'diseases'"></span>. Are you sure you want to delete it?</p><br>
        <p style="text-align:center;">
            <span class="btn btn-default" data-bind="click: function () { hide(true) }" data-dismiss="popover">Confirm<span>
        </p>
    </script>
</#assign>

<@c.page title="ABRAID-MP ModelWrapper" mainjs="/js/kickstart/covariates" bootstrapData=bootstrapData templates=templates>
<div class="container">
    <@p.panel "add-covariate-body" "Add Covariate File" true>
        <p>Use the fields below to add new covariate files to the system.</p>
        <@f.form "add-covariate-form" "Upload" "Uploading...">
{'fraction_non_alphanumeric': 0.17163009404388715, 'fraction_numerical': 0.0023510971786833857, 'mean_word_length': 3.1741618969746526, 'pattern_counts': {'":': 0, '<': 105, '<?xml version=': 0, '>': 105, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3397734', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1552, 'n_words': 407}