diff --git a/lib/tool_shed/grids/framework.py b/lib/tool_shed/grids/framework.py index ebce17727dd4..26d052ba2439 100644 --- a/lib/tool_shed/grids/framework.py +++ b/lib/tool_shed/grids/framework.py @@ -620,8 +620,8 @@ class Grid: title = "" model_class: Optional[type] = None show_item_checkboxes = False - template = "legacy/grid_base.mako" - async_template = "legacy/grid_base_async.mako" + template = "grid_base.mako" + async_template = "grid_base_async.mako" use_async = False use_hide_message = True global_actions: list[GridAction] = [] diff --git a/lib/tool_shed/webapp/templates/base.mako b/lib/tool_shed/webapp/templates/base.mako index 77d0be919d6f..4e206757892d 100644 --- a/lib/tool_shed/webapp/templates/base.mako +++ b/lib/tool_shed/webapp/templates/base.mako @@ -1,87 +1,6 @@ -<%namespace name="galaxy_client" file="/galaxy_client_app.mako" /> -<% self.js_app = None %> - -<% _=n_ %> - - ${self.init()} - - - - - Galaxy - %if app.config.brand: - | ${app.config.brand} - %endif - | ${self.title()} - - - ## relative href for site root - ## TODO: try tag? - - - ${self.metas()} - ${self.stylesheets()} - ${self.javascripts()} - ${self.javascript_app()} - - + ${next.body()} - -## Default title -<%def name="title()"> - -## Default init -<%def name="init()"> - -## Default stylesheets -<%def name="stylesheets()"> - ${h.dist_css('base')} - - -## Default javascripts -<%def name="javascripts()"> - ## TODO: remove when all libs are required directly in modules - ${h.dist_js( - 'libs.bundled', - )} - ${self.javascript_entry()} - - -<%def name="javascript_entry()"> - ${h.dist_js('toolshed.bundled')} - - -<%def name="javascript_app()"> - - ${ galaxy_client.load( app=self.js_app ) } - ${ galaxy_client.config_sentry( app=self.js_app ) } - %if self.js_app and self.js_app.config and self.js_app.config.ga_code: - ${ galaxy_client.config_google_analytics(self.js_app.config.ga_code) } - %endif - %if self.js_app and self.js_app.config and self.js_app.config.plausible_server and self.js_app.config.plausible_domain: - ${ galaxy_client.config_plausible_analytics(self.js_app.config.plausible_server, self.js_app.config.plausible_domain) } - %endif - %if self.js_app and self.js_app.config and self.js_app.config.matomo_server and self.js_app.config.matomo_site_id: - ${ galaxy_client.config_matomo_analytics(self.js_app.config.matomo_server, self.js_app.config.matomo_site_id) } - %endif - - %if not form_input_auto_focus is UNDEFINED and form_input_auto_focus: - - %endif - - - -## Additional metas can be defined by templates inheriting from this one. -<%def name="metas()"> diff --git a/lib/tool_shed/webapp/templates/base/base_panels.mako b/lib/tool_shed/webapp/templates/base/base_panels.mako deleted file mode 100644 index 39af7517f317..000000000000 --- a/lib/tool_shed/webapp/templates/base/base_panels.mako +++ /dev/null @@ -1,191 +0,0 @@ - -<%namespace name="galaxy_client" file="/galaxy_client_app.mako" /> - -<% - self.has_left_panel = hasattr( self, 'left_panel' ) - self.message_box_visible = app.config.message_box_visible - self.show_inactivity_warning = False - self.overlay_visible=False - self.active_view=None - self.body_class="" - self.require_javascript=False -%> - -<%def name="init()"> - ## Override - - -## Default stylesheets -<%def name="stylesheets()"> - - ${h.dist_css( - 'base' - )} - - -## Default javascripts -## TODO: remove when all libs are required directly in modules -<%def name="javascripts()"> - - ${h.dist_js( - 'libs.bundled', - )} - ${ javascript_entry() } - - -<%def name="javascript_entry()"> - - ${ h.dist_js('toolshed.bundled')} - - -<%def name="javascript_app()"> - - ${ galaxy_client.load() } - - -## Default late-load javascripts -<%def name="late_javascripts()"> - - - %if t.webapp.name == 'galaxy' and app.config.ga_code: - ${galaxy_client.config_google_analytics(app.config.ga_code)} - %endif - %if t.webapp.name == 'galaxy' and app.config.plausible_server and app.config.plausible_domain: - ${ galaxy_client.config_plausible_analytics(app.config.plausible_server, app.config.plausible_domain) } - %endif - %if t.webapp.name == 'galaxy' and app.config.matomo_server and app.config.matomo_site_id: - ${ galaxy_client.config_matomo_analytics(app.config.matomo_server, app.config.matomo_site_id) } - %endif - - - -## Masthead -<%def name="masthead()"> - ## Override - - -<%def name="overlay( title='', content='', visible=False )"> - <%def name="title()"> - <%def name="content()"> - - <% - if visible: - display = "style='display: block;'" - overlay_class = "in" - else: - display = "style='display: none;'" - overlay_class = "" - %> - - - - -## Document - - - ${self.init()} - - - - - Galaxy - %if app.config.brand: - | ${app.config.brand} - %endif - | ${self.title()} - - - ## relative href for site root - - - ${self.stylesheets()} - - ## Normally, we'd put all the javascripts at the bottom of the - ## but during this transitional period we need access to the config - ## functions which are only available when these scripts are executed - ## and I can't yet control when the templates are going to write scripts - ## to the output - ${self.javascripts()} - ${self.javascript_app()} - - - - <% - body_class = self.body_class - if self.message_box_visible: - body_class += " has-message-box" - if self.show_inactivity_warning: - body_class += " has-inactivity-box" - %> - - - - %if self.require_javascript: - - %endif -
- - ## Background displays first -
- - ## Layer iframes over backgrounds -
- ${self.masthead()} -
- - %if self.message_box_visible: -
- ${app.config.message_box_content} -
- %endif - - %if self.show_inactivity_warning: -
- ${app.config.inactivity_box_content} Resend verification. -
- %endif - - ${self.overlay(visible=self.overlay_visible)} - -
- %if self.has_left_panel: -
- ${self.left_panel()} -
- %endif -
- ${self.center_panel()} -
-
-
- - - ## Allow other body level elements - ## Scripts can be loaded later since they progressively add features to - ## the panels, but do not change layout - ${self.late_javascripts()} - - diff --git a/lib/tool_shed/webapp/templates/galaxy_client_app.mako b/lib/tool_shed/webapp/templates/galaxy_client_app.mako deleted file mode 100644 index 364bdc87bc03..000000000000 --- a/lib/tool_shed/webapp/templates/galaxy_client_app.mako +++ /dev/null @@ -1,151 +0,0 @@ -<%def name="render_json( dictionary )"> -${ h.dumps( dictionary, indent=( 2 if trans.debug else 0 ) ) } - - -## ============================================================================ - -<%def name="load( app=None, **kwargs )"> - - - -<%def name="config_sentry(app)"> - %if app and app.config: - - %endif - - -<%def name="config_google_analytics(ga_code)"> - - - -<%def name="config_plausible_analytics(plausible_server, plausible_domain)"> - %if plausible_server and plausible_domain: - - %else: - - %endif - - -<%def name="config_matomo_analytics(matomo_server, matomo_site_id)"> - - - - -## ---------------------------------------------------------------------------- -<%def name="get_user_dict()"> - ## Return a dictionary of user or anonymous user data including: - ## email, id, disk space used, quota percent, and tags used - <% - from markupsafe import escape - user_dict = {} - try: - if trans.user: - user_dict = trans.user.to_dict( view='element', - value_mapper={ 'id': trans.security.encode_id, 'total_disk_usage': float, 'email': escape, 'username': escape } ) - user_dict[ 'quota_percent' ] = trans.app.quota_agent.get_percent( trans=trans ) - user_dict[ 'is_admin' ] = trans.user_is_admin - - return user_dict - - usage = 0 - percent = None - try: - usage = trans.app.quota_agent.get_usage( trans, history=trans.history ) - percent = trans.app.quota_agent.get_percent( trans=trans, usage=usage ) - except AssertionError as assertion: - # no history for quota_agent.get_usage assertion - pass - return { - 'total_disk_usage' : int( usage ), - 'nice_total_disk_usage' : util.nice_size( usage ), - 'quota_percent' : percent - } - - except Exception as exc: - pass - #TODO: no logging available? - #log.exception( exc ) - - return user_dict - %> - - -<%def name="get_user_json()"> - ## Conv. fn to write as JSON -${ h.dumps( get_user_dict() )} - diff --git a/lib/tool_shed/webapp/templates/legacy/grid_base.mako b/lib/tool_shed/webapp/templates/grid_base.mako similarity index 95% rename from lib/tool_shed/webapp/templates/legacy/grid_base.mako rename to lib/tool_shed/webapp/templates/grid_base.mako index a8f399c701da..edd63d8bb997 100644 --- a/lib/tool_shed/webapp/templates/legacy/grid_base.mako +++ b/lib/tool_shed/webapp/templates/grid_base.mako @@ -40,11 +40,7 @@
diff --git a/lib/tool_shed/webapp/templates/grid_base_async.mako b/lib/tool_shed/webapp/templates/grid_base_async.mako new file mode 100644 index 000000000000..b9cb63f398e1 --- /dev/null +++ b/lib/tool_shed/webapp/templates/grid_base_async.mako @@ -0,0 +1,4 @@ +<%namespace name="grid_base" file="/grid_base.mako" import="*" /> + +${init()} +${h.dumps( grid_base.get_grid_config() )} diff --git a/lib/tool_shed/webapp/templates/legacy/grid_base_async.mako b/lib/tool_shed/webapp/templates/legacy/grid_base_async.mako deleted file mode 100644 index a6bedc9b97fb..000000000000 --- a/lib/tool_shed/webapp/templates/legacy/grid_base_async.mako +++ /dev/null @@ -1,4 +0,0 @@ -<%namespace name="grid_base" file="/legacy/grid_base.mako" import="*" /> - -${init()} -${h.dumps( grid_base.get_grid_config() )} diff --git a/lib/tool_shed/webapp/templates/message.mako b/lib/tool_shed/webapp/templates/message.mako index f3a77429b05e..0fbe50554619 100644 --- a/lib/tool_shed/webapp/templates/message.mako +++ b/lib/tool_shed/webapp/templates/message.mako @@ -1,60 +1,6 @@ -<%! - from galaxy.util.sanitize_html import sanitize_html - - def inherit(context): - if context.get('use_panels'): - if context.get('webapp'): - app_name = context.get('webapp') - elif context.get('app'): - app_name = context.get('app').name - else: - app_name = 'galaxy' - return '/webapps/%s/base_panels.mako' % app_name - else: - return '/base.mako' -%> -<%inherit file="${inherit(context)}"/> - -<%namespace file="/refresh_frames.mako" import="handle_refresh_frames" /> - -<% _=n_ %> - -<%def name="init()"> -<% - self.has_left_panel=False - self.active_view=active_view - self.message_box_visible=False -%> - - -<%def name="javascript_app()"> - - ${parent.javascript_app()} - ${handle_refresh_frames()} - - - -## -## Override methods from base.mako and base_panels.mako -## - -<%def name="center_panel()"> - ${render_msg( message, status )} - - -<%def name="body()"> - ${render_msg( message, status )} - - -## Render a message <%def name="render_msg( msg, status='done' )"> <% + from galaxy.util.sanitize_html import sanitize_html if status == "done": status = "success" elif status == "error": @@ -64,3 +10,13 @@ %>
${sanitize_html(msg)}
+ + + + + ${ h.dist_css('base') } + + + ${ render_msg( message, status) } + + diff --git a/lib/tool_shed/webapp/templates/refresh_frames.mako b/lib/tool_shed/webapp/templates/refresh_frames.mako deleted file mode 100644 index 46df4e693737..000000000000 --- a/lib/tool_shed/webapp/templates/refresh_frames.mako +++ /dev/null @@ -1,76 +0,0 @@ -## Include JavaScript code to refresh Galaxy application frames as needed. -<%def name="handle_refresh_frames()"> - - ## If no refresh frames, print nothing. - <% if not refresh_frames: return '' %> - - - diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/admin/index.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/admin/index.mako index 0b7aa4bfe7e7..1b6eac66eb8f 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/admin/index.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/admin/index.mako @@ -1,103 +1,6 @@ -<%inherit file="/webapps/tool_shed/base_panels.mako"/> -<%namespace file="/message.mako" import="render_msg" /> +<%inherit file="/base.mako"/> -<%def name="stylesheets()"> - ## Include "base.css" for styling tool menu and forms (details) - ${h.css( "base" )} - - ## But make sure styles for the layout take precedence - ${parent.stylesheets()} - - - -<%def name="javascripts()"> - ${parent.javascripts()} - - -<%def name="init()"> - ${parent.init()} - <% - self.has_left_panel=True - self.active_view="tools" - %> - %if trans.app.config.require_login and not trans.user: - - %endif - - -<%def name="left_panel()"> -
-
Administration
-
-
-
-
-
- Repositories -
- -
-
- Categories -
-
- -
-
-
- Security -
-
- -
-
-
- Statistics -
- -
-
-
- - -<%def name="center_panel()"> +<%def name="body()"> <% center_url = h.url_for(controller='admin', action='center' ) %> diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/base_panels.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/base_panels.mako deleted file mode 100644 index 94b1d67058d3..000000000000 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/base_panels.mako +++ /dev/null @@ -1,183 +0,0 @@ -<%inherit file="/base/base_panels.mako"/> -<%namespace name="galaxy_client" file="/galaxy_client_app.mako" /> - -## Default title -<%def name="title()">Tool Shed - -<%def name="init()"> - ${parent.init()} - <% - self.body_class = "toolshed" - %> - - -<%def name="javascript_app()"> - ${parent.javascript_app()} - - -<%def name="javascripts()"> - ${parent.javascripts()} - - - -## Masthead -<%def name="masthead()"> - - %if app.config.ga_code: - ${ galaxy_client.config_google_analytics(app.config.ga_code)} - %endif - %if app.config.plausible_server and app.config.plausible_domain: - ${ galaxy_client.config_plausible_analytics(app.config.plausible_server, app.config.plausible_domain) } - %endif - %if app.config.matomo_server: - ${ galaxy_client.config_matomo_analytics(app.config.matomo_server) } - %endif - - ## start main tag - - diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/category/grid.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/category/grid.mako index fbe9675b7e11..e56a03bca8f2 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/category/grid.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/category/grid.mako @@ -1,5 +1,5 @@ <%inherit file="/base.mako"/> -<%namespace name="grid_base" file="/legacy/grid_base.mako" import="*" /> +<%namespace name="grid_base" file="/grid_base.mako" import="*" /> <%namespace name="grid_common" file="../common/grid_common.mako" import="*" /> <%def name="insert()"> diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/category/valid_grid.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/category/valid_grid.mako index 298c8c88a963..2872e12b39dc 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/category/valid_grid.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/category/valid_grid.mako @@ -1,5 +1,5 @@ <%inherit file="/base.mako"/> -<%namespace name="grid_base" file="/legacy/grid_base.mako" import="*" /> +<%namespace name="grid_base" file="/grid_base.mako" import="*" /> <%namespace name="grid_common" file="../common/grid_common.mako" import="*" /> <%def name="insert()"> diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/group/index.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/group/index.mako index 76d5fcd4019a..346b431d6899 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/group/index.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/group/index.mako @@ -1,36 +1,5 @@ -<%inherit file="/webapps/tool_shed/base_panels.mako"/> -<%namespace file="/message.mako" import="render_msg" /> +<%inherit file="/base.mako"/> -<%def name="stylesheets()"> - ## Include "base.css" for styling tool menu and forms (details) - ${h.css( "base" )} - - ## But make sure styles for the layout take precedence - ${parent.stylesheets()} - - - -<%def name="javascripts()"> - ${parent.javascripts()} - - -<%def name="init()"> - ${parent.init()} - %if trans.app.config.require_login and not trans.user: - - %endif - - -<%def name="center_panel()"> - -
+<%def name="body()"> +
diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/index.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/index.mako index 3edd24d5381a..a530ddd116d7 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/index.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/index.mako @@ -1,147 +1,6 @@ -<%inherit file="/webapps/tool_shed/base_panels.mako"/> -<%namespace file="/message.mako" import="render_msg" /> +<%inherit file="/base.mako"/> -<%def name="stylesheets()"> - ## But make sure styles for the layout take precedence - ${parent.stylesheets()} - - - -<%def name="javascripts()"> - ${parent.javascripts()} - - -<%def name="init()"> - ${parent.init()} - <% - self.has_left_panel=True - self.active_view="tools" - %> - %if trans.app.config.require_login and not trans.user: - - %endif - - -<%def name="left_panel()"> -
-
${trans.app.shed_counter.unique_valid_tools | h} valid tools on ${util.unicodify( trans.app.shed_counter.generation_time ) | h}
-
-
-
-
- %if user_id or repository_id: - ## The route in was a sharable url, and may have included a changeset_revision, although we don't check for it. -
-
- All Repositories -
- - %else: - %if repository_metadata: -
-
- Search -
- -
-
- Valid Galaxy Utilities -
-
- Tools -
- - - - %endif -
-
- All Repositories -
- - %if trans.user: - %if trans.user.active_repositories or can_administer_repositories: -
-
- Repositories I Can Change -
- - %if can_administer_repositories: - - %endif - %if has_deprecated_repositories: - - %endif - - - - - %endif -
-
- Available Actions -
- - %if trans.app.config.enable_galaxy_flavor_docker_image: - - %endif - %else: -
-
- Available Actions -
- - %if trans.app.config.enable_galaxy_flavor_docker_image: - - %endif - %endif - %endif -
-
-
- - -<%def name="center_panel()"> +<%def name="body()"> <% if trans.app.config.require_login and not trans.user: center_url = h.url_for( controller='user', action='login', message=message, status=status ) diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/common.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/common.mako index ef01febb00de..2c65f7478f2f 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/common.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/repository/common.mako @@ -1,174 +1,8 @@ <%namespace file="/webapps/tool_shed/common/common.mako" import="*" /> <%def name="common_javascripts(repository)"> - <%def name="container_javascripts()"> - <%def name="render_repository_type_select_field( repository_type_select_field, render_help=True )"> diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/user/login.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/user/login.mako index e2cc738402fd..f91c8b630532 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/user/login.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/user/login.mako @@ -1,77 +1,11 @@ -<%! -#This is a hack, we should restructure templates to avoid this. -def inherit(context): - if context.get('trans').webapp.name == 'tool_shed' and context.get( 'use_panels', True ): - return '/webapps/tool_shed/base_panels.mako' - else: - return '/base.mako' -%> - -<%inherit file="${inherit(context)}"/> - -<%def name="init()"> -<% - self.has_left_panel=False - self.active_view=active_view - self.message_box_visible=False -%> - +<%inherit file="/base.mako"/> <%namespace file="/message.mako" import="render_msg" /> -<%def name="center_panel()"> - ${body()} - - <%def name="body()"> - - - - %if redirect_url: - - %endif - - %if context.get('use_panels'): -
- %else: -
- %endif - - %if message: - ${render_msg( message, status )} - %endif - - %if not trans.user: - - ${render_login_form()} - -
- - %if trans.app.config.get( 'terms_url', None ) is not None: -
-

- Terms and Conditions for use of this service -

- %endif - - %endif - -
- - - -<%def name="render_login_form( form_action=None )"> - <% - if form_action is None: - form_action = h.url_for( controller='user', action='login', use_panels=use_panels ) + form_action = h.url_for( controller='user', action='login', use_panels=use_panels ) %> - %if header: ${header} %endif @@ -96,5 +30,4 @@ def inherit(context):
- diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/user/logout.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/user/logout.mako index 28be45ce8d25..a2f03ca4bdfe 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/user/logout.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/user/logout.mako @@ -1,42 +1,11 @@ -<%! -#This is a hack, we should restructure templates to avoid this. -def inherit(context): - if context.get('trans').webapp.name == 'tool_shed': - return '/webapps/tool_shed/base_panels.mako' - else: - return '/base.mako' -%> - -<%inherit file="${inherit(context)}"/> +<%inherit file="/base.mako"/> <%namespace file="/message.mako" import="render_msg" /> -<%def name="init()"> -<% - self.has_left_panel=False - self.message_box_visible=False - self.active_view="user" - self.overlay_visible=False -%> - - <%def name="title()">Logout -<%def name="center_panel()"> - ${self.body()} - - <%def name="body()"> %if message: ${render_msg( message, status )} %endif - -<%def name="javascript_app()"> - ${ parent.javascript_app() } - - \ No newline at end of file diff --git a/lib/tool_shed/webapp/templates/webapps/tool_shed/user/register.mako b/lib/tool_shed/webapp/templates/webapps/tool_shed/user/register.mako index af1137040e9f..01871de976d3 100644 --- a/lib/tool_shed/webapp/templates/webapps/tool_shed/user/register.mako +++ b/lib/tool_shed/webapp/templates/webapps/tool_shed/user/register.mako @@ -1,24 +1,8 @@ <%inherit file="/base.mako"/> <%namespace file="/webapps/tool_shed/common/common.mako" import="*" /> -<%def name="init()"> -<% - self.has_left_panel=False - self.active_view="user" - self.message_box_visible=False -%> - - <%namespace file="/message.mako" import="render_msg" /> -<%def name="center_panel()"> - ${body()} - - -<%def name="javascripts()"> - ${parent.javascripts()} - - <%def name="body()">