Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/setup wizard #2616

Open
wants to merge 51 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4fd21d2
feat: add setup wizard menu page
squigglybob Dec 10, 2024
38d1d7b
phpcs
squigglybob Dec 10, 2024
31db646
feat: add non bundled lit component
squigglybob Dec 10, 2024
53298a6
feat: add some basic styling
squigglybob Dec 10, 2024
0066aec
style: adjust button styling
squigglybob Dec 11, 2024
ebddb72
feat: create a kitchen sink of items
squigglybob Dec 11, 2024
65a5a91
feat: add toggleable button
squigglybob Dec 11, 2024
80d6b93
feat: add basic stepper
squigglybob Dec 11, 2024
8fe906c
feat: create example steps
squigglybob Dec 11, 2024
e51507f
feat: change system to pass in component name into wizard for the steps
squigglybob Dec 13, 2024
9c28737
feat: hide back button on first step
squigglybob Dec 13, 2024
463d03e
feat: add stages to the module step
squigglybob Dec 13, 2024
d37c726
Merge branch 'refs/heads/develop' into feat/setup-wizard
corsacca Dec 16, 2024
a756693
Fix enqueue and syntax errors
corsacca Dec 16, 2024
d53070f
Merge branch 'refs/heads/develop' into feat/setup-wizard
corsacca Dec 16, 2024
a0bb92d
Run prettier
corsacca Dec 16, 2024
bb601c0
revert module type in package.json
corsacca Dec 16, 2024
ac2c520
rebuild styles
corsacca Dec 16, 2024
5b80ef8
feat: add module selection
squigglybob Dec 16, 2024
ad223ac
feat: add backLabel and nextLabel to controls
squigglybob Dec 16, 2024
5a68fc2
Plugins step
corsacca Dec 17, 2024
c35effe
add module step to wizard (#2617)
squigglybob Dec 18, 2024
589949a
Add geocoding step and endpoint to update dt options (#2619)
corsacca Dec 18, 2024
952e40b
Consistent Capitalization
corsacca Dec 18, 2024
2165853
Add titles to keys and plugin steps
corsacca Dec 18, 2024
923ec01
Feat/last bits (#2620)
squigglybob Dec 18, 2024
2fbc967
Fix saving enabled and disable modules. (#2623)
corsacca Dec 19, 2024
959897b
Feat/setup wizard plugins step fixes(#2622)
corsacca Dec 19, 2024
f5cdb93
Feat/setup wizard wordings (#2624)
corsacca Dec 19, 2024
17cfab1
Don't run setup wizard on network admin side
corsacca Dec 19, 2024
b288941
Merge branch 'refs/heads/develop' into feat/setup-wizard
corsacca Dec 19, 2024
4189925
Bring user to the wizard when they first log in.
corsacca Dec 19, 2024
5e54ee7
Feat/setup wizard last bits 2 (#2625)
squigglybob Dec 19, 2024
f2181f0
only network admins can install plugins on multisites (#2627)
corsacca Dec 19, 2024
28af1ef
Feat/setup wizard Wordings (#2626)
corsacca Dec 19, 2024
1978d2e
Only show the setup wizard on new installs (#2628)
corsacca Dec 19, 2024
0892579
update geocoding wording
corsacca Dec 19, 2024
f427fd6
fix word
corsacca Dec 19, 2024
e987631
Feat/setup wizard dash tasks (#2629)
corsacca Dec 19, 2024
07bfc0d
Feat/sidebar progress (#2630)
squigglybob Dec 19, 2024
405fb33
fix: add more spacing between cover elements
squigglybob Dec 19, 2024
f88609d
dt_setup_wizard_completed filter
corsacca Dec 19, 2024
4a948ce
feat: simplify button styles; use btn-outline on keys instructions
squigglybob Dec 19, 2024
e5c002a
Feat/setup wizard people groups step (#2632)
squigglybob Jan 7, 2025
d1b904d
Feat/setup wizard tweaks (#2636)
corsacca Jan 7, 2025
55de758
intro and finish wording
corsacca Jan 7, 2025
899f3aa
tweask (#2637)
squigglybob Jan 8, 2025
ca58380
Fix multisite plugins preselected for non super admin
corsacca Jan 9, 2025
f3d75e0
Filter out already installed and active plugins in getPluginsToInstall()
corsacca Jan 9, 2025
985fe6f
Also save options change after "Confirm" is clicked
corsacca Jan 9, 2025
486fac7
Plugins: Only disable back and skip buttons while plugins are installing
corsacca Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dt-contacts/contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
'description' => 'Default contact functionality'
];
$modules['access_module'] = [
'name' => 'Access Module',
'name' => 'Follow-up',
'enabled' => true,
'prerequisites' => [ 'contacts_base' ],
'post_type' => 'contacts',
'description' => 'Field and workflows for follow-up ministries',
'description' => 'Manage incoming contacts from various sources and assign them to users for follow-up.',
'submodule' => true
];
return $modules;
Expand Down
6 changes: 3 additions & 3 deletions dt-contacts/module-baptisms.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

add_filter( 'dt_post_type_modules', function( $modules ){
$modules['contacts_baptisms_module'] = [
'name' => 'Baptisms Module',
'name' => 'Baptisms',
'enabled' => true,
'prerequisites' => [ 'contacts_base' ],
'post_type' => 'contacts',
'description' => 'Adds baptism fields and workflows',
'description' => 'Track contact baptism relationships, dates and generations',
'submodule' => true,
];
return $modules;
Expand Down Expand Up @@ -332,4 +332,4 @@ function(e, newContact, fieldKey, optionKey, action) {
<?php
}
}
DT_Contacts_Baptisms::instance();
DT_Contacts_Baptisms::instance();
4 changes: 2 additions & 2 deletions dt-contacts/module-coaching.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

add_filter( 'dt_post_type_modules', function( $modules ){
$modules['contacts_coaching_module'] = [
'name' => 'Coaching Module',
'name' => 'Coaching',
'enabled' => true,
'prerequisites' => [ 'contacts_base' ],
'post_type' => 'contacts',
'description' => 'Adds coaching fields, list filters and workflows',
'description' => 'Track contact coaching relationships',
'submodule' => true,
];
return $modules;
Expand Down
4 changes: 2 additions & 2 deletions dt-contacts/module-faith.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

add_filter( 'dt_post_type_modules', function( $modules ){
$modules['contacts_faith_module'] = [
'name' => 'Faith Module',
'name' => 'Faith',
'enabled' => true,
'prerequisites' => [ 'contacts_base' ],
'post_type' => 'contacts',
'description' => 'Adds faith field status and faith milestones',
'description' => 'Track progress of contacts in their faith journey',
'submodule' => true,
];
return $modules;
Expand Down
46 changes: 46 additions & 0 deletions dt-core/admin/admin-settings-endpoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,52 @@ public function add_api_routes() {
'permission_callback' => [ $this, 'default_permission_check' ],
]
);
register_rest_route(
$this->namespace, '/modules-update', [
'methods' => 'POST',
'callback' => [ $this, 'update_modules' ],
'permission_callback' => [ $this, 'default_permission_check' ],
]
);
register_rest_route(
$this->namespace, '/update-dt-options', [
'methods' => 'POST',
'callback' => [ $this, 'update_dt_options' ],
'permission_callback' => [ $this, 'default_permission_check' ],
]
);
}

public function update_dt_options( WP_REST_REQUEST $request ){
$params = $request->get_params();
$updated = false;
foreach ( $params as $option_key => $option_value ){
//only allow updating D.T options
if ( strpos( $option_key, 'dt_' ) !== 0 ){
continue;
}
update_option( $option_key, $option_value );
$updated = true;
}
return $updated;
}

public function update_modules( WP_REST_REQUEST $request ) {
$modules_option_name = 'dt_post_type_modules';
$modules_to_update = $request->get_param( 'modules' );
$modules_to_update = dt_recursive_sanitize_array( $modules_to_update );

$modules = get_option( $modules_option_name );

foreach ( $modules_to_update as $key => $enabled ){
if ( !isset( $modules[$key] ) ){
$modules[$key] = [];
}
$modules[$key]['enabled'] = !empty( $enabled );
}

update_option( $modules_option_name, $modules );
return true;
}

public function update_languages( WP_REST_REQUEST $request ) {
Expand Down
60 changes: 60 additions & 0 deletions dt-core/admin/components/setup-wizard-celebration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { html } from 'https://cdn.jsdelivr.net/gh/lit/[email protected]/all/lit-all.min.js';
import { OpenLitElement } from './setup-wizard-open-element.js';

export class SetupWizardCelebration extends OpenLitElement {
static get properties() {
return {
step: { type: Object },
};
}

constructor() {
super();
this.translations = window.setupWizardShare.translations;
}

back() {
this.dispatchEvent(new CustomEvent('back'));
}
async next() {
await window.dt_admin_shared.update_dt_options({
dt_setup_wizard_completed: true,
});
window.location.href = window.setupWizardShare.admin_url;
}

render() {
return html`
<div class="step-layout">
<h2>All finished</h2>
<div class="content stack">
<p>
After closing this setup wizard, you'll find yourself in the
WordPress admin dashboard. From there, you can explore these
settings and continue customizing your Disciple.Tools site.
</p>
<p>
Disciple.Tools has a huge ability to be customized to serve your
needs. If you have any questions or need any further assistance in
getting Disciple.Tools. to work for you, please reach out on our
community forum or our discord channel.
</p>
<a href="https://community.disciple.tools/" target="_blank">
Community Forum
</a>
<a href="https://discord.gg/kp5pYmrhSd" target="_blank">
Discord Invitation
</a>
</div>
<setup-wizard-controls
hideSkip
nextLabel=${this.translations.finish}
@next=${this.next}
@back=${this.back}
nextLabel="Close Wizard"
></setup-wizard-controls>
</div>
`;
}
}
customElements.define('setup-wizard-celebration', SetupWizardCelebration);
54 changes: 54 additions & 0 deletions dt-core/admin/components/setup-wizard-controls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { html } from 'https://cdn.jsdelivr.net/gh/lit/[email protected]/all/lit-all.min.js';
import { OpenLitElement } from './setup-wizard-open-element.js';

export class SetupWizardControls extends OpenLitElement {
static get properties() {
return {
hideBack: { type: Boolean },
hideSkip: { type: Boolean },
backLabel: { type: String },
nextLabel: { type: String },
skipLabel: { type: String },
saving: { type: Boolean },
};
}
back() {
this.dispatchEvent(new CustomEvent('back'));
}
next() {
if (this.saving) {
return;
}
this.dispatchEvent(new CustomEvent('next'));
}
skip() {
this.dispatchEvent(new CustomEvent('skip'));
}
render() {
return html`
<div class="cluster" position="end">
${this.hideSkip
? ''
: html`
<button @click=${this.skip} class="btn-outline">
${this.skipLabel ?? 'Skip'}
</button>
`}
${this.hideBack
? ''
: html`
<button @click=${this.back}>${this.backLabel ?? 'Back'}</button>
`}
<button
@click=${this.next}
class="btn-primary ${this.saving ? 'saving' : ''}"
?disabled=${this.saving}
>
${this.nextLabel ?? 'Next'}
${this.saving ? html`<span class="spinner light"></span>` : ''}
</button>
</div>
`;
}
}
customElements.define('setup-wizard-controls', SetupWizardControls);
43 changes: 43 additions & 0 deletions dt-core/admin/components/setup-wizard-details.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
html,
css,
} from 'https://cdn.jsdelivr.net/gh/lit/[email protected]/all/lit-all.min.js';
import { OpenLitElement } from './setup-wizard-open-element.js';

export class SetupWizardDetails extends OpenLitElement {
static styles = [
css`
:host {
display: block;
}
`,
];

static get properties() {
return {
step: { type: Object },
firstStep: { type: Boolean },
};
}

back() {
this.dispatchEvent(new CustomEvent('back'));
}
next() {
this.dispatchEvent(new CustomEvent('next'));
}

render() {
return html`
<div class="step-layout">
<div class="content">Sort out details here</div>
<setup-wizard-controls
?hideBack=${this.firstStep}
@next=${this.next}
@back=${this.back}
></setup-wizard-controls>
</div>
`;
}
}
customElements.define('setup-wizard-details', SetupWizardDetails);
64 changes: 64 additions & 0 deletions dt-core/admin/components/setup-wizard-intro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { html } from 'https://cdn.jsdelivr.net/gh/lit/[email protected]/all/lit-all.min.js';
import { OpenLitElement } from './setup-wizard-open-element.js';

export class SetupWizardIntro extends OpenLitElement {
static get properties() {
return {
step: { type: Object },
};
}

back() {
this.dispatchEvent(new CustomEvent('back'));
}
next() {
this.dispatchEvent(new CustomEvent('next'));
}

render() {
return html`
<div class="step-layout">
<h2>Setting up Disciple.Tools for you</h2>
<div class="content stack">
<p>
We're glad you are here, and we want to help set you up so you can take
advantage of the power tool that is Disciple.Tools.
</p>
<p>
Disciple.Tools can be used in many ways from managing connections and
relationships, all the way through to tracking and managing a
movement of Disciple Making.
</p>
<p>
In order to help you, we want to take you through a series of
choices to give you the best start at getting Disciple.Tools setup
ready to suit your needs.
</p>
<p>
<ol>
<li>
We'll choose which parts of the system we want to enable
</li>
<li>
We'll select which plugins we want to install
</li>
<li>
We'll look at some extra setup options
</li>
</ol>
</p>
<p>
Ready? Let's get started.
</p>
</div>
<setup-wizard-controls
hideBack
hideSkip
@next=${this.next}
@back=${this.back}
></setup-wizard-controls>
</div>
`;
}
}
customElements.define('setup-wizard-intro', SetupWizardIntro);
Loading
Loading