Skip to content

Commit

Permalink
visual update
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardBock committed Aug 6, 2021
1 parent 2b18ea3 commit d1fb67a
Show file tree
Hide file tree
Showing 12 changed files with 7,899 additions and 2,413 deletions.
10,241 changes: 7,847 additions & 2,394 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -19,18 +19,18 @@
},
"homepage": "https://github.com/palasthotel/ph-postqueue#readme",
"dependencies": {
"@wordpress/api-fetch": "^5.1.1",
"@wordpress/dom-ready": "^3.1.1",
"@wordpress/element": "^3.1.1",
"@wordpress/scripts": "^16.1.3",
"@wordpress/api-fetch": "^5.2.1",
"@wordpress/dom-ready": "^3.2.1",
"@wordpress/element": "^4.0.0",
"@wordpress/scripts": "^17.1.0",
"react": "^17.0.2",
"react-dnd": "^14.0.2",
"react-dnd-html5-backend": "^14.0.0",
"react-dom": "^17.0.2",
"react-sortablejs": "^6.0.0",
"sortablejs": "^1.13.0"
"sortablejs": "^1.14.0"
},
"devDependencies": {
"@types/sortablejs": "^1.10.6"
"@types/sortablejs": "^1.10.7"
}
}
4 changes: 3 additions & 1 deletion public/classes/Ajax.php
Expand Up @@ -2,7 +2,9 @@

namespace Postqueue;


/**
* @deprecated use rest instead. Still used by meta box
*/
class Ajax extends Component\Component {

public function onCreate() {
Expand Down
9 changes: 8 additions & 1 deletion public/classes/REST.php
Expand Up @@ -53,7 +53,14 @@ public function rest_api_init() {
register_rest_route( REST::NAMESPACE, '/queues/(?P<id>\d+)', array(
'methods' => WP_REST_Server::READABLE,
'callback' => function ( WP_REST_Request $request ) {
return $this->plugin->store->get_queue_by_id( $request->get_param( "id" ) );
$items = $this->plugin->store->get_queue_by_id( $request->get_param( "id" ) );
return array_map(function($item){
$post_id = $item->post_id;
$item->edit_post_link = get_edit_post_link($post_id, '');
$item->post_status = get_post_status($post_id);
$item->post_date = get_the_date('l, F j, Y', $post_id);
return $item;
}, $items);
},
'permission_callback' => [ $this, 'permissionCheck' ],
) );
Expand Down
6 changes: 3 additions & 3 deletions public/classes/Store.php
Expand Up @@ -68,7 +68,7 @@ public function get_queues()
/**
* returns queue by id
*
* @return object queue
* @return array queue
*/
public function get_queue_by_id($qid)
{
Expand All @@ -78,7 +78,7 @@ public function get_queue_by_id($qid)
/**
* returns queue by slug
*
* @return object queue
* @return array queue
*/
public function get_queue_by_slug($slug)
{
Expand All @@ -88,7 +88,7 @@ public function get_queue_by_slug($slug)
/**
* helper function for returning a queue
*
* @return object queue
* @return array queue
*/
private function get_queue($key, $value)
{
Expand Down
2 changes: 1 addition & 1 deletion public/dist/editor.asset.php
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-dom-ready', 'wp-element', 'wp-polyfill'), 'version' => '1cfae946e3f648dd418b8cc1bb3cb709');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-dom-ready', 'wp-element', 'wp-polyfill'), 'version' => '0b005fbae59a48e6f9b748d3f34c1dbd');
2 changes: 1 addition & 1 deletion public/dist/editor.css

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

2 changes: 1 addition & 1 deletion public/dist/editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/ph-postqueue.php
Expand Up @@ -7,7 +7,7 @@
/**
* Plugin Name: Postqueue
* Description: Create manually ordered postqueues
* Version: 1.3.1
* Version: 1.4.0
* Requires at least: 5.0
* Tested up to: 5.8
* Requires PHP: 7.4
Expand Down
5 changes: 4 additions & 1 deletion public/readme.txt
Expand Up @@ -4,7 +4,7 @@ Donate link: http://palasthotel.de/
Tags: loop, order posts, queue
Requires at least: 5.0
Tested up to: 5.8
Stable tag: 1.3.1
Stable tag: 1.4.0
Requires PHP: 7.4
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl
Expand All @@ -31,6 +31,9 @@ This Plugin provides a new Box for [Grid](http://wordpress.org/plugins/grid/ "Gr

== Changelog ==

= 1.4.0 =
* Visual update: Date and status information in post queue editor

= 1.3.1 =
* Bugfix: PHP7.3 compatibility issue fixed

Expand Down
23 changes: 21 additions & 2 deletions src/scripts/components/QueueEditor.jsx
Expand Up @@ -6,7 +6,24 @@ import LoadingLine from "./LoadingLine.jsx";

export const TYPE = "dnditem";

const ListItem = ({index, post_id, post_title, moveItem, findItem, onDelete}) => {
const PostStatus = ({status})=>{
const icon = (status === "future") ? "⏱" : "✅";
return <span className="post-item__status">{icon}</span>
}

const ListItem = (
{
index,
post_id,
post_title,
post_status,
post_date,
edit_post_link,
moveItem,
findItem,
onDelete
}
) => {
const {i18n} = PostQueue;
const originalIndex = findItem(post_id).index;
const [{isDragging}, drag, preview] = useDrag(() => ({
Expand Down Expand Up @@ -39,7 +56,9 @@ const ListItem = ({index, post_id, post_title, moveItem, findItem, onDelete}) =>
className={`queue-item queue-item-set ${isDragging ? "is-dragging" : ""}`}
>
<div ref={drag} className="drag-handle ui-sortable-handle"/>
<span>{post_title}</span>
<a href={edit_post_link}>{post_title}</a>
<br/>
<PostStatus status={post_status} /><span className="queue-item__date">{post_date}</span>
<div className="delete-post" onClick={onDelete}>{i18n.remove}</div>
</li>
}
Expand Down
4 changes: 3 additions & 1 deletion src/styles/editor/ph-postqueue-editor.scss
Expand Up @@ -106,8 +106,10 @@ $error: #dd3d36;
margin: 0;
padding: 16px 35px 10px;
counter-increment: posts;
font-weight: bold;
min-height: 50px;
.post-item__status{
margin-right: 4px;
}
&:first-child:before{
top: 50%;
}
Expand Down

0 comments on commit d1fb67a

Please sign in to comment.