Skip to content

Commit

Permalink
Issue #25 - Implement 5 oik-bbw prefixed blocks copied/cobbled from o…
Browse files Browse the repository at this point in the history
…ik-blocks
  • Loading branch information
bobbingwide committed Jan 22, 2020
1 parent dd35b81 commit 0295dbc
Show file tree
Hide file tree
Showing 13 changed files with 218 additions and 71 deletions.
25 changes: 25 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"presets": [
[
"env",
{
"modules": false
}
]
],
"plugins": [
"transform-object-rest-spread",
[
"transform-react-jsx",
{
"pragma": "wp.element.createElement"
}
],
["lodash"]
],
"env": {
"default": {
"plugins": ["transform-runtime"]
}
}
}
4 changes: 2 additions & 2 deletions blocks/github/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const {
*/
export default registerBlockType(
// Namespaced, hyphens, lowercase, unique name
'oik-block/github',
'oik-bbw/github',
{
// Localize title using wp.i18n.__()
title: __( 'GitHub Issue', 'oik-blocks' ),

description: 'Display a link to a GitHub issue',
description: 'Display a link to a GitHub issue',

// Category Options: common, formatting, layout, widgets, embed
category: 'common',
Expand Down
32 changes: 16 additions & 16 deletions blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@
* @author Herb Miller @bobbingwide
*/
import './github'; // From oik-bob-bing-wide
import './oik-address'; // From oik & oik-user
import './oik-googlemap'; // From oik bw_show_googlemap
import './oik-person'; // From oik-user bw_user and bw_follow_me etc
import './oik-contact-form'; // From oik bw_contact_form
import './oik-follow-me'; // From oik bw_follow_me
import './oik-countdown'; // From oik bw_countdown
import './oik-nivo'; // From oik-nivo-slider nivo
import './oik-css'; // From oik-css bw_css
//import './oik-address'; // From oik & oik-user
//import './oik-googlemap'; // From oik bw_show_googlemap
//import './oik-person'; // From oik-user bw_user and bw_follow_me etc
//import './oik-contact-form'; // From oik bw_contact_form
//import './oik-follow-me'; // From oik bw_follow_me
//import './oik-countdown'; // From oik bw_countdown
//import './oik-nivo'; // From oik-nivo-slider nivo
//import './oik-css'; // From oik-css bw_css
import './oik-csv'; // From oik-bob-bing-wide bw_csv
import './oik-shortcode'; // From oik general purpose shortcode block
//import './oik-shortcode'; // From oik general purpose shortcode block
import './oik-wp'; // From oik-bob-bing-wide wp shortcode
import './oik-geshi'; // From oik-css bw_geshi shortcode
import './oik-search'; // From wordpress - get_search_form()
import './oik-uk-tides'; // From uk-tides - [bw_tides] shortcode
import './oik-fields'; // From oik-fields - [bw_fields] and [bw_field] shortcode
//import './oik-geshi'; // From oik-css bw_geshi shortcode
import './oik-search'; // From WordPress - get_search_form()
//import './oik-uk-tides'; // From uk-tides - [bw_tides] shortcode
//import './oik-fields'; // From oik-fields - [bw_fields] and [bw_field] shortcode
import './oik-dashicon'; // From oik-bob-bing-wide [bw_dash]
import './oik-blockicon'; // Displays a selected BlockIcon
import './oik-blockinfo'; // Displays a selected Block's information
import './oik-blocklist'; // Displays a list of Blocks for a selected prefix
//import './oik-blockicon'; // Displays a selected BlockIcon
//import './oik-blockinfo'; // Displays a selected Block's information
//import './oik-blocklist'; // Displays a list of Blocks for a selected prefix



Expand Down
4 changes: 2 additions & 2 deletions blocks/oik-csv/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ icons.descriptionList =
id="SVGRoot"
version="1.1"
viewBox="0 0 128 128"
height="128px"
width="128px">
height="20px"
width="20px">

<g
id="layer1">
Expand Down
10 changes: 6 additions & 4 deletions blocks/oik-csv/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
import './style.scss';
import './editor.scss';
import portOptions from "../oik-uk-tides/tidetimes-co-uk";
//import portOptions from "../oik-uk-tides/tidetimes-co-uk";
import { transforms } from './transforms.js';

// Get just the __() localization function from wp.i18n
Expand All @@ -20,14 +20,16 @@ const {

const {
Editable,
PlainText,

AlignmentToolbar,
BlockControls,

ServerSideRender,
} = wp.editor;
const {
InspectorControls,
BlockControls,
PlainText,

} = wp.blockEditor;

const {
Expand Down Expand Up @@ -65,7 +67,7 @@ import icons from './icons.js';
*/
export default registerBlockType(
// Namespaced, hyphens, lowercase, unique name
'oik-block/csv',
'oik-bbw/csv',
{
// Localize title using wp.i18n.__()
title: __( 'CSV' ),
Expand Down
22 changes: 15 additions & 7 deletions blocks/oik-csv/transforms.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
/* Transformation of [bw_csv] shortcode to oik-blocks/csv
* Is this possible?
/* Transformation to oik-bbw/csv of to oik-block/csv and [bw_csv]
*
* Well. If you use source: 'text' then the new lines disappear
* If you use source: 'html' then you get <br> tags
* How can I use a function?
* Maybe we can strip the <br> tags in some onChange logic
*
*/
const { createBlock
} = wp.blocks;

const transforms = {
from: [
{
type: 'block',
blocks: ['oik-block/csv'],
transform: function (attributes) {
return createBlock('oik-bbw/csv', {
content: attributes.content,
th: attributes.th,
uo: attributes.uo,

});
},
},
{
type: 'shortcode',
tag: 'bw_csv',
Expand All @@ -26,4 +33,5 @@ const transforms = {
]
};

export { transforms } ;
export { transforms } ;

2 changes: 1 addition & 1 deletion blocks/oik-dashicon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { DashiconsSelect } from './dashicons.js';
*/
export default registerBlockType(
// Namespaced, hyphens, lowercase, unique name
'oik-block/dashicon',
'oik-bbw/dashicon',
{
// Localize title using wp.i18n.__()
title: __( 'Dashicon' ),
Expand Down
2 changes: 1 addition & 1 deletion blocks/oik-search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Fragment = wp.element.Fragment;
*/
export default registerBlockType(
// Namespaced, hyphens, lowercase, unique name
'oik-block/search',
'oik-bbw/search',
{
// Localize title using wp.i18n.__()
title: __( 'Search' ),
Expand Down
2 changes: 1 addition & 1 deletion blocks/oik-wp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const {
*/
export default registerBlockType(
// Namespaced, hyphens, lowercase, unique name
'oik-block/wp',
'oik-bbw/wp',
{
// Localize title using wp.i18n.__()
title: __( 'WordPress' ),
Expand Down
33 changes: 11 additions & 22 deletions oik-bob-bing-wide.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: oik bob bing wide shortcodes
Plugin URI: https://www.oik-plugins.com/oik-plugins/oik-bob-bing-wide-plugin
Description: More lazy smart shortcodes: bw_csv, bw_plug, bw_page, bw_post, oik and loik, wp, wpms, bp, artisteer, drupal, bw_search, bw_dash, bw_rpt, bw_graphviz, bw_option, github, bw_archive
Version: 1.33.0
Version: 1.34.0-alpha-20200122
Author: bobbingwide
Author URI: https://www.bobbingwide.com/about-bobbing-wide
Text Domain: oik-bob-bing-wide
Expand Down Expand Up @@ -57,26 +57,15 @@ function oik_bob_bing_wide_init() {
// define( "OIK_WP_LOADED", true );
//}
oik_require_lib( 'class-BW-');

/* Shortcodes for each of the more useful bobbingwide babbles */
if ( false ) {
bw_add_shortcode( 'bob', 'bw_bob', oik_path("shortcodes/oik-bob-bing-wide.php", "oik-bob-bing-wide" ), true );
bw_add_shortcode( 'fob', 'bw_fob', oik_path("shortcodes/oik-bob-bing-wide.php", "oik-bob-bing-wide" ), true );
bw_add_shortcode( 'bing', 'bw_bing', oik_path("shortcodes/oik-bob-bing-wide.php", "oik-bob-bing-wide" ), true );
bw_add_shortcode( 'bong', 'bw_bong', oik_path("shortcodes/oik-bob-bing-wide.php", "oik-bob-bing-wide" ), true );
bw_add_shortcode( 'wide', 'bw_wide', oik_path("shortcodes/oik-bob-bing-wide.php", "oik-bob-bing-wide" ), true );
bw_add_shortcode( 'hide', 'bw_hide', oik_path("shortcodes/oik-bob-bing-wide.php", "oik-bob-bing-wide" ), true );

bw_add_shortcode( 'wow', 'bw_wow', oik_path("shortcodes/oik-wow.php", "oik-bob-bing-wide" ), true );
bw_add_shortcode( 'WoW', 'bw_wow', oik_path("shortcodes/oik-wow.php", "oik-bob-bing-wide" ), true );
bw_add_shortcode( 'WOW', 'bw_wow_long', oik_path("shortcodes/oik-wow.php", "oik-bob-bing-wide" ), true);
// Note: The bw_oik() & bw_oik_long() functions are actually delivered from oik's includes/bobbcomp.php
// If includes/bobbcomp.php exists we reckon shortcodes/oik-bob-bing-wide.php will do too.
$bobbcomp_file = oik_path( 'includes/bobbcomp.php' );
if ( file_exists( $bobbcomp_file ) ) {
bw_add_shortcode( 'oik', 'bw_oik', $bobbcomp_file, true );
bw_add_shortcode( 'loik', 'bw_loik', oik_path( "shortcodes/oik-bob-bing-wide.php" ), false ); // Link to the plugin
bw_add_shortcode( 'OIK', 'bw_oik_long', $bobbcomp_file, true ); // Spells out OIK Information kit
bw_add_shortcode( 'lbw', 'bw_lbw', oik_path( "shortcodes/oik-bob-bing-wide.php" ), false ); // Link to Bobbing Wide or other websites
}

// Note: The bw_oik() & bw_oik_long() functions are actually delivered from bobbcomp.inc
bw_add_shortcode( 'oik', 'bw_oik', oik_path("shortcodes/oik-bob-bing-wide.php"), true );
bw_add_shortcode( 'loik', 'bw_loik', oik_path("shortcodes/oik-bob-bing-wide.php"), false ); // Link to the plugin
bw_add_shortcode( 'OIK', 'bw_oik_long', oik_path("shortcodes/oik-bob-bing-wide.php"), true); // Spells out OIK Information kit
bw_add_shortcode( 'lbw', 'bw_lbw', oik_path("shortcodes/oik-bob-bing-wide.php"), false); // Link to Bobbing Wide or other websites

bw_add_shortcode( 'bw_page', 'bw_page', oik_path("shortcodes/oik-post-page.php", "oik-bob-bing-wide" ), false );
bw_add_shortcode( 'bw_post', 'bw_post', oik_path("shortcodes/oik-post-page.php", "oik-bob-bing-wide" ), false );
Expand Down Expand Up @@ -232,8 +221,8 @@ function oik_bob_bing_wide_loaded() {
function oik_bob_bing_wide_init_blocks() {
oik_bob_bing_wide_plugins_loaded();
$library_file = oik_require_lib( 'oik-blocks');
//oik\oik_blocks\oik_blocks_register_editor_scripts( 'oik-bob-bing-wide', 'oik-bob-bing-wide');
//oik\oik_blocks\oik_blocks_register_block_styles( 'oik-bob-bing-wide' );
oik\oik_blocks\oik_blocks_register_editor_scripts( 'oik-bob-bing-wide', 'oik-bob-bing-wide');
oik\oik_blocks\oik_blocks_register_block_styles( 'oik-bob-bing-wide' );
oik_bob_bing_wide_register_dynamic_blocks();

}
Expand Down
38 changes: 38 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "oik-bob-bing-wide",
"scripts": {
"dev": "cross-env BABEL_ENV=default webpack --watch",
"build": "cross-env BABEL_ENV=default NODE_ENV=production webpack"
},
"main": "blocks/index.js",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^8.1.2",
"babel-loader": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.7.0",
"browser-sync": "^2.26.3",
"browser-sync-webpack-plugin": "^1.2.0",
"classnames": "^2.2.5",
"cross-env": "^5.1.1",
"css-loader": "^0.28.7",
"eslint": "^4.14.0",
"eslint-config-prettier": "^2.9.0",
"eslint-config-wordpress": "^2.0.0",
"eslint-plugin-prettier": "^2.4.0",
"extract-text-webpack-plugin": "^3.0.2",
"node-sass": "^4.9.4",
"postcss-loader": "^2.0.9",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.6",
"style-loader": "^0.19.1",
"webpack": "^3.10.0"
},
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"babel-plugin-lodash": "^3.3.4"
}
}
30 changes: 15 additions & 15 deletions phpunit.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="oik-bob-bing-wide" tests="9" assertions="43" errors="0" failures="0" skipped="0" time="0.838981">
<testsuite name="Tests_bw_list_dashicons" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-bw_list_dashicons.php" tests="1" assertions="2" errors="0" failures="0" skipped="0" time="0.053941">
<testcase name="test_bw_list_dashicons" class="Tests_bw_list_dashicons" classname="Tests_bw_list_dashicons" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-bw_list_dashicons.php" line="21" assertions="2" time="0.053941"/>
<testsuite name="oik-bob-bing-wide" tests="9" assertions="43" errors="0" failures="0" skipped="0" time="0.946658">
<testsuite name="Tests_bw_list_dashicons" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-bw_list_dashicons.php" tests="1" assertions="2" errors="0" failures="0" skipped="0" time="0.108899">
<testcase name="test_bw_list_dashicons" class="Tests_bw_list_dashicons" classname="Tests_bw_list_dashicons" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-bw_list_dashicons.php" line="21" assertions="2" time="0.108899"/>
</testsuite>
<testsuite name="Tests_bw_plug" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-bw_plug.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="0.689600">
<testcase name="test_bw_plug_banner_image_url" class="Tests_bw_plug" classname="Tests_bw_plug" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-bw_plug.php" line="23" assertions="1" time="0.689600"/>
<testsuite name="Tests_bw_plug" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-bw_plug.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="0.739045">
<testcase name="test_bw_plug_banner_image_url" class="Tests_bw_plug" classname="Tests_bw_plug" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-bw_plug.php" line="23" assertions="1" time="0.739045"/>
</testsuite>
<testsuite name="Tests_oik_github" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-github.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="0.015275">
<testcase name="test_github_type_is_file" class="Tests_oik_github" classname="Tests_oik_github" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-github.php" line="18" assertions="1" time="0.015275"/>
<testsuite name="Tests_oik_github" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-github.php" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="0.012138">
<testcase name="test_github_type_is_file" class="Tests_oik_github" classname="Tests_oik_github" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-github.php" line="18" assertions="1" time="0.012138"/>
</testsuite>
<testsuite name="Tests_oik_post_page" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-oik-post-page.php" tests="4" assertions="16" errors="0" failures="0" skipped="0" time="0.012493">
<testcase name="test_site_url" class="Tests_oik_post_page" classname="Tests_oik_post_page" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-oik-post-page.php" line="27" assertions="4" time="0.004514"/>
<testcase name="test_bw_post_no_params" class="Tests_oik_post_page" classname="Tests_oik_post_page" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-oik-post-page.php" line="48" assertions="4" time="0.003651"/>
<testcase name="test_bw_page_no_params" class="Tests_oik_post_page" classname="Tests_oik_post_page" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-oik-post-page.php" line="67" assertions="4" time="0.001606"/>
<testcase name="test_bw_page_post_type_oik_faq" class="Tests_oik_post_page" classname="Tests_oik_post_page" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-oik-post-page.php" line="87" assertions="4" time="0.002722"/>
<testsuite name="Tests_oik_post_page" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-oik-post-page.php" tests="4" assertions="16" errors="0" failures="0" skipped="0" time="0.018725">
<testcase name="test_site_url" class="Tests_oik_post_page" classname="Tests_oik_post_page" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-oik-post-page.php" line="27" assertions="4" time="0.004108"/>
<testcase name="test_bw_post_no_params" class="Tests_oik_post_page" classname="Tests_oik_post_page" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-oik-post-page.php" line="48" assertions="4" time="0.005875"/>
<testcase name="test_bw_page_no_params" class="Tests_oik_post_page" classname="Tests_oik_post_page" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-oik-post-page.php" line="67" assertions="4" time="0.004213"/>
<testcase name="test_bw_page_post_type_oik_faq" class="Tests_oik_post_page" classname="Tests_oik_post_page" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-oik-post-page.php" line="87" assertions="4" time="0.004529"/>
</testsuite>
<testsuite name="Tests_shortcodes_oik_wp" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-shortcodes-oik-wp.php" tests="2" assertions="23" errors="0" failures="0" skipped="0" time="0.067672">
<testcase name="test_wp__example" class="Tests_shortcodes_oik_wp" classname="Tests_shortcodes_oik_wp" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-shortcodes-oik-wp.php" line="21" assertions="8" time="0.019705"/>
<testcase name="test_wp__example_bb_BB" class="Tests_shortcodes_oik_wp" classname="Tests_shortcodes_oik_wp" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-shortcodes-oik-wp.php" line="31" assertions="15" time="0.047967"/>
<testsuite name="Tests_shortcodes_oik_wp" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-shortcodes-oik-wp.php" tests="2" assertions="23" errors="0" failures="0" skipped="0" time="0.067851">
<testcase name="test_wp__example" class="Tests_shortcodes_oik_wp" classname="Tests_shortcodes_oik_wp" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-shortcodes-oik-wp.php" line="21" assertions="8" time="0.010470"/>
<testcase name="test_wp__example_bb_BB" class="Tests_shortcodes_oik_wp" classname="Tests_shortcodes_oik_wp" file="C:\apache\htdocs\wordpress\wp-content\plugins\oik-bob-bing-wide\tests\test-shortcodes-oik-wp.php" line="31" assertions="15" time="0.057381"/>
</testsuite>
</testsuite>
</testsuites>
Loading

0 comments on commit 0295dbc

Please sign in to comment.