Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
30f0db9
Add 'all' option and display labels if selected
recrwplay May 18, 2023
c92ad38
Merge branch 'master' into cs-all
recrwplay Feb 14, 2024
d8f6bff
Remove pipe from replaced characters in callouts (#213)
nvitucci Feb 15, 2024
9e927ad
switch tabs when id and hash is used (#215)
recrwplay Feb 28, 2024
555605a
GraphAcademy Top-level Menu (#219)
adam-cowley Mar 6, 2024
9b69d52
Updates to Labs menu (#208)
adam-cowley Mar 6, 2024
74f3b4d
Add a banner to a page (#217)
recrwplay Mar 6, 2024
274d932
Add color for visited links (#218)
recrwplay Mar 6, 2024
9acd7bf
Create labels from roles in docs (#211)
recrwplay Mar 6, 2024
022db0d
0.20.1
adam-cowley Mar 6, 2024
b1bdff6
0.21.0
adam-cowley Mar 6, 2024
ea66631
0.22.0
adam-cowley Mar 6, 2024
abcac35
0.23.0
adam-cowley Mar 6, 2024
2f34363
Use full URL for logo
adam-cowley Mar 7, 2024
fbccc3b
0.23.1
adam-cowley Mar 7, 2024
8937173
Roles labels refinement (#220)
recrwplay Mar 8, 2024
7bbef1a
0.23.2
recrwplay Mar 8, 2024
2fe8fd4
fix tabs bug (#221)
recrwplay Mar 8, 2024
165593a
0.23.3
recrwplay Mar 8, 2024
e5cc8ed
Add highlight.js language `parameters` as an alias for `json`, for cy…
stefano-ottolenghi Mar 15, 2024
68726b7
Ensure `<details>` only has margin-bottom when block element (ex not …
stefano-ottolenghi Apr 18, 2024
5ddefe0
Avoid autoscroll when changing tab in tabbed example. (#226)
stefano-ottolenghi Apr 30, 2024
38f5bc7
dropdown background
recrwplay May 3, 2024
de8f578
pls commit thx
recrwplay May 3, 2024
f69e852
Use negation labels
recrwplay May 7, 2024
7fd2fce
Addition of GDS client to the Docs dropdown menu in the header (#225)
lidiazuin May 7, 2024
dc84717
fix kb label color (#227)
recrwplay May 8, 2024
db8c187
Reduce tab-size (#224)
adam-cowley May 8, 2024
e9562b8
Add NVL to dropdown (#228)
recrwplay May 9, 2024
a14ef37
0.23.4
recrwplay May 9, 2024
e1e7c47
0.23.5
recrwplay May 9, 2024
ccf531d
Add image class `rounded-corners`. (#229)
stefano-ottolenghi May 16, 2024
c8184a1
Center align layout (#230)
adam-cowley May 16, 2024
61387ab
0.23.6
adam-cowley May 16, 2024
d60b644
0.23.7
adam-cowley May 16, 2024
1b6fac6
linting
adam-cowley May 16, 2024
25df854
0.23.8
adam-cowley May 16, 2024
103afb1
Allow rounded-corners for videos.
stefano-ottolenghi May 17, 2024
0bca741
Fix h5 and h6 headers (#231)
JPryce-Aklundh May 20, 2024
46fb933
Fix bug in label parsing (#232)
recrwplay Jun 3, 2024
6f67eb5
Accessibility fixes (1) (#210)
recrwplay Jun 3, 2024
955bf6c
0.24.0
recrwplay Jun 7, 2024
576dd21
Add missing Aura labels (#233)
recrwplay Jun 7, 2024
c6587ef
0.24.1
recrwplay Jun 7, 2024
c58896f
add promo blocks (#234)
adam-cowley Jun 12, 2024
8b30f6d
0.24.2
adam-cowley Jun 12, 2024
108f12b
Fix code highlighting (#236)
stefano-ottolenghi Jun 18, 2024
a2afda7
Update labs menu (#237)
adam-cowley Jun 27, 2024
31b81a3
design changes to ad block (#235)
adam-cowley Jul 3, 2024
154e6ef
New home and hub pages (#223)
recrwplay Jul 5, 2024
643881c
Modify component title display and version selector (#216)
recrwplay Jul 5, 2024
2c2342e
Unlink component name in nav (#238)
recrwplay Jul 5, 2024
446cc41
0.25.0
recrwplay Jul 5, 2024
8ebe696
Revert to previous behavior for non-docs (#239)
recrwplay Jul 10, 2024
6a2eb74
0.25.1
recrwplay Jul 10, 2024
27f7250
comment out `Remove H3 anchors`
stefano-ottolenghi Jul 11, 2024
515ca1d
Remove duplicate neomodel link (#240)
adam-cowley Jul 12, 2024
1308ccf
0.25.2
adam-cowley Jul 12, 2024
0b88767
0.25.3
adam-cowley Jul 12, 2024
2262c35
Labels: make deprecated labels yellow, discontinued red. (#242)
stefano-ottolenghi Jul 15, 2024
ea0e76d
Enlarge docs header dropdown (#243)
stefano-ottolenghi Jul 19, 2024
e6b1710
Merge branch 'master' into cs-all
recrwplay Jul 22, 2024
415b48f
better label positioning for responsive
recrwplay Aug 2, 2024
675eaf8
page-labels position
recrwplay Aug 2, 2024
ec3244c
bug fix
recrwplay Aug 2, 2024
3210677
default to all and show labels
recrwplay Aug 5, 2024
7103f14
set and use default value in options
recrwplay Aug 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions preview-src/cheat-sheet.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ This example only applies to Neo4j Enterprise Edition and is marked with the `[.
=== Read queries subsection


[.neo4j-ce.neo4j-ee.aura-dbe.aura-dsp.aura-dbp.aura-dse]
====
[source, cypher, role=noheader]
----
<CYPHER EXAMPLE>
----

[.description]
This example only applies to Neo4j Enterprise Edition and is marked with the `[.neo4j-ee]` role.
====


====
[source, cypher, role=noheader]
----
Expand Down
4 changes: 3 additions & 1 deletion preview-src/ui-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ page:
# additional page attributes indexed by page-slug
pages-data:
cheatsheet-products: &cheatsheet-products
- name: 'All'
class: 'all'
default: true
- name: 'Neo4j Community Edition'
class: 'neo4j-ce'
- name: 'Neo4j Enterprise Edition'
Expand All @@ -288,7 +291,6 @@ page:
class: 'aura-dbp'
- name: 'AuraDB Enterprise'
class: 'aura-dbe'
default: true
- name: 'AuraDS Professional'
class: 'aura-dsp'
- name: 'AuraDS Enterprise'
Expand Down
55 changes: 37 additions & 18 deletions src/css/cheat-sheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ body.cheat-sheet .nav-panel-versions .dropdown .dropdown-label {
body.cheat-sheet .nav-panel-versions .dropdown .dropdown-styles {
width: 50%;
display: inline-block;
background-color: var(--colors-neutral-10);
}

body.cheat-sheet .selectors > div {
Expand All @@ -200,7 +201,7 @@ body.cheat-sheet .selectors > div {
body.cheat-sheet .selectors .dropdown .dropdown-styles {
display: inline-block;
width: 100%;
/* background-color: var(--toolbar-background); */
background-color: var(--colors-neutral-10);
}

/* toc */
Expand Down Expand Up @@ -337,6 +338,10 @@ body.cheat-sheet .sect1 {
flex-wrap: wrap;
}

body.cheat-sheet .sect1 > .sectionbody {
margin-top: 0.75rem;
}

body.cheat-sheet .sect2 {
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -401,7 +406,7 @@ body.cheat-sheet .exampleblock > .content > div {

body.cheat-sheet .exampleblock > .content > div.labels {
flex: 0 0 100%;
justify-content: flex-start;
justify-content: flex-end;
padding-bottom: 0;
padding-top: 0;
gap: 0.25rem;
Expand All @@ -411,11 +416,6 @@ body.cheat-sheet .exampleblock > .content > div.labels span.label {
margin-top: 1rem;
}

body.cheat-sheet div.labels span.group--products,
body.cheat-sheet div.page-labels span.group--products {
display: none;
}

body.cheat-sheet .exampleblock > .content > div.extra {
flex-grow: 2;
border-top: none;
Expand All @@ -433,7 +433,7 @@ body.cheat-sheet .page-labels {
/* flex-grow: 1; */
/* flex-direction: row-reverse; */
margin: 0;
padding: 0;
padding: 1rem 0.5rem;
align-items: center;
gap: 0.25rem;
/* border-bottom: 1px solid rgba(var(--colors-neutral-20)); */
Expand All @@ -445,11 +445,12 @@ body.cheat-sheet .sect1 > h2 {

body.cheat-sheet .sect1 > .page-labels {
padding-right: 0.5rem;
margin: 0 0 0 auto;
}

body.cheat-sheet .page-labels:first-of-type {
/* body.cheat-sheet .page-labels:first-of-type {
margin: 0 0 0 auto;
}
} */

body.cheat-sheet .page-labels p {
flex-direction: row;
Expand Down Expand Up @@ -504,6 +505,10 @@ body.cheat-sheet span.label.hidden,
padding: 0;
}

body.cheat-sheet .article h3:not(.discrete) {
flex: auto;
}

body.cheat-sheet .toc-menu-placeholder ul {
display: flex;
flex-wrap: wrap;
Expand Down Expand Up @@ -540,26 +545,37 @@ body.cheat-sheet span.label.hidden,
margin: 0 0.5rem;
} */

body.cheat-sheet .sect1 > .page-labels {
justify-content: flex-start;
margin: 0;
}

body.cheat-sheet .sect2 {
background: none;
/* background: none; */
padding: 0;
border: 1px solid rgba(var(--colors-neutral-30));
}

body.cheat-sheet .sect2 > div.exampleblock:first-of-type {
border: none;
}

body.cheat-sheet h3:not(.discrete) {
background: rgba(var(--colors-neutral-20));
margin: 0 0.5rem 0 0.5rem;
/* background: rgba(var(--colors-neutral-20)); */
/* margin: 0 0.5rem 0 0.5rem; */
padding: 1rem;
flex-grow: 1;
border: 1px solid rgba(var(--colors-neutral-30));
/* border: 1px solid rgba(var(--colors-neutral-30)); */
/* border-right: none; */
}

body.cheat-sheet .sect2 > div {
flex: 0 0 80%;
flex-grow: 1;
padding: 0.5rem;
/* padding: 0.5rem; */
margin: 0 0.5rem;
background-color: rgba(var(--colors-neutral-20));
border: 1px solid rgba(var(--colors-neutral-70));
/* background-color: rgba(var(--colors-neutral-20)); */
/* border: 1px solid rgba(var(--colors-neutral-70)); */
border-radius: 0;
}

Expand All @@ -578,8 +594,11 @@ body.cheat-sheet span.label.hidden,
}

body.cheat-sheet .sect2 > div.page-labels {
/* background: rgba(var(--colors-neutral-20)); */
border-left: none;
margin-left: -0.5rem;
margin-left: 0;
padding: 1rem;
/* flex-grow: 1; */
}

body.cheat-sheet .sect2 > div.listingblock {
Expand Down
1 change: 1 addition & 0 deletions src/css/labels.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ span.label--beta {

span.label--na,
span.label--no,
span.label.not-available,
span.label--removed {
background: var(--warning-color);
color: var(--warning-background-color);
Expand Down
73 changes: 50 additions & 23 deletions src/js/50-cheat-sheet-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const optionMap = [...selectorOptions].map((o) => ({
text: o.dataset.label,
class: o.dataset.class,
labelType: o.dataset.labelType,
default: o.dataset.defaultValue,
labelOnly: o.hidden,
selected: o.selected,
inScope: true,
Expand All @@ -23,7 +24,9 @@ const prodMatrix = {
'neo4j-enterprise': 'neo4j-ee',
}

const defaultProd = 'auradb-enterprise'
// get the default product from optionMap
const defaultProdArray = optionMap.find((prod) => prod.default === 'true')
const defaultProd = defaultProdArray ? defaultProdArray.value : optionMap[0].value

const defaultClasses = ['exampleblock', 'sect2', 'sect1']

Expand Down Expand Up @@ -55,7 +58,7 @@ document.addEventListener('DOMContentLoaded', function () {
if (labelShow) {
labelShow.addEventListener('click', function (c) {
c.stopPropagation()
toggleLabels(c)
toggleLabels(c.target.checked)
})
}

Expand All @@ -79,7 +82,7 @@ document.addEventListener('DOMContentLoaded', function () {
// console.log(`classes on the element: ${elClasses}`)

// get an array of classes that match the select options
const labelsToAdd = optionNames.filter(function (obj) {
let labelsToAdd = optionNames.filter(function (obj) {
return elClasses.indexOf(obj) !== -1
}).sort()

Expand All @@ -100,17 +103,27 @@ document.addEventListener('DOMContentLoaded', function () {
return
}

const allLabels = Object.values(prodMatrix)
let availableOn = true
const difference = allLabels.filter((l) => !labelsToAdd.includes(l))
if (difference && difference.length <= 2) {
labelsToAdd = difference
availableOn = false
}

if (labelsToAdd && labelsToAdd.length > 0) {
labelsToAdd.forEach((label) => {
addLabel(el, label)
if (label !== 'all') {
addLabel(el, label, availableOn)
}
})
}
})

// if we've removed elements we need to clean the toc by removing entries for those elements
cleanToc()

function addLabel (el, match) {
function addLabel (el, match, availableOn) {
const div = createElement('div', 'paragraph')
let labelType = 'labels'

Expand All @@ -133,8 +146,11 @@ document.addEventListener('DOMContentLoaded', function () {
const p = createElement('p')
const span = createElement('span', `label label--${match} group--${group}`)

const text = getProductFromOptionMap(match)

let text = getProductFromOptionMap(match)
if (!availableOn) {
text = 'Not available on ' + text
span.classList.add('not-available')
}
span.textContent = text
p.appendChild(span)

Expand Down Expand Up @@ -174,17 +190,25 @@ document.addEventListener('DOMContentLoaded', function () {
prodSelector.addEventListener('change', function (e) {
e.stopPropagation()

// if localhost
if (curURL.host.indexOf('localhost') !== -1) {
setVisibility(hiddenOptionNames, e.target.value === 'all')
return
}

const currentProd = Object.keys(prodMatrix).find((key) => prodMatrix[key] === e.target.dataset.current)
const newProd = Object.keys(prodMatrix).find((key) => prodMatrix[key] === e.target.value)
const re = new RegExp(`/${currentProd}/`)
let newURL

// if we're using a proxied path, just load the new url
if (selectionFromPath) {
// get the new url
const currentProd = Object.keys(prodMatrix).find((key) => prodMatrix[key] === e.target.dataset.current)
const newProd = Object.keys(prodMatrix).find((key) => prodMatrix[key] === e.target.value)
const newURL = curURL.href.replace(currentProd, newProd)
document.location.replace(newURL)
newURL = newProd ? curURL.href.replace(re, `/${newProd}/`) : curURL.href.replace(re, '')
} else {
// reset everything
setVisibility(hiddenOptionNames)
newURL = curURL.href.split('#')[0].concat(newProd).concat(curURL.hash)
}

if (newURL) document.location.replace(newURL)
})

var versionSelector = document.querySelector('body.cheat-sheet .version-selector')
Expand All @@ -211,7 +235,7 @@ document.addEventListener('DOMContentLoaded', function () {
})
}

setVisibility(hiddenOptionNames)
setVisibility(hiddenOptionNames, prodSelector.dataset.current === 'all')

const matchTo = parseFloat(document.querySelector('.nav-container .selectors').getBoundingClientRect().height)
const firstSection = document.querySelector('article h2')
Expand All @@ -226,19 +250,22 @@ document.addEventListener('DOMContentLoaded', function () {
})
})

function setVisibility (hiddenOptionNames) {
function setVisibility (hiddenOptionNames, showLabels = false) {
// reset everything
clearClass('hidden')
clearClass('hide-this')
clearClass('selectors-match')
clearClasses(['hidden', 'hide-this', 'selectors-match'])
// clearClass('hide-this')
// clearClass('selectors-match')
selectorMatch(hiddenOptionNames)
hideTocEntries()
toggleLabels(showLabels)
document.querySelector('body.cheat-sheet').style.opacity = '1'
}

function clearClass (cl) {
document.querySelectorAll(`.toc-menu .${cl}, .content .sect1.${cl}, .content .sect2.${cl}, .content .exampleblock.${cl}`).forEach((el) => {
el.classList.remove(cl)
function clearClasses (cl) {
cl.forEach((c) => {
document.querySelectorAll(`.toc-menu .${c}, .content .sect1.${c}, .content .sect2.${c}, .content .exampleblock.${c}`).forEach((el) => {
el.classList.remove(c)
})
})
}

Expand Down Expand Up @@ -459,7 +486,7 @@ function removeDefaultClasses (c) {

function toggleLabels (l) {
document.querySelectorAll('span.group--products').forEach((div) => {
if (l.target.checked) {
if (l) {
div.style.display = 'flex'
} else {
div.style.display = 'none'
Expand Down
2 changes: 1 addition & 1 deletion src/partials/footer-scripts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{#if (or (eq @root.page.layout 'training-certification') (eq @root.page.layout 'training-enrollment') (eq @root.page.layout 'training'))}}
<script src="//go.neo4j.com/js/forms2/js/forms2.min.js"></script>
{{/if}}
{{#if (and (eq @root.page.attributes.theme "cheat-sheet") (not (eq @root.site.url "http://localhost:5252")))}}
{{#if (and (eq @root.page.attributes.theme "cheat-sheet") @root.page.attributes.publish)}}
<script src="{{{@root.site.path}}}{{{@root.site.ui.url}}}/js/vendor/auth0.js"></script>

<script src="{{{@root.site.path}}}{{{@root.site.ui.url}}}/js/site.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion src/partials/nav-selectors.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{{!-- <option value="all" data-label="all" data-class="all" data-label-type="products">All</option> --}}
{{#each page.attributes.cheatsheet-products}}
{{#if this.default}}
<option value="{{this.class}}" data-label="{{#with (or this.label this.name) }}{{{this}}}{{/with}}" data-class="{{this.class}}" data-label-type="products" selected>{{this.name}}</option>
<option value="{{this.class}}" data-label="{{#with (or this.label this.name) }}{{{this}}}{{/with}}" data-class="{{this.class}}" data-label-type="products" data-default-value="true" selected>{{this.name}}</option>
{{else}}
<option value="{{this.class}}" data-label="{{#with (or this.label this.name) }}{{{this}}}{{/with}}" data-class="{{this.class}}" data-label-type="products" {{#if this.label-only }}hidden{{/if}}>{{this.name}}</option>
{{/if}}
Expand Down