Skip to content

Commit

Permalink
Use sphinx-design dropdown instead of custom toggle class
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Dec 11, 2023
1 parent d77ad46 commit 4e6229d
Show file tree
Hide file tree
Showing 19 changed files with 161 additions and 144 deletions.
19 changes: 0 additions & 19 deletions docs/_static/collapsible_container.css

This file was deleted.

10 changes: 0 additions & 10 deletions docs/_static/collapsible_container.js

This file was deleted.

2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@
html_static_path = ['_static']
html_favicon = join('_static', 'favicon.ico')
html_logo = join('_static', 'pyinaturalist_logo.png')
html_js_files = ['collapsible_container.js']
html_css_files = [
'collapsible_container.css',
'colors.css',
'table.css',
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css',
Expand Down
6 changes: 2 additions & 4 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ TODO: Can't generate thumbnails for Altair visualizations
:end-line: 6
```

:::{admonition} Example code
:class: toggle
:::{dropdown} Example code

```{literalinclude} ../examples/observations_to_gpx.py
:lines: 1,8-
Expand All @@ -59,8 +58,7 @@ TODO: Can't generate thumbnails for Altair visualizations
:end-line: 17
```

:::{admonition} Example code
:class: toggle
:::{dropdown} Example code

```{literalinclude} ../examples/observation_photo_metadata.py
:lines: 1,19-
Expand Down
4 changes: 2 additions & 2 deletions docs/user_guide/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ you will need to use an access token.
3. Pass that access token to any API request function that uses it

### Creating an Application
:::{admonition} Why do I need to create an application?
:class: toggle, tip
:::{dropdown} Why do I need to create an application?
:icon: info

iNaturalist uses OAuth2, which provides several different methods (or "flows") to access the site.
For example, on the [login page](https://www.inaturalist.org/login), you have the option of logging
Expand Down
8 changes: 4 additions & 4 deletions docs/user_guide/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ See {ref}`contributing` for details on setup for local development.
:::
::::

:::{admonition} Python version compatibility
:class: toggle, tip
:::{dropdown} Python version compatibility
:icon: info

pyinaturalist currently requires **python 3.7+**. If you need to use an older version
of python, here are the last compatible versions of pyinaturalist:
Expand Down Expand Up @@ -101,8 +101,8 @@ iNaturalist.org:
```

And here is what that same observation looks like in JSON:
:::{admonition} Observation response JSON
:class: toggle
:::{dropdown} Observation response JSON
:icon: code-square
```{literalinclude} ../sample_data/get_observation_2.json
```
:::
Expand Down
10 changes: 6 additions & 4 deletions pyinaturalist/v0/observation_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ def get_observation_fields(**params) -> JsonResponse:
>>> from pprint import pprint
>>> pprint({r['id']: r['name'] for r in response})
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_observation_fields.py
Expand Down Expand Up @@ -75,8 +76,9 @@ def put_observation_field_values(
... access_token=token,
... )
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/post_put_observation_field_value.json
:language: javascript
Expand Down
55 changes: 33 additions & 22 deletions pyinaturalist/v0/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,37 +35,43 @@ def get_observations(**params) -> Union[List, str]:
>>> get_observations(id=45414404, converters='atom')
.. admonition:: Example Response (atom)
:class: toggle
.. dropdown:: Example Response (atom)
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_observations.atom
:language: xml
.. admonition:: Example Response (csv)
:class: toggle
.. dropdown:: Example Response (csv)
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_observations.csv
.. admonition:: Example Response (dwc)
:class: toggle
.. dropdown:: Example Response (dwc)
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_observations.dwc
:language: xml
.. admonition:: Example Response (json)
:class: toggle
.. dropdown:: Example Response (json)
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_observations.json
:language: json
.. admonition:: Example Response (kml)
:class: toggle
.. dropdown:: Example Response (kml)
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_observations.kml
:language: xml
.. admonition:: Example Response (widget)
:class: toggle
.. dropdown:: Example Response (widget)
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_observations.js
:language: javascript
Expand Down Expand Up @@ -106,14 +112,16 @@ def create_observation(**params) -> ListResponse:
>>> observation_fields={297: 1}, # 297 is the obs. field ID for 'Number of individuals'
>>> )
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/create_observation_result.json
:language: javascript
.. admonition:: Example Response (failure)
:class: toggle
.. dropdown:: Example Response (failure)
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/create_observation_fail.json
:language: javascript
Expand Down Expand Up @@ -171,8 +179,9 @@ def update_observation(observation_id: int, **params) -> ListResponse:
>>> description='updated description!',
>>> )
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/update_observation_result.json
:language: javascript
Expand Down Expand Up @@ -218,8 +227,9 @@ def upload_photos(observation_id: int, photos: MultiFile, **params) -> ListRespo
>>> access_token=token,
>>> )
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/post_observation_photos_list.json
:language: javascript
Expand Down Expand Up @@ -261,8 +271,9 @@ def upload_sounds(observation_id: int, sounds: MultiFile, **params) -> ListRespo
>>> token = get_access_token()
>>> upload_sounds(1234, '~/observations/2020_09_01_14003156.mp3', access_token=token)
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/post_observation_sounds_list.json
:language: javascript
Expand Down
10 changes: 6 additions & 4 deletions pyinaturalist/v1/controlled_terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ def get_controlled_terms(taxon_id: Optional[int] = None, **params) -> JsonRespon
4: Pupa
...
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_controlled_terms.json
:language: JSON
Expand Down Expand Up @@ -53,8 +54,9 @@ def get_controlled_terms_for_taxon(taxon_id: int, **params) -> JsonResponse:
4: Pupa
...
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_controlled_terms_for_taxon.json
:language: JSON
Expand Down
10 changes: 6 additions & 4 deletions pyinaturalist/v1/identifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ def get_identifications_by_id(identification_id: MultiInt, **params) -> JsonResp
Example:
>>> get_identifications_by_id(155554373)
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_identifications.py
Expand Down Expand Up @@ -52,8 +53,9 @@ def get_identifications(**params) -> JsonResponse:
[147500725] Species: 1163860 (improving) added on 2020-12-24 23:52:30+00:00 by jkcook
...
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_identifications.py
Expand Down
10 changes: 6 additions & 4 deletions pyinaturalist/v1/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ def get_message_by_id(message_id: MultiInt, **params) -> JsonResponse:
>>> response = get_messages(123456)
>>> pprint(response)
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_messages.json
Expand All @@ -49,8 +50,9 @@ def get_messages(**params) -> JsonResponse:
>>> response = get_messages()
>>> pprint(response)
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/get_messages.json
Expand Down
5 changes: 3 additions & 2 deletions pyinaturalist/v1/observation_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ def set_observation_field(
... access_token=token,
... )
.. admonition:: Example Response
:class: toggle
.. dropdown:: Example Response
:color: primary
:icon: code-square
.. literalinclude:: ../sample_data/post_put_observation_field_value.json
:language: javascript
Expand Down
Loading

0 comments on commit 4e6229d

Please sign in to comment.