-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(templates,css,js): better api examples;
- Aligned API examples with the new DataStore templating and styles.
- Loading branch information
1 parent
d6ba9e1
commit 718d260
Showing
7 changed files
with
253 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#api-access-accordion figure{ | ||
display: none; | ||
} | ||
#api-access-accordion figure.python{ | ||
display: none; | ||
} | ||
/* Default cURL display */ | ||
#api-access-accordion figure.curl{ | ||
display: block; | ||
} | ||
#api-access-accordion figure.powershell{ | ||
display: none; | ||
} | ||
#api-access-example-code-control label::after{ | ||
content: none !important; | ||
} | ||
#api-access-example-code-control input[type="radio"]{ | ||
cursor: pointer !important; | ||
} | ||
#api-access-accordion figure{ | ||
margin-bottom: 12px !important; | ||
} | ||
#api-access-accordion pre{ | ||
margin-bottom: 0 !important; | ||
border-bottom-left-radius: 0 !important; | ||
border-bottom-right-radius: 0 !important; | ||
} | ||
#api-access-accordion figure figcaption{ | ||
padding: 4px 8px; | ||
background-color: #335075; | ||
color: white; | ||
font-weight: 700 !important; | ||
font-size: 14px; | ||
line-height: 1.5 !important; | ||
border-bottom-left-radius: 4px !important; | ||
border-bottom-right-radius: 4px !important; | ||
text-align: right !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
window.addEventListener('load', function(){ | ||
$(document).ready(function() { | ||
|
||
// Code example switching | ||
let codeExampleControl = $('#api-access-example-code-control'); | ||
let codeBlocks = $('#api-access-accordion').find('figure'); | ||
|
||
if( codeExampleControl.length > 0 ){ | ||
|
||
let controlButtons = $(codeExampleControl).find('input[name="api-access-example-code"]'); | ||
|
||
if( controlButtons.length > 0 ){ | ||
|
||
$(controlButtons).on('change', function(_event){ | ||
|
||
let selectedCode = $(codeExampleControl).find('input[name="api-access-example-code"]:checked').val(); | ||
|
||
$(codeBlocks).each(function(_index, _codeBlock){ | ||
|
||
if( $(_codeBlock).hasClass(selectedCode) ){ | ||
|
||
$(_codeBlock).show(); | ||
|
||
}else{ | ||
|
||
$(_codeBlock).hide(); | ||
|
||
} | ||
|
||
}); | ||
|
||
}); | ||
|
||
} | ||
|
||
} | ||
|
||
// Activity tab link | ||
let activityTab = $('#activity-lnk'); | ||
|
||
if( activityTab.length > 0 ){ | ||
|
||
let link = $('#activity').find('a').first().attr('href'); | ||
|
||
if( link && link.length > 0 ){ | ||
|
||
$(activityTab).attr('href', link); | ||
$(activityTab).removeAttr('aria-controls'); | ||
$(activityTab).attr('tabindex', 0); | ||
|
||
$(activityTab).off('click'); | ||
$(activityTab).off('keyup'); | ||
|
||
function _goto_activity(){ | ||
window.location = link; | ||
} | ||
|
||
$(activityTab).on('click.Link', function(_event){ | ||
_event.preventDefault(); | ||
_goto_activity(); | ||
}); | ||
$(activityTab).on('keyup.Link', function(_event){ | ||
let keyCode = _event.keyCode ? _event.keyCode : _event.which; | ||
// space and enter keys required for a11y | ||
if( keyCode == 32 || keyCode == 13 ){ | ||
_event.preventDefault(); | ||
_goto_activity(); | ||
} | ||
}); | ||
|
||
} | ||
|
||
} | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
code_block_buttons: | ||
contents: | ||
- js/code_block_buttons.js | ||
output: recombinant/%(version)s_code_block_buttons.js | ||
|
||
main_css: | ||
contents: | ||
- css/recombinant.css | ||
output: recombinant/%(version)s_recombinant.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.