diff --git a/assets/js/expandcode.js b/assets/js/expandcode.js index d2a47d3e25..ceaa8eb9ef 100644 --- a/assets/js/expandcode.js +++ b/assets/js/expandcode.js @@ -9,12 +9,13 @@ function toggle_cs(eo) { if (placeholders.length) { // collapsing placeholders.remove(); - $(window).scrollTop(code_el.offset().top - 124) + // This caused jumping around when code was closed. + // $(window).scrollTop(code_el.offset().top - 124) } else { code_el.after("
 
"); } current_button_expanded = code_el.hasClass('expanded'); @@ -38,6 +39,7 @@ function make_code_expandable() { return "
"; }); + // Multi code blocks var code_samples = $('.code_sample'); code_samples.find("code").each(function() { let jqThis = $(this); @@ -45,7 +47,7 @@ function make_code_expandable() { jqThis.dblclick(toggle_cs); jqThis.attr('title', 'Double-click to expand/collapse'); var newbtn = $(``); - newbtn.appendTo(jqThis.parents(".code_sample")); + newbtn.appendTo(jqThis.parents(".codehilite").children(".btn-group")); } }); diff --git a/template/pagetype-doc.html.jinja b/template/pagetype-doc.html.jinja index 27f3a64f1e..0555e9e34d 100644 --- a/template/pagetype-doc.html.jinja +++ b/template/pagetype-doc.html.jinja @@ -15,21 +15,44 @@ new ClipboardJS('.clipboard-btn'); }); + {# temp styling for testing. #} {% endblock %} @@ -38,7 +61,7 @@
{% if (target.lang != "en" and "en" in currentpage.targets) or currentpage.untranslated_warning %} {# Add a "sorry this page isn't translated" banner. #} -
{% trans %}Sorry, this page is not available in your language.{% endtrans %} +
{% trans %}Sorry, this page is not available in your language.{% endtrans %}

{% trans %}We are making an effort to offer the XRP Ledger Dev Portal in a variety of languages, but not all pages are available in all languages. If you'd like to help, please contribute!{% endtrans %}

{% endif %} diff --git a/tool/filter_copy_code_to_clipboard.py b/tool/filter_copy_code_to_clipboard.py index 6ff346248e..bbde54e967 100644 --- a/tool/filter_copy_code_to_clipboard.py +++ b/tool/filter_copy_code_to_clipboard.py @@ -18,7 +18,7 @@ def filter_soup(soup, **kwargs): 1. Finds all elements with class of "codehilite" 2. Adds copy to clipboard button. Button looks like > - + 3. Adds id to element. """ @@ -29,15 +29,22 @@ def filter_soup(soup, **kwargs): codeBlock = code_block.find("code") codeBlock_id = "codeblock-%d" % index1 codeBlock["id"] = codeBlock_id + # Add button group + btn_group = soup.new_tag('div') + btn_group['class'] = "btn-group" + btn_group['role'] = "group" + btn_group['aria-label'] = "Code Buttons" + code_block.insert(0, btn_group) + # Add copy button new_tag = soup.new_tag('button', id=codeBlock_id+'button') icon = soup.new_tag('i') icon['class'] = "fa fa-clipboard" - new_tag['class'] = "clipboard-btn" + new_tag['class'] = "btn btn-outline-secondary clipboard-btn" new_tag['alt'] = "Copy to clipboard" new_tag['data-clipboard-target'] = "#"+codeBlock_id new_tag.insert(0, icon) - code_block.insert(0, new_tag) + btn_group.insert(0, new_tag) # index1 += 1