Skip to content

Commit

Permalink
Add form button to main page
Browse files Browse the repository at this point in the history
Adding form to the sides of epschedule.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/EastsidePreparatorySchool/epschedule?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
Dfnkk committed Dec 19, 2024
1 parent a52e43e commit 2b881de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import os
import re
import requests

import google.oauth2.id_token
from flask import Flask, abort, make_response, render_template, request, session
Expand Down Expand Up @@ -527,3 +528,9 @@ def handle_cron_photos():
def handle_cron_lunches():
read_lunches()
return "OK"


@app.route("/forms")
def handle_forms():
response = requests.get("https://nikhilmahesh.com")
return response.text
11 changes: 11 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<paper-header-panel id="drawerheader" drawer>
<paper-toolbar>
<span class="title">EPSchedule</span>
<div id="form-content" style="margin-left: auto;"></div>
</paper-toolbar>
<div>
<div class="image-container">
Expand Down Expand Up @@ -235,6 +236,16 @@ <h3 class="privacypaneltitle">Privacy</h3>
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-83598394-1', 'auto');
ga('send', 'pageview');

// Fetch the HTML content from /forms and embed it in the new div
fetch('/forms')
.then(response => response.text())
.then(html => {
document.getElementById('form-content').innerHTML = html;
})
.catch(error => {
console.error('Error fetching form content:', error);
});
</script>
</body>
</html>

0 comments on commit 2b881de

Please sign in to comment.