Adds back home/local/federated tabs
I don't think this is how I want the UI to work in the long run, but for now it's better than not having it. Fixes #210
This commit is contained in:
parent
9c83d68a80
commit
8d9474275e
|
@ -33,6 +33,20 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="column is-two-thirds" id="feed">
|
<div class="column is-two-thirds" id="feed">
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li class="{% if tab == 'home' %}is-active{% endif %}">
|
||||||
|
<a href="/#feed">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="{% if tab == 'local' %}is-active{% endif %}">
|
||||||
|
<a href="/local#feed">Local</a>
|
||||||
|
</li>
|
||||||
|
<li class="{% if tab == 'federated' %}is-active{% endif %}">
|
||||||
|
<a href="/federated#feed">Federated</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% if not activities %}
|
{% if not activities %}
|
||||||
<p>There aren't any activities right now! Try following a user to get started</p>
|
<p>There aren't any activities right now! Try following a user to get started</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -45,6 +45,7 @@ urlpatterns = [
|
||||||
re_path(r'^invite/(?P<code>[A-Za-z0-9]+)/?$', views.invite_page),
|
re_path(r'^invite/(?P<code>[A-Za-z0-9]+)/?$', views.invite_page),
|
||||||
|
|
||||||
path('', views.home),
|
path('', views.home),
|
||||||
|
re_path(r'^(?P<tab>home|local|federated)/?$', views.home_tab),
|
||||||
re_path(r'^notifications/?', views.notifications_page),
|
re_path(r'^notifications/?', views.notifications_page),
|
||||||
re_path(r'import/?$', views.import_page),
|
re_path(r'import/?$', views.import_page),
|
||||||
re_path(r'import_status/(\d+)/?$', views.import_status),
|
re_path(r'import_status/(\d+)/?$', views.import_status),
|
||||||
|
|
|
@ -44,6 +44,12 @@ def not_found_page(request, _):
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def home(request):
|
def home(request):
|
||||||
|
''' this is the same as the feed on the home tab '''
|
||||||
|
return home_tab(request, 'home')
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def home_tab(request, tab):
|
||||||
''' user's homepage with activity feed '''
|
''' user's homepage with activity feed '''
|
||||||
# TODO: why on earth would this be where the pagination is set
|
# TODO: why on earth would this be where the pagination is set
|
||||||
page_size = 15
|
page_size = 15
|
||||||
|
@ -81,7 +87,7 @@ def home(request):
|
||||||
if len(suggested_books) >= count:
|
if len(suggested_books) >= count:
|
||||||
break
|
break
|
||||||
|
|
||||||
activities = get_activity_feed(request.user, 'home')
|
activities = get_activity_feed(request.user, tab)
|
||||||
|
|
||||||
activity_count = activities.count()
|
activity_count = activities.count()
|
||||||
activities = activities[(page - 1) * page_size:page * page_size]
|
activities = activities[(page - 1) * page_size:page * page_size]
|
||||||
|
@ -94,6 +100,7 @@ def home(request):
|
||||||
'activities': activities,
|
'activities': activities,
|
||||||
'review_form': forms.ReviewForm(),
|
'review_form': forms.ReviewForm(),
|
||||||
'quotation_form': forms.QuotationForm(),
|
'quotation_form': forms.QuotationForm(),
|
||||||
|
'tab': tab,
|
||||||
'comment_form': forms.CommentForm(),
|
'comment_form': forms.CommentForm(),
|
||||||
'next': next_page if activity_count > (page_size * page) else None,
|
'next': next_page if activity_count > (page_size * page) else None,
|
||||||
'prev': prev_page if page > 1 else None,
|
'prev': prev_page if page > 1 else None,
|
||||||
|
|
Loading…
Reference in New Issue