Skip to content

Commit

Permalink
about and about_url metadata options
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Mar 15, 2019
1 parent 41744d7 commit bf6b0f9
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 2 deletions.
3 changes: 3 additions & 0 deletions datasette/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ def update_with_inherited_metadata(self, metadata):
"license": metadata.get("license") or self.metadata("license"),
"license_url": metadata.get("license_url")
or self.metadata("license_url"),
"about": metadata.get("about") or self.metadata("about"),
"about_url": metadata.get("about_url")
or self.metadata("about_url"),
}
)

Expand Down
2 changes: 2 additions & 0 deletions datasette/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ def plugins(all, plugins_dir):
@click.option("--license_url", help="License URL for metadata")
@click.option("--source", help="Source label for metadata")
@click.option("--source_url", help="Source URL for metadata")
@click.option("--about", help="About label for metadata")
@click.option("--about_url", help="About URL for metadata")
def package(
files,
tag,
Expand Down
2 changes: 2 additions & 0 deletions datasette/publish/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def add_common_publish_arguments_and_options(subcommand):
click.option("--license_url", help="License URL for metadata"),
click.option("--source", help="Source label for metadata"),
click.option("--source_url", help="Source URL for metadata"),
click.option("--about", help="About label for metadata"),
click.option("--about_url", help="About URL for metadata"),
)):
subcommand = decorator(subcommand)
return subcommand
Expand Down
4 changes: 4 additions & 0 deletions datasette/publish/heroku.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def heroku(
license_url,
source,
source_url,
about,
about_url,
name,
):
fail_if_publish_binary_not_installed(
Expand Down Expand Up @@ -72,6 +74,8 @@ def heroku(
"license_url": license_url,
"source": source,
"source_url": source_url,
"about": about,
"about_url": about_url,
},
):
app_name = None
Expand Down
4 changes: 4 additions & 0 deletions datasette/publish/now.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def now(
license_url,
source,
source_url,
about,
about_url,
name,
force,
token,
Expand Down Expand Up @@ -70,6 +72,8 @@ def now(
"license_url": license_url,
"source": source,
"source_url": source_url,
"about": about,
"about_url": about_url,
},
):
now_json = {
Expand Down
5 changes: 5 additions & 0 deletions datasette/templates/_description_source_license.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@
<a href="{{ metadata.source_url }}">
{% endif %}{{ metadata.source or metadata.source_url }}{% if metadata.source_url %}</a>{% endif %}
{% endif %}
{% if metadata.about or metadata.about_url %}{% if metadata.license or metadata.license_url or metadata.source or metadat.source_url %}&middot;{% endif %}
About: {% if metadata.about_url %}
<a href="{{ metadata.about_url }}">
{% endif %}{{ metadata.about or metadata.about_url }}{% if metadata.about_url %}</a>{% endif %}
{% endif %}
</p>
{% endif %}
5 changes: 5 additions & 0 deletions datasette/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
<a href="{{ metadata.source_url }}">
{% endif %}{{ metadata.source or metadata.source_url }}{% if metadata.source_url %}</a>{% endif %}
{% endif %}
{% if metadata.about or metadata.about_url %}&middot;
About: {% if metadata.about_url %}
<a href="{{ metadata.about_url }}">
{% endif %}{{ metadata.about or metadata.about_url }}{% if metadata.about_url %}</a>{% endif %}
{% endif %}
{% endif %}
</div>

Expand Down
2 changes: 2 additions & 0 deletions docs/datasette-package-help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ Options:
--license_url TEXT License URL for metadata
--source TEXT Source label for metadata
--source_url TEXT Source URL for metadata
--about TEXT About label for metadata
--about_url TEXT About URL for metadata
--help Show this message and exit.
2 changes: 2 additions & 0 deletions docs/datasette-publish-heroku-help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ Options:
--license_url TEXT License URL for metadata
--source TEXT Source label for metadata
--source_url TEXT Source URL for metadata
--about TEXT About label for metadata
--about_url TEXT About URL for metadata
-n, --name TEXT Application name to use when deploying
--help Show this message and exit.
2 changes: 2 additions & 0 deletions docs/datasette-publish-now-help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Options:
--license_url TEXT License URL for metadata
--source TEXT Source label for metadata
--source_url TEXT Source URL for metadata
--about TEXT About label for metadata
--about_url TEXT About URL for metadata
-n, --name TEXT Application name to use when deploying
--force Pass --force option to now
--token TEXT Auth token to use for deploy
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ def generate_sortable_rows(num):
'license_url': 'https://github.com/simonw/datasette/blob/master/LICENSE',
'source': 'tests/fixtures.py',
'source_url': 'https://github.com/simonw/datasette/blob/master/tests/fixtures.py',
'about': 'About Datasette',
'about_url': 'https://github.com/simonw/datasette',
"plugins": {
"name-of-plugin": {
"depth": "root"
Expand Down
6 changes: 4 additions & 2 deletions tests/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,14 +744,16 @@ def assert_querystring_equal(expected, actual):

def assert_footer_links(soup):
footer_links = soup.find('div', {'class': 'ft'}).findAll('a')
assert 3 == len(footer_links)
datasette_link, license_link, source_link = footer_links
assert 4 == len(footer_links)
datasette_link, license_link, source_link, about_link = footer_links
assert 'Datasette' == datasette_link.text.strip()
assert 'tests/fixtures.py' == source_link.text.strip()
assert 'Apache License 2.0' == license_link.text.strip()
assert 'About Datasette' == about_link.text.strip()
assert 'https://github.com/simonw/datasette' == datasette_link['href']
assert 'https://github.com/simonw/datasette/blob/master/tests/fixtures.py' == source_link['href']
assert 'https://github.com/simonw/datasette/blob/master/LICENSE' == license_link['href']
assert 'https://github.com/simonw/datasette' == about_link['href']


def inner_html(soup):
Expand Down

0 comments on commit bf6b0f9

Please sign in to comment.