mirror of
https://github.com/pinry/pinry.git
synced 2026-01-15 03:32:05 +01:00
Added modal for creating new pins.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
{% load new_pin %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -22,7 +24,7 @@
|
||||
|
||||
<ul class="nav pull-right">
|
||||
{% if user.is_authenticated %}
|
||||
<li><a href="{% url pins:new-pin %}">New Pin</a></li>
|
||||
<li><a href="#new-pin" data-toggle="modal">New Pin</a></li>
|
||||
<li><a href="{% url core:logout %}">Logout</a></li>
|
||||
{% else %}
|
||||
<li><a href="{% url core:login %}">Login</a></li>
|
||||
@@ -34,6 +36,8 @@
|
||||
|
||||
{% block yield %}{% endblock %}
|
||||
|
||||
{% new_pin %}
|
||||
|
||||
{% if debug %}
|
||||
<script src="/static/vendor/jquery/1.7.2/jquery.js"></script>
|
||||
<script src="/static/vendor/bootstrap/2.0.3/js/bootstrap.js"></script>
|
||||
|
||||
19
pinry/pins/templates/pins/templatetags/new_pin.html
Normal file
19
pinry/pins/templates/pins/templatetags/new_pin.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% load bootstrap_field %}
|
||||
|
||||
<div class="modal fade" id="new-pin">
|
||||
<div class="modal-header">
|
||||
<h3>New Pin</h3>
|
||||
</div>
|
||||
<form action="{% url pins:new-pin %}" method="post" class="form-horizontal">
|
||||
<div class="modal-body">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
{% bootstrap_field field %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">Post</button>
|
||||
<a href="#new-pin" data-toggle="modal" class="btn">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
0
pinry/pins/templatetags/__init__.py
Normal file
0
pinry/pins/templatetags/__init__.py
Normal file
13
pinry/pins/templatetags/new_pin.py
Normal file
13
pinry/pins/templatetags/new_pin.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from django.template.loader import render_to_string
|
||||
from django.template import Library
|
||||
|
||||
from pinry.pins.forms import PinForm
|
||||
|
||||
|
||||
register = Library()
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def new_pin():
|
||||
return render_to_string('pins/templatetags/new_pin.html',
|
||||
{'form': PinForm()})
|
||||
Reference in New Issue
Block a user