This commit is contained in:
weryques 2018-01-19 12:56:05 -02:00
commit 00584c08e4
5 changed files with 76 additions and 1 deletions

3
.gitignore vendored
View File

@ -13,3 +13,6 @@ node_modules
npm-debug.log
src/assets/web-components.js
last-js-build.md5
src/admin/scss/.sass-cache
src/assets/css/tainacan-admin.css
src/assets/css/tainacan-admin.css.map

View File

@ -12,5 +12,9 @@ cd src/scss
sass -E 'UTF-8' style.scss:../style.css
cd ../admin/scss
sass -E 'UTF-8' tainacan-admin.scss:../../assets/css/tainacan-admin.css
echo "Compilação do Sass Concluído!"
exit 0

View File

@ -0,0 +1,48 @@
<?php
namespace Tainacan;
class Admin {
private $menu_slug = 'tainacan_admin';
public function __construct() {
add_action( 'admin_menu', array(&$this, 'add_admin_menu') );
add_filter( 'admin_body_class', array(&$this, 'admin_body_class') );
}
function add_admin_menu() {
$page_suffix = add_menu_page( __('Tainacan', 'tainacan'), __('Tainacan', 'tainacan'), 'edit_posts', $this->menu_slug, array(&$this, 'admin_page') );
add_action( 'load-' . $page_suffix, array(&$this, 'load_admin_page'));
}
function load_admin_page() {
add_action( 'admin_enqueue_scripts', array(&$this, 'add_admin_css') );
}
function add_admin_css() {
global $TAINACAN_BASE_URL;
wp_enqueue_style('tainacan-admin-page', $TAINACAN_BASE_URL . '/assets/css/tainacan-admin.css' );
}
function admin_body_class($classes) {
global $pagenow;
if ($pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page'] == $this->menu_slug) {
$classes .= ' tainacan-admin-page';
}
return $classes;
}
function admin_page() {
// TODO move it to a separate file and start the Vue project
echo "<div id='tainacan-admin-app'>Here we go!</div>";
}
}

View File

@ -0,0 +1,15 @@
body.tainacan-admin-page #adminmenumain {
display: none;
}
#tainacan-admin-app {
background: #fff;
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
z-index: 99999999999;
}

View File

@ -24,3 +24,8 @@ $Tainacan_Dev_interface = new \Tainacan\DevInterface\DevInterface();
function tnc_enable_dev_wp_interface() {
return defined('TNC_ENABLE_DEV_WP_INTERFACE') && true === TNC_ENABLE_DEV_WP_INTERFACE ? true : false;
}
// TODO move it somewhere else?
require_once('admin/class-tainacan-admin.php');
global $Tainacan_Admin;
$Tainacan_Admin = new \Tainacan\Admin();