euscanwww: Watched herds/maintainers/categories panel
* Refactored templates and templatetags * Added unfavourite views * Added button to favourite/unfavourite package * Panel for showing favourited objects Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
parent
11c234f7f7
commit
34d3bd714d
@ -58,7 +58,7 @@ def _run_in_chunks(task, iterable, n=32):
|
||||
])
|
||||
result = job.apply_async()
|
||||
# TODO: understand why this causes timeout
|
||||
output.extend(list(result.join(timeout=3600)))
|
||||
#output.extend(list(result.join(timeout=3600)))
|
||||
return output
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
<ul class="submenu">
|
||||
<li><a href="{% url "accounts_categories" %}">Categories</a></li>
|
||||
<li><a href="{% url "accounts_herds" %}">Herds</a></li>
|
||||
<li><a href="{% url "accounts_maintainers" %}">Maintainer profiles</a></li>
|
||||
<li><a href="{% url "accounts_maintainers" %}">Maintainers</a></li>
|
||||
<li><a href="{% url "accounts_packages" %}">Packages</a></li>
|
||||
</ul>
|
||||
<li><a href="{% url "django.contrib.auth.views.logout" %}">Logout</a></li>
|
||||
|
32
euscanwww/djeuscan/templates/euscan/_categories_table.html
Normal file
32
euscanwww/djeuscan/templates/euscan/_categories_table.html
Normal file
@ -0,0 +1,32 @@
|
||||
{% load url from future %}
|
||||
{% load euscan %}
|
||||
|
||||
<table id="table" class="display">
|
||||
<thead>
|
||||
<th>Category</th>
|
||||
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
|
||||
{% if extras %}
|
||||
<th>Graphs</th>
|
||||
{% endif %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for category in categories %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url "category" category.category %}">{{ category.category }}</a>
|
||||
{% package_bar category %}
|
||||
</td>
|
||||
{% package_cols category %}
|
||||
{% if extras %}
|
||||
<td>
|
||||
<img src="{% url "chart_category" category.category 'packages-monthly-small' %}" />
|
||||
<img src="{% url "chart_category" category.category 'versions-monthly-small' %}" />
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
34
euscanwww/djeuscan/templates/euscan/_herds_table.html
Normal file
34
euscanwww/djeuscan/templates/euscan/_herds_table.html
Normal file
@ -0,0 +1,34 @@
|
||||
{% load url from future %}
|
||||
{% load euscan %}
|
||||
|
||||
<table id="table" class="display">
|
||||
<thead>
|
||||
<th>Herd</th>
|
||||
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
|
||||
{% if extras %}
|
||||
<th>Graphs</th>
|
||||
{% endif %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for herd in herds %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url "herd" herd.herds__herd %}">
|
||||
{{ herd.herds__herd }}
|
||||
</a>
|
||||
{% package_bar herd %}
|
||||
</td>
|
||||
{% package_cols herd %}
|
||||
{% if extras %}
|
||||
<td>
|
||||
<img src="{% url "chart_herd" herd.herds__herd 'packages-monthly-small' %}" />
|
||||
<img src="{% url "chart_herd" herd.herds__herd 'versions-monthly-small' %}" />
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
40
euscanwww/djeuscan/templates/euscan/_maintainers_table.html
Normal file
40
euscanwww/djeuscan/templates/euscan/_maintainers_table.html
Normal file
@ -0,0 +1,40 @@
|
||||
{% load url from future %}
|
||||
{% load euscan %}
|
||||
|
||||
<table id="table" class="display">
|
||||
<thead>
|
||||
<th>Maintainer</th>
|
||||
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
|
||||
{% if extras %}
|
||||
<th>Graphs</th>
|
||||
{% endif %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for maintainer in maintainers %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url "maintainer" maintainer.maintainers__id %}">
|
||||
{% if maintainer.maintainers__name != maintainer.maintainers__email %}
|
||||
{{ maintainer.maintainers__name }} <{{ maintainer.maintainers__email }}>
|
||||
{% else %}
|
||||
{{ maintainer.maintainers__name }}
|
||||
{% endif %}
|
||||
</a>
|
||||
{% package_bar maintainer %}
|
||||
</td>
|
||||
{% package_cols maintainer %}
|
||||
|
||||
{% if extras %}
|
||||
<td>
|
||||
<img src="{% url "chart_maintainer" maintainer.maintainers__id 'packages-monthly-small' %}" />
|
||||
<img src="{% url "chart_maintainer" maintainer.maintainers__id 'versions-monthly-small' %}" />
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
@ -1,4 +1,4 @@
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
{% load mul %}
|
||||
{% load sub %}
|
||||
{% load div %}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
{% load sub %}
|
||||
{% load div %}
|
||||
{% load mul %}
|
||||
|
@ -1,11 +1,15 @@
|
||||
{% extends "_base.html" %}
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
{% load url from future %}
|
||||
{% load euscan %}
|
||||
|
||||
{% block title %}
|
||||
{{ block.super }} - My categories
|
||||
{{ block.super }} - Watched categories
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<h2>Welcome {{ user }}</h2>
|
||||
<h2>Watched categories</h2>
|
||||
|
||||
{% categories_table categories %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,11 +1,14 @@
|
||||
{% extends "_base.html" %}
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
{% load url from future %}
|
||||
{% load euscan %}
|
||||
|
||||
{% block title %}
|
||||
{{ block.super }} - My herds
|
||||
{{ block.super }} - Watched herds
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<h2>Welcome {{ user }}</h2>
|
||||
<h2>Watched herds</h2>
|
||||
|
||||
{% herds_table herds %}
|
||||
{% endblock %}
|
||||
|
@ -1,11 +1,14 @@
|
||||
{% extends "_base.html" %}
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
{% load url from future %}
|
||||
{% load euscan %}
|
||||
|
||||
{% block title %}
|
||||
{{ block.super }} - My maintainer profiles
|
||||
{{ block.super }} - Watched maintainers
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<h2>Welcome {{ user }}</h2>
|
||||
<h2>Watched maintainers</h2>
|
||||
|
||||
{% maintainers_table maintainers %}
|
||||
{% endblock %}
|
||||
|
@ -1,15 +1,15 @@
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
{% load url from future %}
|
||||
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
|
||||
{% block title %}
|
||||
{{ block.super }} - My packages
|
||||
{{ block.super }} - Watched packages
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<h2>My Packages</h2>
|
||||
<h2>Watched packages</h2>
|
||||
|
||||
{% packages packages %}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block title %}
|
||||
@ -10,33 +10,6 @@
|
||||
{% block content %}
|
||||
<h2>Categories</h2>
|
||||
|
||||
<table id="table" class="display">
|
||||
<thead>
|
||||
<th>Category</th>
|
||||
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
|
||||
{% if request.GET.extras %}
|
||||
<th>Graphs</th>
|
||||
{% endif %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for category in categories %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url "category" category.category %}">{{ category.category }}</a>
|
||||
{% package_bar category %}
|
||||
</td>
|
||||
{% package_cols category %}
|
||||
{% if request.GET.extras %}
|
||||
<td>
|
||||
<img src="{% url "chart_category" category.category 'packages-monthly-small' %}" />
|
||||
<img src="{% url "chart_category" category.category 'versions-monthly-small' %}" />
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% categories_table categories request.GET.extras %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block title %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block title %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block title %}
|
||||
@ -9,35 +9,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h2>Herds</h2>
|
||||
<table id="table" class="display">
|
||||
<thead>
|
||||
<th>Herd</th>
|
||||
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
|
||||
{% if request.GET.extras %}
|
||||
<th>Graphs</th>
|
||||
{% endif %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for herd in herds %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url "herd" herd.herds__herd %}">
|
||||
{{ herd.herds__herd }}
|
||||
</a>
|
||||
{% package_bar herd %}
|
||||
</td>
|
||||
{% package_cols herd %}
|
||||
{% if request.GET.extras %}
|
||||
<td>
|
||||
<img src="{% url "chart_herd" herd.herds__herd 'packages-monthly-small' %}" />
|
||||
<img src="{% url "chart_herd" herd.herds__herd 'versions-monthly-small' %}" />
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% herds_table herds request.GET.extras %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block title %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block title %}
|
||||
@ -9,41 +9,7 @@
|
||||
|
||||
{% block content %}
|
||||
<h2>Maintainers</h2>
|
||||
<table id="table" class="display">
|
||||
<thead>
|
||||
<th>Maintainer</th>
|
||||
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
|
||||
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
|
||||
{% if request.GET.extras %}
|
||||
<th>Graphs</th>
|
||||
{% endif %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for maintainer in maintainers %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url "maintainer" maintainer.maintainers__id %}">
|
||||
{% if maintainer.maintainers__name != maintainer.maintainers__email %}
|
||||
{{ maintainer.maintainers__name }} <{{ maintainer.maintainers__email }}>
|
||||
{% else %}
|
||||
{{ maintainer.maintainers__name }}
|
||||
{% endif %}
|
||||
</a>
|
||||
{% package_bar maintainer %}
|
||||
</td>
|
||||
{% package_cols maintainer %}
|
||||
|
||||
{% if request.GET.extras %}
|
||||
<td>
|
||||
<img src="{% url "chart_maintainer" maintainer.maintainers__id 'packages-monthly-small' %}" />
|
||||
<img src="{% url "chart_maintainer" maintainer.maintainers__id 'versions-monthly-small' %}" />
|
||||
</td>
|
||||
{% endif %}
|
||||
{% maintainers_table maintainers request.GET.extras %}
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
|
||||
{% block title %}
|
||||
{{ block.super }} - Overlay: {{ overlay }}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block title %}
|
||||
|
@ -31,9 +31,12 @@
|
||||
<button class="refresh-button" data-package="{{ package.category }}/{{ package.name }}">
|
||||
Refresh
|
||||
</button>
|
||||
<button class="favourite-button" data-url="{% url "favourite_package" package.category package.name %}">
|
||||
<button class="favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_package" package.category package.name %}">
|
||||
Add to favourites
|
||||
</button>
|
||||
<button class="unfavourite-button {% if not favourited %}hide{% endif %}" data-url="{% url "unfavourite_package" package.category package.name %}">
|
||||
Remove from favourites
|
||||
</button>
|
||||
{% endif %}
|
||||
</h2>
|
||||
<dl>
|
||||
@ -151,7 +154,15 @@
|
||||
|
||||
$(".favourite-button").click(function() {
|
||||
$.post($(this).data("url"), function() {
|
||||
alert("Favourited!");
|
||||
$(".unfavourite-button").removeClass("hide");
|
||||
$(".favourite-button").addClass("hide");
|
||||
});
|
||||
});
|
||||
|
||||
$(".unfavourite-button").click(function() {
|
||||
$.post($(this).data("url"), function() {
|
||||
$(".favourite-button").removeClass("hide");
|
||||
$(".unfavourite-button").addClass("hide");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "euscan/_datatable.html" %}
|
||||
|
||||
{% load packages %}
|
||||
{% load euscan %}
|
||||
|
||||
{% block title %}
|
||||
{{ block.super }} - World Scan
|
||||
|
49
euscanwww/djeuscan/templatetags/euscan.py
Normal file
49
euscanwww/djeuscan/templatetags/euscan.py
Normal file
@ -0,0 +1,49 @@
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.inclusion_tag('euscan/_packages.html', takes_context=True)
|
||||
def packages(context, pkgs):
|
||||
context['packages'] = pkgs
|
||||
return context
|
||||
|
||||
|
||||
@register.inclusion_tag('euscan/_package_cols.html', takes_context=True)
|
||||
def package_cols(context, infos):
|
||||
context['infos'] = infos
|
||||
return context
|
||||
|
||||
|
||||
@register.inclusion_tag('euscan/_package_bar.html', takes_context=True)
|
||||
def package_bar(context, infos):
|
||||
context['infos'] = infos
|
||||
return context
|
||||
|
||||
|
||||
@register.inclusion_tag('euscan/_categories_table.html')
|
||||
def categories_table(categories, extras=False):
|
||||
return {
|
||||
"categories": categories,
|
||||
"extras": extras,
|
||||
"STATIC_URL": settings.STATIC_URL,
|
||||
}
|
||||
|
||||
|
||||
@register.inclusion_tag('euscan/_herds_table.html')
|
||||
def herds_table(herds, extras=False):
|
||||
return {
|
||||
"herds": herds,
|
||||
"extras": extras,
|
||||
"STATIC_URL": settings.STATIC_URL,
|
||||
}
|
||||
|
||||
|
||||
@register.inclusion_tag('euscan/_maintainers_table.html')
|
||||
def maintainers_table(maintainers, extras=False):
|
||||
return {
|
||||
"maintainers": maintainers,
|
||||
"extras": extras,
|
||||
"STATIC_URL": settings.STATIC_URL,
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.inclusion_tag('euscan/_packages.html', takes_context=True)
|
||||
def packages(context, pkgs):
|
||||
context['packages'] = pkgs
|
||||
return context
|
||||
|
||||
|
||||
@register.inclusion_tag('euscan/_package_cols.html', takes_context=True)
|
||||
def package_cols(context, infos):
|
||||
context['infos'] = infos
|
||||
return context
|
||||
|
||||
|
||||
@register.inclusion_tag('euscan/_package_bar.html', takes_context=True)
|
||||
def package_bar(context, infos):
|
||||
context['infos'] = infos
|
||||
return context
|
@ -18,6 +18,9 @@ package_patterns = patterns('djeuscan.views',
|
||||
'package', name="package"),
|
||||
url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/favourite$',
|
||||
'favourite_package', name="favourite_package"),
|
||||
url((r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/'
|
||||
'unfavourite$'),
|
||||
'unfavourite_package', name="unfavourite_package"),
|
||||
)
|
||||
|
||||
categories_patterns = patterns('djeuscan.views',
|
||||
@ -29,6 +32,8 @@ categories_patterns = patterns('djeuscan.views',
|
||||
'chart_category', name="chart_category"),
|
||||
url(r'^(?P<category>[\w+][\w+.-]*)/favourite$',
|
||||
'favourite_category', name="favourite_category"),
|
||||
url(r'^(?P<category>[\w+][\w+.-]*)/unfavourite$',
|
||||
'unfavourite_category', name="unfavourite_category"),
|
||||
url(r'^$', 'categories', name="categories"),
|
||||
)
|
||||
|
||||
@ -39,6 +44,8 @@ herds_patterns = patterns('djeuscan.views',
|
||||
'chart_herd', name="chart_herd"),
|
||||
url(r'^(?P<herd>[\@\{\}\w+.-]*)/favourite$', 'favourite_herd',
|
||||
name="favourite_herd"),
|
||||
url(r'^(?P<herd>[\@\{\}\w+.-]*)/unfavourite$', 'unfavourite_herd',
|
||||
name="unfavourite_herd"),
|
||||
url(r'^$', 'herds', name="herds"),
|
||||
)
|
||||
|
||||
@ -50,6 +57,8 @@ maintainers_patterns = patterns('djeuscan.views',
|
||||
'chart_maintainer', name="chart_maintainer"),
|
||||
url(r'^(?P<maintainer_id>\d+)/favourite$',
|
||||
'favourite_maintainer', name="favourite_maintainer"),
|
||||
url(r'^(?P<maintainer_id>\d+)/unfavourite$',
|
||||
'unfavourite_maintainer', name="unfavourite_maintainer"),
|
||||
url(r'^$', 'maintainers', name="maintainers"),
|
||||
)
|
||||
|
||||
|
@ -167,13 +167,23 @@ def package(request, category, package):
|
||||
except EuscanResult.DoesNotExist:
|
||||
last_scan = None
|
||||
|
||||
favourited = False
|
||||
if request.user.is_authenticated():
|
||||
try:
|
||||
PackageAssociation.objects.get(user=request.user, package=package)
|
||||
except PackageAssociation.DoesNotExist:
|
||||
pass
|
||||
else:
|
||||
favourited = True
|
||||
|
||||
return {
|
||||
'package': package,
|
||||
'packaged': packaged,
|
||||
'upstream': upstream,
|
||||
'log': log,
|
||||
'vlog': vlog,
|
||||
'last_scan': last_scan
|
||||
'last_scan': last_scan,
|
||||
'favourited': favourited,
|
||||
}
|
||||
|
||||
|
||||
@ -299,19 +309,25 @@ def accounts_index(request):
|
||||
@login_required
|
||||
@render_to('euscan/accounts/categories.html')
|
||||
def accounts_categories(request):
|
||||
return {}
|
||||
categories = [obj.category for obj in
|
||||
CategoryAssociation.objects.filter(user=request.user)]
|
||||
return {"categories": categories}
|
||||
|
||||
|
||||
@login_required
|
||||
@render_to('euscan/accounts/herds.html')
|
||||
def accounts_herds(request):
|
||||
return {}
|
||||
herds = [obj.herd for obj in
|
||||
HerdAssociation.objects.filter(user=request.user)]
|
||||
return {"herds": herds}
|
||||
|
||||
|
||||
@login_required
|
||||
@render_to('euscan/accounts/maintainers.html')
|
||||
def accounts_maintainers(request):
|
||||
return {}
|
||||
maintainers = [obj.maintainer for obj in
|
||||
MaintainerAssociation.objects.filter(user=request.user)]
|
||||
return {"maintainers": maintainers}
|
||||
|
||||
|
||||
@login_required
|
||||
@ -333,6 +349,18 @@ def favourite_package(request, category, package):
|
||||
return {"success": created}
|
||||
|
||||
|
||||
@login_required
|
||||
@require_POST
|
||||
@ajax_request
|
||||
def unfavourite_package(request, category, package):
|
||||
package = get_object_or_404(Package, category=category, name=package)
|
||||
obj = get_object_or_404(
|
||||
PackageAssociation, package=package, user=request.user
|
||||
)
|
||||
obj.delete()
|
||||
return {"success": True}
|
||||
|
||||
|
||||
@login_required
|
||||
@require_POST
|
||||
@ajax_request
|
||||
@ -344,6 +372,18 @@ def favourite_herd(request, herd):
|
||||
return {"success": created}
|
||||
|
||||
|
||||
@login_required
|
||||
@require_POST
|
||||
@ajax_request
|
||||
def unfavourite_herd(request, herd):
|
||||
herd = get_object_or_404(Herd, herd=herd)
|
||||
obj = get_object_or_404(
|
||||
HerdAssociation, herd=herd, user=request.user
|
||||
)
|
||||
obj.delete()
|
||||
return {"success": True}
|
||||
|
||||
|
||||
@login_required
|
||||
@require_POST
|
||||
@ajax_request
|
||||
@ -355,6 +395,18 @@ def favourite_maintainer(request, maintainer_id):
|
||||
return {"success": created}
|
||||
|
||||
|
||||
@login_required
|
||||
@require_POST
|
||||
@ajax_request
|
||||
def unfavourite_maintainer(request, maintainer_id):
|
||||
maintainer = get_object_or_404(Maintainer, pk=maintainer_id)
|
||||
obj = get_object_or_404(
|
||||
MaintainerAssociation, maintainer=maintainer, user=request.user
|
||||
)
|
||||
obj.delete()
|
||||
return {"success": True}
|
||||
|
||||
|
||||
@login_required
|
||||
@require_POST
|
||||
@ajax_request
|
||||
@ -368,3 +420,14 @@ def favourite_category(request, category):
|
||||
user=request.user, category=category
|
||||
)
|
||||
return {"success": created}
|
||||
|
||||
|
||||
@login_required
|
||||
@require_POST
|
||||
@ajax_request
|
||||
def unfavourite_category(request, category):
|
||||
obj = get_object_or_404(
|
||||
CategoryAssociation, user=request.user, category=category
|
||||
)
|
||||
obj.delete()
|
||||
return {"success": True}
|
||||
|
@ -119,68 +119,66 @@ a:hover, a:active
|
||||
|
||||
/*
|
||||
code, pre{
|
||||
background-color:transparent;
|
||||
font-family:"Courier New",Courier,monospace;
|
||||
font-size:small;
|
||||
background-color:transparent;
|
||||
font-family:"Courier New",Courier,monospace;
|
||||
font-size:small;
|
||||
}
|
||||
*/
|
||||
|
||||
a{
|
||||
color: #3F4C66;
|
||||
color: #3F4C66;
|
||||
}
|
||||
|
||||
a:link, a:visited, a:active {
|
||||
color: #3F4C66;
|
||||
text-decoration: none;
|
||||
color: #3F4C66;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
color: #4C5C7B;
|
||||
text-decoration: underline;
|
||||
color: #4C5C7B;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
abbr:hover {
|
||||
text-decoration: underline;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
pre{
|
||||
border-left:5px solid;
|
||||
padding:0.5em 1em;
|
||||
margin-left:2em;
|
||||
border-left:5px solid;
|
||||
padding:0.5em 1em;
|
||||
margin-left:2em;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
dd {
|
||||
border-left: 1px solid #ccc;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
border-left: 1px solid #ccc;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
|
||||
h1 {
|
||||
color: #000;
|
||||
width: 20em;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
color: #000;
|
||||
width: 20em;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.ok {
|
||||
color:#15B100;
|
||||
color:#15B100;
|
||||
}
|
||||
|
||||
hr
|
||||
{
|
||||
margin: 0.3em 1em 0.3em 1em;
|
||||
height: 1px;
|
||||
border: #bcbcbc dashed;
|
||||
border-width: 0 0 1px 0;
|
||||
}
|
||||
hr {
|
||||
margin: 0.3em 1em 0.3em 1em;
|
||||
height: 1px;
|
||||
border: #bcbcbc dashed;
|
||||
border-width: 0 0 1px 0;
|
||||
}
|
||||
|
||||
|
||||
table
|
||||
{
|
||||
table {
|
||||
max-width: 60em;
|
||||
/* width: 50%; */
|
||||
border-collapse: collapse;
|
||||
@ -191,27 +189,24 @@ table
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
td
|
||||
{
|
||||
vertical-align: top;
|
||||
}
|
||||
td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
th
|
||||
{
|
||||
font-size: 0.8em;
|
||||
text-align: center;
|
||||
border-bottom: 3px solid;
|
||||
}
|
||||
th {
|
||||
font-size: 0.8em;
|
||||
text-align: center;
|
||||
border-bottom: 3px solid;
|
||||
}
|
||||
|
||||
#footer
|
||||
{
|
||||
#footer {
|
||||
background: #8076A1;
|
||||
font-size: 0.8em;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
margin-top: 10px;
|
||||
color: #FFF;
|
||||
}
|
||||
}
|
||||
|
||||
#footer p {
|
||||
text-align: right;
|
||||
@ -220,33 +215,31 @@ th
|
||||
|
||||
.err,.ok,.inf
|
||||
{
|
||||
margin: 5px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 70%;
|
||||
font-weight:bold;
|
||||
border: 1px dotted #5682AD;
|
||||
}
|
||||
margin: 5px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 70%;
|
||||
font-weight:bold;
|
||||
border: 1px dotted #5682AD;
|
||||
}
|
||||
|
||||
.added {
|
||||
color: #262;
|
||||
color: #262;
|
||||
}
|
||||
|
||||
.removed {
|
||||
color: #F00;
|
||||
color: #F00;
|
||||
}
|
||||
|
||||
.err
|
||||
{
|
||||
border-color: #F00;
|
||||
color: #F00;
|
||||
}
|
||||
.err {
|
||||
border-color: #F00;
|
||||
color: #F00;
|
||||
}
|
||||
|
||||
.ok
|
||||
{
|
||||
border-color: #262;
|
||||
color: #262;
|
||||
}
|
||||
.ok {
|
||||
border-color: #262;
|
||||
color: #262;
|
||||
}
|
||||
|
||||
.logo {
|
||||
float: right;
|
||||
@ -284,3 +277,7 @@ th
|
||||
max-height: 100pt;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user