Merge branch 'master' of https://github.com/tainacan/tainacan
This commit is contained in:
commit
00584c08e4
|
@ -12,4 +12,7 @@ src/vendor
|
||||||
node_modules
|
node_modules
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
src/assets/web-components.js
|
src/assets/web-components.js
|
||||||
last-js-build.md5
|
last-js-build.md5
|
||||||
|
src/admin/scss/.sass-cache
|
||||||
|
src/assets/css/tainacan-admin.css
|
||||||
|
src/assets/css/tainacan-admin.css.map
|
|
@ -12,5 +12,9 @@ cd src/scss
|
||||||
|
|
||||||
sass -E 'UTF-8' style.scss:../style.css
|
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!"
|
echo "Compilação do Sass Concluído!"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -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>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -24,3 +24,8 @@ $Tainacan_Dev_interface = new \Tainacan\DevInterface\DevInterface();
|
||||||
function tnc_enable_dev_wp_interface() {
|
function tnc_enable_dev_wp_interface() {
|
||||||
return defined('TNC_ENABLE_DEV_WP_INTERFACE') && true === TNC_ENABLE_DEV_WP_INTERFACE ? true : false;
|
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();
|
Loading…
Reference in New Issue