Skip to content

Commit

Permalink
Complete post status.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlambe committed Oct 30, 2018
1 parent 25dbcdf commit 257984b
Show file tree
Hide file tree
Showing 27 changed files with 59,049 additions and 45,195 deletions.
89,315 changes: 51,268 additions & 38,047 deletions dist/js/themosis.core.js

Large diffs are not rendered by default.

804 changes: 804 additions & 0 deletions dist/js/themosis.poststatus.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"/dist/js/themosis.core.js": "/dist/js/themosis.core.js"
"/dist/js/themosis.core.js": "/dist/js/themosis.core.js",
"/dist/js/themosis.poststatus.js": "/dist/js/themosis.poststatus.js"
}
13,052 changes: 6,937 additions & 6,115 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@types/react-dom": "^16.0.7",
"@types/react-sortable-hoc": "^0.6.4",
"@wordpress/components": "^4.0.0",
"@wordpress/rich-text": "^2.0.0",
"axios": "^0.18.0",
"classnames": "^2.2.6",
"lodash": "^4.17.11",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import $ from 'jquery';
import '../../sass/deprecated/_poststatus.scss';

//------------------------------------------------
// Custom publish metabox.
//------------------------------------------------
// Handle the custom statuses.
let submitdiv = $('#themosisSubmitdiv'),
let submitdiv = $('#themosis_publish'),
editButton = submitdiv.find('.edit-post-status'),
selectDiv = submitdiv.find('#post-status-select'),
selectTag = submitdiv.find('#post_status'),
statusLabel = submitdiv.find('#post-status-display'),
statusButtons = submitdiv.find('.save-post-status, .cancel-post-status'),
originalPublish = submitdiv.find('input#original_publish'),
publishButton = submitdiv.find('input#publish');
publishButton = submitdiv.find('input#publish'),
post_type = $('input#post_type').val();

// Edit button
editButton.on('click', e =>
Expand All @@ -36,7 +38,7 @@ statusButtons.on('click', function(e)
// Grab selected label.
let selected = selectTag.find(':selected'),
label = selected.text(),
publishText = selected.data('publish');
publishText = themosisGlobal.post_types[post_type]['statuses'][selected.val()].publish_text;

// Update label text.
statusLabel.text(label);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
import $ from 'jquery';
import _ from 'underscore';
import _ from 'lodash';

/**
* Handle quickedit status select tag.
*/
(function($, _)
{
if (!themosisAdmin._themosisPostTypes) return;// Check if global object is defined first.
(function ($, _) {
if (! themosisGlobal.post_types) {
return;// Check if global object is defined first.
}

let cpts = themosisAdmin._themosisPostTypes,
let cpts = themosisGlobal.post_types,
cptInput = $('input.post_type_page'),
cpt = cptInput.val(),
select = $('.inline-edit-status select[name=_status]');

// Check if current post type screen use custom statuses.
let keys = _.keys(cpts); // Grab object keys first level down.

if (!_.contains(keys, cpt)) return; // Return false if cpt is not found in the keys array. If so, stop and return.
if (-1 === keys.indexOf(cpt)) {
return; // Return false if cpt is not found in the keys array. If so, stop and return.
}

// Clean select tag
// Keep Draft option only.
select.find('option[value!="draft"]').remove();
select.find('option').remove();

// Loop through the statuses
_.each(cpts[cpt]['statuses'], (obj, key) => {
select.append(`<option value="${key}">${obj.label}</option>`);
});

})($, _);

})($, _);
1 change: 0 additions & 1 deletion resources/assets/sass/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
@import "fields/mediaField";
@import "fields/collectionField";
@import "modules/metabox";
@import "modules/poststatus";

/* WordPress Components Styles */
@import '~@wordpress/components/src/color-palette/style.scss';
12 changes: 9 additions & 3 deletions resources/assets/sass/vars/_z-index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
$z-layers: (
".editor-block-list__block-edit::before": 0,
".editor-block-switcher__arrow": 1,
".editor-block-list__block .wp-block-more::before": -1,
".editor-block-list__block {core/image aligned left or right}": 20,
".editor-block-list__block {core/image aligned wide or fullwide}": 20,
".freeform-toolbar": 10,
".block-library-classic__toolbar": 10,
".editor-block-list__layout .reusable-block-indicator": 1,
".editor-block-list__breadcrumb": 2,
".components-form-toggle__input": 1,
".components-panel__header.edit-post-sidebar__panel-tabs": 1,
".editor-inserter__tabs": 1,
".editor-inserter__tab.is-active": 1,
".components-panel__header": 1,
".components-modal__header": 10,
".edit-post-meta-boxes-area.is-loading::before": 1,
".edit-post-meta-boxes-area .spinner": 5,
".editor-block-contextual-toolbar": 21,
Expand All @@ -27,6 +28,8 @@ $z-layers: (
".edit-post-header": 30,
".block-library-button__inline-link .editor-url-input__suggestions": 6, // URL suggestions for button block above sibling inserter
".block-library-image__resize-handlers": 1, // Resize handlers above sibling inserter
".wp-block-cover.has-background-dim::before": 1, // Overlay area inside block cover need to be higher than the video background.
".wp-block-cover__video-background": 0, // Video background inside cover block.

// Side UI active buttons
".editor-block-mover__control": 1,
Expand Down Expand Up @@ -75,7 +78,10 @@ $z-layers: (

// Shows adminbar quicklink submenu above bottom popover:
// #wpadminbar ul li {z-index: 99999;}
".components-popover.is-bottom": 99990,
".components-popover:not(.is-mobile).is-bottom": 99990,

// Shows above edit post sidebar; Specificity needs to be higher than 3 classes.
".block-editor__container .components-popover.components-color-palette__picker.is-bottom": 100001,

".components-autocomplete__results": 1000000,

Expand Down
2 changes: 2 additions & 0 deletions src/Core/Console/VendorPublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ protected function publishFile($from, $to)
*
* @param string $from
* @param string $to
*
* @throws \League\Flysystem\FileNotFoundException
*/
protected function publishDirectory($from, $to)
Expand All @@ -211,6 +212,7 @@ protected function publishDirectory($from, $to)
* Move all the files in the given MountManager.
*
* @param \League\Flysystem\MountManager $manager
*
* @throws \League\Flysystem\FileNotFoundException
*/
protected function moveManagedFiles($manager)
Expand Down
6 changes: 5 additions & 1 deletion src/PostType/PostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ protected function prepareStatus(string $status, array $args)

// Expose post type status for JS use.
$this->filter->add('themosis_admin_global', function ($data) {
$data['post_types'][$this->slug] = ['statuses' => $this->status];
$status['draft'] = $this->parseStatusArguments('draft', [
'publish_text' => __('Save Draft')
]);

$data['post_types'][$this->slug] = ['statuses' => array_merge($status, $this->status)];

return $data;
});
Expand Down
3 changes: 2 additions & 1 deletion src/PostType/views/_themosisPublishMetabox.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@
'choices' => $choices,
'data' => $__post->post_status,
'theme' => 'themosis'
]); ?>
]);
$select->setPrefix(''); ?>
{!! $select->render(); !!}
<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
<a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
Expand Down
5 changes: 0 additions & 5 deletions src/_assets/components/components.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import './fields/fields.styl';
import './fields/color/color';
import './fields/collection/collection';
import './fields/media/media';
import './pages/pages.styl';
import './poststatus/posts.styl';
import './poststatus/poststatus';
import './fields/infinite/infinite';
18 changes: 0 additions & 18 deletions src/_assets/components/fields/collection/ItemModel.js

This file was deleted.

115 changes: 0 additions & 115 deletions src/_assets/components/fields/collection/ItemView.js

This file was deleted.

52 changes: 0 additions & 52 deletions src/_assets/components/fields/collection/ItemsCollection.js

This file was deleted.

Loading

0 comments on commit 257984b

Please sign in to comment.