Browse Source

Ajustes gerais

master
Guilherme Capanema 6 years ago
parent
commit
c98f289d00
7 changed files with 44 additions and 47 deletions
  1. +16
    -0
      admin/class-reuna-glossario-admin.php
  2. +0
    -32
      admin/js/reuna-glossario-admin.js
  3. +1
    -1
      admin/partials/shortcode-metabox.php
  4. +15
    -0
      public/class-reuna-glossario-public.php
  5. +1
    -1
      public/dist/css/glossario.css
  6. +3
    -5
      public/views/post-modal.php
  7. +8
    -8
      public/views/shortcode-output.php

+ 16
- 0
admin/class-reuna-glossario-admin.php View File

@ -73,6 +73,11 @@ class Reuna_Glossario_Admin {
{
}
/**
* Register the custom post type to contain the Glossario.
*
* @since 1.0.0
*/
public function register_glossario_post_type()
{
register_extended_post_type('glossario', [
@ -109,12 +114,23 @@ class Reuna_Glossario_Admin {
]);
}
/**
* Display the shortcode associated to a Glossario post below its title
* in the edit screen.
*
* @since 1.0.0
*/
public function display_term_shortcode_after_title()
{
global $post;
require (plugin_dir_path(__FILE__) . 'partials/shortcode-metabox.php');
}
/**
* Add the post_title_like argument to WP_Query
*
* @since 1.0.0
*/
public function wp_query_by_post_title_like($where, $wp_query)
{
global $wpdb;


+ 0
- 32
admin/js/reuna-glossario-admin.js View File

@ -1,32 +0,0 @@
(function( $ ) {
'use strict';
/**
* All of the code for your admin-facing JavaScript source
* should reside in this file.
*
* Note: It has been assumed you will write jQuery code here, so the
* $ function reference has been prepared for usage within the scope
* of this function.
*
* This enables you to define handlers, for when the DOM is ready:
*
* $(function() {
*
* });
*
* When the window is loaded:
*
* $( window ).load(function() {
*
* });
*
* ...and/or other possibilities.
*
* Ideally, it is not considered best practise to attach more than a
* single DOM-ready or window-load handler for a particular page.
* Although scripts in the WordPress core, Plugins and Themes may be
* practising this, we should strive to set a better example in our own work.
*/
})( jQuery );

+ 1
- 1
admin/partials/shortcode-metabox.php View File

@ -1,7 +1,7 @@
<?php
/**
* The metabox containing the term's shortcode
* The box containing the term's shortcode
*
* @link https://horizontes.info
* @since 1.0.0


+ 15
- 0
public/class-reuna-glossario-public.php View File

@ -64,11 +64,21 @@ class Reuna_Glossario_Public {
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'dist/css/glossario.css', [], $this->version, 'all' );
}
/**
* Register the [glossario] shortcode.
*
* @since 1.0.0
*/
public function register_glossario_shortcode()
{
add_shortcode('glossario', array($this, 'handle_glossario_shortcode'));
}
/**
* Handle the [glossario] shortcode.
*
* @since 1.0.0
*/
public function handle_glossario_shortcode($atts, $content = null)
{
$atts = shortcode_atts([
@ -100,6 +110,11 @@ class Reuna_Glossario_Public {
return ob_get_clean();
}
/**
* Output the glossario post modal
*
* @since 1.0.0
*/
public function output_glossario_post_modal($post)
{
add_action('get_footer', function() use ($post) {


+ 1
- 1
public/dist/css/glossario.css View File

@ -1 +1 @@
.rg-container{width:100%}@media (min-width:640px){.rg-container{max-width:640px}}@media (min-width:768px){.rg-container{max-width:768px}}@media (min-width:1024px){.rg-container{max-width:1024px}}@media (min-width:1280px){.rg-container{max-width:1280px}}.rg-bg-yellow-100{--bg-opacity:1!important;background-color:#faf9f5!important;background-color:rgba(250,249,245,var(--bg-opacity))!important}.rg-border-red-400{--border-opacity:1!important;border-color:#ff746e!important;border-color:rgba(255,116,110,var(--border-opacity))!important}.rg-border-l-8{border-left-width:8px!important}.rg-cursor-pointer{cursor:pointer!important}.rg-font-bold{font-weight:700!important}.rg-h-full{height:100%!important}.rg-text-xl{font-size:1.25rem!important}.rg-text-2xl{font-size:1.5rem!important}.rg-leading-tight{line-height:1.25!important}.rg-mt-2{margin-top:.5rem!important}.rg-mr-2{margin-right:.5rem!important}.rg-mt-5{margin-top:1.25rem!important}.rg-max-w-2xl{max-width:42rem!important}.hover\:rg-opacity-75:hover{opacity:.75!important}.rg-overflow-y-auto{overflow-y:auto!important}.rg-overflow-x-hidden{overflow-x:hidden!important}.rg-px-3{padding-left:.75rem!important;padding-right:.75rem!important}.rg-px-4{padding-left:1rem!important;padding-right:1rem!important}.rg-py-6{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.rg-pt-4{padding-top:1rem!important}.rg-fixed{position:fixed!important}.rg-absolute{position:absolute!important}.rg-relative{position:relative!important}.rg-inset-0{right:0!important;bottom:0!important;left:0!important}.rg-inset-0,.rg-top-0{top:0!important}.rg-right-0{right:0!important}.rg-text-red-400{--text-opacity:1!important;color:#ff746e!important;color:rgba(255,116,110,var(--text-opacity))!important}.hover\:rg-underline:hover{text-decoration:underline!important}.rg-w-full{width:100%!important}.rg-z-40{z-index:40!important}@media (min-width:1024px){.lg\:rg-py-8{padding-top:2rem!important;padding-bottom:2rem!important}.lg\:rg-px-12{padding-left:3rem!important;padding-right:3rem!important}}
.rg-container{width:100%}@media (min-width:640px){.rg-container{max-width:640px}}@media (min-width:768px){.rg-container{max-width:768px}}@media (min-width:1024px){.rg-container{max-width:1024px}}@media (min-width:1280px){.rg-container{max-width:1280px}}.rg-bg-yellow-100{--bg-opacity:1!important;background-color:#faf9f5!important;background-color:rgba(250,249,245,var(--bg-opacity))!important}.rg-border-red-400{--border-opacity:1!important;border-color:#ff746e!important;border-color:rgba(255,116,110,var(--border-opacity))!important}.rg-border-l-8{border-left-width:8px!important}.rg-font-bold{font-weight:700!important}.rg-h-full{height:100%!important}.rg-text-xl{font-size:1.25rem!important}.rg-text-2xl{font-size:1.5rem!important}.rg-leading-tight{line-height:1.25!important}.rg-mt-2{margin-top:.5rem!important}.rg-mr-2{margin-right:.5rem!important}.rg-mt-5{margin-top:1.25rem!important}.rg-max-w-2xl{max-width:42rem!important}.hover\:rg-opacity-75:hover{opacity:.75!important}.rg-overflow-y-auto{overflow-y:auto!important}.rg-overflow-x-hidden{overflow-x:hidden!important}.rg-px-3{padding-left:.75rem!important;padding-right:.75rem!important}.rg-px-4{padding-left:1rem!important;padding-right:1rem!important}.rg-py-6{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.rg-pt-4{padding-top:1rem!important}.rg-fixed{position:fixed!important}.rg-absolute{position:absolute!important}.rg-relative{position:relative!important}.rg-inset-0{right:0!important;bottom:0!important;left:0!important}.rg-inset-0,.rg-top-0{top:0!important}.rg-right-0{right:0!important}.rg-text-red-400{--text-opacity:1!important;color:#ff746e!important;color:rgba(255,116,110,var(--text-opacity))!important}.rg-w-full{width:100%!important}.rg-z-40{z-index:40!important}@media (min-width:1024px){.lg\:rg-py-8{padding-top:2rem!important;padding-bottom:2rem!important}.lg\:rg-px-12{padding-left:3rem!important;padding-right:3rem!important}}

+ 3
- 5
public/views/post-modal.php View File

@ -1,15 +1,13 @@
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
* The modal containing the glossario post content.
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/public/partials
* @subpackage Reuna_Glossario/public/views
*/
$slug = get_post_field('post_name', $post);
@ -32,7 +30,7 @@ $slug = get_post_field('post_name', $post);
<i class="far fa-times-circle"></i>
</button>
<h2 class="rg-text-xl rg-font-bold rg-leading-tight" id="modal-<?php echo $slug ?>-label">
<h2 class="rg-text-xl rg-font-bold rg-leading-tight" id="modal-glossario-<?php echo $slug ?>-label">
<?php echo get_the_title($post); ?>
</h2>


+ 8
- 8
public/views/shortcode-output.php View File

@ -1,22 +1,22 @@
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
* The inline HTML output by the shortcode.
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Reuna_Glossario
* @subpackage Reuna_Glossario/public/partials
* @subpackage Reuna_Glossario/public/views
*/
?>
<span
<a href="#"
x-data
x-on:click="document.getElementById('modal-glossario-<?php echo get_post_field('post_name', $post); ?>').dispatchEvent(new Event('modal-open'))"
class="rg-text-red-400 hover:rg-underline rg-cursor-pointer"
x-on:click="
$event.preventDefault();
document.getElementById('modal-glossario-<?php echo get_post_field('post_name', $post); ?>').dispatchEvent(new Event('modal-open'));
"
>
<?php echo $content; ?>
</span>
</a>