forked from mirrors/bookwyrm
Use inline form component for goal form on goal page
This commit is contained in:
parent
5f3df11e56
commit
6e05fb6dd0
4 changed files with 16 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<section class="card is-hidden {{ class }}" id="{{ controls_text }}{% if controls_uid %}-{{ controls_uid }}{% endif %}">
|
<section class="card {% if not visible %}is-hidden {% endif %}{{ class }}" id="{{ controls_text }}{% if controls_uid %}-{{ controls_uid }}{% endif %}">
|
||||||
<header class="card-header has-background-white-ter">
|
<header class="card-header has-background-white-ter">
|
||||||
<h2 class="card-header-title" tabindex="0" id="{{ controls_text }}{% if controls_uid %}-{{ controls_uid }}{% endif %}_header">
|
<h2 class="card-header-title" tabindex="0" id="{{ controls_text }}{% if controls_uid %}-{{ controls_uid }}{% endif %}_header">
|
||||||
{% block header %}{% endblock %}
|
{% block header %}{% endblock %}
|
||||||
|
|
|
@ -31,9 +31,5 @@
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<button type="submit" class="button is-link">{% trans "Set goal" %}</button>
|
<button type="submit" class="button is-link">{% trans "Set goal" %}</button>
|
||||||
{% if goal %}
|
|
||||||
{% trans "Cancel" as button_text %}
|
|
||||||
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="show_edit_goal" %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{% extends 'user/layout.html' %}
|
{% extends 'user/layout.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load utilities %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header %}
|
||||||
<div class="columns is-mobile">
|
<div class="columns is-mobile">
|
||||||
|
@ -19,20 +20,8 @@
|
||||||
<section class="block">
|
<section class="block">
|
||||||
{% now 'Y' as current_year %}
|
{% now 'Y' as current_year %}
|
||||||
{% if user == request.user and year|add:0 == current_year|add:0 %}
|
{% if user == request.user and year|add:0 == current_year|add:0 %}
|
||||||
<div class="block">
|
{% comparison_bool goal None as visible %}
|
||||||
<section class="card {% if goal %}is-hidden{% endif %}" id="show_edit_goal">
|
{% include 'user/goal_form.html' with goal=goal year=year visible=visible controls_text="show_edit_goal" class="block" %}
|
||||||
<header class="card-header">
|
|
||||||
<h2 class="card-header-title has-background-primary has-text-white" tabindex="0" id="edit_form_header">
|
|
||||||
<span class="icon icon-book is-size-3 mr-2" aria-hidden="true"></span> {% blocktrans %}{{ year }} Reading Goal{% endblocktrans %}
|
|
||||||
</h2>
|
|
||||||
</header>
|
|
||||||
<section class="card-content content">
|
|
||||||
<p>{% blocktrans %}Set a goal for how many books you'll finish reading in {{ year }}, and track your progress throughout the year.{% endblocktrans %}</p>
|
|
||||||
|
|
||||||
{% include 'snippets/goal_form.html' with goal=goal year=year %}
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if not goal and user != request.user %}
|
{% if not goal and user != request.user %}
|
||||||
|
|
12
bookwyrm/templates/user/goal_form.html
Normal file
12
bookwyrm/templates/user/goal_form.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{% extends 'components/inline_form.html' %}
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block header %}
|
||||||
|
<span class="icon icon-book is-size-3 mr-2" aria-hidden="true"></span>
|
||||||
|
{% blocktrans %}{{ year }} Reading Goal{% endblocktrans %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block form %}
|
||||||
|
{% include "snippets/goal_form.html" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue