In order to fill the RetroPGF Round 2 Form as a Badgeholder; there is currently a very manual process of moving allocations from a Google Sheet into a Deform.
Ludens -- from Lattice -- is a badgeholder for RetroPGF, and we worked on a process to make this super easy for them and others to import their allocations into the final form.
Using the automation
Summary: Instead of duplicating the OP provided Sheet, you duplicate a modified Google Sheet containing an AppSript that allows for JSON export of the allocations. Then, when visiting the form, you can import the JSON into the form into a Bookmarklet.
Regardless of how many exports / imports you do, this step is to be done only once
Open the modified Google Sheet; and make a copy of it.
Important: Use File -> Make a Copy instead of duplicating the the sheet; otherwise the AppScript won't be carried over.
You will need to accept a disclaimer about AppScript
Fill in your ballot the same way you would with the original OP Foundation provided sheet, then click on the "OP Vote Allocation" menu and choose "Export Vote Json". If the menu doesn't appear, reload the page. If it still doesn't appear, you probably duplicated the sheet instead of making a copy.
You can now copy your ballot as a JSON file, either keeping it into your clipboard and saving it into a text file.
There is also a feature to import a Ballot! We hope Badge Holders will share their ballot in a json format on Discord and Telegram, and this function will make it easy to import someone else's ballot into your sheet.
Regardless of how many exports / imports you do, this step is to be done only once
You will need to create a bookmarklet with the code below:
javascript: (function () {
var inputJsonString = prompt("Enter Project Allocation JSON");
var projectAllocations = JSON.parse(inputJsonString);
var inputs = document.evaluate(
"//input",
document,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
null
);
for (var i = 1; i < inputs.snapshotLength; i++) {
var input = inputs.snapshotItem(i);
var projectIndex = i - 1;
var project = projectAllocations.find((projectAllocation) => {
return projectAllocation.projectIndex === projectIndex;
});
input.value = project ? project.allocation * 100 : 0;
}
})();
This bookmarklet tutorial assumes you are using Chrome, but this will work in any browser.
- Right click your bookmark bar and hit
Add Page...
- Paste in the code snippet found here for the URL.
You now have the Bookmarklet that imports a Ballot in the JSON format into the RetroPGF Round 2 form
Go to the RetroPGF Round 2 form; then click on your bookmarklet
Paste your JSON Ballot created in Step 2 from your clipboard (or first copy it from the text file you saved it to) into the text box and click "Ok".
The form should now reflect your ballot!