diff --git a/pgweb/downloads/views.py b/pgweb/downloads/views.py index 3d50765..bf87189 100644 --- a/pgweb/downloads/views.py +++ b/pgweb/downloads/views.py @@ -194,6 +194,11 @@ def mirrorselect(request, path): return HttpResponseRedirect("https://ftp.postgresql.org/pub/%s" % path) +# Render javascript for apt downloads +def apt_js(request): + return render(request, 'downloads/js/apt.js', content_type='application/javascript') + + # Render javascript for yum downloads def yum_js(request): with open(settings.YUM_JSON) as f: diff --git a/pgweb/urls.py b/pgweb/urls.py index 3d4d0ca..52c2aba 100644 --- a/pgweb/urls.py +++ b/pgweb/urls.py @@ -48,6 +48,7 @@ urlpatterns = [ url(r'^applications-v2.xml$', pgweb.downloads.views.applications_v2_xml), url(r'^download/uploadftp/', pgweb.downloads.views.uploadftp), url(r'^download/uploadyum/', pgweb.downloads.views.uploadyum), + url(r'^download/js/apt.js', pgweb.downloads.views.apt_js), url(r'^download/js/yum.js', pgweb.downloads.views.yum_js), url(r'^docs/$', pgweb.docs.views.root), diff --git a/templates/downloads/js/apt.js b/templates/downloads/js/apt.js index e69de29..333b429 100644 --- a/templates/downloads/js/apt.js +++ b/templates/downloads/js/apt.js @@ -0,0 +1,8 @@ +/* Event handlers */ +function setupHandlers() { + document.getElementById('copy-btn').addEventListener('click', function () { + copyScript(this, 'script-box'); + }); +} + +document.addEventListener("DOMContentLoaded", setupHandlers); diff --git a/templates/downloads/js/yum.js b/templates/downloads/js/yum.js index e5f8897..52dcdd6 100644 --- a/templates/downloads/js/yum.js +++ b/templates/downloads/js/yum.js @@ -158,3 +158,15 @@ function archChanged() { document.getElementById('copy-btn').style.display = 'block'; } + +/* Event handlers */ +function setupHandlers() { + document.getElementById('copy-btn').addEventListener('click', function () { + copyScript(this, 'script-box'); + }); + document.getElementById('version').addEventListener('change', verChanged); + document.getElementById('platform').addEventListener('change', platChanged); + document.getElementById('arch').addEventListener('change', archChanged); +} + +document.addEventListener("DOMContentLoaded", setupHandlers); diff --git a/templates/pages/download/linux/debian.html b/templates/pages/download/linux/debian.html index a3bc977..d8900cb 100644 --- a/templates/pages/download/linux/debian.html +++ b/templates/pages/download/linux/debian.html @@ -1,5 +1,8 @@ {%extends "base/page.html"%} {%block title%}Linux downloads (Debian){%endblock%} +{%block extrahead%} + +{%endblock%} {%block contents%}

Linux downloads (Debian)

@@ -55,7 +58,7 @@ sudo apt-get update # Install the latest version of PostgreSQL. # If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql': sudo apt-get install postgresql - +

diff --git a/templates/pages/download/linux/redhat.html b/templates/pages/download/linux/redhat.html index c4d3d9e..5c6dd5f 100644 --- a/templates/pages/download/linux/redhat.html +++ b/templates/pages/download/linux/redhat.html @@ -56,13 +56,13 @@ using Fedora for server deployments. To use the PostgreSQL Yum Repository, follow these steps:

    -
  1. Select version:
  2. -
  3. Select platform:
  4. -
  5. Select architecture:
  6. +
  7. Select version:
  8. +
  9. Select platform:
  10. +
  11. Select architecture:
  12. Copy, paste and run the relevant parts of the setup script:
    
    -        
    +        
         
diff --git a/templates/pages/download/linux/ubuntu.html b/templates/pages/download/linux/ubuntu.html index 0465045..d1adfc6 100644 --- a/templates/pages/download/linux/ubuntu.html +++ b/templates/pages/download/linux/ubuntu.html @@ -1,5 +1,8 @@ {%extends "base/page.html"%} {%block title%}Linux downloads (Ubuntu){%endblock%} +{%block extrahead%} + +{%endblock%} {%block contents%}

Linux downloads (Ubuntu)

@@ -54,7 +57,7 @@ sudo apt-get update # Install the latest version of PostgreSQL. # If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql': sudo apt-get install postgresql - +