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

[WIP] Admin settings screen refactor #396

Closed
wants to merge 9 commits into from

Conversation

joshcanhelp
Copy link
Contributor

@joshcanhelp joshcanhelp commented Feb 14, 2018

EDIT: Breaking this up into smaller components for review

Large refactor for wp-admin settings screen to improve the code, add missing translations, rewrite settings descriptions, and other minor improvements. Complete list:

  • Generic functions to output settings field HTML in WP_Auth0_Admin_Generic
  • Generic functions to output dashboard and docs site links
  • Rewrote all settings descriptions and fixed documentation links
  • Persistent tab on settings screen (return to where you were when saving/refreshing)
  • Removed duplicate wp-admin notices for missing information
  • Rewrote delete JWKS cache JS functionality and moved to existing external JS file
  • Generic JS functionality to hide settings fields based on switch on/off
  • Removed unnecessary Audience settings field
  • Fixed Gravatar integration switch

…ror when not connected; default option reordering; simplifying render_a0_switch; adding render_text_field, render_radio_button, render_field_description, get_dashboard_link; refactoring WP_Auth0_Admin_Basic render functions
… adding and working in get_docs_link; tweaks to render_text_field; adding render_textarea_field
… management; renamed render_a0_switch -> render_switch; added render_social_key_field
…in tab; removing API audience field; settings field description editing, link checking; fixing Gravatar integration; reverting Dashboard removal to put in a different PR
@joshcanhelp joshcanhelp added CH: Fixed and removed WIP labels Mar 7, 2018
@joshcanhelp joshcanhelp changed the title [WIP] Admin settings screen refactor Admin settings screen refactor Mar 7, 2018
@joshcanhelp joshcanhelp self-assigned this Mar 20, 2018
@@ -51,12 +51,8 @@ public static function get_connect_info( $opt = '' ) {
'client_secret_encoded' => $a0_options->get( 'client_secret_b64_encoded' ),
'connection' => $a0_options->get( 'db_connection_name' ),
'app_token' => $a0_options->get( 'auth0_app_token' ),
'audience' => $a0_options->get( 'api_audience' ),
'audience' => self::get_endpoint( 'api/v2/' ),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for the Management API and the audience for that can't be changed so no reason to have it be editable

* Default settings when plugin is installed or reset
*
* @return array
*/
protected function defaults() {
return array(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grouping by settings page tab, reordering by actual field order displayed

wp_enqueue_style( 'wpa0_bootstrap', WPA0_PLUGIN_URL . 'assets/bootstrap/css/bootstrap.min.css' );
wp_enqueue_script( 'wpa0_bootstrap', WPA0_PLUGIN_URL . 'assets/bootstrap/js/bootstrap.min.js' );
wp_enqueue_style( 'wpa0_admin_initial_settup', WPA0_PLUGIN_URL . 'assets/css/initial-setup.css' );
wp_enqueue_script(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding version numbers to act as cache breakers when needed. Otherwise the WP version is used.

}
}

public function cant_connect_to_auth0() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were multiple "no ready to handle login" messages, combined these into 1

) );
}

protected function validate_required_api_scopes() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An API token is not required, should not throw an admin error if missing

@@ -159,20 +146,6 @@ public function input_validator( $input ) {
return $input;
}

public function create_account_message() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were multiple "no ready to handle login" messages, combined these into 1

array( 'id' => 'wpa0_auth0_server_domain', 'name' => 'Auth0 server domain', 'function' => 'render_auth0_server_domain' ),
array( 'id' => 'wpa0_metrics', 'name' => 'Anonymous data', 'function' => 'render_metrics' ),

array( 'id' => 'wpa0_verified_email',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reordered, changed titles, and adjusted for line length. The reordering and title changes made for a big replace block in the diff here so just went ahead and reformatted also.

@joshcanhelp joshcanhelp force-pushed the fixed-admin-settings-screen branch 2 times, most recently from 7c7f119 to a14ea9d Compare March 25, 2018 12:59
…ess method to old code, will be addressed in another branch
@joshcanhelp joshcanhelp changed the title Admin settings screen refactor [WIP] Admin settings screen refactor Mar 25, 2018
joshcanhelp added a commit that referenced this pull request Mar 26, 2018
Admins settings have confusing wording, inconsistent behavior, and
broken links and translation. This first PR refactors the description
system to be more straight-forward, adds HTML generation functions for
consistent field outputs (used in future commits), and fixes a few
other minor issues.

First of a few smaller PRs to replace #396
joshcanhelp added a commit that referenced this pull request Mar 26, 2018
Admins settings have confusing wording, inconsistent behavior, and
broken links and translation. This first PR refactors the description
system to be more straight-forward, adds HTML generation functions for
consistent field outputs (used in future commits), adds settings page
description translation, and fixes a few other minor code issues.

First of a few smaller PRs to replace #396
joshcanhelp added a commit that referenced this pull request Mar 26, 2018
Admins settings have confusing wording, inconsistent behavior, and
broken links and translation. This first PR refactors the description
system to be more straight-forward, adds HTML generation functions for
consistent field outputs (used in future commits), adds settings page
description translation, and fixes a few other minor code issues.

First of a few smaller PRs to replace #396
joshcanhelp added a commit that referenced this pull request Mar 27, 2018
Admins settings have confusing wording, inconsistent behavior, and
broken links and translation. This first PR refactors the description
system to be more straight-forward, adds HTML generation functions for
consistent field outputs (used in future commits), adds settings page
description translation, and fixes a few other minor code issues.

First of a few smaller PRs to replace #396
joshcanhelp added a commit that referenced this pull request Apr 13, 2018
Admins settings have confusing wording, inconsistent behavior, and
broken links and translation. This first PR refactors the description
system to be more straight-forward, adds HTML generation functions for
consistent field outputs (used in future commits), adds settings page
description translation, and fixes a few other minor code issues.

First of a few smaller PRs to replace #396
@joshcanhelp
Copy link
Contributor Author

Parsed into several smaller PRs

@joshcanhelp joshcanhelp deleted the fixed-admin-settings-screen branch April 20, 2018 17:11
@joshcanhelp joshcanhelp removed this from the 3.6.0 milestone Jun 4, 2018
joshcanhelp added a commit that referenced this pull request Jun 5, 2018
Admins settings have confusing wording, inconsistent behavior, and
broken links and translation. This first PR refactors the description
system to be more straight-forward, adds HTML generation functions for
consistent field outputs (used in future commits), adds settings page
description translation, and fixes a few other minor code issues.

First of a few smaller PRs to replace #396
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant