Skip to content

Commit

Permalink
Move recipe photo things to its controller
Browse files Browse the repository at this point in the history
  • Loading branch information
janpeterka committed Jun 30, 2023
1 parent 57b219a commit 58c9ef3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/controllers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from .recipes import RecipeView
from .recipe_tasks import RecipeTaskView
from .edit_recipes import EditRecipeView
from .recipe_photos import RecipePhotoView
from .edit_recipe_ingredients import EditRecipeIngredientView
from .public_recipes import PublicRecipeView
from .public_ingredients import PublicIngredientView
Expand Down Expand Up @@ -69,7 +69,7 @@
"AdminView",
"RecipeView",
"RecipeTaskView",
"EditRecipeView",
"RecipePhotoView",
"EditRecipeIngredientView",
"PublicRecipeView",
"PublicIngredientView",
Expand Down Expand Up @@ -122,7 +122,7 @@ def register_all_controllers(application):

RecipeView.register(application, base_class=HelperFlaskView)
RecipeTaskView.register(application, base_class=HelperFlaskView)
EditRecipeView.register(application, base_class=HelperFlaskView)
RecipePhotoView.register(application, base_class=HelperFlaskView)
EditRecipeIngredientView.register(application, base_class=HelperFlaskView)
PublicRecipeView.register(application, base_class=HelperFlaskView)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from app.models import Recipe, RecipeImageFile


class EditRecipeView(HelperFlaskView):
class RecipePhotoView(HelperFlaskView):
decorators = [login_required]
template_folder = "recipes/edit"

Expand Down
4 changes: 2 additions & 2 deletions app/templates/macros/render_image.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
{% endif %}

{% if with_pin and not image.is_main and image.recipe.can_current_user_edit %}
{{ button_to(url_for('EditRecipeView:set_main_image', recipe_id=image.recipe.id, image_id=image.id), class="image-icon pin-icon", value="<abbr style='cursor: pointer' title='Nastavit jako hlavní'>📌</abbr>") }}
{{ button_to(url_for('RecipePhotoView:set_main_image', recipe_id=image.recipe.id, image_id=image.id), class="image-icon pin-icon", value="<abbr style='cursor: pointer' title='Nastavit jako hlavní'>📌</abbr>") }}
{% endif %}

<img style="{{ style }}" class="{{ class }} img-fluid" src="{{ url }}" alt="{{ image.full_name }}"/>
</div>

{% endmacro %}
{% endmacro %}
2 changes: 1 addition & 1 deletion app/templates/recipes/_images.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>

{% if editable %}
{{ dropzone(action=url_for('EditRecipeView:upload_photo', recipe_id=recipe.id), default_message="přetáhni fotku nebo klikni pro přidání.") }}
{{ dropzone(action=url_for('RecipePhotoView:upload_photo', recipe_id=recipe.id), default_message="přetáhni fotku nebo klikni pro přidání.") }}
{% endif %}
</div>
</turbo-frame>

0 comments on commit 58c9ef3

Please sign in to comment.