Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed a bunch of stuff.

  • Loading branch information...
commit ca7c03e0981f1413d493aa2523f0f03835033fb6 1 parent 0178251
@kgodey authored
View
2  recipes/fields.py
@@ -11,4 +11,4 @@ def to_python(self, value):
if len(split_value) > 1:
fraction_float = float(Fraction(split_value[1]))
return float(split_value[0]) + fraction_float
- return float(value)
+ return float(value) if value else None
View
5 recipes/forms.py
@@ -15,12 +15,13 @@ class Meta:
class RecipeIngredientForm(ModelForm):
ingredient_name = forms.CharField(widget=forms.TextInput(attrs={'class': 'recipeingredient_ingredient_field'}))
- unit_name = forms.CharField(widget=forms.TextInput(attrs={'class': 'recipeingredient_unit_field'}))
- quantity = FractionField(widget=forms.TextInput(attrs={'class': 'recipeingredient_quantity_field'}))
+ quantity = FractionField(required=False, widget=forms.TextInput(attrs={'class': 'recipeingredient_quantity_field'}))
+ unit_name = forms.CharField(required=False, widget=forms.TextInput(attrs={'class': 'recipeingredient_unit_field'}))
class Meta:
model = RecipeIngredient
exclude = ('ingredient', 'unit')
+ fields = ('ingredient_name', 'quantity', 'unit_name', 'preparation', 'optional')
def save(self, force_insert=False, force_update=False, commit=True):
m = super(RecipeIngredientForm, self).save(commit=False)
View
48 recipes/media/recipes/jquery.autocomplete.css
@@ -0,0 +1,48 @@
+.ac_results {
+ padding: 0px;
+ border: 1px solid black;
+ background-color: white;
+ overflow: hidden;
+ z-index: 99999;
+}
+
+.ac_results ul {
+ width: 100%;
+ list-style-position: outside;
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+.ac_results li {
+ margin: 0px;
+ padding: 2px 5px;
+ cursor: default;
+ display: block;
+ /*
+ if width will be 100% horizontal scrollbar will apear
+ when scroll mode will be used
+ */
+ /*width: 100%;*/
+ font: menu;
+ font-size: 12px;
+ /*
+ it is very important, if line-height not setted or setted
+ in relative units scroll will be broken in firefox
+ */
+ line-height: 16px;
+ overflow: hidden;
+}
+
+.ac_loading {
+ background: white url('indicator.gif') right center no-repeat;
+}
+
+.ac_odd {
+ background-color: #eee;
+}
+
+.ac_over {
+ background-color: #0A246A;
+ color: white;
+}
View
62 recipes/media/recipes/style.css
@@ -175,4 +175,66 @@ hr.recipe_separator {
p.spaced {
padding: 10px 0px;
+}
+
+#recipe_form th, tr{
+ font-size: 12px;
+ padding: 15px;
+}
+
+#recipe_form th {
+ width: 150px;
+}
+
+label{
+ font-weight: bold;
+ text-align: right;
+ font-size: 16px;
+}
+
+input[type="text"]{ /*width of text boxes. IE6 does not understand this attribute*/
+ height: 25px;
+}
+
+input#id_name {
+ width: 350px;
+}
+
+textarea#id_directions{
+ width: 350px;
+ height: 200px;
+}
+
+textarea#id_source{
+ width: 350px;
+ height: 50px;
+}
+
+#recipeingredient_forms {
+ overflow: auto;
+}
+
+.recipeingredient_form {
+ width: 220px;
+ display: block;
+ float: left;
+ margin-right: 10px;
+ margin-bottom: 10px;
+ padding: 10px;
+ border: 3px double #416704;
+}
+
+.recipeingredient_form p {
+ padding-right: 10px;
+ line-height: 40px;
+}
+
+.recipeingredient_form input {
+ height: 20px;
+ width: 100px;
+}
+
+.recipeingredient_form label {
+ font-size: 12px;
+ font-weight: 400;
}
View
4 recipes/models.py
@@ -57,10 +57,10 @@ def __unicode__(self):
class RecipeIngredient(models.Model):
recipe = models.ForeignKey(Recipe, related_name='ingredients')
ingredient = models.ForeignKey(Ingredient)
- preparation = models.CharField(max_length=255, blank=True, null=True)
- optional = models.BooleanField(default=False)
quantity = models.FloatField(null=True, blank=True)
unit = models.ForeignKey(MeasurementUnit, null=True, blank=True)
+ preparation = models.CharField(max_length=255, blank=True, null=True)
+ optional = models.BooleanField(default=False)
class JunkRecipe(models.Model):
View
33 recipes/templates/recipes/add_recipe.html
@@ -7,10 +7,10 @@
<script type="text/javascript">
$(document).ready(function() {
$(".recipeingredient_ingredient_field").autocomplete({
- source: "/ajax/ingredient"
+ source: "/ajax/ingredient", delay: 30
});
$(".recipeingredient_unit_field").autocomplete({
- source: "/ajax/unit"
+ source: "/ajax/unit", delay: 30
});
});
</script>
@@ -22,31 +22,6 @@
{% endblock %}
{% block content %}
- <form method="post" action="">
- <table>
- {{ form.as_table }}
- {{ formset.management_form }}
- {% for f in formset.forms %}
- <tr class='formset_form'>
- <td><table class='no_error'>
- {{ f.as_table }}
- </table></td>
- </tr>
- {% endfor %}
- </table>
- <input type="button" value="Add More" id="add_more">
- <script>
- $('#add_more').click(function() {
- var newForm = cloneMore('tr.formset_form:last', 'ingredients');
- $(newForm).find(".recipeingredient_ingredient_field").autocomplete({
- source: "/ajax/ingredient"
- });
- $(newForm).find(".recipeingredient_unit_field").autocomplete({
- source: "/ajax/unit"
- });
- });
- </script>
- {% csrf_token %}
- <input type="submit" />
- </form>
+ <h3>Add a New Recipe</h3>
+ {% include "recipes/recipe_form.html" %}
{% endblock %}
View
1  recipes/templates/recipes/base.html
@@ -4,6 +4,7 @@
<link class="type-a-file" rel="stylesheet" media="screen" type="text/css" href="{% mediaurl 'recipes/taf-seafarer-m.css' %}" /> -->
<link rel="stylesheet" href="{% mediaurl 'recipes/style.css' %}" type="text/css">
<link rel="stylesheet" href="{% mediaurl 'recipes/warnock_pro/stylesheet.css' %}" type="text/css">
+ <link rel="stylesheet" href="{% mediaurl 'recipes/jquery.autocomplete.css' %}" type="text/css">
<script type="text/javascript" src="{% mediaurl 'recipes/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% mediaurl 'recipes/jquery-ui.min.js' %}"></script>
<title>{% block title %} {% endblock %}</title>
View
30 recipes/templates/recipes/edit_recipe.html
@@ -22,31 +22,7 @@
{% endblock %}
{% block content %}
-<form method="post" action="">
- <table>
- {{ form.as_table }}
- {{ formset.management_form }}
- {% for f in formset.forms %}
- <tr class='formset_form'>
- <td><table class='no_error'>
- {{ f.as_table }}
- </table></td>
- </tr>
- {% endfor %}
- </table>
- <input type="button" value="Add More" id="add_more">
- <script>
- $('#add_more').click(function() {
- var newForm = cloneMore('tr.formset_form:last', 'ingredients');
- $(newForm).find(".recipeingredient_ingredient_field").autocomplete({
- source: "/ajax/ingredient"
- });
- $(newForm).find(".recipeingredient_unit_field").autocomplete({
- source: "/ajax/unit"
- });
- });
- </script>
- {% csrf_token %}
- <input type="submit" />
-</form>
+<h3>Edit Recipe</h3>
+<p class="spaced"><strong>Editing recipes does not work yet. Please check back soon.</strong></p>
+{% include "recipes/recipe_form.html" %}
{% endblock %}
View
2  recipes/templates/recipes/recipe.html
@@ -5,7 +5,7 @@
<h3 class="recipetitle">{{ r.name }}</h3>
<p class="byline">Added on {{ r.date_added|date:"F j Y" }} by {% ifequal r.user request.user %} <a href="{% url userpage username=r.user.username %}">you {% if not r.is_public %} <strong>(Private)</strong> {% endif %}</a>
{% else %}
- <a href="{% url userpage username=r.user.username %}">{{ r.user.get_full_name }}</a>
+ <a href="{% url userpage username=r.user.username %}">{% firstof r.user.get_full_name r.user.username %}</a>
{% endifequal %} {% ifequal r.user request.user %} <a href="{% url edit_recipe id=r.id %}">(edit recipe)</a>
{% endifequal %}</p>
<ul class="blurb">
View
30 recipes/templates/recipes/recipe_form.html
@@ -0,0 +1,30 @@
+<div id="recipe_form">
+ <form method="post" action="">
+ <table>
+ {{ form.as_table }}
+ </table>
+ {{ formset.management_form }}
+ <h4>Ingredients</h4>
+ <div id="recipeingredient_forms">
+ {% for f in formset.forms %}
+ <div class="recipeingredient_form">
+ {{ f.as_p }}
+ </div>
+ {% endfor %}
+ </div>
+ <input type="button" value="Add another ingredient" id="add_more">
+ <script>
+ $('#add_more').click(function() {
+ var newForm = cloneMore('div.recipeingredient_form:last', 'ingredients');
+ $(newForm).find(".recipeingredient_ingredient_field").autocomplete({
+ source: "/ajax/ingredient", delay: 30
+ });
+ $(newForm).find(".recipeingredient_unit_field").autocomplete({
+ source: "/ajax/unit", delay: 30
+ });
+ });
+ </script>
+ {% csrf_token %}
+ <input type="submit" / value="Save recipe">
+ </form>
+</div>
View
4 recipes/templates/recipes/userpage.html
@@ -2,10 +2,10 @@
{% load recipes %}
{% load markup %}
-{% block title %} {{request.user.username}}'s Recipes {% endblock %}
+{% block title %} {% ifnotequal request.user recipes.0.user %} {% firstof recipes.0.user.get_full_name recipes.0.user.username %}'s {% else %} My {% endifnotequal %} Recipes {% endblock %}
{% block header %}
- <h2>{% ifnotequal request.user recipes.0.user %} {{recipes.0.user.get_full_name}}'s {% else %} My {% endifnotequal %} Recipes</h2>
+ <h2>{% ifnotequal request.user recipes.0.user %} {% firstof recipes.0.user.get_full_name recipes.0.user.username %}'s {% else %} My {% endifnotequal %} Recipes</h2>
{% endblock %}
{% block content %}
View
9 socialregistration/templates/socialregistration/account_inactive.html
@@ -1 +1,8 @@
-This account is inactive
+{% extends "recipes/base.html" %}
+{% block header %}
+<h2>Error!</h2>
+{% endblock %}
+{% block content %}
+<h3>Uh oh!</h3>
+<p>This account is inactive. Sorry!</p>
+{% endblock %}
View
10 socialregistration/templates/socialregistration/facebook.html
@@ -1,2 +1,8 @@
-<h1>facebook.html</h1>
-<p>This is the error template which is shown when a user logs in via Facebook and something goes wrong.</p>
+{% extends "recipes/base.html" %}
+{% block header %}
+<h2>Error!</h2>
+{% endblock %}
+{% block content %}
+<h3>Uh oh!</h3>
+<p>Your Facebook login attempt did not work. Please try again. If this is a recurring problem, <a href="mailto:kriti.godey@gmail.com">e-mail me</a> to let me know.</p>
+{% endblock %}
View
10 socialregistration/templates/socialregistration/oauthcallback.html
@@ -1,2 +1,8 @@
-<h1>oauthcallback.html</h1>
-<p>This is the error template which is shown when a user logs in via OAuth and something goes wrong.</p>
+{% extends "recipes/base.html" %}
+{% block header %}
+<h2>Error!</h2>
+{% endblock %}
+{% block content %}
+<h3>Uh oh!</h3>
+<p>Your Twitter/OAuth login attempt did not work. Please try again. If this is a recurring problem, <a href="mailto:kriti.godey@gmail.com">e-mail me</a> to let me know.</p>
+{% endblock %}
View
10 socialregistration/templates/socialregistration/openid.html
@@ -1,2 +1,8 @@
-<h1>openid.html</h1>
-<p>This is the error template which is shown when a user logs in via OpenID and something goes wrong.</p>
+{% extends "recipes/base.html" %}
+{% block header %}
+<h2>Error!</h2>
+{% endblock %}
+{% block content %}
+<h3>Uh oh!</h3>
+<p>Your OpenID login attempt did not work. Please try again. If this is a recurring problem, <a href="mailto:kriti.godey@gmail.com">e-mail me</a> to let me know.</p>
+{% endblock %}
View
18 socialregistration/templates/socialregistration/setup.html
@@ -1,15 +1,23 @@
+{% extends "recipes/base.html" %}
{% load socialregistration_tags %}
-<h1>Setup</h1>
-
+{% block header %}
+<h2>Account Setup</h2>
+{% endblock %}
+{% block content %}
+<h3>Account Setup</h3>
{% if error %}
- <p>Your session timed out. Please try again.</p>
+ <p class="spaced">Your session timed out. Please try again.</p>
{% else %}
+ <p class="spaced">Please fill in the following details for your account:</p>
<form action="." method="post">
<table>
- {{ form }}
+ {{ form.as_table }}
</table>
{% social_csrf_token %}
- <input type="submit" value="save" />
+ <p class="spaced"><input type="submit" value="Save" /></p>
</form>
{% endif %}
+{% endblock %}
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.