Commit 35872af3 authored by chris's avatar chris

Templates and static files

parent cf8ef300
/*
body {
background-image: url('/static/images/tiles/pattern_039.gif');
}
*/
a:link, a:active, a:visited {
text-decoration:none;
color:#033591;
}
a:hover {color:#044bcd;}
h3 {color: #555;}
h2 {color: #555;}
td {
vertical-align: middle;
height: 30px;
}
thead, th, tr {
border: 0px;
}
form label {
float: left;
width: 120px;
}
/*
#nheader {
}
*/
#chapeau {
margin-top: 37px;
margin-left: 12%;
width: 720px;
}
#content {
margin-left: 14%;
width: 720px;
}
#menu {
/*text-align: right;*/
padding-left: 7px;
font-size:9pt;
background-color: #eee;
color: #779;
}
#menu a {
background-color: #fff;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
padding: 3px;
}
#notify {
display: inline;
//margin-left: 1%;
//color: #aac;
}
#notify img {
opacity: 0.5;
filter: alpha(opacity=40);
}
.comment {
width: 26px;
}
/*
.bigtable {
}
*/
.bigtable td {
text-align: center;
border: 0px solid #fff;
}
.blue {
color: #99a;
}
.cell {
width: 34px;
}
.helper {
width: 130px;
display: none;
position: absolute;
margin-top: 12px;
margin-left: 12%;
padding: 8px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #ddd;
background-color: #fff;
text-align: right;
font-size: 11px;
}
.right {
position: absolute;
right: 0;
}
.hide {
display: none;
visibility: hidden;
}
.icone {
float: left;
display: block;
text-align: center;
width: 180px;
padding: 8px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #fff;
}
.icone:hover {
border: 1px solid #ccd;
}
.indent {
margin-left: 12px;
}
.info {
float: none;
font-size:10pt;
color: #333;
padding: 9px;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
background-color: #eef;
}
.names {
width: 120px;
}
.names input {
width: 80px;
}
.False, .True {
margin-left: 25%;
background-color: #fbb;
width: 19px;
height: 19px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
color: #fff;
text-align: left;
}
.True {
background-color: #bfb;
}
/*
.datepick {
width: 100px;
text-align: center;
}
*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* jQuery Formset 1.1
* @author Stanislaus Madueke (stan DOT madueke AT gmail DOT com)
* @requires jQuery 1.2.6 or later
*
* Copyright (c) 2009, Stanislaus Madueke
* All rights reserved.
*
* Licensed under the New BSD License
* See: http://www.opensource.org/licenses/bsd-license.php
*/
;(function($) {
$.fn.formset = function(opts)
{
var options = $.extend({}, $.fn.formset.defaults, opts),
flatExtraClasses = options.extraClasses.join(' '),
$$ = $(this),
applyExtraClasses = function(row, ndx) {
if (options.extraClasses) {
row.removeClass(flatExtraClasses);
row.addClass(options.extraClasses[ndx % options.extraClasses.length]);
}
},
updateElementIndex = function(elem, prefix, ndx) {
var idRegex = new RegExp('(' + prefix + '-\\d+-)|(^)'),
replacement = prefix + '-' + ndx + '-';
if (elem.attr("for")) elem.attr("for", elem.attr("for").replace(idRegex, replacement));
if (elem.attr('id')) elem.attr('id', elem.attr('id').replace(idRegex, replacement));
if (elem.attr('name')) elem.attr('name', elem.attr('name').replace(idRegex, replacement));
},
hasChildElements = function(row) {
return row.find('input,select,textarea,label').length > 0;
},
insertDeleteLink = function(row) {
if (row.is('TR')) {
// If the forms are laid out in table rows, insert
// the remove button into the last table cell:
row.children(':last').append('<a class="' + options.deleteCssClass +'" href="javascript:void(0)">' + options.deleteText + '</a>');
} else if (row.is('UL') || row.is('OL')) {
// If they're laid out as an ordered/unordered list,
// insert an <li> after the last list item:
row.append('<li><a class="' + options.deleteCssClass + '" href="javascript:void(0)">' + options.deleteText +'</a></li>');
} else {
// Otherwise, just insert the remove button as the
// last child element of the form's container:
row.append('<a class="' + options.deleteCssClass + '" href="javascript:void(0)">' + options.deleteText +'</a>');
}
row.find('a.' + options.deleteCssClass).click(function() {
var row = $(this).parents('.' + options.formCssClass),
del = row.find('input:hidden[id $= "-DELETE"]');
if (del.length) {
// We're dealing with an inline formset; rather than remove
// this form from the DOM, we'll mark it as deleted and hide
// it, then let Django handle the deleting:
del.val('on');
row.hide();
} else {
row.remove();
// Update the TOTAL_FORMS form count.
// Also update names and IDs for all remaining form controls so they remain in sequence:
var forms = $('.' + options.formCssClass).not('.formset-custom-template');
$('#id_' + options.prefix + '-TOTAL_FORMS').val(forms.length);
for (var i=0, formCount=forms.length; i<formCount; i++) {
applyExtraClasses(forms.eq(i), i);
forms.eq(i).find('input,select,textarea,label').each(function() {
updateElementIndex($(this), options.prefix, i);
});
}
}
// If a post-delete callback was provided, call it with the deleted form:
if (options.removed) options.removed(row);
return false;
});
};
$$.each(function(i) {
var row = $(this),
del = row.find('input:checkbox[id $= "-DELETE"]');
if (del.length) {
// If you specify "can_delete = True" when creating an inline formset,
// Django adds a checkbox to each form in the formset.
// Replace the default checkbox with a hidden field:
del.before('<input type="hidden" name="' + del.attr('name') +'" id="' + del.attr('id') +'" />');
del.remove();
}
if (hasChildElements(row)) {
insertDeleteLink(row);
row.addClass(options.formCssClass);
applyExtraClasses(row, i);
}
});
if ($$.length) {
var addButton, template;
if (options.formTemplate) {
// If a form template was specified, we'll clone it to generate new form instances:
template = (options.formTemplate instanceof $) ? options.formTemplate : $(options.formTemplate);
template.removeAttr('id').addClass(options.formCssClass).addClass('formset-custom-template');
template.find('input,select,textarea,label').each(function() {
updateElementIndex($(this), options.prefix, 2012);
});
insertDeleteLink(template);
} else {
// Otherwise, use the last form in the formset; this works much better if you've got
// extra (>= 1) forms (thnaks to justhamade for pointing this out):
template = $('.' + options.formCssClass + ':last').clone(true).removeAttr('id');
template.find('input:hidden[id $= "-DELETE"]').remove();
template.find('input,select,textarea,label').each(function() {
var elem = $(this);
// If this is a checkbox or radiobutton, uncheck it.
// This fixes Issue 1, reported by Wilson.Andrew.J:
if (elem.is('input:checkbox') || elem.is('input:radio')) {
elem.attr('checked', false);
} else {
elem.val('');
}
});
}
// FIXME: Perhaps using $.data would be a better idea?
options.formTemplate = template;
if ($$.attr('tagName') == 'TR') {
// If forms are laid out as table rows, insert the
// "add" button in a new table row:
var numCols = $$.eq(0).children().length;
$$.parent().append('<tr><td colspan="' + numCols + '"><a class="' + options.addCssClass + '" href="javascript:void(0)">' + options.addText + '</a></tr>');
addButton = $$.parent().find('tr:last a');
addButton.parents('tr').addClass(options.formCssClass + '-add');
} else {
// Otherwise, insert it immediately after the last form:
$$.filter(':last').after('<a class="' + options.addCssClass + '" href="javascript:void(0)">' + options.addText + '</a>');
addButton = $$.filter(':last').next();
}
addButton.click(function() {
var formCount = parseInt($('#id_' + options.prefix + '-TOTAL_FORMS').val()),
row = options.formTemplate.clone(true).removeClass('formset-custom-template'),
buttonRow = $(this).parents('tr.' + options.formCssClass + '-add').get(0) || this;
applyExtraClasses(row, formCount);
row.insertBefore($(buttonRow)).show();
row.find('input,select,textarea,label').each(function() {
updateElementIndex($(this), options.prefix, formCount);
});
$('#id_' + options.prefix + '-TOTAL_FORMS').val(formCount + 1);
// If a post-add callback was supplied, call it with the added form:
if (options.added) options.added(row);
return false;
});
}
return $$;
}
/* Setup plugin defaults */
$.fn.formset.defaults = {
prefix: 'form', // The form prefix for your django formset
formTemplate: null, // The jQuery selection cloned to generate new form instances
addText: 'add another', // Text for the add link
deleteText: 'remove', // Text for the delete link
addCssClass: 'add-row', // CSS class applied to the add link
deleteCssClass: 'delete-row', // CSS class applied to the delete link
formCssClass: 'dynamic-form', // CSS class applied to each form in a formset
extraClasses: [], // Additional CSS classes, which will be applied to each form in turn
added: null, // Function called each time a new form is added
removed: null // Function called each time a form is deleted
};
})(jQuery)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title> {% block title %} nuage - Easy poll sharing {% endblock %} </title>
{% block head %}{% endblock %}
<!-- Django stylesheets -->
<link rel="stylesheet" type="text/css" href="/media/css/base.css"/>
<link rel="stylesheet" type="text/css" href="/media/css/forms.css"/>
<!--link rel="stylesheet" type="text/css" href="/media/css/widgets.css"/-->
<!-- Custom stylesheet -->
<link rel="stylesheet" href="/static/css/nuage.css" />
</head>
<body>
<div id="nheader">
<div id="menu"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="/">nuage</a> &nbsp;
{% if user.is_authenticated %}
<a href="/user/logout/">logout</a>
{% else %}
<a href="/user/login/">login</a>
{% endif %}
{% block menu %}{% endblock %}
{% if error_message %}
<div id="notify"><!--img src="/static/images/info.png" alt="info" "-->&nbsp; {{ error_message }} </div>
{% endif %}
</div>
<div>
<div id="chapeau">
{% block chapeau %}{% endblock %}
</div>
{% block helper %}{% endblock %}
<div id="content">
{% block content %}{% endblock %}
</div>
</body>
</html>
{% extends "base.html" %}
{% block chapeau %}
<h2>nuage</h2>
<p class="info">
<i>nuage</i> let you create polls easily, and publish them for your mates. You may poll on dates or any subject, in order to plan meetings or get a group opinion.
</p>
{% endblock %}
{% block content %}
<br /><br /><br />
<a href="#"><p class="icone">
<img width="24px" src="/static/images/view-calendar-list.png" alt="Make a poll"> &nbsp; New poll</p></a>
<a href="/new/" title="Make an poll" alt="Make an event"><p class="icone">
<img width="24px" src="/static/images/view-calendar-day-2.png"> &nbsp; &nbsp; Shedule an event</p></a>
<a href="/nuage" title="Make an event" alt="Learn more"><p class="icone">
<img width="24px" src="/static/images/document-send.png"> &nbsp; About nuage</p></a>
<br /><br /><br /><br /> <br /><br />
{% if user.is_authenticated %}
<h3>My polls</h3>
{% if object_list %}
<ul>
{% for object in object_list %}
{% ifequal object.author user.username %}
<li><a href="{{ object.id }}">{{ object.title }}</a>
[<a href="{{ object.id }}/edit">edit</a>] </li>
{% endifequal %}
{% endfor %}
</ul>
{% else %}
<p>No polls are available.</p>
{% endif %}
{% else %}
<h3>Examples</h3>
<ul>
<li><a href="/7d31/">Quand allons nous au potager?</a></li>
</ul>
{% endif %}
{% endblock %}
{% extends "base.html" %}
{% block chapeau %}
<h2>About</h2>
<p class="info">
<i>nuage</i> aims to provide a collaborative meeting poll system, similar to doodle or rdvz. It is build in python, using the django framework and a little of javascript. This application was named after Django's famous song.
Feedback and collaboration are welcome at <a href="mailto:">nuage@ domainepublic.net</a>.
Here is the <a href="http://projects.domainepublic.net/nuage/">project page</a>.
<a href="#">Sources</a> are <a href="#">freely</a> available.
</p>
{% endblock %}
{% block content %}
<br /><br /><br />
<div id="notify" class="blue">
<ol> <b>nuage</b> /ny.aʒ/<br /><br />
<li> (Météorologie) Amas de gouttelettes d’eau maintenues en suspension dans l’atmosphère et qui se résolvent ordinairement en pluie.
<ul>
<li> La nuit était sombre, pas une étoile ne brillait au ciel, des nuages lourds et chargés de pluie glissaient au-dessus de la tête de nos voyageurs, comme les vagues d’une mer aérienne. — (Alexandre Dumas, Othon l’archer, 1839)</li>
</ul><br />
</li>
<li> (Par extension) Tout ce qui empêche de voir distinctement les objets.
<ul>
<li> Je ne vois rien, dit-elle, qu’un nuage de flèches si épais, qu’elles éblouissent mes yeux et cachent à ma vue même les archers qui les lancent. — (Walter Scott, Ivanhoé, Traduction de l’anglais par Alexandre Dumas, 1820)</li>
<li> (Figuré) Les nuages de l’erreur.</li>
</ul>
</li>
</ol>
</div>
{% endblock %}
{% extends "base.html" %}
{% block chapeau %}
{% if form.errors %}
<p class="error">Sorry, that's not a valid username or password</p>
{% endif %}
{% endblock %}
{% block content %}
<h2>Sondage</h2>
<p class=info>Authenticate to <i>Sondage</i></p>
<ul>
<li>Provide username and password:
<form action="" method="post">
<label for="username"></label>
<input type="text" name="username" value="" id="username">
<label for="password"></label>
<input type="password" name="password" value="" id="password">
<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next|escape }}" />
</form><br />
</li>
<li><a href="/user/register">Register for a new account</a></li>
<li><a href="/">Stay anonymous</a></li>
</ul>
{% endblock %}
{% extends "base.html" %}
{% block title %}nuage - Create an account{% endblock %}
{% block chapeau %}
<h2>Create an account</h2>
<p class=info>Fill the form to create an account for <i>sondage</i>.</p>
{% endblock %}
{% block content %}
<div id="subcontent">
<form action="" method="post">
{{ form.as_p }}
<input type="submit" value="Create the account">
</form>
</div>
{% endblock %}
{% extends "base.html" %}
{% block title %}nuage - {{object}}{% endblock %}
{% block head %}
<script type="text/javascript" src="/static/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.formset.js"></script>
<script type="text/javascript" src="/static/js/jquery-ui-1.8.1.custom.min.js"></script>
<link type="text/css" href="/static/css/smoothness/jquery-ui-1.8.1.custom.css" rel="stylesheet" />
<script type="text/javascript">
$(document).ready(function(){
// new rows datepicker need to be re-initialized
function addcalls() {
$('form').find("input").each(function(){
//$("input").each(function(){
if($(this).hasClass("hasdatepicker")){ // if the current input has the hasDatpicker class
var this_id = $(this).attr("id"); // current inputs id
var new_id = this_id +1; // a new id
$(this).attr("id", new_id); // change to new id
$(this).removeClass('hasdatepicker'); // remove hasDatepicker class
// re-init datepicker
$(this).datepicker({
dateFormat: 'dd-mm',
//showButtonPanel: true,
showOn: 'both', //'button',
buttonImage: '/static/images/calendar.png',
buttonImageOnly: true,
minDate: '+1d',
});
}
});
};
$(function() {
$('#dateChoice tbody tr').formset({
//prefix: 'ordered_items';
prefix: 'choice_set',
added: addcalls,
});
});
addcalls();
//alert('This is what an alert message looks like.');
});
</script>
<style type="text/css">
.add-row {
display:block;
margin:5px 0 0 10px;
text-indent:20px;
background:url(/static/images/add.png) no-repeat left center;
}
.delete-row {
//float:right;
//display:block;
//margin:5px 0 0 7px;
//text-indent:20px;
//background:url(/static/images/delete.png) no-repeat left center;
//width:16px;
//height:16px;
}
</style>
{% endblock %}
{% block chapeau %}
<h3>Step 2 : Manage choices</h3>
<p class="info">Provide possible dates for your meeting. You may add details as meeting hours, places, or else.</p>
{% endblock %}
{% block content %}
<br />
<div class="indent">
<form method="post" action="">
<table id="dateChoice" class="form-container">
<tbody>
<thead>
<tr>
<td><span class="blue"><b>Dates</b></span></td>
<td><span class="blue"><b>Details</b></span></td>