Skip to content

Commit

Permalink
Re-jig to only use ajax where required, and not in the tree viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
hyanwong committed Apr 16, 2024
1 parent 8c11642 commit d22fe08
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 24 deletions.
1 change: 1 addition & 0 deletions views/default/sponsor_leaf.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
response.files.append(URL('static', 'OZSponsor/EOLqueries.js'))
response.files.append(URL('static','css/content_pages.css'))
}}
{{include 'web2py_ajax.html' # need ajax here}}
{{import img}}
{{if is_testing: response.meta.viewfile, response.meta.date_accessed = response.view, request.now}}{{pass}}
{{extend ('popup.html' if 'popup' in request.vars else 'uikit_layout.html')}}
Expand Down
1 change: 1 addition & 0 deletions views/default/sponsor_node.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{{if is_testing: response.meta.viewfile, response.meta.date_accessed = response.view, request.now}}{{pass}}
{{response.files.insert(0,URL('static','js/web2py.js')) #To allow =LOAD(ajax=True) to work}}
{{response.files.append(URL('static', 'css/content_pages.css'))}}
{{include 'web2py_ajax.html'}} <!-- We need ajax to load scrolling pictures in the sponsor node page-->
{{extend ('popup.html' if 'popup' in request.vars else 'uikit_layout.html')}}

{{block masthead}}
Expand Down
4 changes: 2 additions & 2 deletions views/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
<!--[if lt IE 9]>
<script src="{{=URL('static','js/respond-1.4.2.min.js')}}"></script>
<![endif]-->
{{include 'web2py_ajax.html'}} <!-- this includes jquery.js, calendar.js/.css and web2py.js -->

{{include 'web2py_ajax.html'}} <!--This just includes the web2py ajax stuff-->
{{include 'web2py.html'}}
<!-- Treeviewer code for search / embedded view -->
{{if is_testing:}}<script>window.is_testing = true;</script>{{pass}}
<script>var OZstrings={{include 'treeviewer/js_strings.json'}};</script>
Expand Down
6 changes: 1 addition & 5 deletions views/popup.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<!DOCTYPE html>
<html lang="{{=T.accepted_language or 'en'}}" class="{{='leaf_redirect' if response.view.startswith('default/spl_') else ''}}">
<head>
<script type="text/javascript" src="{{=URL('static','js/jquery.min.js')}}"></script>
<script src="{{=URL('static','uikit-3/js/uikit.min.js')}}"></script>
<link rel="stylesheet" href="{{=URL('static','uikit-3/css/uikit.min.css')}}" />
<link rel="stylesheet" href="{{=URL('static','css/content.css')}}" type="text/css" />
<link rel="stylesheet" href="{{=URL('static','css/popup.css')}}" type="text/css" />
<link rel="shortcut icon" href="{{=URL('static', 'favicon.ico')}}" type="image/x-icon" />
<link rel="apple-touch-icon" href="{{=URL('static','favicon.png')}}">
{{include 'web2py.html'}}
<style>h2 {margin-top: 0}</style>
{{
response.include_meta()
response.include_files()
}}
<script>
{{include 'popup.js'}}
var OZstrings={{include 'treeviewer/js_strings.json'}};
Expand Down
3 changes: 1 addition & 2 deletions views/treeviewer/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}}
<title>OneZoom Tree of Life Explorer, text page for {{=page_info.get('title_name')}}</title>
{{if response.canonical:}}<link rel="canonical" href="{{=response.canonical}}" />{{pass}}
{{include 'web2py_ajax.html' #only really needed for web2py ajax loading in sponsor_node tab (must be above the UIkit lines)}}
{{include 'web2py.html' # must be above the UIkit lines}}
<link rel="stylesheet" href="{{=URL('static','uikit-3/css/uikit.min.css')}}" />
<script src="{{=URL('static','uikit-3/js/uikit.min.js')}}"></script>
<script src="{{=URL('static','uikit-3/js/uikit-icons.min.js')}}"></script>
Expand All @@ -36,7 +36,6 @@
<!-- do not change the next line in any way. The exact format is used for partial installs -->
<div id="OZ_js_modules" data-include="../static/OZTreeModule/dist/OZ_main.html">
{{include "../static/OZTreeModule/dist/OZ_main.html"}}
{{include '../static/OZTreeModule/dist/OZui.html'}}
</div>

<!-- treeviewer constants -->
Expand Down
10 changes: 1 addition & 9 deletions views/uikit_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,14 @@
<meta name="google-site-verification" content="">
{{if response.canonical:}}<link rel="canonical" href="{{=response.canonical}}">{{pass}}

<script type="text/javascript" src="{{=URL('static','js/jquery.min.js')}}"></script>
<link rel="stylesheet" href="{{=URL('static','uikit-3/css/uikit.min.css')}}" />
<script src="{{=URL('static','uikit-3/js/uikit.min.js')}}"></script>
<script src="{{=URL('static','uikit-3/js/uikit-icons.min.js')}}"></script>
<link rel="stylesheet" type="text/css" href="{{=URL('static', 'css/content.css')}}" />

{{
response.include_meta()
response.include_files()
}}
<!-- include 'web2py_ajax.html' could be done here, but it performs more than we want so we disect it and keep only the bits we really need -->

{{include 'web2py.html'}}

{{if is_testing:}}<script>window.is_testing = true;</script>{{pass}}
{{include '../static/OZTreeModule/dist/OZ_main.html'}}
{{include '../static/OZTreeModule/dist/OZui.html'}}
<script>var OZstrings={{include 'treeviewer/js_strings.json'}}</script>
{{include 'treeviewer/server_urls.html' }}
</head>
Expand Down
6 changes: 6 additions & 0 deletions views/web2py.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!--A OneZoom-specific slimmed down version of the standard includes, if ajax is not required-->
{{
response.files.insert(0,URL('static','js/jquery.min.js'))
response.include_meta()
response.include_files()
}}
8 changes: 2 additions & 6 deletions views/web2py_ajax.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
)}}
//--></script>
{{
response.files.insert(0,URL('static','js/jquery.min.js'))
response.files.insert(1,URL('static','css/calendar.css'))
response.files.insert(2,URL('static','js/calendar.js'))
response.files.insert(3,URL('static','js/web2py.js'))
response.include_meta()
response.include_files()
# For speed, we only use ajax where we need it
response.files.insert(1, URL('static','js/web2py.js'))
}}

0 comments on commit d22fe08

Please sign in to comment.