mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Button to format SQL, closes #136
SQL code will be formatted on page load, and can additionally be formatted by clicking the "Format SQL" button. Thanks, @rixx!
This commit is contained in:
parent
fffd69ec03
commit
af2e6a5cf1
6 changed files with 50 additions and 9 deletions
|
|
@ -37,7 +37,7 @@
|
|||
{% if editable and config.allow_sql %}
|
||||
<p><textarea id="sql-editor" name="sql">{% if query and query.sql %}{{ query.sql }}{% else %}select * from {{ tables[0].name|escape_sqlite }}{% endif %}</textarea></p>
|
||||
{% else %}
|
||||
<pre>{% if query %}{{ query.sql }}{% endif %}</pre>
|
||||
<pre id="sql-query">{% if query %}{{ query.sql }}{% endif %}</pre>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<input type="hidden" name="sql" value="{% if query and query.sql %}{{ query.sql }}{% else %}select * from {{ tables[0].name|escape_sqlite }}{% endif %}">
|
||||
|
|
@ -49,7 +49,10 @@
|
|||
<p><label for="qp{{ loop.index }}">{{ name }}</label> <input type="text" id="qp{{ loop.index }}" name="{{ name }}" value="{{ value }}"></p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<p><input type="submit" value="Run SQL"></p>
|
||||
<p>
|
||||
<button id="sql-format" type="button" hidden>Format SQL</button>
|
||||
<input type="submit" value="Run SQL">
|
||||
</p>
|
||||
</form>
|
||||
|
||||
{% if display_rows %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue