Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
* Use namespaces for classes.
* Improve the function conditionality for the page action.
  • Loading branch information
Jack-Dane committed Dec 5, 2023
1 parent 154dba4 commit 9469f33
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion admin/menu_items.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

include("pageHelpers/table_display.php");
include("table_display.php");
include("pages/page_router.php");
include("pages/forms/odoo_form.php");
include("pages/connections/odoo_connection.php");
Expand Down
3 changes: 3 additions & 0 deletions admin/pages/connections/odoo_connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use odoo_conn\admin\api\endpoints\OdooConnPutOdooConnection;
use odoo_conn\encryption\OdooConnEncryptionFileHandler;
use odoo_conn\encryption\OdooConnEncryptionHandler;
use odoo_conn\admin\pages\page_router\OdooConnPageRouterCreate;
use odoo_conn\admin\table_display\OdooConnCustomTableEditableDisplay;

use function odoo_conn\admin\api\endpoints\odoo_conn_test_odoo_connection;


Expand Down
2 changes: 2 additions & 0 deletions admin/pages/errors/odoo_errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use odoo_conn\admin\api\endpoints\OdooConnGetOdooErrors;
use odoo_conn\admin\api\endpoints\OdooConnDeleteOdooErrors;
use odoo_conn\admin\pages\page_router\OdooConnPageRouter;
use odoo_conn\admin\table_display\OdooConnCustomTableDeletableDisplay;


class OdooConnOdooErrorsListTableEditable extends OdooConnCustomTableDeletableDisplay
Expand Down
2 changes: 2 additions & 0 deletions admin/pages/form_mappings/odoo_form_mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use odoo_conn\admin\api\endpoints\OdooConnPostOdooFormMappings;
use odoo_conn\admin\api\endpoints\OdooConnGetOdooFormMappingSingle;
use odoo_conn\admin\api\endpoints\OdooConnPutOdooFormMappings;
use odoo_conn\admin\pages\page_router\OdooConnPageRouterCreate;
use odoo_conn\admin\table_display\OdooConnCustomTableEditableDisplay;


class OdooConnOdooFormMappingListTableEditable extends OdooConnCustomTableEditableDisplay
Expand Down
2 changes: 2 additions & 0 deletions admin/pages/forms/odoo_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use odoo_conn\admin\api\endpoints\OdooConnPostOdooForm;
use odoo_conn\admin\api\endpoints\OdooConnGetOdooFormSingle;
use odoo_conn\admin\api\endpoints\OdooConnPutOdooForm;
use odoo_conn\admin\pages\page_router\OdooConnPageRouterCreate;
use odoo_conn\admin\table_display\OdooConnCustomTableEditableDisplay;


class OdooConnOdooFormListTableEditable extends OdooConnCustomTableEditableDisplay
Expand Down
7 changes: 5 additions & 2 deletions admin/pages/page_router.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

namespace odoo_conn\admin\pages\page_router;


abstract class OdooConnPageRouter
{

Expand Down Expand Up @@ -66,14 +69,14 @@ protected function dont_display_table_actions()

protected function handle_route($action)
{
parent::handle_route($action);

if ($action === "new") {
$this->add_form_style();
$this->display_input_form();
} else if ($action === "edit") {
$this->add_form_style();
$this->display_edit_form($_REQUEST["id"]);
} else {
parent::handle_route($action);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php

namespace odoo_conn\admin\table_display;


use WP_List_Table;


if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
Expand Down

0 comments on commit 9469f33

Please sign in to comment.