Skip to content

Commit

Permalink
Show a snackbar notice when a layout is added to a page (godaddy-word…
Browse files Browse the repository at this point in the history
…press#1893)

* Show a snackbar notice when a layout is added to a page

* Join spec file with commas
  • Loading branch information
EvanHerman authored May 4, 2021
1 parent 64c7b7a commit b6c00b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ commands:
if [ "$CIRCLE_BRANCH" == "master" ] || [ "$CIRCLE_BRANCH" == "develop" ] || [ "$CIRCLE_BRANCH" == *"run-all-tests"* ]; then
./node_modules/.bin/cypress run --config integrationFolder=./ --browser << parameters.browser >> --record --parallel --group e2e-<< parameters.browser >>
else
./node_modules/.bin/cypress run --config integrationFolder=./ --browser << parameters.browser >> --record --parallel --group e2e-<< parameters.browser >> --spec "$(cat /tmp/specstring)"
./node_modules/.bin/cypress run --config integrationFolder=./ --browser << parameters.browser >> --record --parallel --group e2e-<< parameters.browser >> --spec "$(cat /tmp/specstring | xargs | sed -e 's/ /,/g')"
fi
start_wpcli_server:
Expand Down
13 changes: 11 additions & 2 deletions src/extensions/layout-selector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import classnames from 'classnames';
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
import { Component, isValidElement } from '@wordpress/element';
import { applyFilters } from '@wordpress/hooks';
import { registerPlugin } from '@wordpress/plugins';
Expand Down Expand Up @@ -210,11 +210,12 @@ if ( typeof coblocksLayoutSelector !== 'undefined' && coblocksLayoutSelector.pos
updateSelectedCategory,
} = dispatch( 'coblocks/template-selector' );
const { editPost } = dispatch( 'core/editor' );
const { createWarningNotice } = dispatch( 'core/notices' );
const { createWarningNotice, createSuccessNotice } = dispatch( 'core/notices' );

return {
closeTemplateSelector,
createWarningNotice,
createSuccessNotice,
editPost,
updateSelectedCategory,

Expand All @@ -226,6 +227,14 @@ if ( typeof coblocksLayoutSelector !== 'undefined' && coblocksLayoutSelector.pos
} );
closeTemplateSelector();
incrementLayoutUsage( layout );
createSuccessNotice(
sprintf(
// translators: %s is the post title.
__( '"%s" layout has been added to the page.', 'nextgen' ),
layout.label
),
{ type: 'snackbar' }
);
},

useEmptyTemplateLayout: () => {
Expand Down

0 comments on commit b6c00b8

Please sign in to comment.