Skip to content

Commit

Permalink
Merge pull request #381 from stefanorosanelli/chore/humanize-fields
Browse files Browse the repository at this point in the history
chore: humanize list field labels
  • Loading branch information
didoda authored Jan 30, 2020
2 parents c9dfe45 + 4a96d77 commit 488407f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Template/Element/FilterBox/filter_box_common.twig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{# other dynamic filters #}
<div v-for="filter in dynamicFilters" class="filter-container" :class="[filter.name, filter.type, filter.date? 'date' : '' ]">
<input type="hidden" :name="filter.name" :value="filter.value">
<div class="filter-label"><: t(filter.name) :></div>
<div class="filter-label"><: filter.name | humanize :></div>

<span v-if="filter.type === 'select' || filter.type === 'radio'">
<select v-model="queryFilter.filter[filter.name]" :id="filter.name" class="{{ selectBaseClasses }}">
Expand Down
4 changes: 2 additions & 2 deletions src/Template/Pages/Modules/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
{% endfor %}
<div>{{ Link.sort('id')}}</div>
{% if currentModule.hints.multiple_types %}
<div>{{ __('type') }}</div>
<div>{{ __('Type') }}</div>
{% endif %}

<div>{{ __('status') }}</div>
<div>{{ __('Status') }}</div>
<div>{{ Link.sort('modified')}}</div>
<div></div>
</nav>
Expand Down
3 changes: 2 additions & 1 deletion src/View/Helper/LinkHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Cake\Filesystem\Folder;
use Cake\Routing\Router;
use Cake\Utility\Hash;
use Cake\Utility\Inflector;
use Cake\View\Helper;

/**
Expand Down Expand Up @@ -91,7 +92,7 @@ public function sort($field): void
}
}
$url = $this->replaceParamUrl('sort', $sortValue);
echo '<a href="' . $url . '" class="' . $class . '">' . __($field) . '</a>';
echo '<a href="' . $url . '" class="' . $class . '">' . Inflector::humanize($field) . '</a>';
}

/**
Expand Down

0 comments on commit 488407f

Please sign in to comment.