visual improvements
This commit is contained in:
parent
b92c6dd88f
commit
0acecba367
@ -1,5 +1,3 @@
|
|||||||
from crispy_forms.helper import FormHelper
|
|
||||||
from crispy_forms.layout import Submit
|
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django import forms
|
from django import forms
|
||||||
from .models import *
|
from .models import *
|
||||||
@ -17,12 +15,6 @@ class EditRecipeForm(forms.ModelForm):
|
|||||||
'path': _('Path'),
|
'path': _('Path'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super(EditRecipeForm, self).__init__(*args, **kwargs)
|
|
||||||
self.helper = FormHelper()
|
|
||||||
self.helper.form_method = 'post'
|
|
||||||
self.helper.add_input(Submit('save', _('Save'), css_class='btn-primary'))
|
|
||||||
|
|
||||||
|
|
||||||
class MonitorForm(forms.Form):
|
class MonitorForm(forms.Form):
|
||||||
path = forms.CharField(label=_('Path'))
|
path = forms.CharField(label=_('Path'))
|
||||||
|
@ -10,7 +10,7 @@ class Keyword(models.Model):
|
|||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return "{0} {1}".format(self.icon, self.name)
|
||||||
|
|
||||||
|
|
||||||
class Category(models.Model):
|
class Category(models.Model):
|
||||||
@ -22,7 +22,7 @@ class Category(models.Model):
|
|||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return "{0} {1}".format(self.icon, self.name)
|
||||||
|
|
||||||
|
|
||||||
class Recipe(models.Model):
|
class Recipe(models.Model):
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
from django.utils.html import format_html
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django_tables2.utils import A # alias for Accessor
|
from django_tables2.utils import A # alias for Accessor
|
||||||
|
|
||||||
@ -45,6 +46,13 @@ class KeywordTable(tables.Table):
|
|||||||
class ImportLogTable(tables.Table):
|
class ImportLogTable(tables.Table):
|
||||||
monitor_id = tables.LinkColumn('edit_monitor', args=[A('monitor_id')])
|
monitor_id = tables.LinkColumn('edit_monitor', args=[A('monitor_id')])
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def render_status(value):
|
||||||
|
if value == 'SUCCESS':
|
||||||
|
return format_html('<span class="badge badge-success">%s</span>' % value)
|
||||||
|
else:
|
||||||
|
return format_html('<span class="badge badge-error">%s</span>' % value)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SyncLog
|
model = SyncLog
|
||||||
template_name = 'generic/table_template.html'
|
template_name = 'generic/table_template.html'
|
||||||
@ -55,6 +63,10 @@ class MonitoredPathTable(tables.Table):
|
|||||||
id = tables.LinkColumn('edit_monitor', args=[A('id')])
|
id = tables.LinkColumn('edit_monitor', args=[A('id')])
|
||||||
delete = tables.TemplateColumn("<a href='{% url 'delete_monitor' record.id %}' >" + _('Delete') + "</a>")
|
delete = tables.TemplateColumn("<a href='{% url 'delete_monitor' record.id %}' >" + _('Delete') + "</a>")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def render_path(value):
|
||||||
|
return format_html('<code>%s</code>' % value)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Sync
|
model = Sync
|
||||||
template_name = 'generic/table_template.html'
|
template_name = 'generic/table_template.html'
|
||||||
|
@ -9,12 +9,26 @@
|
|||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
{% trans 'Batch edit Recipes' %}
|
{% trans 'Batch edit Recipes' %}
|
||||||
<small class="text-muted">{% trans 'Add the specified category and keywords to all recipes containing a word' %}</small>
|
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<form method="POST" class="post-form">{% csrf_token %}
|
<div class="card border-info" >
|
||||||
|
<div class="card-body text-info">
|
||||||
|
<p class="card-text">{% trans 'Add the specified category and keywords to all recipes containing a word' %}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="POST" class="post-form">
|
||||||
|
{% csrf_token %}
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
<input type="submit" value="Submit" class="btn btn-success">
|
<input type="submit" value="Submit" class="btn btn-success">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//TODO clean this up
|
||||||
|
//converts multiselct in recipe edit to searchable multiselect
|
||||||
|
//shitty solution that needs to be redone at some point
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#id_keyword').select2();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -8,16 +8,24 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h3>{% trans 'Manage watched Folders' %}</h3>
|
<h3>{% trans 'Manage watched Folders' %}</h3>
|
||||||
|
<div class="card border-info">
|
||||||
|
<div class="card-body text-info">
|
||||||
|
<p class="card-text">
|
||||||
|
{% trans 'On this Page you can manage all DropBox folder locations that should be monitored and synced' %}
|
||||||
|
<br/>
|
||||||
|
{% trans 'The path must be in the following format' %} <code>/Folder/RecipesFolder</code>
|
||||||
|
</p>
|
||||||
|
<form method="POST" class="post-form">{% csrf_token %}
|
||||||
|
{{ form|crispy }}
|
||||||
|
<input type="submit" value="Submit" class="btn btn-success">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% trans 'On this Page you can manage all DropBox folder locations that should be monitored and synced' %} <br/>
|
|
||||||
{% trans 'The path must be in the following format' %} <code>/Folder/RecipesFolder</code>
|
|
||||||
<br/>
|
<br/>
|
||||||
<a href="{% url 'api_dropbox_sync' %}" class="btn btn-success">{% trans 'Sync Now!' %}</a>
|
<a href="{% url 'api_dropbox_sync' %}" class="btn btn-warning">{% trans 'Sync Now!' %}</a>
|
||||||
<br/>
|
<br/><br/>
|
||||||
<form method="POST" class="post-form">{% csrf_token %}
|
|
||||||
{{ form|crispy }}
|
|
||||||
<input type="submit" value="Submit" class="btn btn-success">
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% render_table monitored_paths %}
|
{% render_table monitored_paths %}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
//TODO clean this up
|
||||||
//converts multiselct in recipe edit to searchable multiselect
|
//converts multiselct in recipe edit to searchable multiselect
|
||||||
//shitty solution that needs to be redone at some point
|
//shitty solution that needs to be redone at some point
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
//TODO clean this up
|
||||||
//converts multiselct in recipe edit to searchable multiselect
|
//converts multiselct in recipe edit to searchable multiselect
|
||||||
//shitty solution that needs to be redone at some point
|
//shitty solution that needs to be redone at some point
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
@ -31,7 +31,7 @@ urlpatterns = [
|
|||||||
path('delete/import/<int:pk>/', edit.ImportDelete.as_view(), name='delete_import'),
|
path('delete/import/<int:pk>/', edit.ImportDelete.as_view(), name='delete_import'),
|
||||||
|
|
||||||
path('batch/monitor', batch.batch_monitor, name='batch_monitor'),
|
path('batch/monitor', batch.batch_monitor, name='batch_monitor'),
|
||||||
path('batch/category', batch.batch_edit, name='batch_edit'),
|
path('batch/edit', batch.batch_edit, name='batch_edit'),
|
||||||
path('batch/import/all', batch.batch_import_all, name='batch_import_all'),
|
path('batch/import/all', batch.batch_import_all, name='batch_import_all'),
|
||||||
|
|
||||||
path('api/get_file_link/<int:recipe_id>/', api.get_file_link, name='api_get_file_link'),
|
path('api/get_file_link/<int:recipe_id>/', api.get_file_link, name='api_get_file_link'),
|
||||||
|
Loading…
Reference in New Issue
Block a user