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

UCPKN-3056: Agenda theming. #268

Open
wants to merge 28 commits into
base: 1.x
Choose a base branch
from
Open

UCPKN-3056: Agenda theming. #268

wants to merge 28 commits into from

Conversation

kp77
Copy link

@kp77 kp77 commented Apr 29, 2024

Hi @brummbar,

The PR is still wip, without tests. There are some changes since we last discussed, most importanty that I ended up adding templates/preprocesses only for the bundles that are shipped by oe_agenda, and I don't override the general entity templates. I think it's cleaner like this, because we use bundle fields in all the templates.

This affected the session templates a bit, so now I don't have a oe-agenda-session.html.twig that the oe-default and oe-break templates are extending, instead the oe-break template extends the oe-default (but otherwise the idea is the same). Let me know what you think, I will add comments to the code where I have something to say.

@kp77 kp77 added the question Further information is requested label Apr 30, 2024
Copy link

@msnassar msnassar left a comment

Choose a reason for hiding this comment

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

Hello @kp77 Looks good to me. Just some miner issues...

@kp77 kp77 force-pushed the contribution/UCPKN-3056 branch from fc6918d to 643ea79 Compare May 13, 2024 13:28
@kp77 kp77 requested a review from msnassar May 13, 2024 13:41
Copy link

@msnassar msnassar left a comment

Choose a reason for hiding this comment

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

Hello @kp77
Please look into the new comments below...

@kp77 kp77 force-pushed the contribution/UCPKN-3056 branch from 3d73618 to 11664e0 Compare May 15, 2024 12:02
@kp77
Copy link
Author

kp77 commented May 15, 2024

Hi @msnassar,

I added 3 new commits since last review round:

  1. UCPKN-3056: Normalize spacing between session sections. is the proposed solution for the inconsistency between sessions and session sections (this is what UCPKN-3105 ticket was created for as a follow up)
  2. UCPKN-3056: Set correct size/spacing for break/default session title. fixed session title font size and spacing to align with mockup
  3. UCPKN-3056: Display hours as muted only for break session. the text-muted class was incorrectly applied on the default session hours, but they should be muted only in break session

@kp77 kp77 requested a review from msnassar May 15, 2024 12:17
Copy link

@msnassar msnassar left a comment

Choose a reason for hiding this comment

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

Hello @kp77
Please have a look into the new comments above...

@kp77 kp77 requested a review from msnassar May 16, 2024 08:32
Copy link

@msnassar msnassar left a comment

Choose a reason for hiding this comment

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

Hello @kp77 Please see one miner issue...

* @see ./modules/contrib/oe_agenda/templates/oe-agenda-session.html.twig
*/
#}
{% macro icon(name = 'clock', size = 'xs', attributes) %}

Choose a reason for hiding this comment

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

I understand the reason behind assigning default values to the parameters. But I am not sure we should do this. As this macro is generic, I prefer to have them passed instead.
Also, I believe it is better to add macros to the end of the file...

Copy link
Author

Choose a reason for hiding this comment

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

This macro is added to the session template, and the default icon we use in the session is what the defaults of the macro are assigning. What is the reason not to assign default values for the macro and making it easier to insert the default session icon for hours?

Regarding where to put the macro: I would have also put it to the end of the file, but the only macro examples I found in Whitelabel are placing the macro at the top of the file. Not sure if it's 'better' to put it to the end, I think it's just a question of preference/convention, and I was trying to follow the Whitelabel practice.

Choose a reason for hiding this comment

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

Yes, it is part of the session template... But if we have another icons that we would like to display, I think we will use the same macro but in this case we will pass values to the parameters!
The reasons I prefer not to set default values:

  • Code readability. {{ _self.icon() }} doesn't tell much! specially if we will use the macro to display other icons (which is not the case now).
  • Less confusing for other developers who would like to extend/override the template and also reuse the macro.

Anyway. lets see the opinion from the other reviewers ;)

Copy link
Author

Choose a reason for hiding this comment

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

Well, for me {{ _self.icon() }} tells something: it tells that there's a macro in this template (or the parent template) that defines an icon for the template. If I don't know what it outputs and how, I should probably go and check it.

The original purpose of this macro is to output the icon we need - as we need it - in multiple places without repeating ourselves. If I have to pass everything in the different places I need the icon (and that includes also the spacing classes passed in the attributes), that goes against the original idea of using the macro (I might as well just call the pattern twice..)

The fact that this macro also can be used to output other icons in other sizes/attributes is just a bonus IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

Checking core and other modules/themes, there are never defaults. Let's not use them.

Copy link
Author

Choose a reason for hiding this comment

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

Removed the defaults in 737e683

drishu
drishu previously approved these changes Aug 22, 2024
Copy link
Contributor

@brummbar brummbar left a comment

Choose a reason for hiding this comment

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

We miss tests.

foreach (['oe_session_venue', 'oe_session_online_link'] as $index => $field_name) {
$field = $session->get($field_name);
assert($field instanceof FieldItemListInterface);
if ($field->isEmpty() || !$field->access()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to gather the access cache metadata and bubble it up here.

Copy link
Author

Choose a reason for hiding this comment

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

This is done in 9cb8051

@kp77 kp77 removed the question Further information is requested label Sep 9, 2024
@kp77
Copy link
Author

kp77 commented Sep 30, 2024

Hi @brummbar,

The changes since your last review are all commits after and including: UCPKN-3056: Add session link fields access cache metadata to render array.

Please have a look.

@kp77 kp77 requested a review from brummbar September 30, 2024 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants