First works on enqueuing necessary js an css for roles section for admin panel. #274.

This commit is contained in:
Mateus Machado Luna 2019-11-19 12:46:38 -03:00
parent c62c2574ef
commit 03ac5d2980
8 changed files with 90 additions and 10 deletions

View File

@ -13,25 +13,27 @@ sass -E 'UTF-8' --cache-location .tmp/sass-cache-1 src/scss/tainacan-embeds.scss
sass -E 'UTF-8' --cache-location .tmp/sass-cache-2 src/admin/scss/tainacan-admin.scss:src/assets/css/tainacan-admin.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-3 src/gutenberg-blocks/tainacan-collections/collections-list/collections-list.scss:src/assets/css/tainacan-gutenberg-block-collections-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-3 src/admin/scss/tainacan-roles.scss:src/assets/css/tainacan-roles.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-4 src/gutenberg-blocks/tainacan-collections/carousel-collections-list/carousel-collections-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-collections-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-4 src/gutenberg-blocks/tainacan-collections/collections-list/collections-list.scss:src/assets/css/tainacan-gutenberg-block-collections-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-5 src/gutenberg-blocks/tainacan-items/items-list/items-list.scss:src/assets/css/tainacan-gutenberg-block-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-5 src/gutenberg-blocks/tainacan-collections/carousel-collections-list/carousel-collections-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-collections-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-6 src/gutenberg-blocks/tainacan-items/dynamic-items-list/dynamic-items-list.scss:src/assets/css/tainacan-gutenberg-block-dynamic-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-6 src/gutenberg-blocks/tainacan-items/items-list/items-list.scss:src/assets/css/tainacan-gutenberg-block-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-7 src/gutenberg-blocks/tainacan-items/search-bar/search-bar.scss:src/assets/css/tainacan-gutenberg-block-search-bar.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-7 src/gutenberg-blocks/tainacan-items/dynamic-items-list/dynamic-items-list.scss:src/assets/css/tainacan-gutenberg-block-dynamic-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-8 src/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-8 src/gutenberg-blocks/tainacan-items/search-bar/search-bar.scss:src/assets/css/tainacan-gutenberg-block-search-bar.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-9 src/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-10 src/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss:src/assets/css/tainacan-gutenberg-block-terms-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-10 src/gutenberg-blocks/tainacan-items/carousel-items-list/carousel-items-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-items-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-11 src/gutenberg-blocks/tainacan-facets/facets-list/facets-list.scss:src/assets/css/tainacan-gutenberg-block-facets-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-11 src/gutenberg-blocks/tainacan-terms/terms-list/terms-list.scss:src/assets/css/tainacan-gutenberg-block-terms-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-12 src/gutenberg-blocks/tainacan-terms/carousel-terms-list/carousel-terms-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-12 src/gutenberg-blocks/tainacan-facets/facets-list/facets-list.scss:src/assets/css/tainacan-gutenberg-block-facets-list.css
sass -E 'UTF-8' --cache-location .tmp/sass-cache-13 src/gutenberg-blocks/tainacan-terms/carousel-terms-list/carousel-terms-list.scss:src/assets/css/tainacan-gutenberg-block-carousel-terms-list.css
echo "Compilação do Sass Concluído!"
exit 0

View File

@ -51,7 +51,19 @@ class Admin {
array( &$this, 'systemcheck_page' )
);
// We must get correct edit roles cap latter
$roles_cap = $dummyEntity->get_capabilities()->edit_posts;
$roles_page_suffix = add_submenu_page(
$this->menu_slug,
__('Roles', 'tainacan'),
__('Roles', 'tainacan'),
$roles_cap,
'tainacan_roles',
array( &$this, 'roles_page' )
);
add_action( 'load-' . $page_suffix, array( &$this, 'load_admin_page' ) );
add_action( 'load-' . $roles_page_suffix, array( &$this, 'load_roles_page' ) );
}
function load_admin_page() {
@ -60,6 +72,10 @@ class Admin {
add_action( 'admin_enqueue_scripts', array(&$this, 'add_theme_files') );
}
function load_roles_page() {
add_action( 'roles_enqueue_scripts', array( &$this, 'add_roles_css' ), 90 );
add_action( 'roles_enqueue_scripts', array( &$this, 'add_roles_js' ), 90 );
}
function login_styles_reset( $style ) {
if ( strpos( $style, 'wp-admin-css' ) !== false ) {
@ -82,6 +98,27 @@ class Admin {
wp_enqueue_script('underscore');
}
function add_roles_css() {
global $TAINACAN_BASE_URL;
wp_enqueue_style( 'tainacan-roles-page', $TAINACAN_BASE_URL . '/assets/css/tainacan-roles.css', [], TAINACAN_VERSION );
}
function add_roles_js() {
global $TAINACAN_BASE_URL;
wp_enqueue_script( 'tainacan-roles', $TAINACAN_BASE_URL . '/assets/roles-components.js', [], TAINACAN_VERSION, true );
do_action('tainacan-enqueue-roles-scripts');
}
function roles_page() {
global $TAINACAN_BASE_URL;
// TODO move it to a separate file and start the Vue project
echo "<div id='tainacan-roles-app'></div>";
}
function add_admin_css() {
global $TAINACAN_BASE_URL;
@ -341,6 +378,5 @@ class Admin {
$check = new System_Check();
$check->admin_page();
}
}

View File

@ -0,0 +1,11 @@
import Vue from 'vue';
import store from '../../js/store/store';
import router from './router';
import RolesPage from '../roles.vue';
new Vue({
el: '#tainacan-roles-app',
store,
router,
render: h => h(RolesPage)
});

20
src/admin/roles.vue Normal file
View File

@ -0,0 +1,20 @@
<template>
<div id="tainacan-roles-app">
{{ pageTitle }}
</div>
</template>
<script>
export default {
name: "RolesPage",
data() {
return {
pageTitle: 'Roles'
}
}
}
</script>
<style lang="scss">
</style>

View File

View File

@ -0,0 +1,3 @@
/*# sourceMappingURL=tainacan-roles.css.map */

View File

@ -0,0 +1,7 @@
{
"version": 3,
"mappings": "",
"sources": [],
"names": [],
"file": "tainacan-roles.css"
}

View File

@ -7,6 +7,7 @@ module.exports = {
entry: {
user_search: './src/admin/js/theme-main.js',
user_admin: './src/admin/js/main.js',
roles: './src/admin/js/main-roles.js',
gutenberg_terms_list: './src/gutenberg-blocks/tainacan-terms/terms-list/index.js',