Add account id to every view

This commit is contained in:
eraden 2022-07-29 19:29:15 +02:00
parent 03b0884723
commit 3a7501dcc6
12 changed files with 19 additions and 18 deletions

View File

@ -1,7 +1,7 @@
{% extends "../base.html" %}
{% block content %}
<contact-info-editor type="email" value="{{h.email(account)}}">
<contact-info-editor type="email" value="{{h.email(account)}}" {{h.account_id_tag(account)}}>
<contact-info-list>
{% for contact in contacts %}
<edit-contact-info contact-id="{{contact.id}}" mode="view">

View File

@ -1,7 +1,7 @@
{% extends "../base.html" %}
{% block content %}
<h2 style="text-align: center">Lokalne usługi</h2>
<local-business-list>
<local-business-list {{h.account_id_tag(account)}}>
{% for business in businesses %}
<local-business
slot="business"

View File

@ -1,6 +1,6 @@
{% extends "../base.html" %}
{% block content %}
<marketplace-offers>
<marketplace-offers {{h.account_id_tag(account)}}>
<h2>Edycja oferty</h2>
<offer-form
state="{{offer.state.as_str()}}"

View File

@ -1,12 +1,6 @@
{% extends "../base.html" %}
{% block content %}
<marketplace-offers
{% match account %}
{% when Some with (a) %}
account-id="{{a.id}}"
{% when None %}
{% endmatch %}
>
<marketplace-offers {{h.account_id_tag(account)}}>
<h2 style="text-align: center">Rzeczy wystawione na sprzedaż</h2>
{% for offer in my_offers %}

View File

@ -1,6 +1,6 @@
{% extends "../base.html" %}
{% block content %}
<marketplace-offers>
<marketplace-offers {{h.account_id_tag(account)}}>
<h2>Tworzenie oferty</h2>
<offer-form></offer-form>
</marketplace-offers>

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block content %}
<ow-articles>
<ow-articles {{h.account_id_tag(account)}}>
{% for article in news %}
<news-article
article-id="{{ article.id }}"

View File

@ -1,6 +1,6 @@
{% extends "../base.html" %}
{% block content %}
<marketplace-offers>
<marketplace-offers {{h.account_id_tag(account)}}>
<h2>Sprzedaż niepotrzebnych rzeczy</h2>
<offer-form></offer-form>

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block content %}
<privacy-policy>
<privacy-policy {{h.account_id_tag(account)}}>
<h2>POLITYKA PRYWATNOŚCI STRONY INTERNETOWEJ <br/>https://oswilno.pl/</h2>
<ol>
<li>

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block content %}
<ow-account>
<ow-account {{h.account_id_tag(account)}}>
<register-form
page="{{register_page.as_str()}}"
>

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block content %}
<ow-account>
<ow-account {{h.account_id_tag(account)}}>
<login-form></login-form>
</ow-account>
{% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% block content %}
<terms-and-conditions>
<terms-and-conditions {{h.account_id_tag(account)}}>
<h3 style="text-align: center;">REGULAMIN SERIWSU INTERNETOWEGO<br> oswilno.pl</h3>
<p>&nbsp;</p>
<h3>§ 1. DEFINICJE</h3>
@ -16,7 +16,7 @@
Mieszkaniec - osoba zamieszkująca dzielnicę Elsnerów w Warszawie.
</li>
<li>
Upoważniony użytkownik - osoba zarejestrowana i nie będąca Mieszkańcem.
Upoważniony użytkownik osoba zarejestrowana i nie będąca Mieszkańcem.
</li>
<li>
Gość - osoba niezarejestrowana korzystająca z serwisu.

View File

@ -29,6 +29,13 @@ impl Helper {
.unwrap_or_default()
}
pub fn account_id_tag(&self, account: &Option<crate::model::db::Account>) -> String {
account
.as_ref()
.map(|a| format!("account-id={}", a.id))
.unwrap_or_default()
}
pub fn email<'a>(&self, account: &'a Option<crate::model::db::Account>) -> &'a str {
account
.as_ref()