Code Monkey home page Code Monkey logo

vf-wp's People

Contributors

dbushell avatar ebiwd-jros avatar francisco-ebi avatar kasprzyk-sz avatar khawkins98 avatar meladawy avatar nitinja avatar renovate-bot avatar renovate[bot] avatar sandykadam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vf-wp's Issues

CSS: Remove guttenberg button styling

By default WP is attaching some styling that clashes hard with VF styles; see: https://www.embl.org/news/lab-matters/corona-updates/

Here .wp-block-button is resulting in:

image

Here's one possible approach to resolve: WordPress/gutenberg#11338 (comment)

Removing works fine for me with the following example:

wp.domReady( () => {
	wp.blocks.unregisterBlockStyle( 'core/quote', 'default' );
	wp.blocks.unregisterBlockStyle( 'core/quote', 'large' );

	wp.blocks.unregisterBlockStyle( 'core/button', 'default' );
	wp.blocks.unregisterBlockStyle( 'core/button', 'outline' );
	wp.blocks.unregisterBlockStyle( 'core/button', 'squared' );
} );

This script is enqueued via wp_enqueue_script( 'gutenberg-testing', plugins_url( 'editor.js', __FILE__ ), array( 'wp-blocks', 'wp-dom' ), time(), true );

Events plugin stage 2 requirments

David has made a foundational events plugin in #225 -- it will allow EBI Devs to begin integrating into the contentHub, but to complete the work we'll need some more fields.

Those fields will largely need to reflect the ones in the contentHub event content type:

field name machine name type
Additional Info field_event_additional_info Text (formatted, long, with summary)
Canceled field_event_canceled List (integer)
Closing date field_event_registration_closing Date
Closing date field_event_submission_closing Date
Description body Text (formatted, long, with summary)
EMBL.org term: what field_embl_org_term_what Entity reference
EMBL.org term: where field_embl_org_term_where Entity reference
EMBL.org term: who field_embl_org_term_who Entity reference
End date field_event_end_date_time Date
Feeds item feeds_item Feed
Location field_event_location Entity reference
More Information link field_event_more_information Link
Opening date field_event_registration_opening Date
Opening date field_event_submission_opening Date
Registration Fee field_event_registration_fe Text (plain)
Registration Link field_event_registration_link Link
Start date field_event_start_date_time Date
Tags field_tags Entity reference
Type field_event_type List (text)
Unique Identifier field_event_unique_identifier Text (plain)
Venue field_event_venue Text (plain)

And here's what it looks like with content:

image

Not all of these are strictly required, but this is a full list for informational needs.

CHORE - Use site config for taxonomy URL

As noted by @sandykadam, it would be good to import the taxonomy from the URL indicated in the by vf_api_urland then combine the string “pattern.json?pattern=embl-ontology&source=contenthub”

private $defaults = array(
'embl_taxonomy' => 'https://wwww.embl.org/api/v1/pattern.json?pattern=embl-ontology&source=contenthub'
);

Believe a similar method is already done in vf-cache.php

BUG - ContentHub caching doesn't properly handle html comments

When caching a response from the contentHub the vf-wp theme seems to be erroneously parsing HTML comments.

For example:

<div class="vf-content-hub-html">

   <!-- Generated by: http://content.embl.org/api/v1/pattern.html?filter-content-type=article&amp;filter-id=580&amp;pattern=node-body -->
   <div data-embl-js-conditional-edit="580">
   <div class="vf-banner vf-banner--phase">
   <div class="vf-banner__content">
   <!--<span class="vf-badge vf-badge--primary">BETA</span>-->
   <p class="vf-text--body-r">We're building a new website. <a href="https://www.surveymonkey.co.uk/r/emblbeta" class="vf-link">Complete our quick survey</a> to help us make it better.</p>
   </div>
   </div>
   <a class="vf-text vf-text--body-r vf-link embl-conditional-edit" href="https://content.embl.org/node/580" target="_blank">Edit</a>
   </div>
 </div>

Becomes:

<div class="vf-content-hub-html">
  <!-- Generated by: http://content.embl.org/api/v1/pattern.html?filter-content-type=article&amp;filter-id=580&amp;pattern=node-body -->
  <div data-embl-js-conditional-edit="580">
  <div class="vf-banner vf-banner--phase">
  <div class="vf-banner__content">
  &lt;!--<span class="vf-badge vf-badge--primary">BETA</span>--&gt;
  <p class="vf-text--body-r">We're building a new website. <a href="https://www.surveymonkey.co.uk/r/emblbeta" class="vf-link">Complete our quick survey</a> to help us make it better.</p>
  </div>

image

This particular example is easily fixable in the contentHub, but we'll surely see similar in the future.

Cached content (via server-side Content Hub request) is replaced with JS fallback

The current scenario:

  • cache is empty, or stale
  • a server-side request is made to the Content Hub
  • on success: replace cache with new content
  • on failure: replace cache with JavaScript fallback
  • cached content (or JS) is served in the PHP template

Problem: if the Content Hub is inaccessible for the client-side request we're left with a lot of blank areas on the page because the old content was already lost. The JS fallback is also likely to fail.

Not really a bug because it's by design but it feels like one if the cache was not empty.

It would make more sense to toggle a flag on the cached content if a server-side request fails. That way we can serve the JS fallback alongside the old content rather than replacing it in the cache. Instead, JS attempt to replace it client-side. The next successful request removes the flag.

This change should serve the most up-to-date content without throwing it away to quickly.

EBI plugin CSS

The stylesheets are hard-coded into the EBI Global Footer plugin template causing CSS issues.

Move them to a WP enqueue hook before the vf-core and main theme CSS.

remove embl-grid wrapping vf-breadcrumbs

We'd need to change the grid-column for vf-breadcrumbs for this not to break.

embl-grid adds vertical spacing which looks horrid for simple components like this, and as with the groups, like it seems the dashboard - vf-body is the parent so it could grab the grid from that.

Also - if vf-core has the grid changes making things max-width and margin: 0 auto it would tighten this up a little too

So, there's options.

logo missing?

Local dev setup scripts and config

The scripts bin/dev quick_group etc are failing to configure WordPress.

I was seeing a lot of errors:

Error: 'wp-config.php' not found.
Either create one manually or use `wp config create`.

It would eventually load a default unconfigured WordPress in the browser on the install page.

I had to add this to my .env file:

WP_SETTINGS_PHP=${RELATIVE_DOCUMENT_ROOT}/wp-config.php
WP_DEFAULT_SETTINGS_PHP=${RELATIVE_DOCUMENT_ROOT}/wp-config-sample.php

and then the setup process was able to bootstrap successfully.

Not sure if this the permanent solution I should commit?

Sidebar widgets need to use VF markup for lists

Related (out-dated) PR: #21

Widgets like WP_Widget_Categories need vf-list classes.

We're using filters with string/regex replacement on the widget HTML. Not nice but WordPress doesn't give us much option.

WP 5.3 update makes Gutenberg blocks fail to reorder

After updating to WordPress 5.3 blocks in the Gutenberg editor do not add or reorder properly.

Initial investigation suggests only a Firefox issue.

Chrome handles it (with new fancy animations).

Happens with WP core blocks alone, so not a bug we can resolve here?

Update API call to to point to variable

From @sandykadam:

can you please call the API endpoint from the config options_vf_api_url instead of hardcode. because we are going to set it via VF config - https://dev.beta.embl.org/api/v1/

$heading = '<h1 class="vf-lede">' . VF_Cache::get_post('https://dev.beta.embl.org/api/v1/pattern.html?filter-content-type=profiles&filter-uuid='.$uuid.'&pattern=node-teaser&source=contenthub') . '</h1>';

Regression: EBI header and footer not present in new template

As spotted by @sandykadam: The new template defaults to the EMBL header+footer, which means EBI sites now get the wrong header+footer:

image

There are number of possible approaches:

  1. have the template referance all 4: EMBL header+footer and EBI header+footer and then if a plugin is disable it just wouldn’t show
  2. add an option to change the “default” one the deployment script would just have to edit the default post
  3. others?

Probably will have to wait until @dbushell is back on the week of the 27th

vf-masthead short description

In the theme's partials/vs-masthead.php include, the short description under the group name is from the Content Hub.

Todo:

  • Use config instead of hard-coded API in template (https://dev.beta.embl.org/api/v1/)
  • (idea) Move to EMBL Settings admin page with button to refresh cache
  • (idea) store as standard WP blog description/tagline option?

FEATURE - Custom `embl-grid`-based layouts in Gutenberg

Currently we can add pre-made vf-block or vf-container level components to the WP Gutenberg editor (that's great).

To build more dynamic pages we'll need to be able to add vf-grid and embl-grid container and then add Gutenberg blocks and vf-blocks inside that "grid container".

Documentation on the parent grid:

So the workflow might be like; an editor:

  1. Adds a custom Gutenberg block: "EMBL Grid"
  2. Selects type of EMBL Grid, in this case embl-grid embl-grid--has-sidebar
  3. Adds a vf-label block to the left grid cell
  4. Adds a vf-news feed to middle cell
  5. Adds a vf-factorid to right cell

And a vf-grid scenario

  1. Adds a custom Gutenberg block: "VF Grid"
  2. Selects type of VF Grid, in this case vf-grid vf-grid__col-3
  3. Adds a vf-label block to the left grid cell
  4. Adds a vf-news feed to middle cell
  5. Sets the middle cell to be vf-grid__col--span-2 (right most cell is then disabled/goes away)

Jobs listing sorts by expiration date

The jobs listing sorts to show the first expiring job, we're receiving feedback that it's better to show the newest job instead.

I should be able to tackle this.

FEATURE - Support non-group pages

As part of the generic page building effort (project?), we'll need to be able to build pages that don't look like groups sites; that is:

image

Left: embl-boilerplate-page Right: embl-group-page

Currently all vf-wp sites are assumed to be like the right side, but we'll also need to do the left side. The main difference will be in (not) adding a couple of classes to div.vf-body and if a .vf-header.vf-header--inlay is shown.

So we could probably do this any of these ways (or others):

  • Make the group look a child theme
  • Add a per-page level option of "show as a group page"
  • Add a theme level option of "is a group site"

ALSO, there could (perhaps) in time be a couple other options:

  • Is an EMBL-EBI group
  • We may need to support a difference in look/options between scientific groups and admin teams
  • We may want also support embl-subsite-page

☝️ But those are still maybes

Remove Webpack dependency - use Rollup or just Gulp/Babel

With vf-core using Rollup and further integration in the works here #48 – it would make sense to use Rollup in vf-wp too to reduce the size of Node dependencies.

Alternatively, a custom Gulp task (or gulp-babel) would likely suffice.

Webpack was only used as a quick solution.

ENHANCEMENT - "No results" behaviour for blocks

When a query to the contentHub returns no results, it would be nice to have a "No results behaviour".

My initial thought:

No results behaviour

Options:

  • Default (as specified in the plugin)
    • Might be: "No jobs could be found at this time."
  • Hide the widget
  • Use custom text

Add Gutenberg block for vf-video component

The built-in WordPress blocks like "Video", "Embed", "YouTube", etc do not support all services that require iframe embeds (namely, Mediasite and Panopto have been requested).

The "Custom HTML" block is not a user-friendly way to embed other iframes.

Idea: create a generic iframe embed block using the vf-video component.

https://visual-framework.github.io/vf-core/components/detail/vf-video.html

Attributes would be:

  • url - iframe source
  • ratio - aspect ratio for responsive resize (default: 16:9)
  • width - (optional) default width for custom aspect ratio
  • height - (optional) default height for custom aspect ratio
  • maxWidth - (optional) do not resize above this width

Add vf-core typographic styles and webfont to the Gutenberg editor

Typographic blocks in the Gutenberg editor include:

  • core/paragraph
  • core/heading
  • core/list
  • core/quote

We're using the built-in WordPress blocks rather than reinventing the wheel. Unlike our VF blocks they're not sandboxed in an <iframe> with the vf-core stylesheet.

If would be nice if the WP Admin styles the blocks so that the whole Gutenberg experience ressembles the VF design (closer to the front-end) and not a hybrid.

The theme functions/admin.php enqueues an admin stylesheet. Move this action to the vf-gutenberg plugin?

After #48 is integrated it will be easier to include the relevant Sass. Additional selectors will be necessary to scope or override existing styles.

CHORE - Petrol/green options can be removed

The code that allowed the header to be set as EMBL Green or EBI Petrol I believe is no longer used (or needed) with the new vf-masthead, at least for the vf-wp-group child theme.

public function customize_theme_colors($colors) {
$colors = array_merge($colors, array(
'009f4d' => __('EMBL Green', 'vfwp'),
'007c80' => __('EMBL-EBI Petrol', 'vfwp'),
));
return array_unique($colors);

/**
* Output custom inline <head> stuff
*/
public function wp_head() {
$theme_color = get_theme_mod(
'vf_theme_color',
array_keys($this->theme_colors)[0]
);
?>
<style>
/*.vf-wp-theme .vf-masthead,*/
.vf-wp-theme .vf-box--secondary {
--vf-masthead__color--background: #<?php echo $theme_color; ?>;
}
</style>

If so, we should remove the configuration option and code.


This relates to visual-framework/vf-core#758 and the vf-masthead (sort of) no longer supporting colourisation.

Chore: tidy up news tags

The tags could be made a bit nicer on the news site.

Currently:

image

Suggestion:

  • make the "tags" header inline
  • remove comma from last item

image

ENHANCEMENT - Make more child themes

Continuing and closing #29 (FEATURE - Support non-group pages), we have need of a "generic" child theme for higher level EMBL-branded pages; as David said in #29:

I plan to develop another child theme – maybe vf-wp-boilerplate – that has various customisable options and more templates.

ENHANCEMENT - Allow querying for specific persons, teams

There's a need to be able to do a bit more with people querying:

1. Query by custom team

Probably an easy-ish enhancement to the existing vf-members logic to not query for the current team, but to "show me all the members of Web Development"

2. Show a specific person(s)

This might need to be a new Gutenberg block to show vf-person and query for a specific person by name or UUID ... "show me Ken Hawkins as vf-summary--large or --medium"

vf-gutenberg block preview height

When a server-side rendered block updates the height resets to the minium causing a "jump" in the content - persist the height between renders?

BUG/CHORE - Advanced Custom Fields newer versions missing cache.php

We're currently using 5.8.0-beta3.

Some time back I tried to update to beta4 but that broke things as cache.php had been removed.

I had started a ticket with the maintainer but have shamefully not followed up ... and it may have been resolved it the latest version (I'd try again, but I can't seem to find the user/pass for the pro version — but looking at the release notes it doesn't seem like the cache has been added back).

My "report":

With the beta.4 we noticed that includes/cache.php has been removed -- we were previously using functions like acf_disable_cache().

If cache.php wasn't accidently removed, is it not recommended to use acf_disable_cache()?  

Response: 
 

We made changes to our "cache" functions in version 5.7.11.

These changes have been included in the latest 5.8.0 beta-4.

Can you please provide some more info/context on why you were using those functions?Perhaps they are no longer needed? Or perhaps we need to add them back in.

Maybe David's already changed his approach or found a workaround.

How to update Gutenberg/Nunjucks templates after theme customisation

Parts of a theme that exist as PHP templates – e.g. the vf-masthead – can adapt to customisation changes because the PHP is rendered on every page load.

There is a problem with Gutenberg blocks that are rendered with Nunjucks templates.

Say we add a vf-factoid block to a page within the Gutenberg editor. The factoid.njk template is rendered as the page/post is edited. HTML is saved to the post content. When that post is visited the pre-rendered HTML is outputted.

If the theme is later customised and vf-factoid blocks require different markup (e.g. a new modifier class), we cannot update those within post content. Only when each post is edited again will they be rendered with the new template.

This is because Nunjucks is a JavaScript library and it runs client-side in the browser.

Possible solutions

  1. ❌ Find a way to run Nunjucks server-side. This is not practical without a PHP library (which doesn't exist). Running Node on the server is a big ask. Also keeping track of which post content contains out-dated templates is not trivial. Then updating all posts after each customisation change would be an expensive operation.

  2. 🤮 Update posts client-side. This would require a lot of AJAX in the WordPress admin. We cannot guarantee the process will complete, and all the same problems as above.

  3. 🤔 Do not use Nunjucks and do not save rendered HTML to the post content (only the block attributes). Instead use PHP templates to render server-side on each page load. This would require a PHP version of the component .njk templates – in vf-core or vf-wp – either way adding to the maintenance.

  4. 🤷 Ignore the issue. Assume customisation will be done once when the theme is set up and therefore changes are unlikely. Posts will require a manual edit/save to update.

Thoughts

1 and 2 are non-starters. 3 would be easy to implement (in the theme at least). I'm leaning towards 4 for now until we know just how often the issue might occur.

There may also be some blocks where the style variant is chosen independent of any global theme customisation. We need to account for this use case too.

Support default Gutenberg alignment (for image and other blocks)

Image blocks (and others) have the default alignment attribute:
gutenberg-image-alignment

Right now this is ignored by the vf-gutenberg plugin which re-writes the markup here:
vf-gutenberg/includes/core/core-image.php

We should either remove the align options if unsupported using block filters to alter the supports attribute. Or update the new markup to account for this option.

See Utility Classes: Float in vf-core.

Todo: list all default WP blocks that include align support.

The "Mortal Kombat" levels need updating

We have recently moved to update the levels of design fanciness' naming to better match what is used in Mortal Kombat which gives us the benefit of curtailing any potential confusion.

These need updating in vf-wp for (at least) the vf-hero.

The new levels are now

very-easy replaces easy
easy replaces normal
normal replaces medium

REFACTOR - Update vf-wp cache to serve and then invalidate

The current implementation of page caching is slow.

Here's what currently happens when the cache expires ($max_age = 300):

  1. Stale items exists in cache
  2. Page serve request
  3. Cache is dumped if $cached_age > $max_age
  4. Cache is refreshed (can take 10+ seconds)
  5. Cache filled
  6. Page served

Conceptual improvement:

  1. Stale items exists in cache
  2. Page serve request
  3. If cached items exist, regardless of age, page served
  4. Cache is dumped if $cached_age > $max_age
  5. Cache is refreshed (can take 10+ seconds)
  6. Cache filled

CHORE - Update method to override masthead colour

The masthead colour override setting outputs this CSS:

.vf-wp-theme .embl-group-page--vf-header--bg-color {
 background: #000;
}

The method the VF expects has now changed and needs to be updated to output:  

.vf-masthead {
    --vf-masthead__color--background: #00;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.