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

Add "Archives" block #1518

Closed
wants to merge 1 commit into from
Closed

Add "Archives" block #1518

wants to merge 1 commit into from

Conversation

swissspidy
Copy link
Member

This is a possible implementation for an archives block that uses the same code as the archives widget currently in code. The same code and filters are used for output on the front end, so there shouldn't be any BC concerns.

Todo:

  • Add server-side rendering, either through a custom REST API endpoint or something like Server side rendering API endpoint #780.
    Right now, a fake loading screen is shown in the editor.
  • Testing
  • Styling
  • Accessibility improvements
    Probably something to happen in core directly, see Add Block: Archive #1464 (comment)). Not really a blocker for this implementation
  • Maybe implement alignment options

Screenshots:

screen shot 2017-06-27 at 13 34 39

screen shot 2017-06-27 at 13 07 45

screen shot 2017-06-27 at 21 54 45


Fixes #1464.

@swissspidy swissspidy added the [Status] In Progress Tracking issues with work in progress label Jun 28, 2017
@swissspidy swissspidy changed the title [WIP] Add "Archives" block Add "Archives" block Jun 28, 2017
@westonruter
Copy link
Member

For alignment options, see #1803.

@@ -23,4 +23,5 @@

// Register server-side code for individual blocks.
require_once dirname( __FILE__ ) . '/lib/blocks/latest-posts.php';
require_once dirname( __FILE__ ) . '/lib/blocks/archives.php';
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be changed in light of #2014.

/**
* WordPress dependencies
*/
import { Component } from 'element';
Copy link
Member

Choose a reason for hiding this comment

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

Note with #2172, these need to be updated to prefix the dependencies with @wordpress/. You will need to perform a rebase against the latest version of master and apply your changes:

git fetch origin
git rebase origin/master

@gziolo
Copy link
Member

gziolo commented Jan 27, 2018

@swissspidy, do you plan to continue the work started in this PR. It might require some extra work to make it up to date.

@gziolo gziolo added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Jan 27, 2018
@swissspidy
Copy link
Member Author

@gziolo Seeing that #1464 was miraculously reopened, sure :) Some guidance would be nice re: the REST API question at the beginning. Is there any precedence for this nowadays?

@gziolo
Copy link
Member

gziolo commented Feb 7, 2018

Not sure what the issue was, but you can see how it was done for the Latest Posts block. See https://github.com/WordPress/gutenberg/tree/master/blocks/library/latest-posts.

@gziolo gziolo removed the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Feb 15, 2018
@westonruter
Copy link
Member

@swissspidy I don't think that we should use the REST API to populate the editor preview. We could instead use the ServerSideRender as proposed in #780 which would eliminate the need to duplicate the PHP rendering logic in JS.

@westonruter
Copy link
Member

westonruter commented Feb 28, 2018

Per @mtias in Slack:

It doesn’t exclude having a server side render component for other widgets (maybe calendar, tag cloud, etc), but I don’t believe we should be blocked by the lack of such endpoint/component, and we should definitely start already with blocks like “archives”.

So this should move forward now without ServerSideRenderer to be like the Latest Posts block. A new endpoint in the gutenberg namespace will probably be needed to obtain the data required for rendering an Archives block.

@miina
Copy link
Contributor

miina commented Feb 28, 2018

@swissspidy since the ticket can move forward without ServerSideRenderer are you planning to continue work on it? :) Asking since if you wouldn't, I'd be interested in giving it a try and picking up where you left off.

@swissspidy
Copy link
Member Author

@miina Go for it! :) Feel free to pick some bits of this PR and let me know if I can help with anything.

@miina miina mentioned this pull request Mar 8, 2018
@westonruter
Copy link
Member

Closing in favor of #1518 where this work is being picked up.

@westonruter westonruter closed this Mar 9, 2018
@afercia
Copy link
Contributor

afercia commented Mar 9, 2018

For reference: I guess it's #5495

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants