several shopping list improvements
This commit is contained in:
parent
76eeed1a77
commit
2149f4034b
@ -510,14 +510,14 @@ class ShoppingListRecipe(models.Model, PermissionModelMixin):
|
|||||||
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE, null=True, blank=True)
|
recipe = models.ForeignKey(Recipe, on_delete=models.CASCADE, null=True, blank=True)
|
||||||
servings = models.DecimalField(default=1, max_digits=8, decimal_places=4)
|
servings = models.DecimalField(default=1, max_digits=8, decimal_places=4)
|
||||||
|
|
||||||
objects = ScopedManager(space='shoppinglist__space')
|
objects = ScopedManager(space='recipe__space')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_space_key():
|
def get_space_key():
|
||||||
return 'shoppinglist', 'space'
|
return 'recipe', 'space'
|
||||||
|
|
||||||
def get_space(self):
|
def get_space(self):
|
||||||
return self.shoppinglist_set.first().space
|
return self.recipe.space
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'Shopping list recipe {self.id} - {self.recipe}'
|
return f'Shopping list recipe {self.id} - {self.recipe}'
|
||||||
|
@ -122,8 +122,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody is="draggable" :list="c.entries" tag="tbody" group="people" @sort="sortEntries"
|
<tbody is="draggable" :list="c.entries" tag="tbody" group="people" @sort="sortEntries"
|
||||||
@change="dragChanged(c, $event)">
|
@change="dragChanged(c, $event)" handle=".handle">
|
||||||
<tr v-for="(element, index) in c.entries" :key="element.id">
|
<tr v-for="(element, index) in c.entries" :key="element.id" v-bind:class="{ 'text-muted': element.checked }">
|
||||||
<td class="handle"><i class="fas fa-sort"></i></td>
|
<td class="handle"><i class="fas fa-sort"></i></td>
|
||||||
<td>[[element.amount]]</td>
|
<td>[[element.amount]]</td>
|
||||||
<td>[[element.unit.name]]</td>
|
<td>[[element.unit.name]]</td>
|
||||||
@ -154,7 +154,7 @@
|
|||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input id="id_simple_entry" class="form-control" v-model="simple_entry">
|
<input id="id_simple_entry" class="form-control" v-model="simple_entry">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-outline-secondary" type="button"><i class="fa fa-plus"></i>
|
<button class="btn btn-outline-secondary" type="button" @click="addSimpleEntry()"><i class="fa fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -349,6 +349,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<b-modal id="id_modal_export" title="{% trans 'Copy/Export' %}">
|
<b-modal id="id_modal_export" title="{% trans 'Copy/Export' %}">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -448,7 +450,7 @@
|
|||||||
name: gettext('Uncategorized'),
|
name: gettext('Uncategorized'),
|
||||||
id: -1,
|
id: -1,
|
||||||
entries: [],
|
entries: [],
|
||||||
order: 99999999
|
order: -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user