Browse Source

Added modal for creating new pins.

tags/v0.2.1
Isaac Bythewood 12 years ago
parent
commit
ec3694acb7
4 changed files with 37 additions and 1 deletions
  1. +5
    -1
      pinry/core/templates/core/base.html
  2. +19
    -0
      pinry/pins/templates/pins/templatetags/new_pin.html
  3. +0
    -0
      pinry/pins/templatetags/__init__.py
  4. +13
    -0
      pinry/pins/templatetags/new_pin.py

+ 5
- 1
pinry/core/templates/core/base.html View File

@@ -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
- 0
pinry/pins/templates/pins/templatetags/new_pin.html View 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
- 0
pinry/pins/templatetags/__init__.py View File


+ 13
- 0
pinry/pins/templatetags/new_pin.py View 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()})

Loading…
Cancel
Save