Skip to content

Commit

Permalink
Merge pull request #46 from froboy/YDEN-140-skip-wizard
Browse files Browse the repository at this point in the history
feat: YDEN-140 Add 'Skip wizard' option on AF4 block
  • Loading branch information
podarok authored Jul 26, 2024
2 parents 1bb0e8c + 5324436 commit 6e99d6d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions openy_activity_finder.module
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function openy_activity_finder_theme() {
'in_memberships_filter' => FALSE,
'start_month_filter' => FALSE,
'duration_filter' => FALSE,
'skip_wizard' => FALSE,
],
],
];
Expand Down
2 changes: 1 addition & 1 deletion openy_af4_vue_app/dist/activity_finder_4.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion openy_af4_vue_app/dist/activity_finder_4.umd.min.js.map

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion openy_af4_vue_app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,10 @@ export default {
bsVersion: {
type: Number,
required: true
},
skipWizard: {
type: Boolean,
required: true
}
},
data() {
Expand Down Expand Up @@ -472,7 +476,7 @@ export default {
selectedPath: '',
maxAges: 2,
defaults: {
step: 'selectPath',
step: this.skipWizard ? 'results' : 'selectPath',
selectedAges: [],
selectedDays: [],
selectedTimes: [],
Expand Down Expand Up @@ -655,6 +659,10 @@ export default {
this.updateUrl()
},
step(val, oldVal) {
// If skipWizard, then ignore all steps and go directly to results.
if (this.skipWizard) {
this.viewResults()
}
// Check if we returned to previously completed step - using browser back button - then we
// need to remove this step from completed steps.
// The else part tracks the completed step if the first (default) step was already completed
Expand Down
3 changes: 3 additions & 0 deletions openy_af4_vue_app/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const path = require('path')
module.exports = {
configureWebpack: {
devtool: 'source-map',
watchOptions: {
poll: 1000,
},
externals: {
'vue-router': 'VueRouter',
axios: 'axios',
Expand Down
15 changes: 13 additions & 2 deletions src/Plugin/Block/ActivityFinder4Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function defaultConfiguration() {
'in_memberships_filter' => 0,
'duration_filter' => 0,
'start_month_filter' => 0,
'skip_wizard' => 0,
];
}

Expand Down Expand Up @@ -220,6 +221,7 @@ public function build() {
'#duration_filter' => (bool) $conf['duration_filter'],
'#in_memberships_filter' => (bool) $conf['in_memberships_filter'],
'#hide_home_branch_block' => (bool) $conf['hide_home_branch_block'],
'#skip_wizard' => (bool) $conf['skip_wizard'],
'#background_image' => [
'mobile' => $image_mobile,
'desktop' => $image_desktop,
Expand Down Expand Up @@ -340,7 +342,7 @@ public function blockForm($form, FormStateInterface $form_state) {
$form['legacy_mode'] = [
'#type' => 'checkbox',
'#title' => $this->t('Legacy mode'),
'#description' => $this->t('Enable legacy mode for Activity Finder.'),
'#description' => $this->t('Enable legacy mode for Activity Finder to emulate v3. Legacy mode disables bookmarks on the results screen, hides the age indicator on results, and removes the time options on the "Days & Times" wizard step.'),
'#default_value' => $conf['legacy_mode'],
];

Expand All @@ -360,7 +362,7 @@ public function blockForm($form, FormStateInterface $form_state) {
$form['additional']['start_month_filter'] = [
'#type' => 'checkbox',
'#title' => $this->t('Start month'),
'#description' => $this->t('Allow users to filter by start month. This option has no additional configuration.'),
'#description' => $this->t('Allow users to filter by the start month in the Session Time field. This option has no additional configuration.'),
'#default_value' => $conf['start_month_filter'],
];

Expand Down Expand Up @@ -393,9 +395,17 @@ public function blockForm($form, FormStateInterface $form_state) {
$form['hide_home_branch_block'] = [
'#type' => 'checkbox',
'#title' => $this->t('Hide Home Branch info block'),
'#description' => $this->t('Disables functionality related to the user’s selected home branch.'),
'#default_value' => $conf['hide_home_branch_block'],
];

$form['skip_wizard'] = [
'#type' => 'checkbox',
'#title' => $this->t('Skip wizard'),
'#description' => $this->t('Display results on page load and skip the "Start your search..." wizard.'),
'#default_value' => $conf['skip_wizard'],
];

// Entity Browser element for background image.
$form['background_image'] = $this->getEntityBrowserForm(
'images_library',
Expand Down Expand Up @@ -436,6 +446,7 @@ public function blockSubmit($form, FormStateInterface $form_state) {
$this->configuration['duration_filter'] = $additional_filters['duration_filter'];
$this->configuration['in_memberships_filter'] = $additional_filters['in_memberships_filter'];
$this->configuration['hide_home_branch_block'] = $form_state->getValue('hide_home_branch_block');
$this->configuration['skip_wizard'] = $form_state->getValue('skip_wizard');
$this->configuration['background_image'] = $this->getEntityBrowserValue($form_state, 'background_image');
}

Expand Down
1 change: 1 addition & 0 deletions templates/openy-activity-finder-4-block.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
:disable-search-box="{{ disable_search_box|json_encode }}"
:filters-section-config="{{ filters_section_config|json_encode }}"
:bs-version="{{ bs_version|json_encode }}"
:skip-wizard="{{ skip_wizard|json_encode }}"
></activity-finder>
</div>
</div>

0 comments on commit 6e99d6d

Please sign in to comment.