Skip to content

Commit

Permalink
Merge pull request #668 from CTPUG/feature/add_more_template_blocks
Browse files Browse the repository at this point in the history
Feature/add more template blocks
  • Loading branch information
drnlm authored Jun 29, 2023
2 parents e1562ae + ae1e210 commit 6818490
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 60 deletions.
72 changes: 40 additions & 32 deletions wafer/talks/templates/wafer.talks/talk_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,53 @@
{% load static %}
{% block content %}
<section class="wafer wafer-talk-edit">
{% if can_edit %}
<h1>{% trans "Edit Talk" %}</h1>
{% with corresponding_author_name=object.corresponding_author.userprofile.display_name %}
{% url 'wafer_user_profile' username=object.corresponding_author.username as corresponding_author_url %}
{% block heading %}
{% if can_edit %}
<h1>{% trans "Edit Talk" %}</h1>
{% with corresponding_author_name=object.corresponding_author.userprofile.display_name %}
{% url 'wafer_user_profile' username=object.corresponding_author.username as corresponding_author_url %}
{% blocktrans trimmed %}
<p>Submitted by <a href="{{ corresponding_author_url }}">{{ corresponding_author_name }}</a>.</p>
{% endblocktrans %}
{% endwith %}
{% else %}
<h1>{% trans "Talk Submission" %}</h1>
{% endif %}
{% endblock heading %}
{% if not can_edit and not can_submit %}
{% block talks_closed %}
{% blocktrans trimmed %}
<p>Submitted by <a href="{{ corresponding_author_url }}">{{ corresponding_author_name }}</a>.</p>
<em>Talk submission is closed</em>
{% endblocktrans %}
{% endwith %}
{% endblock talks_closed %}
{% else %}
<h1>{% trans "Talk Submission" %}</h1>
{% endif %}
{% if not can_edit and not can_submit %}
{% blocktrans trimmed %}
<em>Talk submission is closed</em>
{% endblocktrans %}
{% else %}
{% url 'wafer_user_edit_profile' form.user as edit_bio_url %}
{% if form.user.userprofile.bio %}
<div>
<label for="bio" class="col-form-label">
{% trans "Your Biography" %}
<a href="{{ edit_bio_url }}">{% trans "Edit" %}</a>
</label>
<div id="bio" class="card card-body">
{{ form.user.userprofile.bio|linebreaks }}
{% block form_preamble %}
{% url 'wafer_user_edit_profile' form.user as edit_bio_url %}
{% if form.user.userprofile.bio %}
<div>
<label for="bio" class="col-form-label">
{% trans "Your Biography" %}
<a href="{{ edit_bio_url }}">{% trans "Edit" %}</a>
</label>
<div id="bio" class="card card-body">
{{ form.user.userprofile.bio|linebreaks }}
</div>
</div>
</div>
{% else %}
<div class="alert alert-primary">
{% blocktrans trimmed %}
Please
<a href="{{ edit_bio_url }}">add a speaker biography</a>
before submitting a talk.
{% endblocktrans %}
</div>
{% endif %}
{% else %}
<div class="alert alert-primary">
{% blocktrans trimmed %}
Please
<a href="{{ edit_bio_url }}">add a speaker biography</a>
before submitting a talk.
{% endblocktrans %}
</div>
{% endif %}
{% endblock form_preamble %}
{% block talkform %}
<form method="post">
{% crispy form %}
</form>
{% endblock talkform %}
{% endif %}
</section>
{% endblock %}
62 changes: 34 additions & 28 deletions wafer/users/templates/wafer.users/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@
{% block content %}
<section class="wafer wafer-profile">
{% with profile=object.userprofile %}
{% block preamble %}
{% endblock preamble %}
<div class="row">
<div class="col-md-2" id="profile-avatar">
{% with profile.avatar_url as avatar_url %}
{% if avatar_url != None %}
<img src="{{ profile.avatar_url }}">
{% block mugshot %}
{% with profile.avatar_url as avatar_url %}
{% if avatar_url != None %}
<img src="{{ profile.avatar_url }}">
{% endif %}
{% endwith %}
{% if can_edit %}
<a class="btn btn-secondary btn-sm" href="#" rel="popover" data-bs-toggle="popover"
data-bs-title="{% trans 'Changing your mugshot' %}" data-bs-html="true"
data-bs-placement="bottom">{% trans 'Edit Mugshot' %}</a>
<div class="popover-contents">
{% blocktrans trimmed %}
Pictures provided by <a href="https://www.libravatar.org/">libravatar</a>
(which falls back to <a href="https://secure.gravatar.com/">Gravatar</a>).<br>
Change your picture there.
{% endblocktrans %}
</div>
{% endif %}
{% endwith %}
{% if can_edit %}
<a class="btn btn-secondary btn-sm" href="#" rel="popover" data-bs-toggle="popover"
data-bs-title="{% trans 'Changing your mugshot' %}" data-bs-html="true"
data-bs-placement="bottom">{% trans 'Edit Mugshot' %}</a>
<div class="popover-contents">
{% blocktrans trimmed %}
Pictures provided by <a href="https://www.libravatar.org/">libravatar</a>
(which falls back to <a href="https://secure.gravatar.com/">Gravatar</a>).<br>
Change your picture there.
{% endblocktrans %}
</div>
{% endif %}
{% endblock mugshot %}
</div>
<div class="col-md-10">
{% block side_menu %}
Expand All @@ -47,17 +51,19 @@
{% endif %}
</ul>
{% endif %}
{% endblock side_menu %}
{% endblock side_menu %}
{% spaceless %}
<h1>
{% if profile.homepage %}
<a href="{{ profile.homepage_url }}">
{% endif %}
{{ profile.display_name }}
{% if profile.homepage %}
</a>
{% endif %}
</h1>
{% block name %}
<h1>
{% if profile.homepage %}
<a href="{{ profile.homepage_url }}">
{% endif %}
{{ profile.display_name }}
{% if profile.homepage %}
</a>
{% endif %}
</h1>
{% endblock name %}
{% block social %}
{% if profile.twitter_handle %}
<p>
Expand Down Expand Up @@ -186,7 +192,7 @@ <h3 class="card-title">
{% endif %}
{% endwith %}
</section>
{% endblock %}
{% endblock content %}
{% block extra_foot %}
<script type="text/javascript">
{% if profile.twitter_handle %}
Expand All @@ -205,4 +211,4 @@ <h3 class="card-title">
$("#profile-avatar [rel=popover]").attr("data-bs-content", $("#profile-avatar .popover-contents").html());
$("a[rel=popover]").popover();
</script>
{% endblock %}
{% endblock extra_foot %}

0 comments on commit 6818490

Please sign in to comment.