Skip to content

Commit

Permalink
Fix preferences page
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Apr 3, 2024
1 parent 1f575ae commit 9b8195b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/GaletteObjectsLend/Controllers/MainController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function preferences(Request $request, Response $response): Response

$params = [
'page_title' => _T('ObjectsLend preferences', 'objectslend'),
'ctypes' => $ctypes->getList(),
'type_cotis_options' => $ctypes->getList(),
'lendsprefs' => $lendsprefs->getPreferences()
];

Expand Down
22 changes: 14 additions & 8 deletions templates/default/preferences.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,20 @@
{% endfor %}

{# TODO: hide this one if AUTO_GENERATE_CONTRIBUTION is off #}
{% include "components/forms/select.html.twig" with {
id: 'contribution_type',
name: 'GENERATED_CONTRIBUTION_TYPE_ID',
value: lendsprefs.GENERATED_CONTRIBUTION_TYPE_ID,
values: ctype_list_values,
label: _T("Contribution type:", "objectslend"),
required: lendsprefs.AUTO_GENERATE_CONTRIBUTION == '1'
} %}
<div class="field{% if lendsprefs.AUTO_GENERATE_CONTRIBUTION == '1' %} required{% endif %}">
<label for="contribution_type">{{ _T("Contribution type:") }}</label>
<div id="contribution_type" class="ui dropdown selection">
{% set selectedid = lendsprefs.GENERATED_CONTRIBUTION_TYPE_ID %}
<input id="id_type_cotis_input" type="hidden" name="id_type_cotis" value="{{ selectedid }}"{% if lendsprefs.AUTO_GENERATE_CONTRIBUTION == '1' %} required="required"{% endif %}>
<i class="dropdown icon"></i>
<div class="text">{% for key, values in type_cotis_options %}{% if key == selectedid %}{{ values.label }}{% endif %}{% endfor %}</div>
<div class="menu">
{% for key, values in type_cotis_options %}
<div class="item{% if key == selectedid %} active selected{% endif %}" data-value="{{ key }}">{{ values.label }}</div>
{% endfor %}
</div>
</div>
</div>

{% include "components/forms/text.html.twig" with {
id: 'contrib_text',
Expand Down

0 comments on commit 9b8195b

Please sign in to comment.