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 import forms
|
||||||
from django.contrib import admin
|
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 django.utils.translation import ugettext as _
|
||||||
|
|
||||||
from newsreader.accounts.models import User
|
from newsreader.accounts.models import User
|
||||||
|
|
||||||
|
|
||||||
class UserAdminForm(forms.ModelForm):
|
class UserAdminForm(UserChangeForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
widgets = {
|
widgets = {
|
||||||
"email": forms.EmailInput(attrs={"size": "50"}),
|
"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_display = ("email", "last_name", "date_joined", "is_active")
|
||||||
list_filter = ("is_active", "is_staff", "is_superuser")
|
list_filter = ("is_active", "is_staff", "is_superuser")
|
||||||
ordering = ("email",)
|
ordering = ("email",)
|
||||||
|
|
@ -26,7 +28,7 @@ class UserAdmin(admin.ModelAdmin):
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(
|
(
|
||||||
_("User settings"),
|
_("User settings"),
|
||||||
{"fields": ("email", "first_name", "last_name", "is_active")},
|
{"fields": ("email", "password", "first_name", "last_name", "is_active")},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
_("Reddit settings"),
|
_("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
|
import pytz
|
||||||
|
|
||||||
|
from newsreader.core.forms import CheckboxInput
|
||||||
from newsreader.news.collection.choices import RuleTypeChoices
|
from newsreader.news.collection.choices import RuleTypeChoices
|
||||||
from newsreader.news.collection.models import CollectionRule
|
from newsreader.news.collection.models import CollectionRule
|
||||||
from newsreader.news.collection.reddit import REDDIT_API_URL
|
from newsreader.news.collection.reddit import REDDIT_API_URL
|
||||||
|
|
@ -95,4 +96,6 @@ class SubRedditRuleForm(CollectionRuleForm):
|
||||||
|
|
||||||
class OPMLImportForm(forms.Form):
|
class OPMLImportForm(forms.Form):
|
||||||
file = forms.FileField(allow_empty_file=False)
|
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>
|
||||||
|
|
||||||
<section class="section form__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">
|
<thead class="table__header rules-table__header">
|
||||||
<tr class="table__row rules-table__row">
|
<tr class="table__row rules-table__row">
|
||||||
<th class="table__heading rules-table__heading--select">
|
<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--url">{% trans "URL" %}</th>
|
||||||
<th class="table__heading rules-table__heading--succeeded">{% trans "Successfuly ran" %}</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--enabled">{% trans "Enabled" %}</th>
|
||||||
<th class="table__heading rules-table__heading--link"></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="table__body">
|
<tbody class="table__body">
|
||||||
{% for rule in rules %}
|
{% 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">
|
<td class="table__item rules-table__item">
|
||||||
{% with rule|id_for_label:"rules" as id_for_label %}
|
{% 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 %}
|
{% include "components/form/checkbox.html" with name="rules" value=rule.pk id=id_for_label id_for_label=id_for_label %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</td>
|
</td>
|
||||||
<td class="table__item rules-table__item" title="{{ rule.name }}">{{ rule.name }}</td>
|
<td class="table__item rules-table__item" title="{{ rule.name }}">
|
||||||
<td class="table__item rules-table__item" title="{{ rule.category.name }}">{{ rule.category.name }}</td>
|
<a class="link" href="{{ rule.update_url }}">{{ rule.name }}</a>
|
||||||
<td class="table__item rules-table__item" title="{{ rule.url }}">{{ rule.url }}</td>
|
</td>
|
||||||
<td class="table__item rules-table__item" title="{{ rule.succeeded }}">{{ rule.succeeded }}</td>
|
<td class="table__item rules-table__item" title="{{ rule.category.name }}">
|
||||||
<td class="table__item rules-table__item" title="{{ rule.enabled }}">{{ rule.enabled }}</td>
|
{% 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">
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{% load filters %}
|
{% load filters %}
|
||||||
|
|
||||||
{% with option.instance|id_for_label:"category" as id_for_label %}
|
{% 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 %}
|
{% endwith %}
|
||||||
|
|
||||||
{% if option.instance.favicon %}
|
{% if option.instance.favicon %}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
padding: 15px;
|
padding: 15px;
|
||||||
|
|
||||||
width: 50%;
|
width: 50%;
|
||||||
border-radius: 5px;
|
|
||||||
|
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
||||||
background-color: $error-red;
|
background-color: $error-red;
|
||||||
border-radius: 5px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
& li {
|
& li {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
width: 70%;
|
width: 70%;
|
||||||
border-radius: 5px;
|
|
||||||
|
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@
|
||||||
padding: 20px 15px;
|
padding: 20px 15px;
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
|
|
||||||
border-radius: 5px;
|
|
||||||
|
|
||||||
background-color: $blue;
|
background-color: $blue;
|
||||||
|
|
||||||
&--error {
|
&--error {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,5 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
border-radius: 0;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,10 @@
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& ul, ol {
|
||||||
|
list-style-position: inside;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__close-button {
|
&__close-button {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
@extend .section;
|
@extend .section;
|
||||||
|
|
||||||
width: 70%;
|
width: 70%;
|
||||||
border-radius: 5px;
|
|
||||||
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
list-style: none;
|
list-style: none;
|
||||||
border-radius: 5px;
|
|
||||||
|
|
||||||
&__item {
|
&__item {
|
||||||
padding: 2px 10px 5px 10px;
|
padding: 2px 10px 5px 10px;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&--name {
|
&--name {
|
||||||
width: 20%;
|
width: 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--category {
|
&--category {
|
||||||
|
|
@ -23,16 +23,5 @@
|
||||||
&--enabled {
|
&--enabled {
|
||||||
width: 10%;
|
width: 10%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--link {
|
|
||||||
width: 5%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
& .link {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
padding: 10px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
table-layout: fixed;
|
table-layout: fixed;
|
||||||
|
|
||||||
background-color: $white;
|
background-color: $white;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
|
@ -13,11 +14,15 @@
|
||||||
@extend .h1;
|
@extend .h1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__row {
|
||||||
|
&--error {
|
||||||
|
background-color: transparentize($error-red, 0.8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&__item {
|
&__item {
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
|
|
||||||
border-bottom: 1px solid $border-gray;
|
|
||||||
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
margin: 5% auto;
|
margin: 5% auto;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
|
|
||||||
border-radius: 4px;
|
|
||||||
|
|
||||||
& .form {
|
& .form {
|
||||||
@extend .form;
|
@extend .form;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
{% extends "admin/base.html" %}
|
{% extends "admin/base.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
|
{% block branding %}
|
||||||
|
<h1 id="site-name"><a href="{% url 'index' %}">Newsreader</a></h1>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block extrahead %}
|
{% block extrahead %}
|
||||||
<link type="image/png" href="{% static 'favicon.png' %}" rel="shortcut icon" />
|
<link type="image/png" href="{% static 'favicon.png' %}" rel="shortcut icon" />
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
{% if widget %}
|
{% include "components/form/input.html" with id=id name=name type="checkbox" value=value checked=checked widget=widget %}
|
||||||
{% include "components/form/input.html" with widget=widget %}
|
|
||||||
{% else %}
|
<label class="checkbox__label" for="{{ id }}">
|
||||||
{% 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 %}">
|
|
||||||
<span class="checkbox__box"/>
|
<span class="checkbox__box"/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@
|
||||||
type="{{ widget.type }}" name="{{ widget.name }}"
|
type="{{ widget.type }}" name="{{ widget.name }}"
|
||||||
{% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}
|
{% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include "django/forms/widgets/attrs.html" %}>
|
{% include "components/form/attrs.html" %}>
|
||||||
{% endspaceless %}
|
{% 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