Skip to content

Commit

Permalink
Merge pull request #6 from jdmdigital/develop
Browse files Browse the repository at this point in the history
Production-Ready
  • Loading branch information
jdmdigital committed Apr 27, 2016
2 parents 6072b33 + 8050f52 commit 313851b
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 24 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ The plugin is still in BETA, but you're welcome to take a look at how it's comin

## Changelog

**1.0**
* Production-Ready
* Several Bug Fixes
* Better Touch-enabled Device Support
* Version Bump

**0.9**
* Updated CSS, JS

**0.8**
* new customizer link added
* version Bump

**0.7**
* Test if Bootstrap enqueued
* jdm-fab.css file updated
* add support for genericons and fontawesome
* Version Bump

**0.6**
* First well-tested version
* version Bump
Expand Down
19 changes: 12 additions & 7 deletions css/jdm-fab.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* JDM FAB Styles */
.no-js #hide-admin-buttons{display:none;}

/* in case no Bootstrap - since v0.7 */
/* in case of no Bootstrap - since v0.7 */
.no-bs .btn{ opacity:0.8; -moz-user-select: none; -webkit-user-select:none; -ms-user-select: none; background-image: none; border-radius: 4px; cursor: pointer; font-size: 16px; line-height:22px; font-weight: normal; padding: 6px 12px; vertical-align: middle; white-space: nowrap; text-transform:none; letter-spacing:normal;}
.no-bs a.btn:hover{opacity:1;}
.no-bs .btn .genericon{font-size:22px; line-height:22px; vertical-align:middle;}
Expand All @@ -9,22 +10,26 @@
.no-bs .btn-info { background-color: #5bc0de; border-color: #46b8da; color: #fff;}
.no-bs .btn-primary { background-color: #007acc; border-color: #0171bc; color: #fff;}
.no-bs .btn-danger { background-color: #d9534f; border-color: #d43f3a; color: #fff;}
.no-bs .btn-warning{ opacity:1; background-color: #EC971F; border-color: #EC971F; color: #fff;}

.no-bs .btn-default:hover, .no-bs .btn-default:focus { opacity:1; background-color: #f1f1f1; border-color: #999; color: #222;}
.no-bs .btn-info:hover, .no-bs .btn-info:focus { opacity:1; background-color: #46b8da; border-color: #46b8da; color: #fff;}
.no-bs .btn-primary:hover, .no-bs .btn-primary:focus { opacity:1; background-color: #0171bc; border-color: #0171bc; color: #fff;}
.no-bs .btn-danger:hover, .no-bs .btn-danger:focus { opacity:1; background-color: #d43f3a; border-color: #d43f3a; color: #fff;}
.no-bs .btn-warning:hover, .no-bs .btn-warning:focus { opacity:1; background-color: #EC971F; border-color: #EC971F; color: #fff;}

/* general styles */
.jdm-fab{width:170px; position:fixed; top:60px; right:0; opacity:0.7;-webkit-transition: all 300ms ease; -moz-transition: all 300ms ease;-ms-transition: all 300ms ease;-o-transition: all 300ms ease;transition: all 300ms ease;}

.home .jdm-fab{ top:105px;}
.jdm-fab:hover{-webkit-transition: all 300ms ease; -moz-transition: all 300ms ease;-ms-transition: all 300ms ease;-o-transition: all 300ms ease;transition: all 300ms ease;}
.jdm-fab{-webkit-transition: all 300ms ease; -moz-transition: all 300ms ease;-ms-transition: all 300ms ease;-o-transition: all 300ms ease;transition: all 300ms ease;}
.admin-btns-wrapper .btn{font-family:"Open Sans",sans-serif; margin-bottom:2px; margin-right:0; text-align:left; line-height:2; border-top-right-radius:0; border-bottom-right-radius:0;}
.admin-btns-wrapper .btn span{margin-right:15px; margin-left:5px;}

.jdm-fab{opacity:1;-moz-transform: translateX(115px);-webkit-transform: translateX(115px);-o-transform: translateX(115px);-ms-transform: translateX(115px);transform: translateX(115px);}
.jdm-fab:hover, #admin-btns:focus, #admin-btns:active{-moz-transform: translateX(0);-webkit-transform: translateX(0);-o-transform: translateX(0);-ms-transform: translateX(0);transform: translateX(0);}
.jdm-fab, .jdm-fab:hover, .jdm-fab:focus, .jdm-fab:active{-moz-transform: translateX(115px);-webkit-transform: translateX(115px);-o-transform: translateX(115px);-ms-transform: translateX(115px);transform: translateX(115px);}
.jdm-fab.fontawesome {-moz-transform: translateX(125px);-webkit-transform: translateX(125px);-o-transform: translateX(115px);-ms-transform: translateX(125px);transform: translateX(125px);}
.jdm-fab.genericons {-moz-transform: translateX(105px);-webkit-transform: translateX(105px);-o-transform: translateX(105px);-ms-transform: translateX(105px);transform: translateX(105px);}

.jdm-fab.genericons.has-hover, .jdm-fab.fontawesome.has-hover, .jdm-fab.has-hover, .no-js .jdm-fab:hover{opacity:1;-moz-transform: translateX(0);-webkit-transform: translateX(0);-o-transform: translateX(0);-ms-transform: translateX(0);transform: translateX(0);}


/* @since v0.9 */
.jdm-fab.fontawesome {-moz-transform: translateX(125px);-webkit-transform: translateX(125px);-o-transform: translateX(115px);-ms-transform: translateX(125px);transform: translateX(125px);}
#fab-admin-btns.not-ready{opacity:0;}
25 changes: 12 additions & 13 deletions jdm-frontend-admin-buttons.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/**
* Plugin Name: JDM Frontend Admin Buttons
* Plugin URI: https://github.com/jdmdigital/jdm-frontend-admin-buttons/
* Plugin URI: http://labs.jdmdigital.co/code/frontend-admin-buttons/
* Description: JDM Frontend Admin Buttons is a lightweight WordPress plugin that hides the default Admin Bar and replaces it with out of the way, contextually-aware, floating buttons for basic admin tasks.
* Version: 0.9
* Version: 1.0
* Author: JDM Digital
* Author URI: http://jdmdigital.co
* License: GPLv2 or later
Expand Down Expand Up @@ -59,7 +59,7 @@ function jdm_edit_with_vc(){
$vcEditlink = $adminURL.'post.php?vc_action=vc_inline&amp;post_id='.$id.'&amp;post_type='.$type;

if($vc) {
return '<a href="'.$vcEditlink.'" class="btn btn-block btn-warning"><span class="glyphicon glyphicon-fullscreen genericon genericon-maximize"></span> Visual Editor</a>';
return '<a id="fab-vcedit" href="'.$vcEditlink.'" class="btn btn-block btn-warning"><span class="glyphicon glyphicon-fullscreen genericon genericon-maximize"></span> Visual Editor</a>';
}

}
Expand Down Expand Up @@ -110,35 +110,35 @@ function jdmfab_show_admin_buttons() {
if( current_user_can('edit_others_pages') ) {
$adminurl = get_admin_url();

$html = '<div id="fab-admin-btns" class="'.$fabclass.'">';
$html = '<div id="fab-admin-btns" class="not-ready '.$fabclass.'">';
$html .= ' <div class="admin-btns-wrapper">';

// Several If/else statements here to make sure these look good.
$html .= ' <button id="hide-admin-buttons" type="button" class="btn btn-block btn-default"><span class="'.$icon_prefix.' '.$icon_close.'"></span> Hide Btns</button>';

if(is_page()) {
$html .= ' <a href="'. get_edit_post_link().'" class="btn btn-block btn-info"><span class="'.$icon_prefix.' '.$icon_edit.'"></span> Edit Page</a>';
$html .= ' <a id="fab-page" href="'. get_edit_post_link().'" class="btn btn-block btn-info"><span class="'.$icon_prefix.' '.$icon_edit.'"></span> Edit Page</a>';
} elseif(is_front_page() || is_home()) {
$html .= ' <a href="'. get_edit_post_link().'" class="btn btn-block btn-info"><span class="'.$icon_prefix.' '.$icon_edit.'"></span> Edit Home</a>';
$html .= ' <a id="fab-home" href="'. get_edit_post_link().'" class="btn btn-block btn-info"><span class="'.$icon_prefix.' '.$icon_edit.'"></span> Edit Home</a>';
} elseif(is_single()) {
$html .= ' <a href="'. get_edit_post_link().'" class="btn btn-block btn-info"><span class="'.$icon_prefix.' '.$icon_edit.'"></span> Edit Post</a>';
$html .= ' <a id="fab-post" href="'. get_edit_post_link().'" class="btn btn-block btn-info"><span class="'.$icon_prefix.' '.$icon_edit.'"></span> Edit Post</a>';
} elseif(is_category()) {
$catid = get_query_var('cat');
$html .= ' <a href="'.$adminurl.'edit-tags.php?action=edit&taxonomy=category&tag_ID='.$catid.'&post_type=post" class="btn btn-block btn-info"><span class="'.$icon_prefix.' '.$icon_edit.'"></span> Edit Category</a>';
$html .= ' <a id="fab-cat" href="'.$adminurl.'edit-tags.php?action=edit&taxonomy=category&tag_ID='.$catid.'&post_type=post" class="btn btn-block btn-info"><span class="'.$icon_prefix.' '.$icon_edit.'"></span> Edit Category</a>';
} else {
$html .= ' <a href="'. get_edit_post_link().'" class="btn btn-block btn-info"><span class="'.$icon_prefix.' '.$icon_edit.'"></span> Edit This</a>';
$html .= ' <a id="fab-else" href="'. get_edit_post_link().'" class="btn btn-block btn-info"><span class="'.$icon_prefix.' '.$icon_edit.'"></span> Edit This</a>';
}

if(is_plugin_active('js_composer/js_composer.php')) {
$html .= ' '.jdm_edit_with_vc();
} else {
if ( current_user_can( 'customize' ) ) {
$html .= ' <a href="'. get_admin_url().'customize.php?return='.get_permalink().'" class="btn btn-block btn-warning"><span class="'.$icon_prefix.' '.$icon_customize.'"></span> Customize</a>';
$html .= ' <a id="fab-customize" href="'. get_admin_url().'customize.php?return='.get_permalink().'" class="btn btn-block btn-warning"><span class="'.$icon_prefix.' '.$icon_customize.'"></span> Customize</a>';
}
}

$html .= ' <a href="'. network_admin_url().'" class="btn btn-block btn-primary"><span class="'.$icon_prefix.' '.$icon_admin.'"></span> WP Admin</a>';
$html .= ' <a href="'. wp_logout_url( get_permalink() ).'" class="btn btn-block btn-danger"><span class="'.$icon_prefix.' '.$icon_logout.'"></span> Logout</a>';
$html .= ' <a id="fab-wpadmin" href="'. network_admin_url().'" class="btn btn-block btn-primary"><span class="'.$icon_prefix.' '.$icon_admin.'"></span> WP Admin</a>';
$html .= ' <a id="fab-logout" href="'. wp_logout_url( get_permalink() ).'" class="btn btn-block btn-danger"><span class="'.$icon_prefix.' '.$icon_logout.'"></span> Logout</a>';

$html .= ' </div>';
$html .= '</div>';
Expand All @@ -148,4 +148,3 @@ function jdmfab_show_admin_buttons() {
}
}


55 changes: 54 additions & 1 deletion js/jdm-fab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,58 @@
jQuery( document ).ready(function() {
'use strict';
jQuery('html').on("touchstart", function() {
if(jQuery('.jdm-fab').hasClass('has-hover')) {
jQuery('.jdm-fab').removeClass('has-hover');
}
});

jQuery('#fab-admin-btns').click(function(evt){
evt.stopPropagation();
});

jQuery('.admin-btns-wrapper a').on("touchstart", function (evt) {
if (jQuery('.jdm-fab').hasClass('has-hover')) {
return true;
jQuery('.jdm-fab').removeClass('has-hover');
} else {
jQuery('.jdm-fab').addClass('has-hover');
evt.preventDefault();
return false; //consistent return points
}
});

jQuery('.has-hover a').click( function (evt) {
if (jQuery('.jdm-fab').hasClass('has-hover')) {
return true;
} else {
jQuery('.jdm-fab').addClass('has-hover');
evt.preventDefault();
return false; //consistent return points
}
});

jQuery('.admin-btns-wrapper').hover(function() {
// mouseenter
jQuery('.jdm-fab').addClass('has-hover');
},
function() {
// mouseexit
jQuery('.jdm-fab').removeClass('has-hover');
}
);

jQuery('#hide-admin-buttons').click(function() {
jQuery('#fab-admin-btns').fadeOut();
if (jQuery('.jdm-fab').hasClass('has-hover')) {
jQuery('.jdm-fab').removeClass('has-hover');
//jQuery('#fab-admin-btns').fadeOut();
} else {
jQuery('#fab-admin-btns').fadeOut();
}
});


});

jQuery( window ).load(function() {
jQuery('#fab-admin-btns').removeClass('not-ready');
});
1 change: 1 addition & 0 deletions js/jdm-fab.min.js

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

23 changes: 20 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: jdm-labs
Donate link: http://jdmdigital.co
Tags: administration, admin, frontend, buttons.
Requires at least: 3.0.1
Tested up to: 4.4.2
Tested up to: 4.5.2
Stable tag: 0.9
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand All @@ -13,6 +13,8 @@ JDM Frontend Admin Buttons is a lightweight WordPress plugin that hides the defa
== Description ==
The WordPress admin bar gets in the way of basic frontend management of your WordPress site&mdash;esspecially if you have a fixed main navigation. This simple and VERY light-weight plugin offers floating buttons that are contextually-aware and fixed to one side so they're out of the way.

Learn more on the plugin site: http://labs.jdmdigital.co/code/frontend-admin-buttons/ and view the project on GitHub: https://github.com/jdmdigital/jdm-frontend-admin-buttons

= Vision =
A few goals we had in making this plugin:

Expand All @@ -25,7 +27,7 @@ A few goals we had in making this plugin:
== Installation ==
1. Install the plugin, and the updater - [tutorial here for using GitHub Updater](http://labs.jdmdigital.co/plugins/github-updates/)
1. Activate the plugin
1. Setup the plugin (TBD)
1. That's it!

== Frequently Asked Questions ==

Expand All @@ -35,12 +37,17 @@ TBD
== Screenshots ==

1. Frontend example screenshot
http://labs.jdmdigital.co/wp-content/uploads/sites/4/2015/12/jdm-fab.jpg

== Upgrade Notice ==

= 1.0 =
* Updated CSS, JS
* Several Bug Fixes
* Better Touch-enabled Device Support

= 0.8 =
* new customizer link added
* version Bump

= 0.7 =
* Test if Bootstrap enqueued
Expand All @@ -58,6 +65,16 @@ TBD

== Changelog ==

= 1.0 =
* Updated CSS, JS
* Several Bug Fixes
* Better Touch-enabled Device Support
* Version Bump

= 0.8 =
* new customizer link added
* version Bump

= 0.5 =
* Enabled GitHub Updater
* Small edits to source code and readme file(s)
Expand Down

0 comments on commit 313851b

Please sign in to comment.