Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome: Adding the Revisions Panel #910

Merged
merged 2 commits into from
May 31, 2017
Merged

Conversation

youknowriad
Copy link
Contributor

closes #853

  • The revisions are fetched in the component itself.
  • We trigger a new fetch each time the post is saved.
  • I extracted some URL utils to the url utils file.

@youknowriad youknowriad added the General Interface Parts of the UI which don't fall neatly under other labels. label May 26, 2017
@youknowriad youknowriad self-assigned this May 26, 2017
@@ -96,8 +95,11 @@ export function savePost( dispatch, postId, edits ) {

export function trashPost( dispatch, postId, postType ) {
new wp.api.models.Post( { id: postId } ).destroy().done( () => {
window.location.href = 'edit.php?post_type=' + postType
+ '&trashed=1&ids=' + postId;
window.location.href = getWPAdminURL( 'edit.php', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this just reuse addQueryArgs, e.g. addQueryArgs( 'edit.php', { post_type: postType } ); ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes probably, but I thought it should be a separate function to be able to change its implementation later (#867)

@jasmussen
Copy link
Contributor

Designwise this looks great! And great to see all the progress on the sidebar as a whole!

I'm getting more and more JS errors with 405 though. This one using PUT:

screen shot 2017-05-30 at 06 42 13

@nylen any tips?

@youknowriad
Copy link
Contributor Author

I'm merging soon if no objections?

@youknowriad youknowriad merged commit 9b918bb into master May 31, 2017
@youknowriad youknowriad deleted the add/last-revision-link branch May 31, 2017 11:49

/**
* WordPress dependencies
* Internal dependencies
*/
import { getBlockSettings, switchToBlockType } from 'blocks';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's both WordPress and Internal dependencies here.

Aside: We could do for a better indicator.


const newUrl = baseUrl + '?' + stringify( {
...qs,
const newUrl = getGutenbergURL( {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistency between Url and URL. I think we'll want to settle on and use consistently a recommendation for acronyms. The core guidelines do not include one. Calypso recommends strict camel-casing, but I've personally grown fonder of upper-case. I can create an issue.

*/
export function getGutenbergURL( query = {} ) {
const [ baseUrl, currentQuery ] = window.location.href.split( '?' );
const qs = parseQueryString( currentQuery || '' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: The default can be assigned in the array destructure for clarity/consistency:

const [ baseUrl, currentQuery = '' ] = window.location.href.split( '?' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General Interface Parts of the UI which don't fall neatly under other labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sidebar: Link to latest revision
3 participants