Make it easier to switch between v1/v2 layout.

This commit is contained in:
James Cole 2021-02-03 06:25:46 +01:00
parent 957e34a57a
commit 08fcff2a98
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
12 changed files with 42 additions and 42 deletions

View File

@ -52,7 +52,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
$reportType = 'account';
$preferredPeriod = $this->preferredPeriod();
try {
$result = view('reports.double.report', compact('accountIds', 'reportType', 'doubleIds', 'preferredPeriod'))
$result = prefixView('reports.double.report', compact('accountIds', 'reportType', 'doubleIds', 'preferredPeriod'))
->with('start', $this->start)->with('end', $this->end)
->with('doubles', $this->expense)
->render();

View File

@ -79,7 +79,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
'due_date', 'payment_date', 'invoice_date',
];
try {
$result = view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
$result = prefixView('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
->render();
} catch (Throwable $e) {

View File

@ -65,7 +65,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
$budgetIds = implode(',', $this->budgets->pluck('id')->toArray());
try {
$result = view(
$result = prefixView(
'reports.budget.month',
compact('accountIds', 'budgetIds')
)

View File

@ -54,7 +54,7 @@ class YearReportGenerator implements ReportGeneratorInterface
$reportType = 'default';
try {
$result = view(
$result = prefixView(
'reports.default.year',
compact('accountIds', 'reportType')
)->with('start', $this->start)->with('end', $this->end)->render();

View File

@ -75,7 +75,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
// render!
try {
$result = view(
$result = prefixView(
'reports.tag.month',
compact('accountIds', 'reportType', 'tagIds')
)->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render();

View File

@ -62,7 +62,7 @@ class ExpandedForm
$value = round((float) $value, 8);
}
try {
$html = view('form.amount-no-currency', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.amount-no-currency', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render amountNoCurrency(): %s', $e->getMessage()));
$html = 'Could not render amountNoCurrency.';
@ -98,7 +98,7 @@ class ExpandedForm
unset($options['placeholder'], $options['autocomplete'], $options['class']);
try {
$html = view('form.checkbox', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.checkbox', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render checkbox(): %s', $e->getMessage()));
$html = 'Could not render checkbox.';
@ -123,7 +123,7 @@ class ExpandedForm
$value = $this->fillFieldValue($name, $value);
unset($options['placeholder']);
try {
$html = view('form.date', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.date', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render date(): %s', $e->getMessage()));
$html = 'Could not render date.';
@ -146,7 +146,7 @@ class ExpandedForm
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
try {
$html = view('form.file', compact('classes', 'name', 'label', 'options'))->render();
$html = prefixView('form.file', compact('classes', 'name', 'label', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render file(): %s', $e->getMessage()));
$html = 'Could not render file.';
@ -172,7 +172,7 @@ class ExpandedForm
$value = $this->fillFieldValue($name, $value);
$options['step'] = '1';
try {
$html = view('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.integer', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render integer(): %s', $e->getMessage()));
$html = 'Could not render integer.';
@ -197,7 +197,7 @@ class ExpandedForm
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
try {
$html = view('form.location', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.location', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render location(): %s', $e->getMessage()));
$html = 'Could not render location.';
@ -255,7 +255,7 @@ class ExpandedForm
$value = round((float) $value, $selectedCurrency->decimal_places);
}
try {
$html = view('form.non-selectable-amount', compact('selectedCurrency', 'classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.non-selectable-amount', compact('selectedCurrency', 'classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render nonSelectableAmount(): %s', $e->getMessage()));
$html = 'Could not render nonSelectableAmount.';
@ -281,7 +281,7 @@ class ExpandedForm
$options['step'] = 'any';
unset($options['placeholder']);
try {
$html = view('form.number', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.number', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render number(): %s', $e->getMessage()));
$html = 'Could not render number.';
@ -300,7 +300,7 @@ class ExpandedForm
public function optionsList(string $type, string $name): string
{
try {
$html = view('form.options', compact('type', 'name'))->render();
$html = prefixView('form.options', compact('type', 'name'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render select(): %s', $e->getMessage()));
$html = 'Could not render optionsList.';
@ -323,7 +323,7 @@ class ExpandedForm
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
try {
$html = view('form.password', compact('classes', 'name', 'label', 'options'))->render();
$html = prefixView('form.password', compact('classes', 'name', 'label', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render password(): %s', $e->getMessage()));
$html = 'Could not render password.';
@ -351,7 +351,7 @@ class ExpandedForm
$options['step'] = 'any';
unset($options['placeholder']);
try {
$html = view('form.percentage', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.percentage', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render percentage(): %s', $e->getMessage()));
$html = 'Could not render percentage.';
@ -374,7 +374,7 @@ class ExpandedForm
$options = $this->expandOptionArray($name, $label, $options);
$classes = $this->getHolderClasses($name);
try {
$html = view('form.static', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.static', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render staticText(): %s', $e->getMessage()));
$html = 'Could not render staticText.';
@ -398,7 +398,7 @@ class ExpandedForm
$classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value);
try {
$html = view('form.text', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.text', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render text(): %s', $e->getMessage()));
$html = 'Could not render text.';
@ -428,7 +428,7 @@ class ExpandedForm
}
try {
$html = view('form.textarea', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.textarea', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render textarea(): %s', $e->getMessage()));
$html = 'Could not render textarea.';
@ -457,7 +457,7 @@ class ExpandedForm
}
try {
$html = view('form.object_group', compact('classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.object_group', compact('classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render objectGroup(): %s', $e->getMessage()));
$html = 'Could not render objectGroup.';

View File

@ -139,7 +139,7 @@ class AccountForm
unset($options['class']);
try {
$html = view('form.assetAccountCheckList', compact('classes', 'selected', 'name', 'label', 'options', 'grouped'))->render();
$html = prefixView('form.assetAccountCheckList', compact('classes', 'selected', 'name', 'label', 'options', 'grouped'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render assetAccountCheckList(): %s', $e->getMessage()));
$html = 'Could not render assetAccountCheckList.';

View File

@ -154,7 +154,7 @@ class CurrencyForm
$value = round((float) $value, $defaultCurrency->decimal_places);
}
try {
$html = view('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
$html = 'Could not render currencyField.';
@ -205,7 +205,7 @@ class CurrencyForm
$value = round((float) $value, $defaultCurrency->decimal_places);
}
try {
$html = view('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
$html = prefixView('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render currencyField(): %s', $e->getMessage()));
$html = 'Could not render currencyField.';

View File

@ -79,7 +79,7 @@ trait FormSupport
$selected = $this->fillFieldValue($name, $selected);
unset($options['autocomplete'], $options['placeholder']);
try {
$html = view('form.select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render();
$html = prefixView('form.select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render();
} catch (Throwable $e) {
Log::debug(sprintf('Could not render select(): %s', $e->getMessage()));
$html = 'Could not render select.';

View File

@ -48,7 +48,7 @@ trait ModelInformation
protected function getActionsForBill(Bill $bill): array // get info and augument
{
try {
$result = view(
$result = prefixView(
'rules.partials.action',
[
'oldAction' => 'link_to_bill',
@ -139,7 +139,7 @@ trait ModelInformation
];
foreach ($billTriggers as $index => $trigger) {
try {
$string = view(
$string = prefixView(
'rules.partials.trigger',
[
'oldTrigger' => $trigger,
@ -257,7 +257,7 @@ trait ModelInformation
foreach ($journalTriggers as $index => $trigger) {
try {
$string = view(
$string = prefixView(
'rules.partials.trigger',
[
'oldTrigger' => $trigger,

View File

@ -78,7 +78,7 @@ trait RenderPartialViews
// @codeCoverageIgnoreStart
try {
$result = view('reports.options.double', compact('set'))->render();
$result = prefixView('reports.options.double', compact('set'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
@ -111,7 +111,7 @@ trait RenderPartialViews
$journals = $popupHelper->balanceForBudget($budget, $account, $attributes);
// @codeCoverageIgnoreStart
try {
$view = view('popup.report.balance-amount', compact('journals', 'budget', 'account'))->render();
$view = prefixView('popup.report.balance-amount', compact('journals', 'budget', 'account'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
@ -134,7 +134,7 @@ trait RenderPartialViews
$budgets = $repository->getBudgets();
// @codeCoverageIgnoreStart
try {
$result = view('reports.options.budget', compact('budgets'))->render();
$result = prefixView('reports.options.budget', compact('budgets'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';
@ -167,7 +167,7 @@ trait RenderPartialViews
$journals = $popupHelper->byBudget($budget, $attributes);
// @codeCoverageIgnoreStart
try {
$view = view('popup.report.budget-spent-amount', compact('journals', 'budget'))->render();
$view = prefixView('popup.report.budget-spent-amount', compact('journals', 'budget'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
@ -196,7 +196,7 @@ trait RenderPartialViews
$journals = $popupHelper->byCategory($category, $attributes);
try {
$view = view('popup.report.category-entry', compact('journals', 'category'))->render();
$view = prefixView('popup.report.category-entry', compact('journals', 'category'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
@ -217,7 +217,7 @@ trait RenderPartialViews
$categories = $repository->getCategories();
// @codeCoverageIgnoreStart
try {
$result = view('reports.options.category', compact('categories'))->render();
$result = prefixView('reports.options.category', compact('categories'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.category: %s', $e->getMessage()));
$result = 'Could not render view.';
@ -252,7 +252,7 @@ trait RenderPartialViews
$journals = $popupHelper->byExpenses($account, $attributes);
// @codeCoverageIgnoreStart
try {
$view = view('popup.report.expense-entry', compact('journals', 'account'))->render();
$view = prefixView('popup.report.expense-entry', compact('journals', 'account'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
@ -280,7 +280,7 @@ trait RenderPartialViews
foreach ($currentActions as $entry) {
$count = ($index + 1);
try {
$actions[] = view(
$actions[] = prefixView(
'rules.partials.action',
[
'oldAction' => $entry->action_type,
@ -332,7 +332,7 @@ trait RenderPartialViews
if ('user_action' !== $entry->trigger_type) {
$count = ($index + 1);
try {
$renderedEntries[] = view(
$renderedEntries[] = prefixView(
'rules.partials.trigger',
[
'oldTrigger' => OperatorQuerySearch::getRootOperator($entry->trigger_type),
@ -378,7 +378,7 @@ trait RenderPartialViews
$journals = $popupHelper->byIncome($account, $attributes);
// @codeCoverageIgnoreStart
try {
$view = view('popup.report.income-entry', compact('journals', 'account'))->render();
$view = prefixView('popup.report.income-entry', compact('journals', 'account'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Could not render: %s', $e->getMessage()));
$view = 'Firefly III could not render the view. Please see the log files.';
@ -398,7 +398,7 @@ trait RenderPartialViews
{
// @codeCoverageIgnoreStart
try {
$result = view('reports.options.no-options')->render();
$result = prefixView('reports.options.no-options')->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.no-options: %s', $e->getMessage()));
$result = 'Could not render view.';
@ -422,7 +422,7 @@ trait RenderPartialViews
// @codeCoverageIgnoreStart
try {
$result = view('reports.options.tag', compact('tags'))->render();
$result = prefixView('reports.options.tag', compact('tags'))->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.options.tag: %s', $e->getMessage()));
$result = 'Could not render view.';

View File

@ -57,7 +57,7 @@ trait RuleManagement
$index = 0;
foreach ($submittedOperators as $operator) {
try {
$renderedEntries[] = view(
$renderedEntries[] = prefixView(
'rules.partials.trigger',
[
'oldTrigger' => OperatorQuerySearch::getRootOperator($operator['type']),
@ -140,7 +140,7 @@ trait RuleManagement
if (is_array($oldInput)) {
foreach ($oldInput as $oldAction) {
try {
$triggers[] = view(
$triggers[] = prefixView(
'rules.partials.action',
[
'oldAction' => $oldAction['type'],
@ -185,7 +185,7 @@ trait RuleManagement
if (is_array($oldInput)) {
foreach ($oldInput as $oldTrigger) {
try {
$renderedEntries[] = view(
$renderedEntries[] = prefixView(
'rules.partials.trigger',
[
'oldTrigger' => OperatorQuerySearch::getRootOperator($oldTrigger['type']),