Implemented new Userfield type "Link" (references #258)

This commit is contained in:
Bernd Bestel
2019-09-17 19:33:06 +02:00
parent 6aa278c19c
commit 0fa0138972
6 changed files with 17 additions and 2 deletions

View File

@@ -20,9 +20,10 @@
- Equipment improvements/fixes
- Fixed that the delete button not always deleted the currently selected equipment item
- Userfield improvements/fixes
- New userfield type "Select list" for a list of predefined values where a single or also multiple values can then be selected on the entity object
- Fixed that the Userfield type "Preset list" had always the caption "Product group" instead of the configured one (thanks @oncleben31)
- New Userfield type "Select list" for a list of predefined values where a single or also multiple values can then be selected on the entity object
- New Userfield type "Link" - a single-line-textbox where the content will be rendered as a clickable link
- Userfields of type "checkbox" are rendered as a checkmark in tables when checked (instead of "1" as till now)
- Fixed that the Userfield type "Preset list" had always the caption "Product group" instead of the configured one (thanks @oncleben31)
- General improvements/fixes
- Improved the handling which entry page to use with disabled feature flags (thanks @nielstholenaar)
- Boolean settings provided via environment variables (so the strings `true` and `false`) are now parsed correctly (thanks @mduret)

View File

@@ -38,3 +38,6 @@ msgstr "Select list (a single item can be selected)"
msgid "preset-checklist"
msgstr "Select list (multiple items can be selected)"
msgid "link"
msgstr "Link"

View File

@@ -38,3 +38,6 @@ msgstr ""
msgid "preset-checklist"
msgstr ""
msgid "link"
msgstr ""

View File

@@ -13,6 +13,7 @@ class UserfieldsService extends BaseService
const USERFIELD_TYPE_CHECKBOX = 'checkbox';
const USERFIELD_TYPE_PRESET_LIST = 'preset-list';
const USERFIELD_TYPE_PRESET_CHECKLIST = 'preset-checklist';
const USERFIELD_TYPE_LINK = 'link';
public function __construct()
{

View File

@@ -10,6 +10,8 @@
@if($userfieldObject->value == 1)<i class="fas fa-check"></i>@endif
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_PRESET_CHECKLIST)
{!! str_replace(',', '<br>', $userfieldObject->value) !!}
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_LINK)
<a href="{{ $userfieldObject->value }}" target="_blank">{{ $userfieldObject->value }}</a>
@else
{{ $userfieldObject->value }}
@endif

View File

@@ -93,6 +93,11 @@
@endforeach
</select>
</div>
@elseif($userfield->type == \Grocy\Services\UserfieldsService::USERFIELD_TYPE_LINK)
<div class="form-group">
<label for="name">{{ $userfield->caption }}</label>
<input type="link" class="form-control userfield-input" data-userfield-name="{{ $userfield->name }}">
</div>
@endif
@endforeach