Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datasette.client internal requests mechanism #1000

Merged
merged 12 commits into from
Oct 9, 2020
Prev Previous commit
Next Next commit
Added base_url in a bunch more places
simonw committed Oct 9, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 68dc2f20712c769bcd22b4cb7b59674470fa0ac9
4 changes: 2 additions & 2 deletions datasette/templates/_table.html
Original file line number Diff line number Diff line change
@@ -8,9 +8,9 @@
{{ column.name }}
{% else %}
{% if column.name == sort %}
<a href="{{ path_with_replaced_args(request, {'_sort_desc': column.name, '_sort': None, '_next': None}) }}" rel="nofollow">{{ column.name }}&nbsp;▼</a>
<a href="{{ base_url }}{{ path_with_replaced_args(request, {'_sort_desc': column.name, '_sort': None, '_next': None}) }}" rel="nofollow">{{ column.name }}&nbsp;▼</a>
{% else %}
<a href="{{ path_with_replaced_args(request, {'_sort': column.name, '_sort_desc': None, '_next': None}) }}" rel="nofollow">{{ column.name }}{% if column.name == sort_desc %}&nbsp;▲{% endif %}</a>
<a href="{{ base_url }}{{ path_with_replaced_args(request, {'_sort': column.name, '_sort_desc': None, '_next': None}) }}" rel="nofollow">{{ column.name }}{% if column.name == sort_desc %}&nbsp;▲{% endif %}</a>
{% endif %}
{% endif %}
</th>
2 changes: 1 addition & 1 deletion datasette/templates/query.html
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ <h3>Query parameters</h3>
</form>

{% if display_rows %}
<p class="export-links">This data as {% for name, url in renderers.items() %}<a href="{{ url }}">{{ name }}</a>{{ ", " if not loop.last }}{% endfor %}, <a href="{{ url_csv }}">CSV</a></p>
<p class="export-links">This data as {% for name, url in renderers.items() %}<a href="{{ base_url }}{{ url }}">{{ name }}</a>{{ ", " if not loop.last }}{% endfor %}, <a href="{{ base_url }}{{ url_csv }}">CSV</a></p>
<table class="rows-and-columns">
<thead>
<tr>
2 changes: 1 addition & 1 deletion datasette/templates/row.html
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ <h1 style="padding-left: 10px; border-left: 10px solid #{{ database_color(databa

{% block description_source_license %}{% include "_description_source_license.html" %}{% endblock %}

<p>This data as {% for name, url in renderers.items() %}<a href="{{ url }}">{{ name }}</a>{{ ", " if not loop.last }}{% endfor %}</p>
<p>This data as {% for name, url in renderers.items() %}<a href="{{ base_url }}{{ url }}">{{ name }}</a>{{ ", " if not loop.last }}{% endfor %}</p>

{% include custom_table_templates %}

11 changes: 5 additions & 6 deletions datasette/templates/table.html
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@
{% for column in display_columns %}
.rows-and-columns td:nth-of-type({{ loop.index }}):before { content: "{{ column.name|escape_css_string }}"; }
{% endfor %}
}
</style>
{% endblock %}

@@ -111,7 +110,7 @@ <h3>{{ extra_wheres_for_ui|length }} extra where clause{% if extra_wheres_for_ui
<p><a class="not-underlined" title="{{ query.sql }}" href="{{ database_url(database) }}?{{ {'sql': query.sql}|urlencode|safe }}{% if query.params %}&amp;{{ query.params|urlencode|safe }}{% endif %}">&#x270e; <span class="underlined">View and edit SQL</span></a></p>
{% endif %}

<p class="export-links">This data as {% for name, url in renderers.items() %}<a href="{{ url }}">{{ name }}</a>{{ ", " if not loop.last }}{% endfor %}{% if display_rows %}, <a href="{{ url_csv }}">CSV</a> (<a href="#export">advanced</a>){% endif %}</p>
<p class="export-links">This data as {% for name, url in renderers.items() %}<a href="{{ base_url }}{{ url }}">{{ name }}</a>{{ ", " if not loop.last }}{% endfor %}{% if display_rows %}, <a href="{{ base_url }}{{ url_csv }}">CSV</a> (<a href="#export">advanced</a>){% endif %}</p>

{% if suggested_facets %}
<p class="suggested-facets">
@@ -160,10 +159,10 @@ <h3>{{ extra_wheres_for_ui|length }} extra where clause{% if extra_wheres_for_ui
<div id="export" class="advanced-export">
<h3>Advanced export</h3>
<p>JSON shape:
<a href="{{ renderers['json'] }}">default</a>,
<a href="{{ append_querystring(renderers['json'], '_shape=array') }}">array</a>,
<a href="{{ append_querystring(renderers['json'], '_shape=array&_nl=on') }}">newline-delimited</a>{% if primary_keys %},
<a href="{{ append_querystring(renderers['json'], '_shape=object') }}">object</a>
<a href="{{ base_url }}{{ renderers['json'] }}">default</a>,
<a href="{{ base_url }}{{ append_querystring(renderers['json'], '_shape=array') }}">array</a>,
<a href="{{ base_url }}{{ append_querystring(renderers['json'], '_shape=array&_nl=on') }}">newline-delimited</a>{% if primary_keys %},
<a href="{{ base_url }}{{ append_querystring(renderers['json'], '_shape=object') }}">object</a>
{% endif %}
</p>
<form action="{{ url_csv_path }}" method="get">