-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
163e999
commit 131e86d
Showing
2 changed files
with
48 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,76 @@ | ||
/* Purpose: */ | ||
/* | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<!-- Set base target for all relative URLs within the page to open in the same tab/window --> | ||
<base target="_top"> | ||
|
||
<!-- Inline CSS styles for the page --> | ||
<link href="https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap" rel="stylesheet"> | ||
<style> | ||
body { | ||
font-family: 'Raleway', sans-serif; | ||
} | ||
h1, .center-content { | ||
/* Center-align text for h1 and any element with the class "center-content" */ | ||
text-align: center; | ||
} | ||
/* Style the image: centered, with a fixed width */ | ||
img { | ||
display: block; | ||
margin-left: auto; | ||
margin-right: auto; | ||
width: 500px; /* adjust the width as needed */ | ||
} | ||
/* Ensure div elements inside center-content class display in a line, one after the other */ | ||
.center-content div { | ||
display: inline-block; | ||
} | ||
.successMessageStyle { | ||
color: green; | ||
font-weight: bold; | ||
font-size: 20px; | ||
} | ||
</style> | ||
<script> | ||
// Function to hide the success message after 5 seconds | ||
function hideSuccessMessage() { | ||
setTimeout(function() { | ||
document.getElementById('successMessage').style.display = 'none'; | ||
document.getElementById('submitButton').innerText = 'Collect More Actions'; | ||
}, 5000); // 5000 milliseconds = 5 seconds | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
|
||
<!-- Main title of the page --> | ||
|
||
<h1>In-doc action item collection tool</h1> | ||
|
||
<!-- Input field for Google Doc URL, a submit button, and a placeholder for messages --> | ||
<div class="center-content"> | ||
<div> | ||
Google Document URL: <input type="text" id="documentId"> | ||
</div> | ||
<div> | ||
<button onclick="submitId()">Collect Actions</button> | ||
<button id="submitButton" onclick="submitId()">Collect Actions</button> | ||
</div> | ||
<div id="message"></div> | ||
<div id="successMessage" class="successMessageStyle" style="display:none;"></div> <!-- Success message --> | ||
</div> | ||
|
||
<!-- JavaScript function to handle the form submission --> | ||
<script> | ||
function submitId() { | ||
// Get the value from the input field | ||
var documentId = document.getElementById('documentId').value; | ||
|
||
// Call the server-side function 'processDocumentId' and handle its success response | ||
google.script.run.withSuccessHandler(function(response) { | ||
document.getElementById('message').innerText = response; | ||
document.getElementById('successMessage').innerText = response; | ||
document.getElementById('successMessage').style.display = 'block'; | ||
hideSuccessMessage(); // Hide the message after 10 seconds | ||
}).processDocumentId(documentId); | ||
} | ||
</script> | ||
|
||
<!-- Instructions for the user on how to use the tool --> | ||
<p>Enter the the Document ID or URL of a Google Document that you would like to process. | ||
Ensure that the document meets the following requirements: | ||
<ul> | ||
<li>The document should have a section for Attendees at the top, in the format "Attendees:" followed by names separated by a comma. This list is where the program collects the names associated with each action item. | ||
<li>The document must contain action items in the format "Action:" followed by the name of the person assigned, then the action. Ex: "Action: Amy email purchasing about req 385."" </li> | ||
<li> Note: hyperlinked text with will be transferred to the table without the hyperlink. | ||
</ul> | ||
<p> <li>The document should have a section for Attendees at the top, in the format "Attendees:" followed by names separated by a comma. This list is where the program collects the names associated with each action item. </p> | ||
<p> <li>The document must contain action items in the format "Action:" followed by the name of the person assigned, then the action. Ex: "Action: Amy email purchasing about req 385."" </li></p> | ||
<p> <li> Note: hyperlinked text with will be transferred to the table without the hyperlink. | ||
</ul></p> | ||
Once the document is processed, the action items will be populated in a 3 column table at the end of the document with the column headers "Status" "Owner""Action". If such a table does not already exist, one will be generated and you may then apply your desired formatting. | ||
</p> | ||
<p>Example of an acceptable document with collected action items populated in a table:</p> | ||
|
||
<!-- Example image with a fallback link to a Google Document if the image doesn't load --> | ||
<img src="https://drive.google.com/uc?id=1nn1Hxk3kHBpNUsEeSUBOnK7dTAAb4V76" | ||
alt="Example Document" | ||
onerror="window.location.href='https://docs.google.com/document/d/14-QREzyl-8I3EuVqW_L_-c1H5BQTQ7fHkA6xBlpXBfE/edit?usp=sharing';" | ||
width="500" /> | ||
<p>Example of an acceptable document with collected action items populated in a table can be found here: <a href="https://drive.google.com/uc?id=1nn1Hxk3kHBpNUsEeSUBOnK7dTAAb4V76" target="_Example Agenda">Example Document </a> | ||
|
||
|
||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
// Purpose: | ||
// to be part of a web app designed to let users input a Google Document URL or ID. | ||
// Once provided, the app processes the Google Document to identify and catalog action items. | ||
|
||
// Google Apps Script function to serve as an html page. | ||
function doGet() { | ||
return HtmlService.createHtmlOutputFromFile('Page'); | ||
} | ||
|
||
// accepts an input which can either be a direct Google Document ID or a full Google Document URL and extracts the document ID, calls the processDocument() function (from code.js) to process the Google Document by searching for and cataloging action items. | ||
function processDocumentId(input) { | ||
// If the input looks like a URL, extract the ID | ||
var documentId = input; | ||
if (input.startsWith('https://')) { | ||
var match = input.match(/\/d\/([\w-]+)/); // Regular expression to match /d/ followed by the ID | ||
if (match) { | ||
documentId = match[1]; | ||
} else { | ||
// Handle error if URL does not match expected pattern | ||
return 'Error: Invalid URL format'; | ||
} | ||
return HtmlService.createHtmlOutputFromFile('Page'); | ||
} | ||
|
||
function processDocumentId(input) { | ||
// If the input looks like a URL, extract the ID | ||
var documentId = input; | ||
if (input.startsWith('https://')) { | ||
var match = input.match(/\/d\/([\w-]+)/); // Regular expression to match /d/ followed by the ID | ||
if (match) { | ||
documentId = match[1]; | ||
} else { | ||
// Handle error if URL does not match expected pattern | ||
return 'Error: Invalid URL format'; | ||
} | ||
|
||
// Then, call your existing function | ||
processDocument(documentId); // Updated this line | ||
return 'Success'; // Or an appropriate message | ||
} | ||
|
||
|
||
// Call existing function | ||
processDocument(documentId); | ||
return 'Success!'; // Or an appropriate message | ||
} | ||
|