kopia lustrzana https://github.com/simonw/datasette
include license for sqlformatter, only show button with js enabled
rodzic
316b6db666
commit
86ac746cfc
|
@ -133,6 +133,7 @@ form input[type=button]{
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
border-radius: .25rem;
|
border-radius: .25rem;
|
||||||
-webkit-appearance: button;
|
-webkit-appearance: button;
|
||||||
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-row {
|
.filter-row {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,10 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('js-format-button').addEventListener(
|
var input = document.createElement('input');
|
||||||
'click', format, false
|
input.id = 'js-format-sql';
|
||||||
);
|
input.type = 'button'
|
||||||
|
input.value = 'Format SQL';
|
||||||
|
input.addEventListener('click', format, false);
|
||||||
|
document.getElementById('js-run-sql').parentNode.appendChild(input);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -19,10 +19,7 @@
|
||||||
<form class="sql" action="/{{ database }}-{{ database_hash }}" method="get">
|
<form class="sql" action="/{{ database }}-{{ database_hash }}" method="get">
|
||||||
<h3>Custom SQL query</h3>
|
<h3>Custom SQL query</h3>
|
||||||
<p><textarea name="sql">select * from {{ tables[0].name|escape_sqlite }}</textarea></p>
|
<p><textarea name="sql">select * from {{ tables[0].name|escape_sqlite }}</textarea></p>
|
||||||
<p><input type="submit" value="Run SQL"></p>
|
<p><input id="js-run-sql" type="submit" value="Run SQL"></p>
|
||||||
<p>
|
|
||||||
<input type="button" value="Format SQL" id="js-format-button">
|
|
||||||
</p>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% for table in tables %}
|
{% for table in tables %}
|
||||||
|
|
|
@ -36,10 +36,7 @@
|
||||||
<p><label for="qp{{ loop.index }}">{{ name }}</label> <input type="text" id="qp{{ loop.index }}" name="{{ name }}" value="{{ value }}"></p>
|
<p><label for="qp{{ loop.index }}">{{ name }}</label> <input type="text" id="qp{{ loop.index }}" name="{{ name }}" value="{{ value }}"></p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>
|
<p><input type="submit" value="Run SQL" id="js-run-sql"></p>
|
||||||
<input type="submit" value="Run SQL">
|
|
||||||
<input type="button" value="Format SQL" id="js-format-button">
|
|
||||||
</p>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% if rows %}
|
{% if rows %}
|
||||||
|
|
Ładowanie…
Reference in New Issue