mirror of
https://github.com/pinry/pinry.git
synced 2026-01-20 14:12:07 +01:00
Refactor templates and and make includes for upcoming python file refactor into core and user. Also making templates easier to edit and read overall.
This commit is contained in:
@@ -5,7 +5,7 @@ urlpatterns = patterns('',
|
||||
url(r'^$', 'pinry.core.views.home', name='home'),
|
||||
url(r'^private/$', 'pinry.core.views.private', name='private'),
|
||||
url(r'^login/$', 'django.contrib.auth.views.login',
|
||||
{'template_name': 'core/login.html'}, name='login'),
|
||||
{'template_name': 'user/login.html'}, name='login'),
|
||||
url(r'^register/$', 'pinry.core.views.register', name='register'),
|
||||
url(r'^logout/$', 'pinry.core.views.logout_user', name='logout'),
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ def home(request):
|
||||
|
||||
|
||||
def private(request):
|
||||
return TemplateResponse(request, 'core/private.html', None)
|
||||
return TemplateResponse(request, 'user/private.html', None)
|
||||
|
||||
|
||||
def register(request):
|
||||
@@ -35,7 +35,7 @@ def register(request):
|
||||
else:
|
||||
form = UserCreationForm()
|
||||
|
||||
return TemplateResponse(request, 'core/register.html', {'form': form})
|
||||
return TemplateResponse(request, 'user/register.html', {'form': form})
|
||||
|
||||
|
||||
@login_required
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from cStringIO import StringIO
|
||||
import urllib2
|
||||
from cStringIO import StringIO
|
||||
|
||||
from django.core.files.uploadedfile import InMemoryUploadedFile
|
||||
from django.db import models
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
from django.template.loader import render_to_string
|
||||
from django.template import Library
|
||||
from django.template import RequestContext
|
||||
|
||||
from pinry.pins.forms import ImageForm
|
||||
|
||||
|
||||
register = Library()
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def new_pin(request):
|
||||
return render_to_string('pins/templatetags/new_pin.html',
|
||||
{'form': ImageForm()},
|
||||
context_instance=RequestContext(request))
|
||||
@@ -1,60 +0,0 @@
|
||||
from django.test import TestCase
|
||||
from django.test.client import Client
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
|
||||
class RecentPinsTest(TestCase):
|
||||
def setUp(self):
|
||||
self.client = Client()
|
||||
self.url = reverse('pins:recent-pins')
|
||||
|
||||
def test_url(self):
|
||||
self.assertEqual(self.url, '/pins/')
|
||||
|
||||
def test_status_code(self):
|
||||
response = self.client.get(self.url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class NewPinTest(TestCase):
|
||||
def setUp(self):
|
||||
self.client = Client()
|
||||
self.url = reverse('pins:new-pin')
|
||||
|
||||
def test_url(self):
|
||||
self.assertEqual(self.url, '/pins/new-pin/')
|
||||
|
||||
def test_status_code(self):
|
||||
response = self.client.get(self.url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_new_pin(self):
|
||||
response = self.client.post(self.url, {
|
||||
'url': 'https://github.com/overshard/pinry/raw/master/'
|
||||
'screenshot.png',
|
||||
})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_new_pin_invalid_protocol(self):
|
||||
response = self.client.post(self.url, {
|
||||
'url': 'ftp://github.com/overshard/pinry/raw/master/'
|
||||
'screenshot.png',
|
||||
})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_new_pin_invalid_file_type(self):
|
||||
response = self.client.post(self.url, {
|
||||
'url': 'https://raw.github.com/overshard/pinry/master/README.md',
|
||||
})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_new_pin_already_pinned(self):
|
||||
response = self.client.post(self.url, {
|
||||
'url': 'http://github.com/overshard/pinry/raw/master/'
|
||||
'screenshot.png',
|
||||
})
|
||||
response = self.client.post(self.url, {
|
||||
'url': 'https://github.com/overshard/pinry/raw/master/'
|
||||
'screenshot.png',
|
||||
})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@@ -1,11 +1,11 @@
|
||||
from django.conf.urls import patterns, url
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from .views import RecentPins
|
||||
from .views import UploadImage
|
||||
|
||||
|
||||
urlpatterns = patterns('pinry.pins.views',
|
||||
url(r'^$', RecentPins.as_view(), name='recent-pins'),
|
||||
url(r'^tag/.+/$', RecentPins.as_view(), name='tag'),
|
||||
url(r'^upload-pin/$', UploadImage.as_view(), name='new-pin'),
|
||||
url(r'^$', TemplateView.as_view(template_name='core/recent_pins.html'),
|
||||
name='recent-pins'),
|
||||
)
|
||||
|
||||
@@ -2,23 +2,17 @@ import json
|
||||
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.contrib import messages
|
||||
from django.http import HttpResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.functional import lazy
|
||||
from django.views.generic import (
|
||||
TemplateView, CreateView)
|
||||
from django.views.generic.detail import SingleObjectTemplateResponseMixin
|
||||
from django.views.generic import CreateView
|
||||
|
||||
from django_images.models import Image
|
||||
|
||||
from .forms import ImageForm
|
||||
|
||||
|
||||
reverse_lazy = lambda name=None, *args: lazy(reverse, str)(name, args=args)
|
||||
|
||||
|
||||
class LoginRequiredMixin(object):
|
||||
"""
|
||||
A login required mixin for use with class based views. This Class is a light wrapper around the
|
||||
@@ -68,7 +62,7 @@ class JSONResponseMixin(object):
|
||||
|
||||
|
||||
class UploadImage(JSONResponseMixin, LoginRequiredMixin, CreateView):
|
||||
template_name = 'pins/pin_form.html'
|
||||
template_name = 'core/pin_form.html'
|
||||
model = Image
|
||||
form_class = ImageForm
|
||||
|
||||
@@ -90,7 +84,3 @@ class UploadImage(JSONResponseMixin, LoginRequiredMixin, CreateView):
|
||||
else:
|
||||
messages.error(self.request, message)
|
||||
return super(UploadImage, self).form_invalid(form)
|
||||
|
||||
|
||||
class RecentPins(TemplateView):
|
||||
template_name = 'pins/recent_pins.html'
|
||||
@@ -35,7 +35,6 @@ STATICFILES_DIRS = [os.path.join(SITE_ROOT, 'pinry/static')]
|
||||
STATICFILES_FINDERS = (
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
'compressor.finders.CompressorFinder',
|
||||
)
|
||||
TEMPLATE_LOADERS = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
@@ -64,7 +63,6 @@ AUTHENTICATION_BACKENDS = (
|
||||
)
|
||||
|
||||
|
||||
COMPRESS_CSS_FILTERS = ['compressor.filters.cssmin.CSSMinFilter']
|
||||
ROOT_URLCONF = 'pinry.urls'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
INTERNAL_IPS = ['127.0.0.1']
|
||||
@@ -84,7 +82,6 @@ INSTALLED_APPS = (
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'south',
|
||||
'compressor',
|
||||
'taggit',
|
||||
'django_images',
|
||||
'pinry.core',
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{% extends 'core/base.html' %}
|
||||
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}404{% endblock %}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{% extends 'core/base.html' %}
|
||||
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}500{% endblock %}
|
||||
|
||||
|
||||
79
pinry/templates/base.html
Normal file
79
pinry/templates/base.html
Normal file
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
|
||||
<!-- ___ ___ ___
|
||||
/ /\ ___ /__/\ / /\ ___
|
||||
/ /::\ / /\ \ \:\ / /::\ /__/|
|
||||
/ /:/\:\ / /:/ \ \:\ / /:/\:\ | |:|
|
||||
/ /:/~/:/ /__/::\ _____\__\:\ / /:/~/:/ | |:|
|
||||
/__/:/ /:/ \__\/\:\__ /__/::::::::\ /__/:/ /:/___ __|__|:|
|
||||
\ \:\/:/ \ \:\/\ \ \:\~~\~~\/ \ \:\/:::::/ /__/::::\
|
||||
\ \::/ \__\::/ \ \:\ ~~~ \ \::/~~~~ ~\~~\:\
|
||||
\ \:\ /__/:/ \ \:\ \ \:\ \ \:\
|
||||
\ \:\ \__\/ \ \:\ \ \:\ \__\/
|
||||
\__\/ \__\/ \__\/ -->
|
||||
|
||||
<title>{{ SITE_NAME }} - {% block title %}{% endblock %}</title>
|
||||
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Monoton"/>
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.0/css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/messages.css"/>
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/lightbox.css"/>
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/pinry.css"/>
|
||||
{% block extra_css %}{% endblock %}
|
||||
<!-- End CSS -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Navigation -->
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<a href="{% url 'core:home' %}" class="brand pull-left">{{ SITE_NAME }}</a>
|
||||
<ul class="nav pull-right">
|
||||
{% if user.is_authenticated %}
|
||||
<li><a class="bookmarklet-link">Bookmarklet</a></li>
|
||||
<li><a id="call-pin-form">New Pin</a></li>
|
||||
<li><a href="{% url 'core:logout' %}">Logout</a></li>
|
||||
{% else %}
|
||||
<li><a href="{% url 'core:login' %}">Login</a></li>
|
||||
<li><a href="{% url 'core:register' %}">Register</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Navigation -->
|
||||
|
||||
<!-- Content -->
|
||||
{% block yield %}{% endblock %}
|
||||
<!-- End Content -->
|
||||
|
||||
<!-- Messages -->
|
||||
{% include "includes/messages.html" %}
|
||||
<!-- End Messages -->
|
||||
|
||||
<!-- Templates -->
|
||||
{% include "includes/lightbox.html" %}
|
||||
{% include "includes/pins.html" %}
|
||||
{% include "includes/pin_form.html" %}
|
||||
{% block extra_templates %}{% endblock %}
|
||||
<!-- End Templates -->
|
||||
|
||||
<!-- JavaScript -->
|
||||
<script>
|
||||
var apiLimitPerPage = {{ API_LIMIT_PER_PAGE }},
|
||||
currentUser = "{{ user.id }}";
|
||||
</script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.min.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/messages.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/lightbox.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/pinry.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/pin-form.js"></script>
|
||||
{% block extra_js %}{% endblock %}
|
||||
<!-- End JavaScript -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,67 +0,0 @@
|
||||
{% spaceless %}
|
||||
{% load compress new_pin %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{ SITE_NAME }} - {% block title %}{% endblock %}</title>
|
||||
|
||||
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Monoton">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.0/css/bootstrap.min.css">
|
||||
{% compress css %}
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/messages.css">
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/lightbox.css">
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}css/pinry.css">
|
||||
{% endcompress %}
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<a href="{% url 'core:home' %}" class="brand pull-left">{{ SITE_NAME }}</a>
|
||||
|
||||
<div class="tags pull-left"></div>
|
||||
|
||||
<ul class="nav pull-right">
|
||||
{% if user.is_authenticated %}
|
||||
<li><a href="#" class="bookmarklet-link">Bookmarklet</a></li>
|
||||
<li><a href="#call-pin-form" id="call-pin-form">New Pin</a></li>
|
||||
<li><a href="{% url 'core:logout' %}">Logout</a></li>
|
||||
{% else %}
|
||||
<li><a href="{% url 'core:login' %}">Login</a></li>
|
||||
<li><a href="{% url 'core:register' %}">Register</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if messages %}
|
||||
<ul class="messages">
|
||||
{% for message in messages %}
|
||||
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% block yield %}{% endblock %}
|
||||
|
||||
{% block templates %}{% endblock %}
|
||||
|
||||
{% compress js inline %}
|
||||
<script>
|
||||
var apiLimitPerPage = {{ API_LIMIT_PER_PAGE }},
|
||||
currentUser = "{{ user.id }}";
|
||||
</script>
|
||||
{% endcompress %}
|
||||
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.min.js"></script>
|
||||
{% compress js %}
|
||||
<script src="{{ STATIC_URL }}js/messages.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/lightbox.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/pinry.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/pin-form.js"></script>
|
||||
{% endcompress %}
|
||||
</body>
|
||||
</html>
|
||||
{% endspaceless %}
|
||||
14
pinry/templates/core/recent_pins.html
Normal file
14
pinry/templates/core/recent_pins.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Recent Pins{% endblock %}
|
||||
|
||||
{% block yield %}
|
||||
<div id="pins"></div>
|
||||
<div class="container spinner">
|
||||
<div class="row">
|
||||
<div class="span12" align="center">
|
||||
<img src="{{ STATIC_URL }}img/loader.gif" alt="Loader">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
23
pinry/templates/includes/lightbox.html
Normal file
23
pinry/templates/includes/lightbox.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% verbatim %}
|
||||
<script id="lightbox-template" type="text/x-handlebars-template">
|
||||
<div class="lightbox-background">
|
||||
<div class="lightbox-wrapper">
|
||||
<div class="lightbox-data clearfix">
|
||||
<div class="avatar pull-left">
|
||||
<img src="http://gravatar.com/avatar/{{gravatar}}.jpg">
|
||||
</div>
|
||||
<div class="text pull-left">
|
||||
<span class="dim">pinned by</span> {{username}}
|
||||
{{#if tags}}
|
||||
<br /><span class="dim">in</span>
|
||||
{{#each tags}}
|
||||
<span class="tag label">{{this}}</span>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<img src="{{image}}" />
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
{% endverbatim %}
|
||||
7
pinry/templates/includes/messages.html
Normal file
7
pinry/templates/includes/messages.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{% if messages %}
|
||||
<ul class="messages">
|
||||
{% for message in messages %}
|
||||
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
38
pinry/templates/includes/pin_form.html
Normal file
38
pinry/templates/includes/pin_form.html
Normal file
@@ -0,0 +1,38 @@
|
||||
{% verbatim %}
|
||||
<script id="pin-form-template" type="text/x-handlebars-template">
|
||||
<div class="modal" id="pin-form">
|
||||
<div class="modal-header">
|
||||
<h3>New Pin</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="span3" id="pin-form-image-preview">
|
||||
Image Preview
|
||||
</div>
|
||||
<div class="span3">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="pin-form-image-url">Image URL</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="pin-form-image-url" id="pin-form-image-url"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="pin-form-description">Description</label>
|
||||
<div class="controls">
|
||||
<textarea name="pin-form-description" id="pin-form-description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="pin-form-tags">Tags</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="pin-form-tags" id="pin-form-tags"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary" id="pin-form-submit">Post</button>
|
||||
<button class="btn" id="pin-form-close">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
{% endverbatim %}
|
||||
35
pinry/templates/includes/pins.html
Normal file
35
pinry/templates/includes/pins.html
Normal file
@@ -0,0 +1,35 @@
|
||||
{% verbatim %}
|
||||
<script id="pins-template" type="text/x-handlebars-template">
|
||||
{{#each pins}}
|
||||
<div class="pin">
|
||||
{{#if editable}}
|
||||
<div class="editable">
|
||||
<div class="borderable">
|
||||
<i class="icon-white icon-pencil"></i>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
<a href="{{image.standard.image}}" class="lightbox" data-username="{{submitter.username}}" data-tags="{{tags}}" data-gravatar="{{submitter.gravatar}}">
|
||||
<img src="{{image.thumbnail.image}}" />
|
||||
</a>
|
||||
{{#if description}}
|
||||
<p>{{description}}</p>
|
||||
{{/if}}
|
||||
<div class="pin-footer clearfix">
|
||||
<div class="avatar pull-left">
|
||||
<img src="http://gravatar.com/avatar/{{submitter.gravatar}}.jpg">
|
||||
</div>
|
||||
<div class="text pull-right">
|
||||
<span class="dim">pinned by</span> {{submitter.username}}
|
||||
{{#if tags}}
|
||||
<span class="dim">in</span>
|
||||
{{#each tags}}
|
||||
<span class="tag">{{this}}</span>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</script>
|
||||
{% endverbatim %}
|
||||
@@ -1,7 +0,0 @@
|
||||
{% extends 'core/base.html' %}
|
||||
|
||||
{% block title %}Bookmarket{% endblock %}
|
||||
|
||||
{% block yield %}
|
||||
Test
|
||||
{% endblock %}
|
||||
@@ -1,26 +0,0 @@
|
||||
{% extends 'core/base.html' %}
|
||||
|
||||
{% load bootstrap_field %}
|
||||
|
||||
|
||||
{% block title %}New Pin{% endblock %}
|
||||
|
||||
{% block yield %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span6 offset3" id="form">
|
||||
<h1>New Pin</h1>
|
||||
{{ form.non_field_errors }}
|
||||
<form enctype="multipart/form-data" action="{% url 'pins:new-pin' %}" method="post" class="form-horizontal">
|
||||
{% for field in form %}
|
||||
{% bootstrap_field field %}
|
||||
{% endfor %}
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">Post</button>
|
||||
<a href="{% url 'core:home' %}" class="btn">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,111 +0,0 @@
|
||||
{% extends 'core/base.html' %}
|
||||
|
||||
{% block title %}Recent Pins{% endblock %}
|
||||
|
||||
{% block yield %}
|
||||
<div id="pins"></div>
|
||||
<div class="container spinner">
|
||||
<div class="row">
|
||||
<div class="span12" align="center">
|
||||
<img src="{{ STATIC_URL }}img/loader.gif" alt="Loader">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block templates %}
|
||||
{% verbatim %}
|
||||
<script id="lightbox-template" type="text/x-handlebars-template">
|
||||
<div class="lightbox-background">
|
||||
<div class="lightbox-wrapper">
|
||||
<div class="lightbox-data clearfix">
|
||||
<div class="avatar pull-left">
|
||||
<img src="http://gravatar.com/avatar/{{gravatar}}.jpg">
|
||||
</div>
|
||||
<div class="text pull-left">
|
||||
<span class="dim">pinned by</span> {{username}}
|
||||
{{#if tags}}
|
||||
<br /><span class="dim">in</span>
|
||||
{{#each tags}}
|
||||
<span class="tag label">{{this}}</span>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<img src="{{image}}" />
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script id="pins-template" type="text/x-handlebars-template">
|
||||
{{#each pins}}
|
||||
<div class="pin">
|
||||
{{#if editable}}
|
||||
<div class="editable">
|
||||
<div class="borderable">
|
||||
<i class="icon-white icon-pencil"></i>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
<a href="{{image.standard.image}}" class="lightbox" data-username="{{submitter.username}}" data-tags="{{tags}}" data-gravatar="{{submitter.gravatar}}">
|
||||
<img src="{{image.thumbnail.image}}" />
|
||||
</a>
|
||||
{{#if description}}
|
||||
<p>{{description}}</p>
|
||||
{{/if}}
|
||||
<div class="pin-footer clearfix">
|
||||
<div class="avatar pull-left">
|
||||
<img src="http://gravatar.com/avatar/{{submitter.gravatar}}.jpg">
|
||||
</div>
|
||||
<div class="text pull-right">
|
||||
<span class="dim">pinned by</span> {{submitter.username}}
|
||||
{{#if tags}}
|
||||
<span class="dim">in</span>
|
||||
{{#each tags}}
|
||||
<span class="tag">{{this}}</span>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</script>
|
||||
|
||||
<script id="pin-form-template" type="text/x-handlebars-template">
|
||||
<div class="modal" id="pin-form">
|
||||
<div class="modal-header">
|
||||
<h3>New Pin</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="span3" id="pin-form-image-preview">
|
||||
Image Preview
|
||||
</div>
|
||||
<div class="span3">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="pin-form-image-url">Image URL</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="pin-form-image-url" id="pin-form-image-url"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="pin-form-description">Description</label>
|
||||
<div class="controls">
|
||||
<textarea name="pin-form-description" id="pin-form-description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="pin-form-tags">Tags</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="pin-form-tags" id="pin-form-tags"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary" id="pin-form-submit">Post</button>
|
||||
<button class="btn" id="pin-form-close">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
{% endverbatim %}
|
||||
{% endblock %}
|
||||
@@ -1,18 +0,0 @@
|
||||
{% load bootstrap_field %}
|
||||
|
||||
<div class="modal fade" id="new-pin">
|
||||
<div class="modal-header">
|
||||
<h3>New Pin</h3>
|
||||
</div>
|
||||
<form enctype="multipart/form-data" action="{% url 'pins:new-pin' %}" method="post" class="form-horizontal">
|
||||
<div class="modal-body">
|
||||
{% 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>
|
||||
@@ -1,7 +1,4 @@
|
||||
{% extends 'core/base.html' %}
|
||||
|
||||
{% load bootstrap_field %}
|
||||
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Login{% endblock %}
|
||||
|
||||
@@ -10,14 +7,13 @@
|
||||
<div class="row">
|
||||
<div id="form" class="span6 offset3">
|
||||
<h1>Login</h1>
|
||||
<form action="{% url 'core:login' %}" method="post" class="form-horizontal">
|
||||
<form action="{% url "core:login" %}" method="post" class="form-horizontal">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
{% bootstrap_field field %}
|
||||
{% include "includes/field.html" %}
|
||||
{% endfor %}
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
<a href="{% url 'core:home' %}" class="btn">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,7 +1,4 @@
|
||||
{% extends 'core/base.html' %}
|
||||
|
||||
{% load bootstrap_field %}
|
||||
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Private{% endblock %}
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
{% extends 'core/base.html' %}
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load bootstrap_field %}
|
||||
|
||||
|
||||
{% block title %}Login{% endblock %}
|
||||
{% block title %}Register{% endblock %}
|
||||
|
||||
{% block yield %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div id="form" class="span6 offset3">
|
||||
<h1>Register</h1>
|
||||
<form action="{% url 'core:register' %}" method="post" class="form-horizontal">
|
||||
<form action="{% url "core:register" %}" method="post" class="form-horizontal">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
{% bootstrap_field field %}
|
||||
{% include "includes/field.html" %}
|
||||
{% endfor %}
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">Register</button>
|
||||
<a href="{% url 'core:home' %}" class="btn">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,9 +1,6 @@
|
||||
http://github.com/django/django/tarball/stable/1.5.x#egg=Django
|
||||
South
|
||||
Pillow
|
||||
South
|
||||
django-tastypie
|
||||
django_compressor
|
||||
cssmin
|
||||
jsmin
|
||||
django-images
|
||||
http://github.com/hcarvalhoalves/django-taggit/tarball/master#egg=django-taggit
|
||||
http://github.com/hcarvalhoalves/django-taggit/tarball/master#egg=django-taggit
|
||||
|
||||
Reference in New Issue
Block a user