<commit_before>{% import '_includes/forms' as forms %}

{% extends 'feed-me/_layouts' %}

{% do view.registerTranslations('feed-me', [
    'Suspend missing users',
    'Suspends any users that are missing from the feed.',
    'None',
    'Processing complete!',
    'Processing failed.',
    'View logs',
]) %}

{% set crumbs = [
    { label: craft.feedme.getPluginName | t('feed-me'), url: url('feed-me') },
] %}

{% if feed.id %}
    {% set crumbs = crumbs | merge([
        { label: feed.name | t('feed-me'), url: url('feed-me/feeds/' ~ feed.id) },
    ]) %}
{% endif %}

{% set title = (feed.id) ? feed.name : 'Create a new feed' | t('feed-me') %}
{% set noTabs = true %}
{% set fullPageForm = true %}

{% set buttons %}
    <div class="buttons">
        <input type="button" data-action="feed-me/feeds/save-feed" class="btn submit" value="{{ 'Save' | t('feed-me') }}">
        <input type="button" data-action="feed-me/feeds/save-and-element-feed" class="btn submit" value="{{ 'Save & Continue' | t('feed-me') }}">
    </div>
{% endset %}

{% block actionButton %}
    {{ buttons }}
{% endblock %}

{% block blockContent %}
    <input type="hidden" name="action" value="feed-me/feeds/save-feed">

    {% if feed.id %}<input type="hidden" name="feedId" value="{{ feed.id }}">{% endif %}

    {{ forms.textField({
        first: true,
        label: "Name" | t('feed-me'),
        instructions: "What this feed will be called in the CP." | t('feed-me'),
        id: 'name',
        name: 'name',
        value: feed.name,
        errors: feed.getErrors('name'),
        autofocus: true,
        required: true,
    }) }}

    {{ forms.textField({
        label: "Feed URL" | t('feed-me'),
        instructions: "Can be a file on the local file system or from a website url (http://...)." | t('feed-me'),
        id: 'feedUrl',
        name: 'feedUrl',
        value: feed.feedUrl,
        errors: feed.getErrors('feedUrl'),
        required: true,
    }) }}

    {{ forms.selectField({
        label: "Feed Type" | t('feed-me'),
        instructions: 'Choose what type of feed you\'re retrieving.' | t('feed-me'),
        id: 'feedType',
        name: 'feedType',
        options: dataTypes,
        value: feed.feedType,
        errors: feed.getErrors('feedType'),
        required: true,
    }) }}

    <hr>

    {% set elementsList = [] %}
    {% for elementClass, element in elements %}
        {% set elementsList = elementsList | merge({ (elementClass): element.name }) %}
    {% endfor %}

    {{ forms.selectField({
        label: "Element Type" | t('feed-me'),
        instructions: 'Choose what element you want to save your feed data to.' | t('feed-me'),
        id: 'elementType',
        name: 'elementType',
        options: [{ label: 'Select', value: '' }] | merge(elementsList),
        value: feed.elementType,
        errors: feed.getErrors('elementType'),
        required: true,
    }) }}

    {% for elementClass, element in elements %}
        <div class="element-select" data-type="{{ elementClass | replace('\\', '-') }}">
            {% set elementType = elementClass %}

            {% include element.groupsTemplate ignore missing %}
        </div>
    {% endfor %}

    {% if craft.app.isMultiSite() %}
        {% set sites = [{ label: 'All Sites' | t('feed-me'), value: '' }] %}

        {% for site in craft.app.sites.getAllSites() %}
            {% set sites = sites | merge([{ label: site.name, value: site.id }]) %}
        {% endfor %}

        {{ forms.selectField({
            label: "Sites" | t('feed-me'),
            instructions: 'Choose which site you want to save your feed data to.' | t('feed-me'),
            id: 'siteId',
            name: 'siteId',
            options: sites,
            value: feed.siteId,
        }) }}
    {% endif %}

    <hr>

    {{ forms.field({
        label: "Import strategy" | t('feed-me'),
        instructions: 'Choose what happens when this feed is run again.' | t('feed-me'),
        id: 'duplicateHandle',
    }) }}

    {{ forms.checkboxField({
        id: 'duplicateHandle',
        name: 'duplicateHandle[]',
        label: 'Create new elements'|t('feed-me'),
        instructions: 'Adds new elements if they do not already exist.'|t('feed-me'),
        value: 'add',
        checked: 'add' in (feed.duplicateHandle ?? ['add'])
    }) }}

    {{ forms.checkboxField({
        name: 'duplicateHandle[]',
        label: 'Update existing elements'|t('feed-me'),
        instructions: 'Updates elements that match the Unique Identifier (next step).'|t('feed-me'),
        value: 'update',
        checked: 'update' in (feed.duplicateHandle ?? [])<commit_msg>Clarify initial value for Site setting<commit_after>{% import '_includes/forms' as forms %}

{% extends 'feed-me/_layouts' %}

{% do view.registerTranslations('feed-me', [
    'Suspend missing users',
    'Suspends any users that are missing from the feed.',
    'None',
    'Processing complete!',
    'Processing failed.',
    'View logs',
]) %}

{% set crumbs = [
    { label: craft.feedme.getPluginName | t('feed-me'), url: url('feed-me') },
] %}

{% if feed.id %}
    {% set crumbs = crumbs | merge([
        { label: feed.name | t('feed-me'), url: url('feed-me/feeds/' ~ feed.id) },
    ]) %}
{% endif %}

{% set title = (feed.id) ? feed.name : 'Create a new feed' | t('feed-me') %}
{% set noTabs = true %}
{% set fullPageForm = true %}

{% set buttons %}
    <div class="buttons">
        <input type="button" data-action="feed-me/feeds/save-feed" class="btn submit" value="{{ 'Save' | t('feed-me') }}">
        <input type="button" data-action="feed-me/feeds/save-and-element-feed" class="btn submit" value="{{ 'Save & Continue' | t('feed-me') }}">
    </div>
{% endset %}

{% block actionButton %}
    {{ buttons }}
{% endblock %}

{% block blockContent %}
    <input type="hidden" name="action" value="feed-me/feeds/save-feed">

    {% if feed.id %}<input type="hidden" name="feedId" value="{{ feed.id }}">{% endif %}

    {{ forms.textField({
        first: true,
        label: "Name" | t('feed-me'),
        instructions: "What this feed will be called in the CP." | t('feed-me'),
        id: 'name',
        name: 'name',
        value: feed.name,
        errors: feed.getErrors('name'),
        autofocus: true,
        required: true,
    }) }}

    {{ forms.textField({
        label: "Feed URL" | t('feed-me'),
        instructions: "Can be a file on the local file system or from a website url (http://...)." | t('feed-me'),
        id: 'feedUrl',
        name: 'feedUrl',
        value: feed.feedUrl,
        errors: feed.getErrors('feedUrl'),
        required: true,
    }) }}

    {{ forms.selectField({
        label: "Feed Type" | t('feed-me'),
        instructions: 'Choose what type of feed you\'re retrieving.' | t('feed-me'),
        id: 'feedType',
        name: 'feedType',
        options: dataTypes,
        value: feed.feedType,
        errors: feed.getErrors('feedType'),
        required: true,
    }) }}

    <hr>

    {% set elementsList = [] %}
    {% for elementClass, element in elements %}
        {% set elementsList = elementsList | merge({ (elementClass): element.name }) %}
    {% endfor %}

    {{ forms.selectField({
        label: "Element Type" | t('feed-me'),
        instructions: 'Choose what element you want to save your feed data to.' | t('feed-me'),
        id: 'elementType',
        name: 'elementType',
        options: [{ label: 'Select', value: '' }] | merge(elementsList),
        value: feed.elementType,
        errors: feed.getErrors('elementType'),
        required: true,
    }) }}

    {% for elementClass, element in elements %}
        <div class="element-select" data-type="{{ elementClass | replace('\\', '-') }}">
            {% set elementType = elementClass %}

            {% include element.groupsTemplate ignore missing %}
        </div>
    {% endfor %}

    {% if craft.app.isMultiSite() %}
        {% set sites = [{ label: 'Primary Site' | t('feed-me'), value: '' }] %}

        {% for site in craft.app.sites.getAllSites() %}
            {% set sites = sites | merge([{ label: site.name, value: site.id }]) %}
        {% endfor %}

        {{ forms.selectField({
            label: "Sites" | t('feed-me'),
            instructions: 'Choose which site you want to save your feed data to initially.' | t('feed-me'),
            id: 'siteId',
            name: 'siteId',
            options: sites,
            value: feed.siteId,
        }) }}
    {% endif %}

    <hr>

    {{ forms.field({
        label: "Import strategy" | t('feed-me'),
        instructions: 'Choose what happens when this feed is run again.' | t('feed-me'),
        id: 'duplicateHandle',
    }) }}

    {{ forms.checkboxField({
        id: 'duplicateHandle',
        name: 'duplicateHandle[]',
        label: 'Create new elements'|t('feed-me'),
        instructions: 'Adds new elements if they do not already exist.'|t('feed-me'),
        value: 'add',
        checked: 'add' in (feed.duplicateHandle ?? ['add'])
    }) }}

    {{ forms.checkboxField({
        name: 'duplicateHandle[]',
        label: 'Update existing elements'|t('feed-me'),
        instructions: 'Updates elements that match the Unique Identifier (next step).'|t('feed-me'),
        value: 'update',
        checked: 'update' in (feed.duplicateHandle ?? [])
{'fraction_non_alphanumeric': 0.1808624758635486, 'fraction_numerical': 0.0, 'mean_word_length': 2.4237972824091076, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '3373113', 'n_tokens_mistral': 2966, 'n_tokens_neox': 2804, 'n_words': 754}