Use inline form component for goal form on goal page

This commit is contained in:
Mouse Reeve 2021-09-29 09:39:23 -07:00
parent 5f3df11e56
commit 6e05fb6dd0
4 changed files with 16 additions and 19 deletions

View file

@ -1,5 +1,5 @@
{% 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">
<h2 class="card-header-title" tabindex="0" id="{{ controls_text }}{% if controls_uid %}-{{ controls_uid }}{% endif %}_header">
{% block header %}{% endblock %}

View file

@ -31,9 +31,5 @@
<div class="field">
<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>
</form>

View file

@ -1,5 +1,6 @@
{% extends 'user/layout.html' %}
{% load i18n %}
{% load utilities %}
{% block header %}
<div class="columns is-mobile">
@ -19,20 +20,8 @@
<section class="block">
{% now 'Y' as current_year %}
{% if user == request.user and year|add:0 == current_year|add:0 %}
<div class="block">
<section class="card {% if goal %}is-hidden{% endif %}" id="show_edit_goal">
<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>
{% comparison_bool goal None as visible %}
{% include 'user/goal_form.html' with goal=goal year=year visible=visible controls_text="show_edit_goal" class="block" %}
{% endif %}
{% if not goal and user != request.user %}

View 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 %}