Skip to content

Commit

Permalink
complete frontend view with custom rewrites
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbir1991 committed Nov 13, 2017
1 parent 7de7db7 commit 075bffc
Show file tree
Hide file tree
Showing 15 changed files with 283 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = function(grunt) {
sourceMapRootpath: '../../'
},
files: {
'<%= dirs.css %>/style.css': '<%= dirs.less %>/style.less'
'<%= dirs.css %>/frontend.css': '<%= dirs.less %>/frontend/style.less'
}
}
},
Expand All @@ -45,7 +45,7 @@ module.exports = function(grunt) {

watch: {
less: {
files: '<%= dirs.less %>/*.less',
files: '<%= dirs.less %>/**/*.less',
tasks: ['less:core']
}
},
Expand Down
34 changes: 34 additions & 0 deletions assets/css/frontend.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.wpsm-content-wrap {
display: flex;
}
.wpsm-content-wrap ul.wpsm-side-nav {
float: left;
flex: 1;
margin: 0 20px 0 0 ;
padding: 0;
background: #fafafa;
}
.wpsm-content-wrap ul.wpsm-side-nav li {
list-style: none;
padding: 0;
margin: 0;
border-bottom: 1px solid #eee;
}
.wpsm-content-wrap ul.wpsm-side-nav li.active {
background: #eee;
}
.wpsm-content-wrap ul.wpsm-side-nav li a {
display: block;
text-decoration: none;
padding: 8px 15px;
color: #222;
}
.wpsm-content-wrap ul.wpsm-side-nav li a:hover {
background: #eee;
}
.wpsm-content-wrap .wpsm-content {
flex: 3;
}
.wpsm-content-wrap .wpsm-content .wpsm-content-article {
border-bottom: none;
}
Empty file removed assets/css/style.css
Empty file.
42 changes: 42 additions & 0 deletions assets/less/frontend/general.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.wpsm-content-wrap {
display: flex;

ul.wpsm-side-nav {
float: left;
flex: 1;
margin: 0 20px 0 0 ;
padding: 0;
background: #fafafa;

li {
list-style: none;
padding: 0;
margin: 0;
border-bottom: 1px solid #eee;

&.active {
background: #eee;
}

a {
display: block;
text-decoration: none;
padding: 8px 15px;
color: #222;


&:hover {
background: #eee;
}
}
}
}

.wpsm-content {
flex: 3;

.wpsm-content-article {
border-bottom: none;
}
}
}
1 change: 1 addition & 0 deletions assets/less/frontend/style.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "general.less";
Empty file removed assets/less/style.less
Empty file.
7 changes: 3 additions & 4 deletions includes/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ public function load_support_dashboard_shortcodes() {
ob_start();

if ( isset( $wp->query_vars['tickets'] ) ) {

wpsm_get_template( 'tickets/tickets.php' );
return ob_get_clean();
}

if ( isset( $wp->query_vars['add-new-tickets'] ) ) {
echo 'lorem for add new tickets';
if ( isset( $wp->query_vars['add-new-ticket'] ) ) {
wpsm_get_template( 'tickets/add-new-ticket.php' );
return ob_get_clean();
}

if ( isset( $wp->query_vars['page'] ) ) {
// error_log( print_r( 'doasboar', true ) );
wpsm_get_template( 'dashboard/dashboard.php' );
return ob_get_clean();
}
Expand Down
2 changes: 1 addition & 1 deletion includes/class-rewrites.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct() {
function register_rule() {
$this->query_vars = apply_filters( 'wpsm_query_var_filter', array(
'tickets',
'add-new-tickets',
'add-new-ticket',
) );

foreach ( $this->query_vars as $var ) {
Expand Down
22 changes: 22 additions & 0 deletions includes/class-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,26 @@ public function __construct() {
public function register_scripts() {

}

/**
* Load admin scripts
*
* @since 1.0.0
*
* @return void
*/
public function load_admin_scripts( $value='' ) {
# code...
}

/**
* Load frontend scripts
*
* @since 1.0.0
*
* @return void
*/
public function load_frontend_scripts() {
wp_enqueue_style( 'wpsm-frontend', WP_SUPPORT_MANAGER_ASSETS . '/css/frontend.css', array(), false, false );
}
}
13 changes: 5 additions & 8 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,23 @@ function wpsm_get_nav_url( $slug = '' ) {
* @return void
*/
function wpsm_get_dashboard_nav() {

return apply_filters( 'wpsm_get_dashboard_nav', array(
array(
'overview' => array(
'title' => __( 'Overview', 'wp-support-manager' ),
'icon' => '',
'url' => wpsm_get_nav_url()
),

array(
'tickets' => array(
'title' => __( 'All Tickets', 'wp-support-manager' ),
'icon' => '',
'url' => wpsm_get_nav_url( 'tickets' )
),

array(
'title' => __( 'Add New Tickets', 'wp-support-manager' ),
'add-new-ticket' => array(
'title' => __( 'Add New Ticket', 'wp-support-manager' ),
'icon' => '',
'url' => wpsm_get_nav_url( 'add-new-tickets' )
'url' => wpsm_get_nav_url( 'add-new-ticket' )
)

) );

}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "woocommerce-customer-support",
"name": "wp-support-manager",
"version": "1.0.0",
"slug": "wc-customer-support",
"description": "A fully customer support system for WooCommerce",
"slug": "wp-support-manager",
"description": "A fully customer support system for WordPress",
"author": "Sabbir Ahmed",
"license": "GPL",
"private": true,
Expand Down
39 changes: 33 additions & 6 deletions templates/global/side-nav.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
<ul>
<li><a href="#">Dashboard</a></li>
<li><a href="#">Tickets</a></li>
<li><a href="#">Add new</a></li>
<li><a href="#">Settings</a></li>
</ul>
<?php
/**
* Side navigation template
*
* @since 1.0.0
*
* @package wp-support-manager
*/

global $wp;

$navigations = wpsm_get_dashboard_nav();
$request = $wp->request;
$active = explode('/', $request );

unset( $active[0] );

if ( $active ) {
$active_menu = implode( '/', $active );
} else {
$active_menu = 'overview';
}

?>
<ul class="wpsm-side-nav">

<?php foreach ( $navigations as $key => $nav ): ?>

<li class="<?php echo ( $key == $active_menu ) ? 'active' : ''; ?>"><a href="<?php echo $nav['url'] ?>" class=""><span class="fa <?php echo $nav['icon'] ?>"></span> <?php echo $nav['title'] ?></a></li>

<?php endforeach ?>

</ul>
68 changes: 68 additions & 0 deletions templates/tickets/add-new-ticket.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* Dokan Dashboard Template
*
* Dokan Main Dahsboard template for Fron-end
*
* @since 2.4
*
* @package dokan
*/
?>
<div class="wpsm-content-wrap">
<?php

/**
* wpsm_content_before hook
*
* @hooked get_dashboard_side_navigation
*
* @since 2.4
*/
wpsm_get_template( 'global/side-nav.php' );
?>

<div class="wpsm-content">

<?php

/**
* wpsm_content_inside_before hook
*
* @hooked show_seller_dashboard_notice
*
* @since 2.4
*/
do_action( 'wpsm_content_inside_before' );
?>

<article class="wpsm-content-article">

<p>Add new tickets</p>

</article><!-- .dashboard-content-area -->

<?php

/**
* wpsm_content_inside_after hook
*
* @since 2.4
*/
do_action( 'wpsm_content_inside_after' );
?>


</div><!-- .wpsm-content -->

<?php

/**
* wpsm_content_after hook
*
* @since 2.4
*/
do_action( 'wpsm_content_after' );
?>

</div><!-- .wpsm-content-wrap -->
68 changes: 68 additions & 0 deletions templates/tickets/tickets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* Dokan Dashboard Template
*
* Dokan Main Dahsboard template for Fron-end
*
* @since 2.4
*
* @package dokan
*/
?>
<div class="wpsm-content-wrap">
<?php

/**
* wpsm_content_before hook
*
* @hooked get_dashboard_side_navigation
*
* @since 2.4
*/
wpsm_get_template( 'global/side-nav.php' );
?>

<div class="wpsm-content">

<?php

/**
* wpsm_content_inside_before hook
*
* @hooked show_seller_dashboard_notice
*
* @since 2.4
*/
do_action( 'wpsm_content_inside_before' );
?>

<article class="wpsm-content-article">

<p>List all tickets</p>

</article><!-- .dashboard-content-area -->

<?php

/**
* wpsm_content_inside_after hook
*
* @since 2.4
*/
do_action( 'wpsm_content_inside_after' );
?>


</div><!-- .wpsm-content -->

<?php

/**
* wpsm_content_after hook
*
* @since 2.4
*/
do_action( 'wpsm_content_after' );
?>

</div><!-- .wpsm-content-wrap -->
1 change: 1 addition & 0 deletions wp-support-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ public function init_classes() {
new WPSM_Frontend();
}

$this->container['scripts'] = new WPSM_Scripts();
}

/**
Expand Down

0 comments on commit 075bffc

Please sign in to comment.