Skip to content

Commit 5c27130

Browse files
SociableStevebp289
andauthored
Prepared for generic page layout (#52)
* Prepared for generic page layout * Updated the template to use cotainer and added hero option * Updated course.html to use the new structure * Updated to 1400px width as max rather than 1600px * Refactored the default.html to be cleaner and more structurally correct * Some minor fixes from auto formatting * Added desktop stylings for content, sidebar navigation, and breadcrumbs * Moved hero outside main * [WIP] hid navigation if dropping below 480px wide * Tidied up some spacing on desktop * Removed JS code which changes structure of the sidebar * [fix] styling for pages without a subnav, and breakpoint width * Added styling to some exiting sidebar menu items * Fixed several linter issues * Removed temp div * Fixed bad merge conflict fix * linters updated * linters updated * removed htmlrc * wrong branch unding changes * wrong branch unding changes --------- Co-authored-by: bp289 <birajpanta112@gmail.com>
1 parent f988cef commit 5c27130

File tree

12 files changed

+175
-215
lines changed

12 files changed

+175
-215
lines changed

README.md

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -292,27 +292,21 @@ Or if you would like to use your package manager to install, you can find instru
292292

293293
https://nodejs.org/en/download/package-manager
294294

295-
Install linters:
296-
297-
npm ci
298-
299-
This project includes stylelint and eslint.
300-
301-
stylelint(for linting css code):
302-
303-
npm run css-lint
304-
305-
eslint(will lint everything in the assets folder):
306-
307-
npm run js-lint
308-
309-
or if you need to specify a directory or a file:
310-
311-
npx eslint <directory/ file>
312-
313-
To run all linters :
314-
315-
npm run lint-all
295+
Install linters: `npm ci`
296+
297+
This project includes liners for HTML, CSS, JavaScript, and markdown files.
298+
instructions for each
299+
To run all linters you can use the command `npm run lint`
300+
For each linter here are the options available:
301+
302+
- stylelint (CSS):
303+
- `npm run css-lint`
304+
- eslint (JavaScript):
305+
- `npm run js-lint <(optional)directory/file>` (default directory is current working directory)
306+
- htmllint (HTML)
307+
- `npm run html-lint <(optional)directory/file>` (default directory is current working directory)
308+
- markdownLint (Markdown)
309+
- `npm run md-lint <(required)directory/file>`
316310

317311
## Overview of site source code
318312

assets/images/chevron_right.svg

Lines changed: 3 additions & 0 deletions
Loading

assets/js/bioconductor.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,6 @@ function addEvent(elem, evtType, func) {
8585
}
8686
}
8787

88-
// parse the page and pick out div's that have a certain class
89-
// and change those into shaded boxes by adding HTML. this inserts
90-
// table code, but that should be transparent to all users.
91-
function renderShadedBoxes() {
92-
// prepare the HTML to insert into the divs of target class
93-
var insert1 =
94-
'<table cellspacing="0" cellpadding="0" class="sb"><tr><td class="sb1"></td><td class="sb2"></td><td class="sb3"></td></tr><tr><td class="sb4">&nbsp;</td><td class="sb5">';
95-
var insert2 =
96-
'</td><td class="sb6">&nbsp;</td></tr><tr><td class="sb7"></td><td class="sb8"></td><td class="sb9"></td></tr></table>';
97-
98-
// obtain all the div's of the target class. note that pre-ie7 doesn't return .getAttribute('class') but does return .getAttribute('className') so we check for that specially
99-
var oDivs = document.getElementsByTagName("div");
100-
var className = "";
101-
for (var i = 0; i < oDivs.length; i++) {
102-
className =
103-
oDivs.item(i).getAttribute("class") ||
104-
oDivs.item(i).getAttribute("className"); //alert(className);
105-
if (className && className.indexOf("shaded_box") > -1) {
106-
//alert(i);
107-
oDivs.item(i).innerHTML = insert1 + oDivs.item(i).innerHTML + insert2;
108-
oDivs.item(i).className = ""; // this removes the shaded_box class from the original div so the styling i just made takes over
109-
}
110-
}
111-
}
112-
113-
// check each page load to see if there is any shaded_box class
114-
addEvent(window, "load", renderShadedBoxes);
11588

11689
Object.size = function (obj) {
11790
var size = 0,

assets/style/bioconductor-v2.css

Lines changed: 94 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,100 @@ body {
33
margin: 0;
44
}
55

6-
/* "site-container" is the single div containing every other element in the site.
7-
it floats center, with no vertical margins, and provides the overall
8-
width of the site. we provide both an id and a class name in order
9-
to allow more flexible cascading: id rules are highly ranked while
10-
class names play nicer with other rules. */
6+
.container {
7+
margin: 0 auto;
8+
width: calc(100% - 3rem);
9+
max-width: 1400px;
10+
}
11+
12+
main > .container.main-subnav {
13+
display: grid;
14+
gap: 2rem;
15+
grid-template-columns: 300px 1fr;
16+
grid-template-areas:
17+
"left-col .";
18+
}
19+
20+
.left-col {
21+
grid-area: left-col;
22+
display: flex;
23+
flex-direction: column;
24+
gap: 1rem;
25+
}
26+
27+
/* TODO: shaded box is a legacy block, and included here for backwards compatibility. once the content is updated this should be removed */
28+
.shaded_box {
29+
padding: 0.5rem;
30+
}
31+
32+
.shaded_box .box_header {
33+
font-size: 1rem;
34+
text-decoration: underline;
35+
font-weight: 700;
36+
}
37+
38+
.shaded_box .box_header .olive {
39+
display: none;
40+
}
41+
42+
.shaded_box ul {
43+
list-style-type: none;
44+
padding: 0;
45+
margin: 0;
46+
}
47+
48+
nav.subnav, .shaded_box {
49+
border-radius: 0.5rem;
50+
border: 1px solid var(--primary-p75);
51+
padding: 0.5rem;
52+
}
53+
54+
nav.subnav a, .shaded_box ul li {
55+
text-decoration: underline;
56+
display: block;
57+
padding: 0.5rem;
58+
padding-bottom: 0.75rem;
59+
background-image: url("/images/chevron_right.svg");
60+
background-repeat: no-repeat;
61+
background-position: right center;
62+
}
63+
64+
nav.subnav a, .shaded_box ul li a {
65+
color: black;
66+
}
67+
68+
.breadcrumbs {
69+
list-style-type: none;
70+
display: flex;
71+
gap: 0.5rem;
72+
margin: 0 0 0.75rem;
73+
padding: 0;
74+
line-height: 1.3rem;
75+
}
76+
77+
.breadcrumbs li:not(:first-of-type) {
78+
background-image: url("/images/chevron_right.svg");
79+
background-repeat: no-repeat;
80+
padding-left: 1.625rem; /* make space for the background image */
81+
}
82+
83+
.breadcrumbs li:last-of-type {
84+
font-weight: bold;
85+
}
86+
87+
.breadcrumbs a {
88+
color: var(--neutral-n400);
89+
text-decoration: none;
90+
}
91+
92+
@media (width <= 768px) {
93+
main > .container {
94+
display: block;
95+
}
96+
97+
.left-col {
98+
display: none;
99+
}
11100

12101
.site-container {
13102
margin: 0 auto; /* floats the design center */

assets/style/bioconductor.css

Lines changed: 0 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -69,39 +69,6 @@ div#PageContent.WithRightRail {
6969
padding-left: 12px;
7070
}
7171

72-
/* PageBreadcrumbs contains the page's breadcrumb trail. it lives
73-
nested within PageContent in order to flow correctly when
74-
breadcrumbs wrap to a second line. we use a background image
75-
in order to create the little arrows between elements. */
76-
#PageBreadcrumbs {
77-
padding: 0 0 2em 0; /*border:1px orange solid;*/
78-
}
79-
.PageBreadcrumbs {
80-
font-family: Helvetica, Arial, Verdana, Sans-serif;
81-
font-size: 110%;
82-
}
83-
.PageBreadcrumbs ul {
84-
list-style-type: none;
85-
margin: 0;
86-
padding: 0;
87-
}
88-
.PageBreadcrumbs ul li {
89-
display: inline;
90-
padding-left: 0.3em;
91-
background-image: none;
92-
}
93-
.PageBreadcrumbs a,
94-
.PageBreadcrumbs a:visited {
95-
color: #000000;
96-
padding-right: 1em;
97-
background-image: url(../images/breadcrumb_arrow.gif);
98-
background-position: center right;
99-
background-repeat: no-repeat;
100-
}
101-
.PageBreadcrumbs a:hover {
102-
color: #888888;
103-
}
104-
10572
/* PageInternalLinksMenu contains any links to intra-page anchors
10673
(i.e., jumps down this page) */
10774
.PageInternalLinksMenu ul {
@@ -121,77 +88,6 @@ div#PageContent.WithRightRail {
12188
white-space: nowrap;
12289
}
12390

124-
/* RightRail is the right-hand column on some pages. it is a sibling
125-
to PageContent. when used, you must add WithRightRail class to the
126-
PageContent div in order to save space for RightRail. */
127-
#RightRail {
128-
/* width is 280px or 27%. adjust in concert with width of
129-
PageContent.WithRightRail */
130-
width: 280px;
131-
padding: 140px 20px 0 10px;
132-
float: right;
133-
background-image: url(../images/rightrail_fade.jpg);
134-
background-position: top left;
135-
background-repeat: no-repeat;
136-
/* fade ends at just under 560px, so make column at least that high
137-
to avoid an edge */
138-
min-height: 560px;
139-
/*border:1px purple solid;*/
140-
}
141-
.RightRail {
142-
font-family: Verdana, Arial, Helvetica, Sans-serif;
143-
font-size: 70%;
144-
line-height: 1.3em;
145-
} /* line-height matches that of .PageContent */
146-
.RightRail a {
147-
color: #1a81c2;
148-
}
149-
.RightRail a:visited {
150-
color: #1a81c2;
151-
}
152-
.RightRail a:hover {
153-
color: #4c94c2;
154-
}
155-
p.rightrail_header {
156-
font-size: 130%;
157-
color: #87b13f;
158-
font-weight: bold;
159-
padding: 0;
160-
margin-bottom: 1em;
161-
}
162-
163-
/* ul lists in right rail are generally pleasing using the
164-
background-image trick */
165-
.RightRail ul {
166-
list-style-type: none;
167-
padding: 0;
168-
margin-top: 0em;
169-
margin-bottom: 1em;
170-
}
171-
.RightRail ul li {
172-
background-image: url(../images/list_bullet_bare.gif);
173-
background-position: 0 0.5em;
174-
background-repeat: no-repeat;
175-
padding-left: 12px;
176-
}
177-
178-
/* "interior" navigation menu, usually within the RightRail,
179-
a simple ul-listing */
180-
ul.section_nav {
181-
list-style-type: none;
182-
margin: 0;
183-
padding: 0;
184-
padding-left: 1em;
185-
}
186-
ul.section_nav li {
187-
padding-bottom: 1em;
188-
font-size: 120%;
189-
background-image: url(../images/list_bullet_bare.gif);
190-
background-position: 0 0.5em;
191-
background-repeat: no-repeat;
192-
padding-left: 12px;
193-
}
194-
19591
/* SiteGlobalFooter is the olive box at page bottom which
19692
contains global site navigation elements, copyright and logos */
19793
#SiteGlobalFooter {
@@ -286,40 +182,6 @@ li.footer_nav_list_element {
286182
border-bottom: 1px #a8bf7c solid;
287183
}
288184

289-
/* here is the styling for shaded boxes. the content author should NOT
290-
use these classes directly... instead, create a div as follows:
291-
292-
<div class='shaded_box'>
293-
content here
294-
</div>
295-
296-
when the page loads, JS will check for all div's of class shaded_box
297-
and perform the correct HTML munging to create the shading effect.
298-
299-
because we use a table structure to get the effect, you'll see classes
300-
sb1 (top-left) through sb9 (bottom-right), reading left-to-right, then
301-
top-to-bottom. box sb5, center-center, contains actual content.
302-
*/
303-
.shaded_box {
304-
border: 1px #d8dcdd solid;
305-
padding: 16px;
306-
margin: 8px;
307-
background-color: #ffffff;
308-
} /* will be removed after processing the shaded_box div */
309-
.shaded_box .box_header {
310-
font-size: 130%;
311-
font-weight: bold;
312-
}
313-
.shaded_box .box_header a,
314-
.shaded_box .box_header a:visited {
315-
color: #000000;
316-
text-decoration: none;
317-
}
318-
.shaded_box .box_header a:hover {
319-
color: #87b13f;
320-
text-decoration: underline;
321-
}
322-
323185
.sb {
324186
width: 100%;
325187
height: 100%;

content/index.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
---
22
title: Home
3+
hero: components/index_hero

layouts/_sitehead.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
44
<meta http-equiv="Content-Language" content="en-us" />
55
<meta name="robots" content="all" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
67

78
<% if item.identifier =~ /^\/help\/bioc-views\/package-pages\// and not
89
item.identifier =~ /\/all-/ %>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<ul class="breadcrumbs">
2+
<% crumbs = get_updated_breadcrumbs(breadcrumbs_trail, item) %>
3+
<% crumbs.each_with_index do |crumb, i| %>
4+
<% next unless crumb %>
5+
<% if (i + 1 < crumbs.length) %>
6+
<%
7+
crumb_id = crumb.identifier.to_s.dup
8+
crumb_id = "/packages/release/BiocViews.html" if crumb_id == "/packages/"
9+
crumb_id.sub!(/BiocViews\.html\/$/, "BiocViews.html")
10+
%>
11+
<li><a href="<%= crumb_id %>"><%= crumb.attributes[:title] %></a></li>
12+
<% else %>
13+
<li><%= crumb.attributes[:title] %></li>
14+
<% end %>
15+
<% end %>
16+
</ul>

layouts/components/index_hero.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>hello, world</p>

layouts/components/subnav.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<% if @item.attributes.include? :suppress_subnav and @item[:suppress_subnav] == true %>
2+
<% elsif @pages.length > 0 %>
3+
<nav class="subnav">
4+
<% @pages.sort{|a, b| a[:title] <=> b[:title]}.select do |p| %>
5+
<a href="<%= p.identifier %>"><%= p[:title] %></a>
6+
<% end %>
7+
</nav>
8+
<% end %>
9+
<% if (@item[:subnav].kind_of? Array) %>
10+
<% @item[:subnav].each do |s| %>
11+
<%= render(s[:include].to_s) %>
12+
<% end %>
13+
<% end %>

0 commit comments

Comments
 (0)