Skip to content
Browse files

Changed instructions to a md field, fixed added fields js, display fixes

  • Loading branch information...
1 parent 719b0c4 commit a7a598188369c81e0dc0ec2ecf563e17da5516f7 @marcneuwirth committed Apr 23, 2012
View
12 recipeList/models.py
@@ -6,6 +6,8 @@ class Recipe(models.Model):
created_on = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=200)
cookingTime = models.IntegerField()
+ reference = models.URLField(null=True, blank=True)
+ instruction = models.TextField(null=True, blank=True)
def __unicode__(self):
return '%s' % (self.name)
@@ -25,6 +27,8 @@ def __unicode__(self):
('slices', 'slices'),
('clove', 'clove'),
('bunch', 'bunch'),
+ ('pinch', 'pinch'),
+ ('can', 'can'),
)
@@ -39,14 +43,6 @@ def __unicode__(self):
return '%s' % (self.name)
-class Instruction(models.Model):
- text = models.CharField(max_length=200)
- recipe = models.ForeignKey(Recipe)
-
- def __unicode__(self):
- return '%s' % (self.text)
-
-
class Meal(models.Model):
date = models.DateField()
pricePerServing = models.FloatField(null=True, blank=True)
View
19 recipeList/static/js/admin/script.js
@@ -8,11 +8,22 @@ $(document).ready(function(){
$.getJSON('/ingredients.json', function(json){
var ingredients = json.ingredients;
- $("#ingredient_set-group .field-name .vTextField").autocomplete({
- source: ingredients
+ var autocomplete = function(){
+ $("#ingredient_set-group .dynamic-ingredient_set .field-name .vTextField").autocomplete({
+ source: ingredients
+ });
+ };
+
+ $('.add-row a').on('click', function(){
+ autocomplete();
});
- });
+ autocomplete();
+
+ $('.dynamic-ingredient_set .field-unit select').chosen();
- $('.field-unit select').chosen();
+ $('.add-row a').on('click', function(){
+ $('.dynamic-ingredient_set .field-unit select').chosen();
+ });
+ });
}
});
View
6 recipeList/templates/recipeList/base.html
@@ -8,11 +8,11 @@
<body>
<header>
- <div class="hero-unit">
+ <div class="hero-unit hidden-phone">
<h1>Recipe List</h1>
</div>
</header>
- <div id="content" class="container">
+ <div id="content" class="container-fluid">
<div class="row-fluid">
<div class="span2">
<ul class="nav nav-list">
@@ -38,7 +38,5 @@
<footer>
</footer>
<script src="/static/js/jquery-1.7.2.min.js" type="text/javascript"></script>
- <script src="/static/js/visualsearch.min.js" type="text/javascript"></script>
- <script src="/static/js/script.js" type="text/javascript"></script>
</body>
</html>
View
5 recipeList/templates/recipeList/meal_detail.html
@@ -35,18 +35,21 @@
</fieldset>
</form>
+{% if meal.rating_set.all|length > 0 %}
<h2>Ratings</h2>
<ul>
{% for rating in meal.rating_set.all %}
<li>{{ rating.stars }}</li>
{% endfor %}
</ul>
-
+{% endif %}
+{% if meal.comment_set.all|length > 0 %}
<h2>Comments</h2>
<ul>
{% for comment in meal.comment_set.all %}
<li>{{ comment.name }}: {{ comment.body }}</li>
{% endfor %}
</ul>
+{% endif %}
{% endblock %}
View
11 recipeList/templates/recipeList/recipe_detail.html
@@ -2,27 +2,26 @@
{% block title %}{{recipe.name}} Recipe{% endblock %}
+{% load markup %}
{% block content %}
<h1>{{ recipe.name }} - {{ recipe.cookingTime }} minutes</h1>
<h2>Ingredients</h2>
<ul>
{% for ingredient in recipe.ingredient_set.all %}
- <li><a href="{% url ingredient_detail ingredient.id %}">{{ ingredient.name }}</a>: {{ ingredient.value }} {{ ingredient.unit|default_if_none:"" }} - <em>{{ ingredient.instruction }}</em></li>
+ <li><a href="{% url ingredient_detail ingredient.id %}">{{ ingredient.name }}</a>: {{ ingredient.value }} {{ ingredient.unit|default_if_none:"" }} {% if ingredient.instruction %}- <em>{{ ingredient.instruction }}</em>{% endif %}</li>
{% endfor %}
</ul>
<h2>Instructions</h2>
-<ul>
-{% for instruction in recipe.instruction_set.all %}
- <li>{{ instruction.text }}</li>
-{% endfor %}
-</ul>
+<p>{{ recipe.instruction|markdown }}</p>
+{% if recipe.meal_set.all|length > 0 %}
<h2>Scheduled Meals</h2>
<ul>
{% for meal in recipe.meal_set.all %}
<li><a href="{% url meal_detail meal.id %}">{{ meal.date|date:'m/d/Y' }}</a></li>
{% endfor %}
</ul>
+{% endif %}
{% endblock %}
View
14 recipeList/templates/recipeList/shopping_list.html
@@ -1,12 +1,18 @@
{% extends "recipeList/base.html" %}
-{% block title %}Shopping List: {{ dateFrom|date:'m/d/Y' }} - {{ dateTo|date:'m/d/Y' }}{% endblock %}
+{% block title %}Shopping List: {{ dateFrom|date:'m/d' }} - {{ dateTo|date:'m/d' }}{% endblock %}
{% block content %}
-<h1>Shopping List: {{ dateFrom|date:'m/d/Y' }} - {{ dateTo|date:'m/d/Y' }}</h1>
-<ul>
+<h1>Shopping List</h1>
+<h2>{{ dateFrom|date:'m/d' }} - {{ dateTo|date:'m/d' }}</h2>
+<ul class="unstyled">
{% for item in items %}
- <li>{{ item.recipe__ingredient__name }}, {{ item.recipe__ingredient__value__sum }} {{ item.recipe__ingredient__unit|default_if_none:"" }}</li>
+ <li>
+ <label class="checkbox">
+ <input type="checkbox" />
+ {{ item.recipe__ingredient__name }}, {{ item.recipe__ingredient__value__sum }} {{ item.recipe__ingredient__unit|default_if_none:"" }}
+ </label>
+ </li>
{% endfor %}
</ul>
{% endblock %}
View
2 requirements.txt
@@ -1,7 +1,9 @@
DateUtils==0.5.1
Django==1.4
+Markdown==2.1.1
django-mongodb-engine==0.4.0
djangotoolbox==0.9.2
+markup==0.2
mongoengine==0.6.3
pymongo==2.1.1
python-dateutil==2.1
View
9 urls.py
@@ -14,22 +14,21 @@
class IngredientInline(admin.TabularInline):
model = Ingredient
-
-
-class InstructionInline(admin.TabularInline):
- model = Instruction
+ extra = 10
class RecipeAdmin(admin.ModelAdmin):
- inlines = [IngredientInline, InstructionInline]
+ inlines = [IngredientInline]
class CommentInline(admin.TabularInline):
model = Comment
+ extra = 0
class RatingInline(admin.TabularInline):
model = Rating
+ extra = 0
class MealAdmin(admin.ModelAdmin):

0 comments on commit a7a5981

Please sign in to comment.
Something went wrong with that request. Please try again.