Skip to content

Firefly III: a personal finances manager

Replace styles with classes.

James Colea3a332643c5a
diff --git a/app/Http/Middleware/SecureHeaders.php b/app/Http/Middleware/SecureHeaders.php
index 0f11608812..db8c7b9b30 100644
--- a/app/Http/Middleware/SecureHeaders.php
+++ b/app/Http/Middleware/SecureHeaders.php
@@ -58,7 +58,8 @@ class SecureHeaders
"default-src 'none'",
"object-src 'none'",
sprintf("script-src 'unsafe-eval' 'strict-dynamic' 'nonce-%1s'", $nonce),
- sprintf("style-src 'self' 'nonce-%1s'", $nonce),
+ // sprintf("style-src 'self' 'nonce-%1s'", $nonce), // safe variant
+ "style-src 'self' 'unsafe-eval'", // unsafe variant
"base-uri 'self'",
"form-action 'self'",
"font-src 'self' data:",
@@ -73,7 +74,8 @@ class SecureHeaders
"default-src 'none'",
"object-src 'none'",
sprintf("script-src 'unsafe-eval' 'strict-dynamic' 'nonce-%1s'", $nonce),
- sprintf("style-src 'self' 'nonce-%1s' https://10.0.0.15:5173/", $nonce),
+ // sprintf("style-src 'self' 'nonce-%1s' https://10.0.0.15:5173/", $nonce), // safe varian
+ "style-src 'self' 'unsafe-inline' https://10.0.0.15:5173/", // unsafe variant
"base-uri 'self'",
"form-action 'self'",
"font-src 'self' data: https://10.0.0.15:5173/",
diff --git a/public/v1/css/firefly.css b/public/v1/css/firefly.css
index 00db7fcb8d..13c63b8c5b 100644
--- a/public/v1/css/firefly.css
+++ b/public/v1/css/firefly.css
@@ -29,6 +29,11 @@
.center-chart {width:100%;margin:0 auto;}
.map-size {width:100%;height:300px;}
+/** tables **/
+td.quarter th.quarter {width:25%;}
+td.thirty th.thirty {width:30%;}
+td.third th.third {width:33%;}
+td.forty th.forty {width:40%;}
/* spacing and padding */
.m-0 { margin:0!important; }
diff --git a/resources/views/accounts/reconcile/index.twig b/resources/views/accounts/reconcile/index.twig
index 4ed4a2ae88..54cb0abe28 100644
--- a/resources/views/accounts/reconcile/index.twig
+++ b/resources/views/accounts/reconcile/index.twig
@@ -22,16 +22,16 @@
</thead>
<tbody>
<tr>
- <td style="width:25%;">
+ <td class="quarter">
{{ 'date'|_ }}
</td>
- <td style="width:25%;">
+ <td class="quarter">
{{ 'balance'|_ }}
</td>
- <td style="width:25%;">
+ <td class="quarter">
{{ 'date'|_ }}
</td>
- <td style="width:25%;">
+ <td class="quarter">
{{ 'balance'|_ }}
</td>
</tr>
diff --git a/resources/views/accounts/reconcile/show.twig b/resources/views/accounts/reconcile/show.twig
index bbcaaff3a1..56e9713bdc 100644
--- a/resources/views/accounts/reconcile/show.twig
+++ b/resources/views/accounts/reconcile/show.twig
@@ -43,7 +43,7 @@
</td>
</tr>
<tr>
- <td style="width:30%;">{{ trans('list.date') }}</td>
+ <td class="thirty">{{ trans('list.date') }}</td>
<td>{{ journal.date.isoFormat(monthAndDayFormat) }}</td>
</tr>
</tbody>
diff --git a/resources/views/budgets/index.twig b/resources/views/budgets/index.twig
index 1110b7a3ad..61cd1b4756 100644
--- a/resources/views/budgets/index.twig
+++ b/resources/views/budgets/index.twig
@@ -207,7 +207,7 @@
<h3 class="box-title">{{ 'budgets'|_ }}</h3>
</div>
<div class="box-body no-padding">
- <div style="padding:8px;">
+ <div class="m-1">
<a href="{{ route('budgets.create') }}" class="btn btn-success"><span class="fa fa-plus fa-fw"></span> {{ 'createBudget'|_ }}</a>
</div>
<table class="table table-bordered sortable-table table-striped sortable" id="budgetList">
@@ -215,7 +215,7 @@
<tr>
<th class="hidden-sm hidden-xs" style="width:10%;">&nbsp;</th>
<th>{{ 'budget'|_ }}</th>
- <th style="width:25%;">{{ 'budgeted'|_ }}</th>
+ <th class="quarter">{{ 'budgeted'|_ }}</th>
<th class="hidden-sm hidden-xs">{{ 'spent'|_ }} ({{ 'per_day'|_|lower }})</th>
<th>{{ 'left'|_ }} ({{ 'per_day'|_|lower }})</th>
</tr>
diff --git a/resources/views/budgets/show.twig b/resources/views/budgets/show.twig
index 1bf10442c2..0f4a0bf84d 100644
--- a/resources/views/budgets/show.twig
+++ b/resources/views/budgets/show.twig
@@ -155,7 +155,7 @@
<div class="box-body no-padding">
<table class="table table-hover">
<tr>
- <td style="width:33%;">{{ 'amount'|_ }}</td>
+ <td class="third">{{ 'amount'|_ }}</td>
<td>
{{ formatAmountBySymbol(limit.amount, limit.transactionCurrency.symbol, limit.transactionCurrency.decimal_places) }}
{% if convertToPrimary and null != limit.native_amount %}
@@ -164,7 +164,7 @@
</td>
</tr>
<tr>
- <td style="width:33%;">{{ 'spent'|_ }}</td>
+ <td class="third">{{ 'spent'|_ }}</td>
<td>
{% if convertToPrimary %}
{{ formatAmountBySymbol(limit.spent, limit.transactionCurrency.symbol, limit.transactionCurrency.decimal_places) }}
diff --git a/resources/views/categories/index.twig b/resources/views/categories/index.twig
index e4e19944ac..618f15d5b3 100644
--- a/resources/views/categories/index.twig
+++ b/resources/views/categories/index.twig
@@ -22,7 +22,7 @@
</div>
<div class="box-body no-padding">
- <div style="padding:8px;">
+ <div class="m-1">
<a class="btn btn-success" href="{{ route('categories.create') }}"><span class="fa fa-plus fa-fw"></span> {{ 'new_category'|_ }}</a>
</div>
{% include 'list/categories' %}
diff --git a/resources/views/currencies/index.twig b/resources/views/currencies/index.twig
index abe1ea20e5..82d40aeebd 100644
--- a/resources/views/currencies/index.twig
+++ b/resources/views/currencies/index.twig
@@ -19,7 +19,7 @@
{{ 'currencies_switch_default'|_ }}
</p>
{% if currencies|length > 0 %}
- <div style="padding-left:8px;">
+ <div class="m-1">
{{ currencies.links('pagination.bootstrap-4')|raw }}
</div>
<table class="table table-hover">
@@ -81,7 +81,7 @@
{% endfor %}
</tbody>
</table>
- <div style="padding-left:8px;">
+ <div class="m-1">
{{ currencies.links('pagination.bootstrap-4')|raw }}
</div>
{% endif %}
diff --git a/resources/views/list/periods.twig b/resources/views/list/periods.twig
index c938cd6757..14b307793b 100644
--- a/resources/views/list/periods.twig
+++ b/resources/views/list/periods.twig
@@ -8,14 +8,14 @@
<table class="table table-hover">
{% if period.total_transactions > 0 %}
<tr>
- <td style="width:33%;">{{ 'transactions'|_ }}</td>
+ <td class="third">{{ 'transactions'|_ }}</td>
<td class="text-right">{{ period.total_transactions }}</td>
</tr>
{% endif %}
{% for entry in period.spent %}
{% if entry.amount != 0 %}
<tr>
- <td style="width:33%;">{{ 'spent'|_ }}</td>
+ <td class="third">{{ 'spent'|_ }}</td>
<td class="text-right">
<span title="{{ entry.count }}">
{{ formatAmountBySymbol(entry.amount, entry.currency_symbol, entry.currency_decimal_places) }}
@@ -28,7 +28,7 @@
{% for entry in period.earned %}
{% if entry.amount != 0 %}
<tr>
- <td style="width:33%;">{{ 'earned'|_ }}</td>
+ <td class="third">{{ 'earned'|_ }}</td>
<td class="text-right">
<span title="{{ entry.count }}">
{% if entry.amount < 0 %}
@@ -45,7 +45,7 @@
{% for entry in period.transferred %}
{% if entry.amount != 0 %}
<tr>
- <td style="width:33%;">{{ 'transferred'|_ }}</td>
+ <td class="third">{{ 'transferred'|_ }}</td>
<td class="text-right">
<span title="{{ entry.count }}">
{{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }}
@@ -58,7 +58,7 @@
{% for entry in period.transferred_away %}
{% if entry.amount != 0 %}
<tr>
- <td style="width:33%;">{{ 'transferred_away'|_ }}</td>
+ <td class="third">{{ 'transferred_away'|_ }}</td>
<td class="text-right">
<span title="{{ entry.count }}">
{% if entry.amount < 0 %}
@@ -75,7 +75,7 @@
{% for entry in period.transferred_in %}
{% if entry.amount != 0 %}
<tr>
- <td style="width:33%;">{{ 'transferred_in'|_ }}</td>
+ <td class="third">{{ 'transferred_in'|_ }}</td>
<td class="text-right">
<span title="{{ entry.count }}">
{% if entry.amount < 0 %}
diff --git a/resources/views/piggy-banks/show.twig b/resources/views/piggy-banks/show.twig
index 15c21cad3f..dd854a6d30 100644
--- a/resources/views/piggy-banks/show.twig
+++ b/resources/views/piggy-banks/show.twig
@@ -33,7 +33,7 @@
<div class="box-body no-padding">
<table class="table table-responsive table-hover" id="piggyDetails">
<tr>
- <td style="width:40%;">{{ 'saveOnAccounts'|_ }}</td>
+ <td class="forty">{{ 'saveOnAccounts'|_ }}</td>
<td>
{% for account in piggy.accounts %}
<a href="{{ route('accounts.show', [account.account_id]) }}">{{ account.name }}</a><br>
@@ -42,7 +42,7 @@
</tr>
{% if piggy.object_group_title %}
<tr>
- <td style="width:40%;">{{ 'object_group'|_ }}</td>
+ <td class="forty">{{ 'object_group'|_ }}</td>
<td>{{ piggy.object_group_title }}</a></td>
</tr>
{% endif %}
diff --git a/resources/views/rules/index.twig b/resources/views/rules/index.twig
index 6082d40141..44afe1e706 100644
--- a/resources/views/rules/index.twig
+++ b/resources/views/rules/index.twig
@@ -77,7 +77,7 @@
<th style="width:5%;">&nbsp;</th>
<th style="width:10%;">&nbsp;</th>
<th style="width:10%;">&nbsp;</th>
- <th style="width:25%;">{{ 'rule_name'|_ }}</th>
+ <th class="quarter">{{ 'rule_name'|_ }}</th>
<th style="width:25%;" class="hidden-xs">{{ 'rule_triggers'|_ }}</th>
<th style="width:25%;" class="hidden-xs">{{ 'rule_actions'|_ }}</th>
</tr>
diff --git a/resources/views/rules/partials/action.twig b/resources/views/rules/partials/action.twig
index 73a4d21a36..ac31ff8970 100644
--- a/resources/views/rules/partials/action.twig
+++ b/resources/views/rules/partials/action.twig
@@ -2,7 +2,7 @@
<td style="width:40px;">
<a href="#" class="btn btn-danger btn-sm remove-action"><span class="fa fa-trash"></span></a>
</td>
- <td style="width:30%;">
+ <td class="thirty">
{# TODO error when invalid name #}
<select name="actions[{{ count }}][type]" class="form-control">
{% for key,type in allRuleActions() %}
diff --git a/resources/views/rules/partials/trigger.twig b/resources/views/rules/partials/trigger.twig
index 52fcb3f251..e8d1be45ab 100644
--- a/resources/views/rules/partials/trigger.twig
+++ b/resources/views/rules/partials/trigger.twig
@@ -2,7 +2,7 @@
<td style="width:40px;">
<a href="#" class="btn btn-danger btn-sm remove-trigger"><span class="fa fa-trash"></span></a>
</td>
- <td style="width:30%;">
+ <td class="thirty">
<select name="triggers[{{ count }}][type]" class="form-control">
{% for key,type in triggers %}
<option value="{{ key }}" label="{{ type }}"
diff --git a/resources/views/tags/show.twig b/resources/views/tags/show.twig
index e0fc62ad54..3e68d2f6ce 100644
--- a/resources/views/tags/show.twig
+++ b/resources/views/tags/show.twig
@@ -56,7 +56,7 @@
{% if currentSum != 0 %}
<tr>
- <td style="width:40%;">{{ trans('list.sum') }}</td>
+ <td class="forty">{{ trans('list.sum') }}</td>
<td>
{% for set in sums %}
{{ formatAmountBySymbol(set.Withdrawal + set.Transfer + set.Deposit, set.currency_symbol, set.currency_decimal_places, true) }}{% if loop.index != sums|length %},{% endif %}
@@ -72,7 +72,7 @@
{% endfor %}
{% if currentSum != 0 %}
<tr>
- <td style="width:40%;">{{ trans('list.sum_excluding_transfers') }}</td>
+ <td class="forty">{{ trans('list.sum_excluding_transfers') }}</td>
<td>
{% for set in sums %}
{{ formatAmountBySymbol(set.Withdrawal + set.Deposit, set.currency_symbol, set.currency_decimal_places, true) }}{% if loop.index != sums|length %},{% endif %}
@@ -88,7 +88,7 @@
{% endfor %}
{% if currentSum != 0 %}
<tr>
- <td style="width:40%;">{{ trans('list.sum_withdrawals') }}</td>
+ <td class="forty">{{ trans('list.sum_withdrawals') }}</td>
<td>
{% for set in sums %}
{{ formatAmountBySymbol(set.Withdrawal, set.currency_symbol, set.currency_decimal_places, true) }}{% if loop.index != sums|length %},{% endif %}
@@ -104,7 +104,7 @@
{% endfor %}
{% if currentSum != 0 %}
<tr>
- <td style="width:40%;">{{ trans('list.sum_deposits') }}</td>
+ <td class="forty">{{ trans('list.sum_deposits') }}</td>
<td>
{% for set in sums %}
{{ formatAmountBySymbol(set.Deposit, set.currency_symbol, set.currency_decimal_places, true) }}{% if loop.index != sums|length %},{% endif %}
@@ -120,7 +120,7 @@
{% endfor %}
{% if currentSum != 0 %}
<tr>
- <td style="width:40%;">{{ trans('list.sum_transfers') }}</td>
+ <td class="forty">{{ trans('list.sum_transfers') }}</td>
<td>
{% for set in sums %}
{{ formatAmountBySymbol(set.Transfer, set.currency_symbol, set.currency_decimal_places, true) }}{% if loop.index != sums|length %},{% endif %}
@@ -136,7 +136,7 @@
{% endfor %}
{% if currentSum != 0 %}
<tr>
- <td style="width:40%;">{{ trans('list.sum_reconciliations') }}</td>
+ <td class="forty">{{ trans('list.sum_reconciliations') }}</td>
<td>
{% for set in sums %}
{{ formatAmountBySymbol(set.Reconciliation, set.currency_symbol, set.currency_decimal_places, true) }}{% if loop.index != sums|length %},{% endif %}
diff --git a/resources/views/transactions/bulk/edit.twig b/resources/views/transactions/bulk/edit.twig
index f58e5660af..81a5cc75e4 100644
--- a/resources/views/transactions/bulk/edit.twig
+++ b/resources/views/transactions/bulk/edit.twig
@@ -102,7 +102,7 @@
<div class="col-lg-8 col-md-12 col-sm-12 col-xs-12">
<table class="table table-striped table-condensed">
<tr>
- <th style="width:25%;">{{ trans('list.category') }}</th>
+ <th class="quarter">{{ trans('list.category') }}</th>
<td>
<input class="form-control" placeholder="" name="category" autocomplete="off" type="text" value="" spellcheck="false">
</td>
diff --git a/resources/views/transactions/convert.twig b/resources/views/transactions/convert.twig
index 92c1d4ac72..c8dd995f3c 100644
--- a/resources/views/transactions/convert.twig
+++ b/resources/views/transactions/convert.twig
@@ -58,9 +58,9 @@
<table class="table">
<tr>
<th style="width:10%;">ID</th>
- <th style="width:25%;">Description</th>
- <th style="width:25%;">Source account</th>
- <th style="width:25%;">Destination account</th>
+ <th class="quarter">Description</th>
+ <th class="quarter">Source account</th>
+ <th class="quarter">Destination account</th>
<th style="width:15%;">Amount</th>
</tr>
{% for transaction in groupArray.transactions %}
diff --git a/resources/views/transactions/show.twig b/resources/views/transactions/show.twig
index 985150ed0e..6191c25e3c 100644
--- a/resources/views/transactions/show.twig
+++ b/resources/views/transactions/show.twig
@@ -63,11 +63,11 @@
<table class="table table-hover">
<tbody>
<tr>
- <td style="width:40%;">{{ trans('list.id') }}</td>
+ <td class="forty">{{ trans('list.id') }}</td>
<td>#{{ transactionGroup.id }}</td>
</tr>
<tr>
- <td style="width:40%;">{{ trans('list.type') }}</td>
+ <td class="forty">{{ trans('list.type') }}</td>
<td>{{ first.transaction_type_type|_ }}</td>
</tr>
<tr>
@@ -81,7 +81,7 @@
</td>
</tr>
<tr>
- <td style="width:30%;">{{ trans('list.date') }}</td>
+ <td class="thirty">{{ trans('list.date') }}</td>
<td>
<span class="date-time" data-date="{{ first.date.toIso8601ZuluString() }}" title="{{ first.date.isoFormat(dateTimeFormat) }}{% if(first.date_tz != '') %} ({{ trans('firefly.stored_in_tz', {timezone: first.date_tz }) }}, {{ trans('firefly.displayed_in_tz', {timezone: config('app.timezone') }) }}){% endif %}">
{{ first.date.isoFormat(dateTimeFormat) }}
@@ -119,7 +119,7 @@
<tbody>
{% if first.transaction_type_type != 'Withdrawal' or splits == 1 %}
<tr>
- <td style="width:40%;">
+ <td class="forty">
{{ trans_choice('firefly.source_accounts', accounts['source']|length ) }}
</td>
<td>
@@ -160,7 +160,7 @@
</tr>
{% endif %}
<tr>
- <td style="width:30%;">{{ 'total_amount'|_ }}</td>
+ <td class="thirty">{{ 'total_amount'|_ }}</td>
<td>
{% for amount in amounts %}
{% if first.transaction_type_type == 'Withdrawal' %}
@@ -369,7 +369,7 @@
</tr>
{% if null != journal.category_id %}
<tr>
- <td style="width:30%;">{{ 'category'|_ }}</td>
+ <td class="thirty">{{ 'category'|_ }}</td>
<td>
<a href="{{ route('categories.show', [journal.category_id]) }}">{{ journal.category_name }}</a>
</td>
@@ -377,7 +377,7 @@
{% endif %}
{% if null != journal.budget_id and first.transaction_type_type == 'Withdrawal' %}
<tr>
- <td style="width:40%;">{{ 'budget'|_ }}</td>
+ <td class="forty">{{ 'budget'|_ }}</td>
<td>
<a href="{{ route('budgets.show', [journal.budget_id]) }}">{{ journal.budget_name }}</a>
</td>
@@ -385,7 +385,7 @@
{% endif %}
{% if null != journal.bill_id and first.transaction_type_type == 'Withdrawal' %}
<tr>
- <td style="width:40%;">{{ 'bill'|_ }}</td>
+ <td class="forty">{{ 'bill'|_ }}</td>
<td>
<a href="{{ route('subscriptions.show', [journal.bill_id]) }}">{{ journal.bill_name }}</a>
</td>
@@ -395,7 +395,7 @@
{% for dateField in ['interest_date','book_date','process_date','due_date','payment_date','invoice_date'] %}
{% if journalHasMeta(journal.transaction_journal_id, dateField) %}
<tr>
- <td style="width:40%;">{{ trans('list.'~dateField) }}</td>
+ <td class="forty">{{ trans('list.'~dateField) }}</td>
<td>{{ journalGetMetaDate(journal.transaction_journal_id, dateField).isoFormat(monthAndDayFormat) }}</td>
</tr>
{% endif %}
@@ -404,7 +404,7 @@
{% if journalHasMeta(journal.transaction_journal_id, metaField) %}
<tr>
<td>{{ trans('list.'~metaField) }}</td>
- <td style="width:40%;">
+ <td class="forty">
{% if 'external_url' == metaField %}
{% set url = journalGetMetaField(journal.transaction_journal_id, metaField) %}
<a href="{{ url }}" rel="noopener noreferrer nofollow" target="_blank">
@@ -424,7 +424,7 @@
{% endfor %}
{% if null != journal.notes and '' != journal.notes %}
<tr>
- <td style="width:40%;">{{ trans('list.notes') }}</td>
+ <td class="forty">{{ trans('list.notes') }}</td>
<td class="markdown">{{ journal.notes|default('')|markdown }}</td>
</tr>
{% endif %}
@@ -434,13 +434,13 @@
{% set recurringTotal = '∞' %}
{% endif %}
<tr>
- <td style="width:40%;">{{ trans('list.recurring_transaction') }}</td>
+ <td class="forty">{{ trans('list.recurring_transaction') }}</td>
<td>{{ trans('firefly.recurring_info', {total: recurringTotal, count: journalGetMetaField(journal.transaction_journal_id, 'recurring_count') }) }}</td>
</tr>
{% endif %}
{% if journal.tags|length > 0 %}
<tr>
- <td style="width:40%;">{{ 'tags'|_ }}</td>
+ <td class="forty">{{ 'tags'|_ }}</td>
<td>
{% for tag in journal.tags %}
{% if null != tag.id and '' != tag.id %}
@@ -518,7 +518,7 @@
<table class="table table-hover">
{% for event in events[journal.transaction_journal_id] %}
<tr>
- <td style="width:30%;">{{ event.amount|raw }}</td>
+ <td class="thirty">{{ event.amount|raw }}</td>
<td>
<a href="{{ route('piggy-banks.show', [event.piggy_id]) }}">{{ event.piggy }}</a>
</td>