mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-25 14:58:40 +00:00
Support markdown in notes.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
@@ -17,11 +17,13 @@ use Carbon\Carbon;
|
|||||||
use ExpandedForm;
|
use ExpandedForm;
|
||||||
use FireflyIII\Http\Requests\PiggyBankFormRequest;
|
use FireflyIII\Http\Requests\PiggyBankFormRequest;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
|
use FireflyIII\Models\Note;
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Input;
|
use Input;
|
||||||
|
use League\CommonMark\CommonMarkConverter;
|
||||||
use Log;
|
use Log;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
use Session;
|
use Session;
|
||||||
@@ -347,7 +349,11 @@ class PiggyBankController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
|
public function show(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
|
||||||
{
|
{
|
||||||
|
/** @var Note $note */
|
||||||
$note = $piggyBank->notes()->first();
|
$note = $piggyBank->notes()->first();
|
||||||
|
$converter = new CommonMarkConverter;
|
||||||
|
$note->text = $converter->convertToHtml($note->text);
|
||||||
|
|
||||||
$events = $repository->getEvents($piggyBank);
|
$events = $repository->getEvents($piggyBank);
|
||||||
$subTitle = e($piggyBank->name);
|
$subTitle = e($piggyBank->name);
|
||||||
|
|
||||||
|
@@ -70,6 +70,7 @@ return [
|
|||||||
'source_accounts' => 'Source account(s)',
|
'source_accounts' => 'Source account(s)',
|
||||||
'destination_accounts' => 'Destination account(s)',
|
'destination_accounts' => 'Destination account(s)',
|
||||||
'user_id_is' => 'Your user id is <strong>:user</strong>',
|
'user_id_is' => 'Your user id is <strong>:user</strong>',
|
||||||
|
'field_supports_markdown' => 'This field supports <a href="https://en.support.wordpress.com/markdown-quick-reference/">Markdown</a>.',
|
||||||
|
|
||||||
// repeat frequencies:
|
// repeat frequencies:
|
||||||
'repeat_freq_monthly' => 'monthly',
|
'repeat_freq_monthly' => 'monthly',
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
{{ Form.textarea(name, value, options) }}
|
{{ Form.textarea(name, value, options) }}
|
||||||
|
{% include 'form/help.twig' %}
|
||||||
{% include 'form/feedback.twig' %}
|
{% include 'form/feedback.twig' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
{{ ExpandedForm.date('targetdate') }}
|
{{ ExpandedForm.date('targetdate') }}
|
||||||
{{ ExpandedForm.textarea('note') }}
|
{{ ExpandedForm.textarea('note', null, {helpText: trans('firefly.field_supports_markdown')} ) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
{{ ExpandedForm.date('targetdate') }}
|
{{ ExpandedForm.date('targetdate') }}
|
||||||
{{ ExpandedForm.textarea('note') }}
|
{{ ExpandedForm.textarea('note', null, {helpText: trans('firefly.field_supports_markdown')}) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -73,20 +73,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if note %}
|
|
||||||
<div class="box">
|
|
||||||
<div class="box-header with-border">
|
|
||||||
<h3 class="box-title">{{ trans('form.notes') }}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="box-body">
|
|
||||||
<p>
|
|
||||||
{{ note.text|nl2br }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h3 class="box-title">{{ 'table'|_ }}</h3>
|
<h3 class="box-title">{{ 'table'|_ }}</h3>
|
||||||
@@ -96,8 +82,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if note %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h3 class="box-title">{{ trans('form.notes') }}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
{{ note.text|raw }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
|
Reference in New Issue
Block a user