<commit_before>{% extends "views/components/map.htm" %}
{% load i18n %}

{% block tabs %}
<div class="workbench-card-sidebar-tab" data-bind="click: function() {
    toggleTab('editor');
}, css: {
    'active': activeTab() === 'editor'
}">
    <i class="fa fa-pencil"></i>
    <span class="map-sidebar-text">{% trans "Edit" %}</span>
</div>
{{ block.super }}
{% endblock tabs %}

{% block sidepanel %}
<!--ko if: activeTab() === 'editor' -->
    <div class="workbench-header-buffer">
        <div class="workbench-card-sidepanel-header-container">
            <h4 class="workbench-card-sidepanel-header" data-bind="click: hideSidePanel, text: card.model.name"></h4>
        </div>
    </div>
    <div data-bind="css: card.model.cssclass">

        <!-- ko if: reviewer && provisionalTileViewModel.selectedProvisionalEdit() -->
        <div class="edit-message-container" style="margin-left: -16px;">
            <span>{% trans 'Showing edits by' %}</span>
            <span class="edit-message-container-user" data-bind="text: provisionalTileViewModel.selectedProvisionalEdit().username() + '.'"></span>
            <!-- ko if: !provisionalTileViewModel.tileIsFullyProvisional() -->
            <a class="reset-authoritative" href='' data-bind="click: function(){provisionalTileViewModel.resetAuthoritative();}">{% trans 'Return to approved edits' %}</a>
            <!-- /ko-->
            <!-- ko if: provisionalTileViewModel.selectedProvisionalEdit().isfullyprovisional -->
            <span>{% trans ' This is a new contribution by a provisional editor.' %}</span>
            <!-- /ko-->
        </div>
        <!-- /ko-->

        <!-- ko if: reviewer && provisionalTileViewModel.provisionaledits().length > 0 && !provisionalTileViewModel.selectedProvisionalEdit()-->
        <div class="edit-message-container approved" style="margin-left: -16px;">
            <div>{% trans 'Currently showing the most recent approved edits' %}</div>
        </div>
        <!-- /ko-->



        <div class="new-provisional-edit-card-container">
            <!-- ko if: reviewer && provisionalTileViewModel.provisionaledits().length > 0 -->
            <!-- ko if: !provisionalTileViewModel.tileIsFullyProvisional() -->
            <div class='new-provisional-edits-list' style="margin-right: -20px">
                <div class='new-provisional-edits-header'>
                    <div class='new-provisional-edits-title'>{% trans 'Provisional Edits' %}</div>
                    <div class="btn btn-shim btn-danger btn-labeled btn-xs fa fa-trash new-provisional-edits-delete-all" style="padding: 3px;" data-bind="click: function(){
                            provisionalTileViewModel.deleteAllProvisionalEdits();
                        }">{% trans 'Delete all edits' %}</div>
                </div>
                <!-- ko foreach: { data: provisionalTileViewModel.provisionaledits(), as: 'pe' } -->
                <div class='new-provisional-edit-entry' data-bind="css: {
                        'selected': pe === $parent.provisionalTileViewModel.selectedProvisionalEdit()
                    }, click: function(){
                        $parent.provisionalTileViewModel.selectProvisionalEdit(pe);
                    }">
                    <div class='title'>
                        <div class='field'>
                            <span data-bind="text : pe.username"></span>
                        </div>
                        <a href='' class='field fa fa-times-circle new-delete-provisional-edit' data-bind="click : function(){
                            $parent.provisionalTileViewModel.rejectProvisionalEdit(pe);
                        }"></a>
                    </div>
                    <div class="field timestamp">
                        <span data-bind="text : pe.displaydate">@</span>
                        <span data-bind="text : pe.displaytimestamp"></span>
                    </div>
                </div>
                <!-- /ko -->
            </div>
            <!-- /ko-->
            <!-- /ko-->

            <!-- ko if: geoJSONString() !== undefined -->
            <div class="card">
                <div class="geojson-editor" data-bind="codemirror: {
                    value: geoJSONString,
                    mode: { name: 'javascript', json: true },
                    lineNumbers: true
                }"></div>
                <div class="install-buttons">
                    <button class="btn btn-shim btn-danger btn-labeled btn-lg fa fa-times" data-bind="click: function () {
                        geoJSONString(undefined);
                    }">{% trans 'Cancel' %}</button>
                    <button class="btn btn-shim btn-labeled btn-lg fa fa-plus btn-mint" data-bind="css: {
                        disabled: geoJSONErrors().length !== 0
                    }, click: updateGeoJSON">{% trans 'Update Features' %}</button>
                </div>
                <!-- ko if: geoJSONErrors().length !== 0 -->
                <div class="geojson-error-list">
                    {% trans "GeoJSON has the following errors that must be resolved:" %}
                    <ul>
                        <!-- ko foreach: geoJSONErrors() -->
                        <li data-bind="text: message"></li>
                        <!-- /ko-->
                    </ul>
                </div>
                <!-- /ko-->
            </div>
            <!-- /ko-->

            <div class="card" data-bind="visible: geoJSONString() === undefined">
                {% block form_header %}
                <!-- ko if: card.model.helpenabled -->
                <span>
                    <a class="pull-right card-help help editable-help" data-bind="click: function () {
                        card.model.get('helpactive')(true)
                    }" style="cursor:pointer;">
                        {% trans "Help" %}
                        <i class="fa fa-question-circle"></i>
                    </a>
                </span>
                <!-- /ko -->
                <h5 data-bind="text: card.model.instructions"></h5>
                {% endblock form_header %}
                <!-- ko if: card.widgets().length > 0 -->
                {% block form_widgets %}
                <form class="widgets" style="margin-bottom: 20px;">
                    <div data-bind="foreach: {
                            data:card.widgets, as: 'widget'
                        }">
                        <!-- ko if: ko.unwrap(self.form.nodeLookup[widget.node_id()].datatype) === 'geojson-feature-collection' -->
                        <div class="row widget-wrapper">
                            <div class="form-group">
                                <label class="control-label widget-input-label" for="" data-bind="text:widget.label"></label>
                                <i data-bind="css: {'ion-asterisk widget-label-required': self.form.nodeLookup[widget.node_id()].isrequired}"></i>

                                <div class="col-xs-12">
                                    <div class="map-card-feature-list">
                                        <div class="add-new-feature">
                                            <select data-placeholder="{% trans "Add a new feature..." %}" data-bind="
                                                value: self.featureLookup[widget.node_id()].selectedTool,
                                                valueAllowUnset: true,
                                                options: widget.drawTools,
                                                optionsText: 'text',
                                                optionsValue: 'value',
                                                chosen: {
                                                    'width': '100%',
                                                    'disable_search_threshold': 10,
                                                    'allow_single_deselect': true
                                                }
                                            "></select>
                                        </div>
                                        <div class="map-data-drop-area" data-bind="event: {
                                            dragover: dropZoneOverHandler,
                                            drop: dropZoneHandler
                                        }">
                                            {% trans "Drag GeoJSON or KML files here to add..." %}
                                        </div>
                                        <table class="table">
                                            <tbody>
                                                <!-- ko foreach: {data: self.featureLookup[widget.node_id()].features, as: 'feature'} -->
                                                <tr class="map-card-feature-item" data-bind="css: {'active': self.selectedFeatureIds().indexOf(feature.id) >= 0}, click: function() { self.fitFeatures([feature]) }">
                                                    <td>
                                                        <span class="map-card-feature-name" data-bind="text: feature.geometry.type"></span>
                                                    </td>
                                                    <td class="map-card-feature-tool">
                                                        <a href="javascript:void(0);" data-bind="click: function() { self.editFeature(feature) }, clickBubble: false">
                                                            <i class="fa fa-pencil map-card-feature-edit"></i>
                                                            {% trans "Edit" %}
                                                        </a>
                                                    </td>
                                                    <td class="map-card-feature-tool">
                                                        <a href="javascript:void(0);" data-bind="click: function() { self.deleteFeature(feature) }, clickBubble: false">
                                                            <i class="fa fa-trash map-card-feature-delete"></i><commit_msg>fixes data drop zone for map card re: #6953<commit_after>{% extends "views/components/map.htm" %}
{% load i18n %}

{% block tabs %}
<div class="workbench-card-sidebar-tab" data-bind="click: function() {
    toggleTab('editor');
}, css: {
    'active': activeTab() === 'editor'
}">
    <i class="fa fa-pencil"></i>
    <span class="map-sidebar-text">{% trans "Edit" %}</span>
</div>
{{ block.super }}
{% endblock tabs %}

{% block sidepanel %}
<!--ko if: activeTab() === 'editor' -->
    <div class="workbench-header-buffer">
        <div class="workbench-card-sidepanel-header-container">
            <h4 class="workbench-card-sidepanel-header" data-bind="click: hideSidePanel, text: card.model.name"></h4>
        </div>
    </div>
    <div data-bind="css: card.model.cssclass">

        <!-- ko if: reviewer && provisionalTileViewModel.selectedProvisionalEdit() -->
        <div class="edit-message-container" style="margin-left: -16px;">
            <span>{% trans 'Showing edits by' %}</span>
            <span class="edit-message-container-user" data-bind="text: provisionalTileViewModel.selectedProvisionalEdit().username() + '.'"></span>
            <!-- ko if: !provisionalTileViewModel.tileIsFullyProvisional() -->
            <a class="reset-authoritative" href='' data-bind="click: function(){provisionalTileViewModel.resetAuthoritative();}">{% trans 'Return to approved edits' %}</a>
            <!-- /ko-->
            <!-- ko if: provisionalTileViewModel.selectedProvisionalEdit().isfullyprovisional -->
            <span>{% trans ' This is a new contribution by a provisional editor.' %}</span>
            <!-- /ko-->
        </div>
        <!-- /ko-->

        <!-- ko if: reviewer && provisionalTileViewModel.provisionaledits().length > 0 && !provisionalTileViewModel.selectedProvisionalEdit()-->
        <div class="edit-message-container approved" style="margin-left: -16px;">
            <div>{% trans 'Currently showing the most recent approved edits' %}</div>
        </div>
        <!-- /ko-->



        <div class="new-provisional-edit-card-container">
            <!-- ko if: reviewer && provisionalTileViewModel.provisionaledits().length > 0 -->
            <!-- ko if: !provisionalTileViewModel.tileIsFullyProvisional() -->
            <div class='new-provisional-edits-list' style="margin-right: -20px">
                <div class='new-provisional-edits-header'>
                    <div class='new-provisional-edits-title'>{% trans 'Provisional Edits' %}</div>
                    <div class="btn btn-shim btn-danger btn-labeled btn-xs fa fa-trash new-provisional-edits-delete-all" style="padding: 3px;" data-bind="click: function(){
                            provisionalTileViewModel.deleteAllProvisionalEdits();
                        }">{% trans 'Delete all edits' %}</div>
                </div>
                <!-- ko foreach: { data: provisionalTileViewModel.provisionaledits(), as: 'pe' } -->
                <div class='new-provisional-edit-entry' data-bind="css: {
                        'selected': pe === $parent.provisionalTileViewModel.selectedProvisionalEdit()
                    }, click: function(){
                        $parent.provisionalTileViewModel.selectProvisionalEdit(pe);
                    }">
                    <div class='title'>
                        <div class='field'>
                            <span data-bind="text : pe.username"></span>
                        </div>
                        <a href='' class='field fa fa-times-circle new-delete-provisional-edit' data-bind="click : function(){
                            $parent.provisionalTileViewModel.rejectProvisionalEdit(pe);
                        }"></a>
                    </div>
                    <div class="field timestamp">
                        <span data-bind="text : pe.displaydate">@</span>
                        <span data-bind="text : pe.displaytimestamp"></span>
                    </div>
                </div>
                <!-- /ko -->
            </div>
            <!-- /ko-->
            <!-- /ko-->

            <!-- ko if: geoJSONString() !== undefined -->
            <div class="card">
                <div class="geojson-editor" data-bind="codemirror: {
                    value: geoJSONString,
                    mode: { name: 'javascript', json: true },
                    lineNumbers: true
                }"></div>
                <div class="install-buttons">
                    <button class="btn btn-shim btn-danger btn-labeled btn-lg fa fa-times" data-bind="click: function () {
                        geoJSONString(undefined);
                    }">{% trans 'Cancel' %}</button>
                    <button class="btn btn-shim btn-labeled btn-lg fa fa-plus btn-mint" data-bind="css: {
                        disabled: geoJSONErrors().length !== 0
                    }, click: updateGeoJSON">{% trans 'Update Features' %}</button>
                </div>
                <!-- ko if: geoJSONErrors().length !== 0 -->
                <div class="geojson-error-list">
                    {% trans "GeoJSON has the following errors that must be resolved:" %}
                    <ul>
                        <!-- ko foreach: geoJSONErrors() -->
                        <li data-bind="text: message"></li>
                        <!-- /ko-->
                    </ul>
                </div>
                <!-- /ko-->
            </div>
            <!-- /ko-->

            <div class="card" data-bind="visible: geoJSONString() === undefined">
                {% block form_header %}
                <!-- ko if: card.model.helpenabled -->
                <span>
                    <a class="pull-right card-help help editable-help" data-bind="click: function () {
                        card.model.get('helpactive')(true)
                    }" style="cursor:pointer;">
                        {% trans "Help" %}
                        <i class="fa fa-question-circle"></i>
                    </a>
                </span>
                <!-- /ko -->
                <h5 data-bind="text: card.model.instructions"></h5>
                {% endblock form_header %}
                <!-- ko if: card.widgets().length > 0 -->
                {% block form_widgets %}
                <form class="widgets" style="margin-bottom: 20px;">
                    <div data-bind="foreach: {
                            data:card.widgets, as: 'widget'
                        }">
                        <!-- ko if: ko.unwrap(self.form.nodeLookup[widget.node_id()].datatype) === 'geojson-feature-collection' -->
                        <div class="row widget-wrapper">
                            <div class="form-group">
                                <label class="control-label widget-input-label" for="" data-bind="text:widget.label"></label>
                                <i data-bind="css: {'ion-asterisk widget-label-required': self.form.nodeLookup[widget.node_id()].isrequired}"></i>

                                <div class="col-xs-12">
                                    <div class="map-card-feature-list">
                                        <div class="add-new-feature">
                                            <select data-placeholder="{% trans "Add a new feature..." %}" data-bind="
                                                value: self.featureLookup[widget.node_id()].selectedTool,
                                                valueAllowUnset: true,
                                                options: widget.drawTools,
                                                optionsText: 'text',
                                                optionsValue: 'value',
                                                chosen: {
                                                    'width': '100%',
                                                    'disable_search_threshold': 10,
                                                    'allow_single_deselect': true
                                                }
                                            "></select>
                                        </div>
                                        <div class="map-data-drop-area" data-bind="event: {
                                            dragover: self.dropZoneOverHandler,
                                            drop: self.dropZoneHandler
                                        }">
                                            {% trans "Drag GeoJSON or KML files here to add..." %}
                                        </div>
                                        <table class="table">
                                            <tbody>
                                                <!-- ko foreach: {data: self.featureLookup[widget.node_id()].features, as: 'feature'} -->
                                                <tr class="map-card-feature-item" data-bind="css: {'active': self.selectedFeatureIds().indexOf(feature.id) >= 0}, click: function() { self.fitFeatures([feature]) }">
                                                    <td>
                                                        <span class="map-card-feature-name" data-bind="text: feature.geometry.type"></span>
                                                    </td>
                                                    <td class="map-card-feature-tool">
                                                        <a href="javascript:void(0);" data-bind="click: function() { self.editFeature(feature) }, clickBubble: false">
                                                            <i class="fa fa-pencil map-card-feature-edit"></i>
                                                            {% trans "Edit" %}
                                                        </a>
                                                    </td>
                                                    <td class="map-card-feature-tool">
                                                        <a href="javascript:void(0);" data-bind="click: function() { self.deleteFeature(feature) }, clickBubble: false">
                                                            <i class="fa fa-trash map-card-feature-delete"></i>
{'fraction_non_alphanumeric': 0.1390006871502896, 'fraction_numerical': 0.003141258466673211, 'mean_word_length': 1.1714803367792817, 'pattern_counts': {'":': 0, '<': 275, '<?xml version=': 0, '>': 283, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 142, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3516383', 'n_tokens_mistral': 4890, 'n_tokens_neox': 4515, 'n_words': 945}