Skip to content
Snippets Groups Projects
Commit e207143f authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Merge branch 'cherry-pick-e43968df' into 'scheduler'

Merge branch 'plotters_patch' into 'master'

[plotters] patched urls and various user/anonymous issues for plotters

patched urls and various user/anonymous issues for plotters

See merge request !192

See merge request !193
parents 6f19e3f2 2ffcaa1f
No related branches found
No related tags found
2 merge requests!194Scheduler,!193Merge branch 'plotters_patch' into 'master'
Pipeline #
......@@ -30,6 +30,6 @@
{% list_tabs author "plotters" %}
{% plotter_table objects owner "plotter-list" %}
{% plotter_table objects owner "list" %}
{% endblock %}
......@@ -62,7 +62,7 @@
{% if objects %}
<div class="scrollable table-responsive">
<table id="{{ panel_id }}" class="table table-hover table-condensed object-list plotter-list">
<table id="{{ panel_id }}" class="table table-hover table-condensed object-list list">
<thead>
<tr>
<th class="privacy"></th>
......
......@@ -48,18 +48,6 @@ urlpatterns = [
name='view',
),
url(
r'^(?P<author_name>\w+)/$',
views.list_plotters,
name='plotter-list',
),
url(
r'^$',
views.list_plotters_public,
name='plotter-public-list',
),
url(
r'^(?P<author>\w+)/(?P<name>[-\w]+)/$',
views.view,
......
......@@ -344,14 +344,17 @@ def view(request, author, name, version=None):
#----------------------------------------------------------
def list_plotters(request, author_name):
def list_plotters(request):
'''List all accessible plotters to the request user'''
# check that the user exists on the system
author = get_object_or_404(User, username=author_name)
objects=Plotter.objects.from_author_and_public(request.user,author_name)
owner=(request.user==author)
if request.user.is_anonymous():
author = request.user #anonymous
objects=Plotter.objects.public().order_by('-creation_date')
owner = False
else:
author = get_object_or_404(User, username=request.user.username)
objects=Plotter.objects.from_author_and_public(request.user,request.user.username)
owner=(request.user==author)
return render_to_response('plotters/list.html',
dict(
......
......@@ -30,7 +30,7 @@
<a class="list-group-item" href="{% if request.user.is_anonymous %}{% url 'attestations:public-list' %}{% else %}{% url 'attestations:list' request.user.username %}{% endif %}" title="Show attestations" data-toggle="tooltip" data-placement="left">Attestations <span class="badge">{{ totals.attestations }}</span></a>
<a class="list-group-item" href="{% if request.user.is_anonymous %}{% url 'search:public-list' %}{% else %}{% url 'search:list' request.user.username %}{% endif %}" title="Show searches" data-toggle="tooltip" data-placement="left">Searches <span class="badge">{{ totals.searches }}</span></a>
<a class="list-group-item" href="{% if request.user.is_anonymous %}{% url 'reports:public-list' %}{% else %}{% url 'reports:list' request.user.username %}{% endif %}" title="Show reports" data-toggle="tooltip" data-placement="left">Reports <span class="badge">{{ totals.reports }}</span></a>
<a class="list-group-item" href="{% if request.user.is_anonymous %}{% url 'plotters:plotter-public-list' %}{% else %}{% url 'plotters:plotter-list' request.user.username %}{% endif %}" title="Show plotters" data-toggle="tooltip" data-placement="left">Plotters <span class="badge">{{ totals.plotters}}</span></a>
<a class="list-group-item" href="{% if request.user.is_anonymous %}{% url 'plotters:list' %}{% else %}{% url 'plotters:list' %}{% endif %}" title="Show plotters" data-toggle="tooltip" data-placement="left">Plotters <span class="badge">{{ totals.plotters}}</span></a>
<a class="list-group-item" href="{% url 'databases:list' %}" title="Show databases" data-toggle="tooltip" data-placement="left">Databases <span class="badge">{{ totals.databases }}</span></a>
<div class="list-group-item">Users <span class="badge">{{ totals.users }}</span></div>
</div>
......
......@@ -168,7 +168,6 @@
<a href="{% url 'teams:list' author.username %}" class="list-group-item">Teams <span class="badge">{{ statistics.teams.count }}</span></a>
<a href="{% url 'attestations:list' author.username %}" class="list-group-item">Attestations <span class="badge">{{ statistics.attestations.count }}</span></a>
<a href="{% url 'reports:list' author.username %}" class="list-group-item">Reports <span class="badge">{{ statistics.reports.count }}</span></a>
<a href="{% url 'plotters:plotter-list' author.username %}" class="list-group-item">Plotters<span class="badge">{{ statistics.plotters.count }}</span></a>
<a href="{% url 'search:list' author.username %}" class="list-group-item">Searches <span class="badge">{{ statistics.searches.count }}</span></a>
</ul>
</div>
......
......@@ -35,12 +35,12 @@
{% endwith %}
{% if not request.user.is_anonymous %}
<a data-toggle="tooltip" data-placement="bottom" title="View all your {{ name_plural }}" href="{% url listurl request.user.username %}">{{ name_plural }}</a>
<a data-toggle="tooltip" data-placement="bottom" title="View all your {{ name_plural }}" href="{% url listurl %}">{{ name_plural }}</a>
{% else %}
<a data-toggle="tooltip" data-placement="bottom" title="View all public {{ name_plural }}" href="{% url public_listurl %}">{{ name_plural }}</a>
<a data-toggle="tooltip" data-placement="bottom" title="View all public {{ name_plural }}" href="{% url listurl %}">{{ name_plural }}</a>
{% endif %}
</li>
<li><a data-toggle="tooltip" data-placement="bottom" title="View all {{ object.author.username }}'s {{ name_plural }}" href="{% url listurl object.author.username %}">{{ object.author.username }}</a></li>
<li><a data-toggle="tooltip" data-placement="bottom" title="View all {{ object.author.username }}'s {{ name_plural }}" href="{% url listurl %}">{{ object.author.username }}</a></li>
<li><a title="View the latest version" data-toggle="tooltip" data-placement="bottom" href="{% url viewurl object.author.username object.name %}">{{ object.name }}</a></li>
<li>{{ object.version }}</li>
</ol>
......
......@@ -58,7 +58,7 @@ def navbar(context):
(False, ''),
('databases', 'databases:list'),
('environments', 'backend:list-environments'),
('plotters', 'plotters:plotter-public-list'),
('plotters', 'plotters:list'),
#('plotterparameters', 'plotters:plotterparameter-public-list'),
],
'user_urls': [
......@@ -76,7 +76,7 @@ def navbar(context):
(False, '', False),
('databases', 'databases:list', False),
('environments', 'backend:list-environments', False),
('plotters', 'plotters:plotter-list', True),
('plotters', 'plotters:list', False),
#('plotterparameters', 'plotters:plotterparameter-list', True),
],
}
......@@ -108,8 +108,8 @@ def contribution_breadcrumb_plotter(context, obj):
'request': context['request'],
'object': obj,
'name_plural': name_plural,
'listurl': name_plural + ':plotter-list',
'public_listurl': name_plural + ':plotter-public-list',
'listurl': name_plural + ':list',
'public_listurl': name_plural + ':list',
'viewurl': name_plural + ':plotter-view-latest',
}
......@@ -163,7 +163,7 @@ def list_tabs(context, user, tab):
system_tabs=OrderedDict([
('databases', 'databases:list'),
('environments', 'backend:list-environments'),
('plotters', 'plotters:plotter-public-list'),
('plotters', 'plotters:list'),
]),
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment