mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
Code samples: cleanup for publishing
This commit is contained in:
18
assets/js/code-samples.js
Normal file
18
assets/js/code-samples.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
$(document).ready(() => {
|
||||||
|
$(".single_lang input").change((event) => {
|
||||||
|
const lang = $(event.target).val()
|
||||||
|
const lang_checked = $(event.target).prop("checked")
|
||||||
|
|
||||||
|
if (lang_checked) {
|
||||||
|
// Enabling a language
|
||||||
|
//$("#input_all").prop("checked", false)
|
||||||
|
$("#code_samples_list .card").hide()
|
||||||
|
$(`#code_samples_list .card.lang_${lang}`).show()
|
||||||
|
}
|
||||||
|
// Disabling a language? Let the other element's handler do it
|
||||||
|
})
|
||||||
|
$("#input_all").change((event) => {
|
||||||
|
const lang = $(event.target).val()
|
||||||
|
$("#code_samples_list .card").show()
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -109,11 +109,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% include "component-tree-nav.html.jinja" %}
|
{% include "component-tree-nav.html.jinja" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block bottom_left_sidebar %}
|
||||||
{% if currentpage.codesamples is defined %}
|
{% endblock %}
|
||||||
{% include "component-code-sample-filter.html.jinja" %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</aside>
|
</aside>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div><!--/.row (main layout)-->
|
</div><!--/.row (main layout)-->
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
{% set lang_text = {
|
|
||||||
"cli": "CLI",
|
|
||||||
"go": "go",
|
|
||||||
"java": "Java",
|
|
||||||
"js": "JavaScript",
|
|
||||||
"py": "Python",
|
|
||||||
"http": "HTTP",
|
|
||||||
} %}
|
|
||||||
|
|
||||||
<div class="p-2 mt-30">
|
|
||||||
<form >
|
|
||||||
<p>Code Language</p>
|
|
||||||
<div>
|
|
||||||
<input type="checkbox" name="langs" id="input_all" value="All" checked> <label for="input_all">All</label>
|
|
||||||
</div>
|
|
||||||
{% for lang in all_langs %}
|
|
||||||
{# <input type="checkbox" name="langs" id="langs_javascript" value="JavaScript" checked> <label for="langs_javascript">{{langValue}}</label> #}
|
|
||||||
<div>
|
|
||||||
<input type="checkbox" name="langs" id="input_{{lang}}" value="{{lang_text[lang]}}"> <label for="input_{{lang}}">{{lang_text[lang]}}</label>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<div>
|
|
||||||
{# <input type="submit" name="submit" value="Submit"/> #}
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
@@ -6,18 +6,14 @@
|
|||||||
{% block main %}
|
{% block main %}
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|
||||||
{# <div class="position-relative">
|
|
||||||
<img src="./img/backgrounds/xrpl-overview-purple.svg" class="landing-bg" id="xrpl-overview-purple">
|
|
||||||
</div> #}
|
|
||||||
|
|
||||||
<section class="py-26">
|
<section class="py-26">
|
||||||
<div class="col-lg-8 mx-auto text-lg-center">
|
<div class="col-lg-8 mx-auto text-lg-center">
|
||||||
<div class="d-flex flex-column-reverse">
|
<div class="d-flex flex-column-reverse">
|
||||||
|
|
||||||
<h1 class="mb-0">{% trans %}Solutions to Accelerate Development{% endtrans %}</h1>
|
<h1 class="mb-0">{% trans %}Solutions to Accelerate Development{% endtrans %}</h1>
|
||||||
<h6 class="eyebrow mb-3">{% trans %}Code Samples{% endtrans %}</h6>
|
<h6 class="eyebrow mb-3">{% trans %}Code Samples{% endtrans %}</h6>
|
||||||
</div>
|
</div>
|
||||||
<a class="mt-12 btn btn-primary btn-arrow" href="#">Submit Code Samples</a>
|
{# <a class="mt-12 btn btn-primary btn-arrow" href="#">Submit Code Samples</a> #}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -30,23 +26,9 @@
|
|||||||
<h6 class="eyebrow mb-3">{% trans %}Explore Code Samples{% endtrans %}</h6>
|
<h6 class="eyebrow mb-3">{% trans %}Explore Code Samples{% endtrans %}</h6>
|
||||||
<h3 class="h4 h2-sm">{% trans %}Browse sample code for building common use cases on the XRP Ledger{% endtrans %}</h3>
|
<h3 class="h4 h2-sm">{% trans %}Browse sample code for building common use cases on the XRP Ledger{% endtrans %}</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row col-12 card-deck mt-10" id="code-samples-deck">
|
<div class="row col-12 card-deck mt-10" id="code-samples-deck">
|
||||||
|
|
||||||
|
|
||||||
{# {% set code_samples = [
|
|
||||||
{ "href": "https://github.com/XRPLF/xrpl-dev-portal/tree/master/content/_code-samples/checks",
|
|
||||||
"title": _("Checks Tutorials"),
|
|
||||||
"langs": [
|
|
||||||
"js",
|
|
||||||
"json-rpc",
|
|
||||||
"websocket",
|
|
||||||
"cli"
|
|
||||||
],
|
|
||||||
"description": _("Create, cash, and cancel Checks for exact or flexible amounts.")
|
|
||||||
},
|
|
||||||
] %} #}
|
|
||||||
|
|
||||||
{% set code_samples = all_code_samples() %}
|
{% set code_samples = all_code_samples() %}
|
||||||
|
|
||||||
{% set lang_icons = {
|
{% set lang_icons = {
|
||||||
@@ -58,7 +40,7 @@
|
|||||||
"http": "assets/img/logos/globe.svg",
|
"http": "assets/img/logos/globe.svg",
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
<div class="row col-md-12 px-0">
|
<div class="row col-md-12 px-0" id="code_samples_list">
|
||||||
{% for card in code_samples %}
|
{% for card in code_samples %}
|
||||||
<a class="card cardtest col-12 col-lg-5 {% for lang in card.langs %} lang_{{lang}} {% endfor %} " href="{{target.github_forkurl}}/tree/{{target.github_branch}}/{{card.href}}">
|
<a class="card cardtest col-12 col-lg-5 {% for lang in card.langs %} lang_{{lang}} {% endfor %} " href="{{target.github_forkurl}}/tree/{{target.github_branch}}/{{card.href}}">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
@@ -70,43 +52,37 @@
|
|||||||
<h4 class="card-title h5">{{card.title}}</h4>
|
<h4 class="card-title h5">{{card.title}}</h4>
|
||||||
<p class="card-text">{{card.description}}</p>
|
<p class="card-text">{{card.description}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer"> </div>
|
||||||
{# <span class="label label-accounts" href="label-accounts.html" title="Pages relating to accounts in the XRP Ledger.">Smart Transactor</span> #}
|
|
||||||
</div>
|
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{# container #}
|
<section class="container-new py-26">
|
||||||
{# col-lg-12 mx-auto #}
|
<div>
|
||||||
<section class="py-26 code-contribute">
|
|
||||||
<div class=" ">
|
|
||||||
|
|
||||||
<div class="d-flex flex-column">
|
<div class="d-flex flex-column">
|
||||||
<h3 class="h4 h2-sm pb-4">{% trans %}Contribute Code Samples{% endtrans %}</h3>
|
<h3 class="h4 h2-sm pb-4">{% trans %}Contribute Code Samples{% endtrans %}</h3>
|
||||||
<h6 class="eyebrow mb-20">{% trans %}Help the XRPL community by submitting your<br> own code samples{% endtrans %}</h6>
|
<h6 class="eyebrow mb-20">{% trans %}Help the XRPL community by submitting your<br> own code samples{% endtrans %}</h6>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row pl-4">
|
<div class="row pl-4">
|
||||||
<div class=" col-lg-3 pl-4 pl-lg-0 pr-4 contribute dot contribute_1"><span class="dot"></span><h5 class="pb-4 pt-md-5">Fork and clone</h5><p class="pb-4">Fork the xrpl-dev-portal repo. Using git, clone the fork to your computer.</p></div>
|
<div class=" col-lg-3 pl-4 pl-lg-0 pr-4 contribute dot contribute_1"><span class="dot"></span><h5 class="pb-4 pt-md-5">Fork and clone</h5><p class="pb-4">Fork the <a href="{{target.github_forkurl}}">xrpl-dev-portal repo</a>. Using git, clone the fork to your computer.</p></div>
|
||||||
<div class=" col-lg-3 pl-4 pl-lg-0 pr-4 contribute dot contribute_2"><span class="dot"></span><h5 class="pb-4 pt-md-5">Add to folder</h5><p class="pb-4">Add your sample code to the content/_code-samples folder. Be sure to include a README.md that summarizes what it does and anything else people should know about it.</p></div>
|
<div class=" col-lg-3 pl-4 pl-lg-0 pr-4 contribute dot contribute_2"><span class="dot"></span><h5 class="pb-4 pt-md-5">Add to folder</h5><p class="pb-4">Add your sample code to the <code>content/_code-samples/</code> folder. Be sure to include a <code>README.md</code> that summarizes what it does and anything else people should know about it.</p></div>
|
||||||
<div class=" col-lg-3 pl-4 pl-lg-0 pr-4 contribute dot contribute_3"><span class="dot"></span><h5 class="pb-4 pt-md-5">Commit and push</h5><p class="pb-4">Commit your changes and push them to your fork on GitHub.</p></div>
|
<div class=" col-lg-3 pl-4 pl-lg-0 pr-4 contribute dot contribute_3"><span class="dot"></span><h5 class="pb-4 pt-md-5">Commit and push</h5><p class="pb-4">Commit your changes and push them to your fork on GitHub.</p></div>
|
||||||
<div class=" col-lg-3 pl-4 pl-lg-0 pr-2 contribute dot contribute_4 mb-4"><span class="dot"></span><h5 class="pb-4 pt-md-5">Open a pull request</h5><p class="pb-0 mb-0">Open a pull request to the original repo. Maintainers will review your submission and suggest changes if necessary. If the code sample is helpful, it’ll be merged and added to XRPL.org!</p></div>
|
<div class=" col-lg-3 pl-4 pl-lg-0 pr-2 contribute dot contribute_4 mb-4"><span class="dot"></span><h5 class="pb-4 pt-md-5">Open a pull request</h5><p class="pb-0 mb-0">Open a pull request to the original repo. Maintainers will review your submission and suggest changes if necessary. If the code sample is helpful, it’ll be merged and added to XRPL.org!</p></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a class="mt-12 btn btn-primary btn-arrow" href="#">Submit Code Samples</a>
|
{#<a class="mt-12 btn btn-primary btn-arrow" href="#">Submit Code Samples</a>#}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% block analytics %}
|
{% block analytics %}
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
@@ -117,3 +93,36 @@
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
{% endblock analytics %}
|
{% endblock analytics %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block bottom_left_sidebar %}
|
||||||
|
{% set lang_text = {
|
||||||
|
"cli": "CLI",
|
||||||
|
"go": "go",
|
||||||
|
"java": "Java",
|
||||||
|
"js": "JavaScript",
|
||||||
|
"py": "Python",
|
||||||
|
"http": "HTTP",
|
||||||
|
} %}
|
||||||
|
|
||||||
|
<div class="p-2 mt-30">
|
||||||
|
<form >
|
||||||
|
<p>Code Language</p>
|
||||||
|
<div>
|
||||||
|
<input type="radio" name="langs" id="input_all" value="All" checked> <label for="input_all">All</label>
|
||||||
|
</div>
|
||||||
|
{% for lang in all_langs %}
|
||||||
|
<div class="single_lang">
|
||||||
|
<input type="radio" name="langs" id="input_{{lang}}" value="{{lang}}">
|
||||||
|
<label for="input_{{lang}}">{{lang_text[lang]}}</label>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block endbody %}
|
||||||
|
<script type="application/javascript" src="{{currentpage.prefix}}assets/js/code-samples.js"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user