mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Edit attachment page.
This commit is contained in:
parent
9502010248
commit
b5e2e8aa1d
@ -3,9 +3,11 @@
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
|
||||
use Crypt;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use Crypt;
|
||||
use View;
|
||||
|
||||
/**
|
||||
* Class AttachmentController
|
||||
*
|
||||
@ -14,6 +16,30 @@ use Crypt;
|
||||
class AttachmentController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
View::share('mainTitleIcon', 'fa-paperclip');
|
||||
View::share('title', trans('firefly.attachments'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function edit(Attachment $attachment)
|
||||
{
|
||||
$subTitleIcon = 'fa-pencil';
|
||||
$subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]);
|
||||
|
||||
return view('attachments.edit', compact('attachment', 'subTitleIcon', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Attachment $attachment
|
||||
*/
|
||||
|
@ -20,6 +20,25 @@ use Session;
|
||||
class ExpandedForm
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function staticText($name, $value, array $options = [])
|
||||
{
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $label, $options);
|
||||
$classes = $this->getHolderClasses($name);
|
||||
$value = $this->fillFieldValue($name, $value);
|
||||
$html = view('form.static', compact('classes', 'name', 'label', 'value', 'options'))->render();
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param null $value
|
||||
|
@ -145,7 +145,7 @@ return [
|
||||
'ExpandedForm' => [
|
||||
'is_safe' => [
|
||||
'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location',
|
||||
'multiRadio','file','multiCheckbox'
|
||||
'multiRadio','file','multiCheckbox','staticText'
|
||||
]
|
||||
],
|
||||
'Form' => [
|
||||
|
@ -18,8 +18,12 @@ return [
|
||||
'showEverything' => 'Show everything',
|
||||
'never' => 'Never',
|
||||
'search_results_for' => 'Search results for ":query"',
|
||||
|
||||
// attachments
|
||||
'nr_of_attachments' => 'One attachment|:count attachments',
|
||||
'attachments' => 'Attachments',
|
||||
'edit_attachment' => 'Edit attachment ":name"',
|
||||
'update_attachment' => 'Update attachment',
|
||||
|
||||
// tour:
|
||||
'prev' => 'Prev',
|
||||
|
@ -61,6 +61,11 @@ return [
|
||||
'add_new_transfer' => 'Add a new transfer',
|
||||
'noPiggybank' => '(no piggy bank)',
|
||||
'noBudget' => '(no budget)',
|
||||
'title' => 'Title',
|
||||
'notes' => 'Notes',
|
||||
'filename' => 'File name',
|
||||
'mime' => 'Mime type',
|
||||
'size' => 'Size',
|
||||
|
||||
'delete_account' => 'Delete account ":name"',
|
||||
'delete_bill' => 'Delete bill ":name"',
|
||||
|
60
resources/twig/attachments/edit.twig
Normal file
60
resources/twig/attachments/edit.twig
Normal file
@ -0,0 +1,60 @@
|
||||
{% extends "./layout/default.twig" %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ Breadcrumbs.renderIfExists(Route.getCurrentRoute().getName(), attachment) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form method="POST" action="{{ route('attachment.update', attachment.id) }}" accept-charset="UTF-8" class="form-horizontal" id="update">
|
||||
|
||||
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
|
||||
<input type="hidden" name="id" value="{{ attachment.id }}"/>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'mandatoryFields'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ ExpandedForm.staticText('filename',attachment.filename) }}
|
||||
{{ ExpandedForm.staticText('mime',attachment.mime) }}
|
||||
{{ ExpandedForm.staticText('size',attachment.size|filesize) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'optionalFields'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ ExpandedForm.text('title') }}
|
||||
{{ ExpandedForm.textarea('description') }}
|
||||
{{ ExpandedForm.textarea('notes') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- panel for options -->
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">{{ 'options'|_ }}</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ ExpandedForm.optionsList('update','attachment') }}
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn pull-right btn-success">
|
||||
{{ ('update_attachment')|_ }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
{% endblock %}
|
7
resources/twig/form/static.twig
Normal file
7
resources/twig/form/static.twig
Normal file
@ -0,0 +1,7 @@
|
||||
<div class="{{ classes }}" id="{{ name }}_holder">
|
||||
<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<p class="form-control-static">{{ value }}</p>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user