Fix category action test
This was the same test as before -.-
This commit is contained in:
parent
f513a494d9
commit
b25cdcf4db
22 changed files with 4087 additions and 2887 deletions
|
|
@ -1,11 +1,13 @@
|
|||
from django import forms
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
|
||||
from django.contrib.auth.forms import UserChangeForm
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from newsreader.accounts.models import User
|
||||
|
||||
|
||||
class UserAdminForm(forms.ModelForm):
|
||||
class UserAdminForm(UserChangeForm):
|
||||
class Meta:
|
||||
widgets = {
|
||||
"email": forms.EmailInput(attrs={"size": "50"}),
|
||||
|
|
@ -14,7 +16,7 @@ class UserAdminForm(forms.ModelForm):
|
|||
}
|
||||
|
||||
|
||||
class UserAdmin(admin.ModelAdmin):
|
||||
class UserAdmin(DjangoUserAdmin):
|
||||
list_display = ("email", "last_name", "date_joined", "is_active")
|
||||
list_filter = ("is_active", "is_staff", "is_superuser")
|
||||
ordering = ("email",)
|
||||
|
|
@ -26,7 +28,7 @@ class UserAdmin(admin.ModelAdmin):
|
|||
fieldsets = (
|
||||
(
|
||||
_("User settings"),
|
||||
{"fields": ("email", "first_name", "last_name", "is_active")},
|
||||
{"fields": ("email", "password", "first_name", "last_name", "is_active")},
|
||||
),
|
||||
(
|
||||
_("Reddit settings"),
|
||||
|
|
|
|||
9
src/newsreader/core/forms.py
Normal file
9
src/newsreader/core/forms.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from django import forms
|
||||
|
||||
|
||||
class CheckboxInput(forms.CheckboxInput):
|
||||
template_name = "components/form/checkbox.html"
|
||||
|
||||
def get_context(self, name, value, attrs):
|
||||
context = super().get_context(name, value, attrs)
|
||||
return {**context, **attrs}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -5,6 +5,7 @@ from django.utils.translation import gettext_lazy as _
|
|||
|
||||
import pytz
|
||||
|
||||
from newsreader.core.forms import CheckboxInput
|
||||
from newsreader.news.collection.choices import RuleTypeChoices
|
||||
from newsreader.news.collection.models import CollectionRule
|
||||
from newsreader.news.collection.reddit import REDDIT_API_URL
|
||||
|
|
@ -95,4 +96,6 @@ class SubRedditRuleForm(CollectionRuleForm):
|
|||
|
||||
class OPMLImportForm(forms.Form):
|
||||
file = forms.FileField(allow_empty_file=False)
|
||||
skip_existing = forms.BooleanField(initial=False, required=False)
|
||||
skip_existing = forms.BooleanField(
|
||||
initial=False, required=False, widget=CheckboxInput
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
</section>
|
||||
|
||||
<section class="section form__section">
|
||||
<table class="table rules-table">
|
||||
<table class="table rules-table" border="0" cellspacing="0">
|
||||
<thead class="table__header rules-table__header">
|
||||
<tr class="table__row rules-table__row">
|
||||
<th class="table__heading rules-table__heading--select">
|
||||
|
|
@ -32,24 +32,40 @@
|
|||
<th class="table__heading rules-table__heading--url">{% trans "URL" %}</th>
|
||||
<th class="table__heading rules-table__heading--succeeded">{% trans "Successfuly ran" %}</th>
|
||||
<th class="table__heading rules-table__heading--enabled">{% trans "Enabled" %}</th>
|
||||
<th class="table__heading rules-table__heading--link"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table__body">
|
||||
{% for rule in rules %}
|
||||
<tr class="table__row rules-table__row">
|
||||
<tr class="table__row {% if not rule.succeeded %}table__row--error {% endif %}rules-table__row">
|
||||
<td class="table__item rules-table__item">
|
||||
{% with rule|id_for_label:"rules" as id_for_label %}
|
||||
{% include "components/form/checkbox.html" with name="rules" value=rule.pk id=id_for_label id_for_label=id_for_label %}
|
||||
{% endwith %}
|
||||
</td>
|
||||
<td class="table__item rules-table__item" title="{{ rule.name }}">{{ rule.name }}</td>
|
||||
<td class="table__item rules-table__item" title="{{ rule.category.name }}">{{ rule.category.name }}</td>
|
||||
<td class="table__item rules-table__item" title="{{ rule.url }}">{{ rule.url }}</td>
|
||||
<td class="table__item rules-table__item" title="{{ rule.succeeded }}">{{ rule.succeeded }}</td>
|
||||
<td class="table__item rules-table__item" title="{{ rule.enabled }}">{{ rule.enabled }}</td>
|
||||
<td class="table__item rules-table__item" title="{{ rule.name }}">
|
||||
<a class="link" href="{{ rule.update_url }}">{{ rule.name }}</a>
|
||||
</td>
|
||||
<td class="table__item rules-table__item" title="{{ rule.category.name }}">
|
||||
{% if rule.category %}
|
||||
<a class="link" href="{% url 'news:core:category-update' pk=rule.category.pk %}">{{ rule.category.name }}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="table__item rules-table__item" title="{{ rule.url }}">
|
||||
<a class="link" href="{{ rule.url }}" target="_blank" rel="noopener noreferrer">{{ rule.url }}</a>
|
||||
</td>
|
||||
<td class="table__item rules-table__item">
|
||||
<a class="link" href="{{ rule.update_url }}"><i class="gg-pen"></i></a>
|
||||
{% if rule.succeeded %}
|
||||
<i class="gg-check"></i>
|
||||
{% else %}
|
||||
<i class="gg-danger"></i>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="table__item rules-table__item">
|
||||
{% if rule.enabled %}
|
||||
<i class="gg-check"></i>
|
||||
{% else %}
|
||||
<i class="gg-play-pause"></i>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{% load filters %}
|
||||
|
||||
{% with option.instance|id_for_label:"category" as id_for_label %}
|
||||
{% include "components/form/checkbox.html" with widget=option checked=option.selected id_for_label=id_for_label only %}
|
||||
{% include "components/form/checkbox.html" with name=option.name value=option.value checked=option.selected id=id_for_label only %}
|
||||
{% endwith %}
|
||||
|
||||
{% if option.instance.favicon %}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
padding: 15px;
|
||||
|
||||
width: 50%;
|
||||
border-radius: 5px;
|
||||
|
||||
background-color: $white;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
padding: 10px;
|
||||
|
||||
background-color: $error-red;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
& li {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
flex-direction: column;
|
||||
|
||||
width: 70%;
|
||||
border-radius: 5px;
|
||||
|
||||
background-color: $white;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
padding: 20px 15px;
|
||||
margin: 5px 0;
|
||||
|
||||
border-radius: 5px;
|
||||
|
||||
background-color: $blue;
|
||||
|
||||
&--error {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,5 @@
|
|||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
border-radius: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,10 @@
|
|||
padding: 10px 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
& ul, ol {
|
||||
list-style-position: inside;
|
||||
}
|
||||
}
|
||||
|
||||
&__close-button {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
@extend .section;
|
||||
|
||||
width: 70%;
|
||||
border-radius: 5px;
|
||||
|
||||
padding: 10px;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
overflow: auto;
|
||||
|
||||
list-style: none;
|
||||
border-radius: 5px;
|
||||
|
||||
&__item {
|
||||
padding: 2px 10px 5px 10px;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
}
|
||||
|
||||
&--name {
|
||||
width: 20%;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
&--category {
|
||||
|
|
@ -23,16 +23,5 @@
|
|||
&--enabled {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
&--link {
|
||||
width: 5%;
|
||||
}
|
||||
}
|
||||
|
||||
& .link {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
.table {
|
||||
table-layout: fixed;
|
||||
|
||||
background-color: $white;
|
||||
width: 90%;
|
||||
padding: 20px;
|
||||
|
|
@ -13,11 +14,15 @@
|
|||
@extend .h1;
|
||||
}
|
||||
|
||||
&__row {
|
||||
&--error {
|
||||
background-color: transparentize($error-red, 0.8);
|
||||
}
|
||||
}
|
||||
|
||||
&__item {
|
||||
padding: 10px 0;
|
||||
|
||||
border-bottom: 1px solid $border-gray;
|
||||
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
margin: 5% auto;
|
||||
width: 50%;
|
||||
|
||||
border-radius: 4px;
|
||||
|
||||
& .form {
|
||||
@extend .form;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
{% extends "admin/base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block branding %}
|
||||
<h1 id="site-name"><a href="{% url 'index' %}">Newsreader</a></h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block extrahead %}
|
||||
<link type="image/png" href="{% static 'favicon.png' %}" rel="shortcut icon" />
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
<div class="checkbox">
|
||||
{% if widget %}
|
||||
{% include "components/form/input.html" with widget=widget %}
|
||||
{% else %}
|
||||
{% include "components/form/input.html" with id=id name=name type="checkbox" value=value data_input=data_input checked=checked %}
|
||||
{% endif %}
|
||||
<label class="checkbox__label" for="{% if widget %}{{ widget.attrs.id }}{% else %}{{ id_for_label }}{% endif %}">
|
||||
{% include "components/form/input.html" with id=id name=name type="checkbox" value=value checked=checked widget=widget %}
|
||||
|
||||
<label class="checkbox__label" for="{{ id }}">
|
||||
<span class="checkbox__box"/>
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@
|
|||
type="{{ widget.type }}" name="{{ widget.name }}"
|
||||
{% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}
|
||||
{% endif %}
|
||||
{% include "django/forms/widgets/attrs.html" %}>
|
||||
{% include "components/form/attrs.html" %}>
|
||||
{% endspaceless %}
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
../../../components/form/attrs.html
|
||||
|
|
@ -1 +0,0 @@
|
|||
../../../components/form/checkbox.html
|
||||
Loading…
Add table
Add a link
Reference in a new issue