Commit ad78c7eb authored by Daniel W Bond's avatar Daniel W Bond
Browse files

added lookouts back to the homepage on login

parent 81c5adf5
{% extends 'layouts/base.html' %}
{% block title %}
SRCT Bookshare • Homepage
{% endblock %}
{% block content %}
<div class="page-header" id="banner">
<div class="row">
<div class="col-lg-12 text-center">
<h1><strong>SRCT</strong>&#8203;BOOKSHARE</h1>
<p class="lead">A place for Mason students to buy and sell textbooks.</p>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<a href="{% url 'create_listing' %}" class="btn btn-primary btn-lg btn-block">
I have a book
</a>
</div>
<div class="col-sm-6">
<a href="{% url 'haystack_search' %}" class="btn btn-primary btn-lg btn-block">
I need a book
</a>
</div>
</div>
<hr/>
{% if listings %}
<div class="row">
{% comment %}
Essentially the logic here is to create 3 columns where
there are n rows in each.
The first conditional will add an initial column tag if the loop is
beginning a new column. The second conditional adds a closing column
tag when the loop ends a column.
{% endcomment %}
{% for listing in listings %}
{% if forloop.counter|add:-1|divisibleby:rows %}
<div class="col-md-4">
{% endif %}
{% include 'listing_preview_panel.html' %}
{% if forloop.counter|add:rows|divisibleby:rows %}
</div>
{% endif %}
{% endfor %}
</div>
<div class="row">
<div class="col-lg-4 col-lg-offset-4">
<ul class="pager">
{% if listings.has_previous %}
<li class="previous">
<a href="?page={{ listings.previous_page_number }}">
&larr; Newer
</a>
</li>
{% else %}
<li class="previous disabled">
<a>
&larr; Newer
</a>
</li>
{% endif %}
{% if listings.has_next %}
<li class="next">
<a href="?page={{ listings.next_page_number }}">
Older &rarr;
</a>
</li>
{% else %}
<li class="next disabled">
<a>
Older &rarr;
</a>
</li>
{% endif %}
</ul>
</div>
</div>
{% else %}
<div class="row">
<div class="col-lg-12 text-center">
<div class="panel panel-warning">
<div class="panel-body">
<h3>No lookout results found.</h3>
<p>
Lookouts are books you have an eye out for. You can
<a data-toggle="modal" data-target="#CreateLookout" href="#">
set some</a>, and we'll automatically show them here when a
selling goes up.
</p>
</div>
</div>
</div>
</div>
{% endif %}
{% include 'create_lookout_modal.html' %}
{% endblock %}
from django.conf.urls import patterns, include, url
from .views import HomepageView
from django.views.generic import TemplateView
from django.contrib import admin
......@@ -20,7 +22,7 @@ urlpatterns = patterns('',
url(r'^search/', include('haystack.urls'), name='search'),
### static pages ###
url(r'^$', TemplateView.as_view(template_name='index.html'), name = 'homepage'),
url(r'^$', HomepageView.as_view(template_name='index.html'), name = 'homepage'),
url(r'^about/?$', TemplateView.as_view(template_name='about.html'), name='about'),
url(r'^privacy/?$', TemplateView.as_view(template_name='privacy.html'), name='privacy'),
url(r'^privacy/opt-out/?$', 'core.views.privacy_opt_out', name='privacy_opt_out'),
......
......@@ -17,7 +17,52 @@ SRCT Bookshare &bull; Homepage
</div>
</div>
</div>
{% if user.is_authenticated %}
<legend class="text-center">Lookouts</legend>
{% if lookouts %}
<div class="row">
{% comment %}
Essentially the logic here is to create 3 columns where
there are n rows in each.
The first conditional will add an initial column tag if the loop is
beginning a new column. The second conditional adds a closing column
tag when the loop ends a column.
{% endcomment %}
{% for listing in my_lookouts %}
{% if forloop.counter|add:-1|divisibleby:rows %}
<div class="col-md-4">
{% endif %}
{% include 'listing_preview_panel.html' %}
{% if forloop.counter|add:rows|divisibleby:rows %}
</div>
{% endif %}
{% endfor %}
</div>
{% else %}
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-warning">
<div class="panel-body text-center">
<h3>No lookout results found.</h3>
<p>
Lookouts are automatic searches for books you have an eye out for. You can create some <a href="#">here</a>, and we'll automatically show you when a listing you want goes up.
<!-- <a data-toggle="modal" data-target="#CreateLookout" href="#"> -->
{% include 'create_lookout_modal.html' %}
</p>
</div>
</div>
</div>
</div>
{% endif %}
{% else %}
<legend></legend>
<div class="row">
......@@ -38,7 +83,7 @@ SRCT Bookshare &bull; Homepage
<h4>Get updates when textbooks you want are posted</h4>
</div>
</div>
{% endif %}
<legend></legend>
<div class="row">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment