Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add form button to main page #693

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Loading