Problem/Motivation
Bartik's code needs to meet current Drupal coding standards.
Proposed resolution
This issue takes a specific section of Bartik's code, it acts as a "component" issue and improves that section of code with minimal impact on the rest of Bartik's codebase.
This issue aims to clean up and properly format the CSS and templates files without breaking Bartik visually.
This issue primarily looks at the css/components/featured-top.css
file.
Work that needs to be included in patches for this issue are fully outlined in the META issue #1342054: [META] Clean up templates and CSS.
The work needs to be crossed off the list below as completed or stated why they were not applicable to this issue in the comments below, to make sure we cover everything.
Also very helpful! Noting the list items in your comment with the patch to show what parts you added to the patch.
Create a patch containing the potential following work:
Code cleanup work
- Check each selector in the CSS file (associated with the particular issue) is in use within core right now.
If not...
a) Check to see if the classes in core have been changed and correct them (for e.g. I found this in this issue ).
or
b) Remove that CSS completely from the CSS file. -
a) Check the CSS selectors are not being replicated in other stylesheets in Bartik.
b) Check the CSS properties are not being overridden by other stylesheets in Bartik.
If a) move all of the properties to the selector in the stylesheet that you think most appropriate for the component you are dealing with.
If a) and b) also remove the CSS properties and values being overridden within that ruleset. - If you find CSS for a component which seems out of place in the file it is currently in move it to the one you think is the correct one.
-
If a selector appears to be too long and/or too specific, check if the selector can be simplified. for eg.
.something .something .something { }
being modified to.something .something { }
. - Check that RTL styles exist when needed and are formatted as per the guidelines. (for e.g. we found that RTL styles are broken on certain pages in this issue, so fix anything you see missing/incorrect in the CSS file.
- If you think the contents of the CSS file could be further broken down into more components CSS files, or grouped together with other existing CSS files to form one component do it. The initial SMACSS issue may not of been perfect, guidelines on CSS file organisation for Drupal 8 can be found here.
- Check the markup from the templates that all of the classes are used as selectors in the CSS files. If not remove them. See an example issue here for this.
Code formatting work
- Add a File comment to the top of the stylesheet - see here for guidelines.
- Check any other comments are formatted correctly - see here for guidelines.
- Check Whitespace is being used correctly, this includes indentations and line breaks - see here for guidelines.
- Check the formatting of rulesets, properties and media queries are correct - see here for guidelines.
- As mentioned above, check existing RTL styles are formatted correctly - see here for guidelines.
Remaining tasks
- Assess the code applicable to this patch and figure out what work in the lists above need to be included in the patch.
- Cross out work tasks that do not apply to this issue.
- Write a patch with as much work as you want to include, upload and comment what you included
- Review the patch - code review and visual changes
- Upload screenshots to show nothing/something is broken on the frontend
User interface changes
None, we are cleaning up CSS and markup in templates. The use of Bartik's UI and design will stay the same.
API changes
n/a
Beta phase evaluation
Issue category | Task because it is a code clean up overhaul of a theme. |
---|---|
Unfrozen changes | Unfrozen because it only refactors CSS and templates, no changes to UI or APIs |
Prioritized changes | The main goal of this issue is usability and performance. We want Bartik code to be up to date and something to be proud of. |
Disruption | No disruption it's only refactoring code not changing how to use the theme |
Comment | File | Size | Author |
---|---|---|---|
#28 | patch-applied.png | 196.05 KB | emma.maria |
#28 | no-patch.png | 199.39 KB | emma.maria |
#26 | 2398469-clean-up-feature-top-26.patch | 3.14 KB | LewisNyman |
#26 | interdiff.txt | 359 bytes | LewisNyman |
#20 | Screen Shot 2015-02-12 at 14.11.32.jpg | 533.71 KB | LewisNyman |
Comments
Comment #1
emma.mariaComment #2
DickJohnson CreditAttribution: DickJohnson commentedInvestigated this a bit.
Currently featured is mentioned in 5 different css-files.
1. featured.css
2. media.css
3. messages.css
4. layout.css
5. admin.css
First four are pretty simple, but I'm not sure if the demo-block related css should be placed to it's own component-file or to featured.css.
On template we have following featured-related things:
I don't really understand the usage of aside on this kind of region and by what we've been talking on #2398471: Clean up the "footer" component in Bartik, i think that this should be probably done like:
I think the
Best guess patch as attachment.
Comment #3
idebr CreditAttribution: idebr commentedIs the duplicate .featured__wrapper/.featured wrapper used for anything or can it be removed?
Comment #4
DickJohnson CreditAttribution: DickJohnson commentedThere was different styles wrote for .featured_wrapper and .featured, but currently it looks like .featured styles are not actually doing anything. I'll rewrite it so that we don't have anything on .featured_wrapper and if everything goes well, I'll remove the it completely.
Comment #5
DickJohnson CreditAttribution: DickJohnson commentedStarted to re-do on this. Sending this patch to see what test-bot is saying. Took the wrapper out completely.
On this patch the markup for featured is
Before it was
Region-featured stuff is actually coming somewhere out of the template. I also had to change the bartik.theme because it was putting class featured to body. Changed that to "has-featured".
Comment #6
LewisNymanCan we move this code to be directly below the elements it's editing? Also we can remove the comment within it
I actually this this styling should go with the primary-menu component, because .has-featured is a modifier of the menu component in this case. Also, this styling makes no sense, what does it do?
We've lost the semantics of the aside element and the role attribute. Can we add them back in?
Are we missing a deleted file from the patch? I see some CSS added that isn't remove from somewhere else.
Comment #7
DickJohnson CreditAttribution: DickJohnson commented#6.1 Agreed
#6.2 With styles:
Without styles:
It is true that it doesn't make sense. Correct breakpoint is somewhere around 810px, but I decided to keep it this way and create follow up on this.
#6.3 Can be done, but I still dislike the idea of having minimum of 4 wrapper'ish things on this kind of region to output anything. Your suggestion?
Comment #8
DickJohnson CreditAttribution: DickJohnson commentedWorked a bit on this, not needing a review on this patch.
Comment #9
DickJohnson CreditAttribution: DickJohnson commentedComment #10
DickJohnson CreditAttribution: DickJohnson commentedComment #11
DickJohnson CreditAttribution: DickJohnson commentedAfter the region was renamed rerolled and added the semantics of aside back.
Comment #12
DickJohnson CreditAttribution: DickJohnson commentedComment #13
DickJohnson CreditAttribution: DickJohnson commentedComment #15
emma.mariaThe patch in #11 breaks Bartik visually all over!
Comment #16
DickJohnson CreditAttribution: DickJohnson commentedIt seems that I forgot to add changes on bartik.theme to latest patch.
Comment #17
mherchelVisually, the patch in #16 looks perfect. That being said, it needs some work to conform to the Drupal 8 CSS standards (see https://www.drupal.org/node/1887918#sub-components)
So, ideally we should see something like
with a class name of
Comment #18
kandra CreditAttribution: kandra commentedI'm taking a look at this
Comment #19
kandra CreditAttribution: kandra commentedUpdated patch
Comment #20
LewisNymanThanks for the fixes. Here is a screenshot to show everything looking lovely.
Comment #21
LewisNymanComment #22
DickJohnson CreditAttribution: DickJohnson commentedI'm not saying the __inner class if wrong, but we didn't put anything similar to footer, right?
And do we really want to use the
structure?
Comment #23
LewisNymanI think we have something similar:
.footer
is similar tofeatured__inner
.featured
is similar tofooter__wrapper
So, I don't know if we want to decide between using either __wrapper subcomponents or __inner subcomponents in Bartik or across of all themes. It feels a bit like a bikeshed discussion, shall we discuss this in a follow up?
Comment #24
kandra CreditAttribution: kandra commentedComment #25
LewisNymanSorry! I spotted something
I noticed that we have a small typo here.
Comment #26
LewisNymanComment #27
LewisNymanComment #28
emma.mariaThe patch applied cleanly.
I visually compared the region before and after applying the patch and featured top looks the same.
Before
After
The code is formatted correctly. There is now a file comment, no IDs, correct line spacing etc.
We haven't lost any code anywhere.
I love the .has-featured-top class on the body element, it makes so much more sense.
I see nothing wrong with the patch, setting to RTBC.
Comment #31
DickJohnson CreditAttribution: DickJohnson commentedComment #32
webchickI was a little confused about has-featured-top vs. featured-top but I see one goes in the body tag and the other goes on the div.
Committed and pushed to 8.0.x. Thanks!