I have found myself doing multiple times in my views:
{{if auth.user:}} # checking that a user in logged in and
{{if auth.user.id == my_table.author_id:}} # if he is the author of a
table entry
SHOW SOMETHING ONLY TO THE AUTHOR OF THIS TABLE
{{pass}}
{{pass}}
I am thinking that repeating myself is a bad code practice and i am going
to make a function like
is_author(auth.user, my_table.author_id)
and in the view have
{{if is_author(...):}}
Could i hear some opinions on that?
Also if there are parts of code that appear in multiple views, is it better
to make a function that returns html code in order to make the code
better???