Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/fava/core/fava_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class FavaOptions:
show_accounts_with_zero_balance: bool = True
show_accounts_with_zero_transactions: bool = True
show_closed_accounts: bool = False
show_metadata_indicators: bool = True
sidebar_show_queries: int = 5
upcoming_events: int = 7
uptodate_indicator_grey_lookback_days: int = 60
Expand Down
11 changes: 11 additions & 0 deletions src/fava/help/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ shown.

______________________________________________________________________

## `show-metadata-indicators`

Default: `true`

Whether to show metadata indicators in journals. For each metadata key on an
entry or posting, a small badge with the first two characters of the key is
shown in the indicators column, with the full key and value available on hover.
Set this to `false` to hide these indicators.

______________________________________________________________________

## `collapse-pattern`

Default: Not set
Expand Down
9 changes: 6 additions & 3 deletions src/fava/templates/_journal_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@

{% macro _account_link(name) %}<a href='{{ url_for('account', name=name) }}'>{{ name }}</a>{% endmacro %}

{% macro _render_metadata_indicators(metadata) -%}
{% macro _render_metadata_indicators(metadata, show_indicators=True) -%}
{% if show_indicators %}
{% for key, value in metadata %}
<span class='metadata-indicator' title='{{ key }}: {{ value }}'>{{ key[:2] }}</span>
{% endfor %}
{% endif %}
{%- endmacro %}

{% macro _render_metadata(metadata, entry_hash=None) -%}
Expand All @@ -40,6 +42,7 @@

{% macro journal_table_contents(entries, show_change_and_balance=False, ledger=None) %}
{% set ledger = ledger or g.ledger %}
{% set show_metadata_indicators = ledger.fava_options.show_metadata_indicators %}
{% autoescape false %}
{% for entry in entries %}
{% if show_change_and_balance %}
Expand Down Expand Up @@ -88,10 +91,10 @@
{% endif %}
</span>
<span class='indicators'>
{{- _render_metadata_indicators(metadata_items) -}}
{{- _render_metadata_indicators(metadata_items, show_metadata_indicators) -}}
{%- for posting in entry.postings -%}
<span{% if posting.flag %} class='{{ posting.flag|flag_to_type }}'{% endif %}></span>
{{- _render_metadata_indicators(posting.meta|meta_items) -}}
{{- _render_metadata_indicators(posting.meta|meta_items, show_metadata_indicators) -}}
{%- endfor -%}
</span>
{% if type == 'balance' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@
"show_accounts_with_zero_balance": false,
"show_accounts_with_zero_transactions": true,
"show_closed_accounts": false,
"show_metadata_indicators": true,
"sidebar_show_queries": 5,
"upcoming_events": 7,
"uptodate_indicator_grey_lookback_days": 60,
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/test_json_api-test_api-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"locale": "None",
"show-accounts-with-zero-balance": "False",
"show-accounts-with-zero-transactions": "True",
"show-metadata-indicators": "True",
"show-closed-accounts": "False",
"sidebar-show-queries": "5",
"upcoming-events": "7",
Expand Down
Loading