Added:
- ContentSource handling in message - ContentSource list, add/update ui - nextPageSelector and imageSelector can be null - cleanup
This commit is contained in:
46
templates/settings/scrapper_list.html.twig
Normal file
46
templates/settings/scrapper_list.html.twig
Normal file
@@ -0,0 +1,46 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Scrapper Configurations{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container mx-auto p-4">
|
||||
<h1 class="text-2xl font-bold mb-6">Scrapper Configurations</h1>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{% for contentSource in contentSources %}
|
||||
<div class="relative flex flex-col justify-between bg-white rounded-sm border border-gray-200 shadow-md hover:shadow-lg transition-shadow duration-300 h-full group">
|
||||
<div class="p-4">
|
||||
<div class="flex flex-row items-center justify-between mb-2">
|
||||
<h5 class="text-xl tracking-tight text-gray-900 truncate flex-grow">
|
||||
{{ contentSource.baseUrl|replace({'http://': '', 'https://': ''})|trim('/', 'right') }}
|
||||
</h5>
|
||||
<a href="{{ contentSource.baseUrl }}" target="_blank" rel="noopener noreferrer" class="text-gray-400 hover:text-green-600 ml-2 z-10">
|
||||
<i class="fas fa-external-link-alt"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-4 bg-gray-50">
|
||||
<div class="flex space-x-2">
|
||||
<span class="px-2 py-1 text-xs font-semibold text-white bg-green-400 rounded-sm">
|
||||
{{ contentSource.scrapingType }}
|
||||
</span>
|
||||
<span class="px-2 py-1 text-xs font-semibold text-white bg-green-400 rounded-sm">
|
||||
{{ contentSource.nextPageSelector ? 'Horizontal' : 'Vertical' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<a href="{{ path('app_settings_scrappers', {'id': contentSource.id}) }}" class="absolute inset-0 z-0">
|
||||
<span class="sr-only">Edit configuration</span>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<a href="{{ path('app_settings_scrappers') }}" class="block p-6 bg-white rounded-sm border border-gray-200 shadow-md hover:bg-gray-100 flex items-center justify-center h-full">
|
||||
<div class="text-center">
|
||||
<i class="fas fa-plus text-4xl text-gray-400 mb-2"></i>
|
||||
<p class="text-gray-600">Add New Configuration</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
66
templates/settings/scrappers.html.twig
Normal file
66
templates/settings/scrappers.html.twig
Normal file
@@ -0,0 +1,66 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}{{ isNew ? 'Create' : 'Edit' }} Scrapper Configuration{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container mx-auto p-4">
|
||||
<div class="bg-white shadow-lg rounded-sm overflow-hidden">
|
||||
<div class="bg-gray-800 text-white p-4">
|
||||
<h1 class="text-2xl font-bold">
|
||||
<i class="fas fa-cog mr-2"></i>{{ isNew ? 'Create' : 'Edit' }} Scrapper Configuration
|
||||
</h1>
|
||||
</div>
|
||||
<div class="p-6" data-controller="scrapper-configure">
|
||||
{{ form_start(form, {'attr': {'class': 'space-y-6', 'data-scrapper-configure-target': 'form', 'data-action': 'submit->scrapper-configure#saveConfiguration'}}) }}
|
||||
|
||||
{% for field in form.children %}
|
||||
<div class="mb-4">
|
||||
{{ form_label(field, null, {'label_attr': {'class': 'block text-sm font-medium text-gray-700 mb-2'}}) }}
|
||||
{{ form_widget(field, {'attr': {
|
||||
'class': 'mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500 sm:text-sm',
|
||||
'placeholder': get_placeholder(field.vars.name)
|
||||
}}) }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="mt-6">
|
||||
<button type="submit" class="w-full flex items-center justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500">
|
||||
<span class="mr-2">{{ isNew ? 'Save' : 'Update' }} Configuration</span>
|
||||
<i class="fas fa-{{ isNew ? 'save' : 'edit' }}"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
<div class="mt-8 bg-gray-100 p-6 rounded-md">
|
||||
<h2 class="text-xl font-semibold mb-4">
|
||||
<i class="fas fa-vial mr-2"></i>Test Configuration
|
||||
</h2>
|
||||
<form
|
||||
action="{{ path('app_settings_scrappers_test') }}"
|
||||
method="POST"
|
||||
data-scrapper-configure-target="testForm"
|
||||
data-action="submit->scrapper-configure#testConfiguration"
|
||||
class="space-y-4">
|
||||
<div>
|
||||
<label for="testMangaSlug" class="block text-sm font-medium text-gray-700 mb-2">Manga Slug</label>
|
||||
<input type="text" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500 sm:text-sm" id="testMangaSlug" name="mangaSlug" required>
|
||||
</div>
|
||||
<div>
|
||||
<label for="testChapterNumber" class="block text-sm font-medium text-gray-700 mb-2">Chapter Number</label>
|
||||
<input type="text" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-green-500 focus:border-green-500 sm:text-sm" id="testChapterNumber" name="chapterNumber" required>
|
||||
</div>
|
||||
<div>
|
||||
<button type="submit" class="w-full flex items-center justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
||||
<span class="mr-2">Test Configuration</span>
|
||||
<i class="fas fa-play"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div data-scrapper-configure-target="testResults" class="mt-8"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user