Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Commit

Permalink
chore(admin-pages): create two admin pages [WIP]
Browse files Browse the repository at this point in the history
fixes #53
  • Loading branch information
Eduardo Campaña committed Nov 20, 2018
1 parent f23b19d commit ab976e0
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 101 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.env.local
dist
File renamed without changes
3 changes: 3 additions & 0 deletions admin/frontity-settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

<div>Settings</div>

49 changes: 0 additions & 49 deletions assets/css/wp-pwa-plugin.css

This file was deleted.

23 changes: 18 additions & 5 deletions frontity.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php
/*
Plugin Name: WordPress PWA
Plugin Name: Frontity
Plugin URI: https://wordpress.org/plugins/wordpress-pwa/
Description: WordPress plugin to turn WordPress blogs into Progressive Web Apps.
Version: 1.8.0
Author: WordPress PWA
Author: Frontity
Author URI:
License: GPL v3
Copyright: Worona Labs SL
Expand Down Expand Up @@ -482,7 +482,7 @@ public function register_wp_pwa_styles($hook) {
* Register and enqueue scripts.
*/
public function register_wp_pwa_scripts($hook) {
wp_register_script('frontity_admin_js',plugin_dir_url(__FILE__) . 'admin/frontity-admin.js', array('jquery'), $this->plugin_version, true);
wp_register_script('frontity_admin_js',plugin_dir_url(__FILE__) . 'admin/dist/frontity-admin.js', array('jquery'), $this->plugin_version, true);
wp_enqueue_script('frontity_admin_js');
}

Expand All @@ -500,18 +500,27 @@ public function register_wp_pwa_scripts($hook) {
* @return N/A
*/
function wp_pwa_admin_actions() {
$icon_url = trailingslashit(plugin_dir_url( __FILE__ )) . "assets/frontity_20x20.png";
$icon_url = trailingslashit(plugin_dir_url( __FILE__ )) . "admin/assets/frontity_20x20.png";
$position = 64.999989; //Right before the "Plugins"

add_menu_page(
'Frontity - Admin',
'Frontity',
'Frontity',
1,
'frontity-admin',
array($this, 'render_frontity_admin'),
$icon_url,
$position
);

add_submenu_page(
'frontity-admin',
'Frontity - Settings',
'Settings',
1,
'frontity-settings',
array($this, 'render_frontity_settings')
);
}

/*
Expand All @@ -532,6 +541,10 @@ function render_frontity_admin() {
include('admin/frontity-admin.php');
}

function render_frontity_settings() {
include('admin/frontity-settings.php');
}

function get_wp_pwa_site_id() {
$settings = get_option('wp_pwa_settings');

Expand Down
96 changes: 50 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"husky": "^1.0.0",
"replace-in-file": "^3.4.2",
"semantic-release": "^15.9.16",
"semantic-release-cli": "^4.0.9",
"semantic-release-cli": "^4.0.10",
"simple-git": "^1.102.0",
"webpack": "^4.25.0",
"webpack-cli": "^3.1.2"
Expand Down

0 comments on commit ab976e0

Please sign in to comment.