Skip to content

Commit

Permalink
Updates for Tethys 4
Browse files Browse the repository at this point in the history
  • Loading branch information
swainn committed Jun 5, 2022
1 parent 0e14e18 commit c196acd
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 59 deletions.
4 changes: 1 addition & 3 deletions install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ requirements:
- netcdf4
- siphon
- owslib
- numpy
- pandas
pip:

post:
post:
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from setuptools import setup, find_namespace_packages
from tethys_apps.app_installation import find_resource_files
from tethys_apps.app_installation import find_all_resource_files
from tethys_apps.base.app_base import TethysAppBase

# -- Apps Definition -- #
app_package = 'thredds_tutorial'
release_package = 'tethysapp-' + app_package
release_package = f'{TethysAppBase.package_namespace}-{app_package}'

# -- Python Dependencies -- #
dependencies = []

# -- Get Resource File -- #
resource_files = find_resource_files('tethysapp/' + app_package + '/templates', 'tethysapp/' + app_package)
resource_files += find_resource_files('tethysapp/' + app_package + '/public', 'tethysapp/' + app_package)
resource_files = find_all_resource_files(app_package, TethysAppBase.package_namespace)


setup(
Expand Down
28 changes: 8 additions & 20 deletions tethysapp/thredds_tutorial/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tethys_sdk.base import TethysAppBase, url_map_maker
from tethys_sdk.base import TethysAppBase
from tethys_sdk.app_settings import SpatialDatasetServiceSetting


Expand All @@ -8,30 +8,18 @@ class ThreddsTutorial(TethysAppBase):
"""

name = 'THREDDS Tutorial'
index = 'thredds_tutorial:home'
icon = 'thredds_tutorial/images/unidata_logo.png'
package = 'thredds_tutorial'
description = ''
package = 'thredds_tutorial' # WARNING: Do not change this value
index = 'home'
icon = f'{package}/images/unidata_logo.png'
root_url = 'thredds-tutorial'
color = '#008e8d'
tags = ''
enable_feedback = False
feedback_emails = []

THREDDS_SERVICE_NAME = 'thredds_service'

def url_maps(self):
"""
Add controllers
"""
UrlMap = url_map_maker(self.root_url)

url_maps = (
UrlMap(
name='home',
url='thredds-tutorial',
controller='thredds_tutorial.controllers.home'
),
)

return url_maps

def spatial_dataset_service_settings(self):
"""
Example spatial_dataset_service_settings method.
Expand Down
30 changes: 15 additions & 15 deletions tethysapp/thredds_tutorial/controllers.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
from django.shortcuts import render
from tethys_sdk.permissions import login_required
from tethys_sdk.routing import controller
from tethys_sdk.gizmos import Button

@login_required()
@controller
def home(request):
"""
Controller for the app home page.
"""
save_button = Button(
display_text='',
name='save-button',
icon='glyphicon glyphicon-floppy-disk',
icon='save',
style='success',
attributes={
'data-toggle':'tooltip',
'data-placement':'top',
'data-bs-toggle':'tooltip',
'data-bs-placement':'top',
'title':'Save'
}
)

edit_button = Button(
display_text='',
name='edit-button',
icon='glyphicon glyphicon-edit',
icon='pen',
style='warning',
attributes={
'data-toggle':'tooltip',
'data-placement':'top',
'data-bs-toggle':'tooltip',
'data-bs-placement':'top',
'title':'Edit'
}
)

remove_button = Button(
display_text='',
name='remove-button',
icon='glyphicon glyphicon-remove',
icon='trash',
style='danger',
attributes={
'data-toggle':'tooltip',
'data-placement':'top',
'data-bs-toggle':'tooltip',
'data-bs-placement':'top',
'title':'Remove'
}
)
Expand All @@ -47,8 +47,8 @@ def home(request):
display_text='Previous',
name='previous-button',
attributes={
'data-toggle':'tooltip',
'data-placement':'top',
'data-bs-toggle':'tooltip',
'data-bs-placement':'top',
'title':'Previous'
}
)
Expand All @@ -57,8 +57,8 @@ def home(request):
display_text='Next',
name='next-button',
attributes={
'data-toggle':'tooltip',
'data-placement':'top',
'data-bs-toggle':'tooltip',
'data-bs-placement':'top',
'title':'Next'
}
)
Expand Down
20 changes: 10 additions & 10 deletions tethysapp/thredds_tutorial/templates/thredds_tutorial/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
{% block app_title %}{{ tethys_app.name }}{% endblock %}

{% block app_navigation_items %}
<li class="title">App Navigation</li>
<li class="active"><a href="">Home</a></li>
<li><a href="">Jobs</a></li>
<li><a href="">Results</a></li>
<li class="title">Steps</li>
<li><a href="">1. The First Step</a></li>
<li><a href="">2. The Second Step</a></li>
<li><a href="">3. The Third Step</a></li>
<li class="separator"></li>
<li><a href="">Get Started</a></li>
<li class="nav-item title">App Navigation</li>
<li class="nav-item active"><a class="nav-link" href="">Home</a></li>
<li class="nav-item"><a class="nav-link" href="">Jobs</a></li>
<li class="nav-item"><a class="nav-link" href="">Results</a></li>
<li class="nav-item title">Steps</li>
<li class="nav-item"><a class="nav-link" href="">1. The First Step</a></li>
<li class="nav-item"><a class="nav-link" href="">2. The Second Step</a></li>
<li class="nav-item"><a class="nav-link" href="">3. The Third Step</a></li>
<li class="nav-item separator"></li>
<li class="nav-item"><a class="nav-link" href="">Get Started</a></li>
{% endblock %}

{% block app_content %}
Expand Down
14 changes: 7 additions & 7 deletions tethysapp/thredds_tutorial/templates/thredds_tutorial/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{% load tethys_gizmos %}

{% block header_buttons %}
<div class="header-button glyphicon-button" data-toggle="tooltip" data-placement="bottom" title="Help">
<a data-toggle="modal" data-target="#help-modal"><span class="glyphicon glyphicon-question-sign"></span></a>
<div class="header-button glyphicon-button" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Help">
<a data-bs-toggle="modal" data-bs-target="#help-modal"><i class="bi bi-question-circle"></i></a>
</div>
{% endblock %}

Expand All @@ -25,17 +25,17 @@ <h6>Heading 6</h6>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h5 class="modal-title" id="help-modal-label">Example Modal</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>You can add custom buttons to the app header using the <code>header_buttons</code> block. Use anchor/link tags for the button and wrap it in a div with the class <code>header-button</code>. For buttons with the gliphyicons, add the <code>glyphicon-button</code> class as well.</p>
<p>Ever have trouble using a modal in a Tethys app? Use the <code>after_app_content</code> block for modal content to allow them to function properly. See: <a href="https://getbootstrap.com/javascript/#modals">Bootstrap Modals</a></p>
<p>Add tooltips to any element by adding the <code>data-toggle</code>, <code>data-placement</code>, and <code>title</code> attributes to the button. See: <a href="https://getbootstrap.com/javascript/#tooltips">Bootstrap Tooltips</a></p>
<p>Ever have trouble using a modal in a Tethys app? Use the <code>after_app_content</code> block for modal content to allow them to function properly. See: <a href="https://getbootstrap.com/docs/5.1/components/modal/">Bootstrap Modals</a></p>
<p>Add tooltips to any element by adding the <code>data-bs-toggle</code>, <code>data-bs-placement</code>, and <code>title</code> attributes to the button. See: <a href="https://getbootstrap.com/docs/5.1/components/tooltips/">Bootstrap Tooltips</a></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">OK</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">OK</button>
</div>
</div>
</div>
Expand Down

0 comments on commit c196acd

Please sign in to comment.