create default step + view time improvement
This commit is contained in:
parent
b490673866
commit
1d2976b687
@ -233,7 +233,7 @@
|
||||
{% endif %}
|
||||
{% if s.name %}{{ s.name }}{% else %}{% trans 'Step' %}
|
||||
{{ forloop.counter }}{% endif %}
|
||||
{% if s.type == 'TIME' %}
|
||||
{% if s.time != 0 %}
|
||||
- {{ s.time }} {% trans 'Minutes' %}
|
||||
{% endif %}
|
||||
</div>
|
||||
@ -242,11 +242,8 @@
|
||||
@change="updateTimes(recipe.steps[{{ forloop.counter0 }}])"
|
||||
v-model="recipe.steps[{{ forloop.counter0 }}].time_finished">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row" v-if="recipe.steps[{{ forloop.counter0 }}].ingredients.length > 0"
|
||||
@ -471,6 +468,7 @@
|
||||
data: {
|
||||
recipe: undefined,
|
||||
has_ingredients: false,
|
||||
has_times: false,
|
||||
ingredient_factor: 1,
|
||||
},
|
||||
|
||||
@ -487,6 +485,9 @@
|
||||
if (step.ingredients.length > 0) {
|
||||
this.has_ingredients = true
|
||||
}
|
||||
if (step.time !== 0) {
|
||||
this.has_times = true
|
||||
}
|
||||
this.$set(step, 'time_finished', undefined)
|
||||
for (let i of step.ingredients) {
|
||||
this.$set(i, 'checked', false)
|
||||
|
@ -11,7 +11,7 @@ from django.views.generic import CreateView
|
||||
from cookbook.forms import ImportRecipeForm, RecipeImport, KeywordForm, Storage, StorageForm, InternalRecipeForm, \
|
||||
RecipeBookForm, MealPlanForm
|
||||
from cookbook.helper.permission_helper import GroupRequiredMixin, group_required
|
||||
from cookbook.models import Keyword, Recipe, RecipeBook, MealPlan, ShareLink, MealType
|
||||
from cookbook.models import Keyword, Recipe, RecipeBook, MealPlan, ShareLink, MealType, Step
|
||||
|
||||
|
||||
class RecipeCreate(GroupRequiredMixin, CreateView):
|
||||
@ -25,6 +25,7 @@ class RecipeCreate(GroupRequiredMixin, CreateView):
|
||||
obj.created_by = self.request.user
|
||||
obj.internal = True
|
||||
obj.save()
|
||||
obj.steps.add(Step.objects.create())
|
||||
return HttpResponseRedirect(reverse('edit_recipe', kwargs={'pk': obj.pk}))
|
||||
|
||||
def get_success_url(self):
|
||||
|
Loading…
Reference in New Issue
Block a user