Skip to content

Commit 8d052f3

Browse files
authored
Merge pull request #362 from itk-dev/hotfix/minor-changes-after-d10
Update share form
2 parents 7c963da + c562419 commit 8d052f3

File tree

9 files changed

+240
-40
lines changed

9 files changed

+240
-40
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Versioning](https://semver.org/spec/v2.0.0.html).
88

99
## [Unreleased]
1010

11+
- [PR-362](https://github.com/itk-dev/os2loop/pull/362)
12+
- Change Share with a friend form
13+
- Add chosen lib
14+
- Use chosen lib for profession and expertise fields
1115
- [PR-361](https://github.com/itk-dev/os2loop/pull/361)
1216
Added local OIDC server-mock
1317

composer.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"drupal/autocomplete_deluxe": "^2.0",
1414
"drupal/better_formats": "^1.0@beta",
1515
"drupal/block_field": "^1.0@RC",
16+
"drupal/chosen": "^4.0",
1617
"drupal/color": "^1.0",
1718
"drupal/config_ignore": "^2.4",
1819
"drupal/convert_media_tags_to_markup": "^3.0",
@@ -57,7 +58,8 @@
5758
"drupal/views_flag_refresh": "^1.0",
5859
"drupal/viewsreference": "^2.0@beta",
5960
"drupal/xls_serialization": "^1.3",
60-
"drush/drush": "^12.2"
61+
"drush/drush": "^12.2",
62+
"jjj/chosen": "2.2.1"
6163
},
6264
"require-dev": {
6365
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
@@ -82,6 +84,19 @@
8284
"url": "https://packages.drupal.org/8",
8385
"canonical": false
8486
},
87+
"chosen": {
88+
"type": "package",
89+
"package": {
90+
"name": "jjj/chosen",
91+
"type": "drupal-library",
92+
"version": "2.2.1",
93+
"source": {
94+
"type": "git",
95+
"url": "https://github.com/JJJ/chosen.git",
96+
"reference": "2.2.1"
97+
}
98+
}
99+
},
85100
"drupal/theme_switcher": {
86101
"type": "vcs",
87102
"url": "https://git.drupalcode.org/project/theme_switcher"

composer.lock

Lines changed: 154 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/sync/chosen.settings.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
_core:
2+
default_config_hash: OHFGY8dygN7xT4c0vdvK-HmdGFN61Sww_KLKfBkIrWc
3+
minimum_single: 20
4+
minimum_multiple: 20
5+
disable_search_threshold: 0
6+
minimum_width: 0
7+
use_relative_width: false
8+
jquery_selector: 'select:visible'
9+
search_contains: false
10+
disable_search: false
11+
allow_single_deselect: false
12+
add_helper_buttons: false
13+
placeholder_text_multiple: 'Choose some options'
14+
placeholder_text_single: 'Choose an option'
15+
no_results_text: 'No results match'
16+
max_shown_results: null
17+
disabled_themes: { }
18+
chosen_include: 2

config/sync/core.entity_form_display.user.user.default.yml

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ dependencies:
2020
- field.field.user.user.os2loop_user_postal_code
2121
- field.field.user.user.os2loop_user_professions
2222
module:
23-
- autocomplete_deluxe
23+
- chosen_field
2424
- field_group
2525
- inline_entity_form
2626
- user
@@ -123,21 +123,10 @@ content:
123123
placeholder: ''
124124
third_party_settings: { }
125125
os2loop_user_areas_of_expertise:
126-
type: autocomplete_deluxe
126+
type: chosen_select
127127
weight: 20
128128
region: content
129-
settings:
130-
match_operator: CONTAINS
131-
autocomplete_route_name: autocomplete_deluxe.autocomplete
132-
size: 60
133-
selection_handler: default
134-
min_length: 0
135-
delimiter: ''
136-
not_found_message_allow: false
137-
not_found_message: "The term '@term' will be added"
138-
new_terms: false
139-
no_empty_message: 'No terms could be found. Please type in order to add a new term.'
140-
match_limit: '0'
129+
settings: { }
141130
third_party_settings: { }
142131
os2loop_user_biography:
143132
type: string_textarea
@@ -180,9 +169,14 @@ content:
180169
override_labels: false
181170
label_singular: ''
182171
label_plural: ''
172+
allow_new: true
173+
hide_fieldset: false
174+
hide_title: false
183175
collapsible: false
184176
collapsed: false
185177
revision: false
178+
config_labels_button: _none
179+
labels: { }
186180
third_party_settings: { }
187181
os2loop_user_job_title:
188182
type: string_textfield
@@ -217,21 +211,10 @@ content:
217211
placeholder: ''
218212
third_party_settings: { }
219213
os2loop_user_professions:
220-
type: autocomplete_deluxe
214+
type: chosen_select
221215
weight: 30
222216
region: content
223-
settings:
224-
match_operator: CONTAINS
225-
autocomplete_route_name: autocomplete_deluxe.autocomplete
226-
size: 60
227-
selection_handler: default
228-
min_length: 0
229-
delimiter: ''
230-
not_found_message_allow: false
231-
not_found_message: "The term '@term' will be added"
232-
new_terms: false
233-
no_empty_message: 'No terms could be found. Please type in order to add a new term.'
234-
match_limit: '0'
217+
settings: { }
235218
third_party_settings: { }
236219
hidden:
237220
langcode: true

config/sync/core.extension.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ module:
55
block: 0
66
block_field: 0
77
breakpoint: 0
8+
chosen: 0
9+
chosen_field: 0
10+
chosen_lib: 0
811
ckeditor5: 0
912
comment: 0
1013
config_filter: 0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
placeholder_text_multiple: Vælg
2+
placeholder_text_single: Vælg
3+
no_results_text: 'Intet resultat'

web/profiles/custom/os2loop/modules/os2loop_share_with_a_friend/src/Form/ShareWithAFriendForm.php

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,36 @@ public function buildForm(array $form, FormStateInterface $form_state) {
9292
/** @var \Drupal\node\NodeInterface $node */
9393
$node = $this->routeMatcher->getParameter('node');
9494

95-
$form['title'] = [
95+
$form['wrapper'] = [
96+
'#type' => 'container',
97+
'#attributes' => ['class' => ['container', 'col-6']],
98+
];
99+
100+
$form['wrapper']['title'] = [
96101
'#type' => 'page_title',
97102
'#title' => $this->t('Share the following with a friend: @document', ['@document' => $node->label()]),
98103
];
99104

100-
$form['message'] = [
101-
'#type' => 'textarea',
102-
'#title' => $this->t('Message'),
103-
'#description' => $this->t('Write a message to the recipient'),
105+
$form['wrapper']['to_email'] = [
106+
'#type' => 'email',
104107
'#required' => TRUE,
108+
'#title' => $this->t('Email address of recipient'),
109+
'#attributes' => [
110+
'class' => [
111+
'form-control',
112+
],
113+
],
105114
];
106115

107-
$form['to_email'] = [
108-
'#type' => 'email',
116+
$form['wrapper']['message'] = [
117+
'#type' => 'textarea',
118+
'#title' => $this->t('Message'),
119+
'#description' => $this->t('Write a message to the recipient'),
109120
'#required' => TRUE,
110-
'#title' => $this->t('Email address of recipient'),
111121
];
112122

113-
$form['actions']['#type'] = 'actions';
114-
$form['actions']['submit'] = [
123+
$form['wrapper']['actions']['#type'] = 'actions';
124+
$form['wrapper']['actions']['submit'] = [
115125
'#type' => 'submit',
116126
'#value' => $this->t('Send'),
117127
'#attributes' => [
@@ -120,7 +130,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
120130
],
121131
],
122132
];
123-
$form['actions']['cancel'] = [
133+
$form['wrapper']['actions']['cancel'] = [
124134
'#type' => 'link',
125135
'#url' => $node->toUrl(),
126136
'#title' => $this->t('Cancel'),

0 commit comments

Comments
 (0)