{% extends "importer/_layouts/feeds.html" %} {% import "_includes/forms" as forms %} {% set selectedTab = 'addfeeds' %} {% set content %} {% block blockContent %}
{{ csrfInput() }} {% if feed.id %}{% endif %} {{ forms.textField({ first: true, label: "Name" | t('importer'), instructions: "What this feed will be called in the CP." | t('importer'), id: 'name', name: 'name', value: feed.name, errors: feed.getErrors('name'), autofocus: true, required: true, }) }} {{ forms.textField({ label: "Feed URL" | t('importer'), instructions: "Can be a file on the local file system or from a website url (http://...)." | t('importer'), id: 'feedUrl', name: 'feedUrl', value: feed.feedurl, errors: feed.getErrors('feedUrl'), required: true, }) }} {{ forms.selectField({ label: "Feed Type" | t('importer'), instructions: 'Choose what type of feed you\'re retrieving.' | t('importer'), id: 'feedType', name: 'feedType', options: feed.feedtype, value: feed.feedtype, errors: feed.getErrors('feedtype'), required: true, }) }} {{ forms.selectField({ label: "Entry Type" | t('importer'), instructions: 'Choose the Entry Type you want to save your feed data into.' | t('importer'), id: 'entryType', name: 'entryType', options: feed.entryType, value: feed.feedtype, errors: feed.getErrors('feedtype'), required: true, }) }} {{ forms.selectField({ label: "Primary Element" | t('importer'), instructions: 'Choose the the primary element, it is repeatable element that contains the data you want to import.' | t('importer'), id: 'primary_element', name: 'primary_element', options: feed.primary_element, value: feed.primary_element, errors: feed.getErrors('primary_element'), required: true, }) }}


{% if feed.id is null %} {% if Feeds is iterable %}

Available Feeds

{% for allfeed in Feeds %} {% if allfeed.id %} {%endif%} {% endfor %}
{{ "Name" | t('Importer') }} {{ "Type" | t('Importer') }} {{ "Element Type" | t('Importer') }} {{ "Process" | t('Importer') }}
{{allfeed.name}} {{allfeed.feedtype}} {{allfeed.entry_type}} Edit Delete
{%endif %} {% endif %} {% js %} $('#feedUrl').on('change',function(){ var dataarray = {}; dataarray['url']=$(this).val(); var option = ''; Craft.postActionRequest(Craft.baseUrl+'/contentimporter/fetchapi',dataarray,function(response){ jQuery.each(response,function(index,value){ option += ''; }); $('#primary_element').html(option); }); }); {% endjs %} {%endblock%} {% endset %}