Skip to content

Commit

Permalink
fb connect
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Potanski committed Dec 29, 2014
1 parent abd608d commit 8e92e80
Show file tree
Hide file tree
Showing 28 changed files with 1,058 additions and 114 deletions.
17 changes: 16 additions & 1 deletion library/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'django_tables2',
'library_app'
'library_app',
'fandjango',
'json_field',
# 'templatetags'
)

Expand All @@ -51,6 +53,8 @@
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'fandjango.middleware.FacebookMiddleware',
'fandjango.middleware.FacebookWebMiddleware',
)

ROOT_URLCONF = 'library.urls'
Expand Down Expand Up @@ -112,4 +116,15 @@
"django.contrib.messages.context_processors.messages",
# "library_app.context_processor.is_authenticated"
"django.core.context_processors.request",
)

FACEBOOK_APPLICATION_ID = 970424339652057
FACEBOOK_APPLICATION_SECRET_KEY = 'e250adbd77eb67fbf006d7faf08cb66a'
FACEBOOK_APPLICATION_NAMESPACE = 'library_django'

# FANDJANGO_SITE_URL = 'http://django-library.herokuapp.com/'
FANDJANGO_SITE_URL = 'http://localhost:8888/fb/'

AUTHENTICATION_BACKENDS = (
'library_app.auth_backend.PasswordlessAuthBackend',
)
12 changes: 6 additions & 6 deletions library/templates/author_show.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

{% if request.user|has_group:"Librarians" %}
<!--TODO Edit link-->
<!--<ul>-->
<!--<li><a href="#">Edit</a> this author</li>-->
<!--<li><a href="#"-->
<!--onclick='return confirm("Do you really want to delete author: {{ author.name }} {{ author.surname }}?")'>Remove-->
<!--</a> this author</li>-->
<!--</ul>-->
<ul>
<li><a href="{% url 'edit' 'authors' author.id %}">Edit</a> this author</li>
<li><a href="{% url 'remove' 'authors' author.id %}"
onclick='return confirm("Do you really want to delete author: {{ author.name }} {{ author.surname }}?")'>Remove
</a> this author</li>
</ul>
{% else %}
{% endif %}

Expand Down
10 changes: 9 additions & 1 deletion library/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<link href="{{ STATIC_URL }}css/bootstrap.min.css" rel="stylesheet" media="screen">

<link rel="stylesheet/less" href="{{ STATIC_URL }}css/style.less">
{% block include %}
{% endblock %}
<script src="{{ STATIC_URL }}js/less.js"></script>
</head>
<body>
Expand Down Expand Up @@ -67,6 +69,7 @@
</div>

<div id="content">
{% block site %}
{% block flash %}
{% if auth_form.non_field_errors or user_form.non_field_errors %}
<div class="flash error">
Expand Down Expand Up @@ -113,7 +116,8 @@
</div>
{% endblock %}

</div>
</div>{% endblock %}

</div>


Expand All @@ -139,5 +143,9 @@
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="{{ STATIC_URL }}js/bootstrap.min.js"></script>
<script src="{{ STATIC_URL }}js/main.js"></script>

{% block include_footer %}
{% endblock %}

</body>
</html>
13 changes: 11 additions & 2 deletions library/templates/book_show.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,19 @@
{% endif %}

{% if request.user|has_group:"Librarians" %}
You are an librarian ;)<br/>
<br/><ul>

<li><a href="{% url 'edit' 'books' book.id %}">Edit</a> this book</li>

<li><a href="{% url 'remove' 'books' book.id %}"
onclick='return confirm("Do you really want to delete book: {{ book.title }}?")'>Remove
</a> this book</li>


{% if book.lend_by != None %}
<a href="{% url 'return_book' book.id %}" onclick='return confirm("Do you want to mark {{ book.title }} as returned")'>Mark</a> this book as returned.
<li><a href="{% url 'return_book' book.id %}" onclick='return confirm("Do you want to mark {{ book.title }} as returned")'>Mark</a> this book as returned.</li>
{% endif %}
</ul>
{% else %}
{% endif %}

Expand Down
48 changes: 45 additions & 3 deletions library/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,48 @@

{% block content %}
<div class="page-title-outer"><div class="page-title">Welcome: {{ user.username }}</div></div>
<p>
</p>
{% endblock %}

<div class="fb_mess">
{% block fb_messages %}
{% endblock %}
</div><br/><br>


<div class="options-list">
<ul>
<li><a href="{% url 'books' %}">Search books</a></li>
<li><a href="{% url 'search_users' %}">Search other users</a></li>
<li><a href="{% url 'user_quotations' %}">Show saved quotations</a></li>
<li><a href="{% url 'user' request.user.username %}">My profile</a> (my friends, my books, my data)</li>
<li><a href="{% url 'about' %}">About library</a></li>

{% if request.user|has_group:"Librarians" %}
</ul><ul><li><a href="{% url 'user' request.user.username %}">Librarian dashboard</a></li> {% endif %}

</ul>
</div>

<div id="count-div" count="{{ count }}"></div>


{% if count > 0 %}
<p>
{% for f, q, author, nr in friends_quotations %}
<div class="quote-from-friend hidden" id="q{{ nr }}" >


{% if f.user.email|length > 0 and f.user.email != None %} <div class="gravator"><img
src="{{ f.user.profile.gravator_url }}"></img></div><br/> {% endif %}
<div class="quotation-owner">{{ f.user.first_name }} {{ f.user.last_name }} </div><br/>

<div class="quotation"><span class="quotation">"{{ q }}<span class='last_letter_of_quotation'>"</span></span> by {{ author }}</div>
</div>
{% endfor %}
</p>
{% endif %}


{% if count == 0 %} To see animated quotations add a few friends. <a href="{% url 'search_users' %}">Add now</a>
;){% endif %}
{% endblock %}

28 changes: 28 additions & 0 deletions library/templates/new.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% xextends "base.html" with small_panel=true vcenter_panel=true active_tab=sign_in %}



{% block content %}

<form action="
{% if id_obj %}
{% if what == 'authors' %} {% url 'edit' 'authors' id_obj %} {% endif %}
{% if what == 'publishers' %} {% url 'edit' 'publishers' id_obj %} {% endif %}
{% if what == 'periods' %} {% url 'edit' 'periods' id_obj %} {% endif %}
{% else %}
{% if what == 'authors' %} {% url 'new' 'authors' %} {% endif %}
{% if what == 'publishers' %} {% url 'new' 'publishers' %} {% endif %}
{% if what == 'periods' %} {% url 'new' 'periods' %} {% endif %}
{% endif %}
"
method="POST" class="form-signin" role="form">{% csrf_token %}
<h2 class="form-signin-heading">{{ title }}</h2>
{% for field in form %}
{{ field }}
{% endfor %}
{# <input class="date" id="id_date_of_birth" name="date_of_birth" type="date" /> #}

<button class="btn btn-lg btn-primary btn-block" type="submit">Submit</button>
</form>

{% endblock %}
17 changes: 0 additions & 17 deletions library/templates/new_author.html

This file was deleted.

6 changes: 6 additions & 0 deletions library/templates/period_show.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@

{% if request.user|has_group:"Librarians" %}
<!--TODO Edit link-->
<ul>
<li><a href="{% url 'edit' 'periods' period.id %}">Edit</a> this period</li>
<li><a href="{% url 'remove' 'periods' period.id %}"
onclick='return confirm("Do you really want to delete lending period: {{ period.name }}?")'>Remove
</a> this period</li>
</ul>
{% else %}
{% endif %}

Expand Down
148 changes: 144 additions & 4 deletions library/templates/public_home.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,148 @@
{% xextends "base.html" with active_tab=home %}

{% block content %}
<div class="page-title-outer"><div class="page-title">Public home</div></div>
<p>
{% block include %}
<link rel="stylesheet/less" href="{{ STATIC_URL }}css/public_home.less">
{# comment #}
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
{# endcomment #}
{% endblock %}

</p>
{% block include_footer %}
<script src="{{ STATIC_URL }}js/public_home.js"></script>
{% endblock %}

{% block site %}

<div class="white-background">
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="{{ STATIC_URL }}img/c1.jpg" alt="First slide">
<div class="container">
<div class="carousel-caption">
<h1>Welcome in Library Online Management System</h1>
<p>Make yourself at home!</p>
<p><a class="btn btn-lg btn-primary" href="{% url 'sign_up' %}" role="button">Sign up today</a></p>
</div>
</div>
</div>
<div class="item">
<img src="{{ STATIC_URL }}img/c2.jpg" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<h1>Another example headline.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="{% url 'about' %}" role="button">Learn more</a></p>
</div>
</div>
</div>
<div class="item">
<img src="{{ STATIC_URL }}img/c3.jpg" alt="Third slide">
<div class="container">
<div class="carousel-caption">
<h1>One more for good measure.</h1>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-lg btn-primary" href="#team" role="button">Meet our team!</a></p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div><!-- /.carousel -->


<!-- Marketing messaging and featurettes
================================================== -->
<!-- Wrap the rest of the page in another container to center all the content. -->

<div class="container marketing">

<h1 class="featurette-heading" id="team">Meet our team!</h1>
<!-- Three columns of text below the carousel -->
<div class="row">
<div class="col-lg-4">
<img class="img-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Generic placeholder image" style="width: 140px; height: 140px;">
<h2>Heading</h2>
<p>Donec sed odio dui. Etiam porta sem malesuada magna mollis euismod. Nullam id dolor id nibh ultricies vehicula ut id elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna.</p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<img class="img-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Generic placeholder image" style="width: 140px; height: 140px;">
<h2>Heading</h2>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.</p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div><!-- /.col-lg-4 -->
<div class="col-lg-4">
<img class="img-circle" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Generic placeholder image" style="width: 140px; height: 140px;">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn btn-default" href="#" role="button">View details &raquo;</a></p>
</div><!-- /.col-lg-4 -->
</div><!-- /.row -->


<!-- START THE FEATURETTES -->

<hr class="featurette-divider">

<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading">First featurette heading. <span class="text-muted"></span></h2>
<p class="lead">Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
</div>
<div class="col-md-5">
<img class="featurette-image img-responsive" data-src="holder.js/300x300/auto"
alt="Generic placeholder image">
</div>
</div>

<hr class="featurette-divider">

<div class="row featurette">
<div class="col-md-5">
<img class="featurette-image img-responsive" data-src="holder.js/300x300/auto"
alt="Generic placeholder image">
</div>
<div class="col-md-7">
<h2 class="featurette-heading">Oh yeah, it's that good. <span class="text-muted">See for yourself.</span></h2>
<p class="lead">Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
</div>
</div>

<hr class="featurette-divider">

<div class="row featurette">
<div class="col-md-7">
<h2 class="featurette-heading">And lastly, this one. <span class="text-muted">Checkmate.</span></h2>
<p class="lead">Donec ullamcorper nulla non metus auctor fringilla. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus magna, vel scelerisque nisl consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
</div>
<div class="col-md-5">
<img class="featurette-image img-responsive" data-src="holder.js/300x300/auto"
alt="Generic placeholder image">
</div>
</div>

<hr class="featurette-divider">

<!-- /END THE FEATURETTES -->
</div>
{% endblock %}
8 changes: 7 additions & 1 deletion library/templates/publisher_show.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
<a href="{% url 'publishers' %}">List of publishers</a><br/><br/>

{% if request.user|has_group:"Librarians" %}
<!--TODO Edit link-->
<!--TODO remove link-->
<ul>
<li><a href="{% url 'edit' 'publishers' publisher.id %}">Edit</a> this publisher</li>
<li><a href="{% url 'remove' 'publishers' publisher.id %}"
onclick='return confirm("Do you really want to delete publisher: {{ publisher.name }}?")'>Remove
</a> this publisher</li>
</ul>
{% else %}
{% endif %}

Expand Down
Loading

0 comments on commit 8e92e80

Please sign in to comment.