Skip to content

Commit

Permalink
Load all of the data
Browse files Browse the repository at this point in the history
  • Loading branch information
knowtheory committed Jan 17, 2019
1 parent 0f28a47 commit 0b03aff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
8 changes: 4 additions & 4 deletions src/App.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<main>
<section id="image">
<img src={image} alt=""/>
<img src={data[topic].imagePath} alt=""/>
</section>
<section id="text">
<nav>
<div><input type="checkbox" bind:checked=showDiff /> View Diff</div>
{#each pages as [name, original, diff] }
<div><label><input type="checkbox" bind:checked=showDiff /> View Diff</label></div>
{#each data[topic].pages as [name, original, diff] }
<div class:active="activePage == name" on:click="selectApp(name)">{name}</div>
{/each}
</nav>
<div id="pages">
{#each pages as [name, original, diff] }
{#each data[topic].pages as [name, original, diff] }
<article class:active="activePage == name">
{@html insertBreaks(showDiff ? diff : original) }
</article>
Expand Down
37 changes: 17 additions & 20 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import App from './App.html';
import Diff from './jsdiff.js';

// import contents from './exec_order_9066.js';
//import contents from './commissary_receipt.js';
import contents from './carter_page_fisa.js';

let prepareData = (contents) => {
console.log(contents["Original"]);
let groundTruth = contents["Transcript"];
let entries = Object.entries(contents).map((row)=>{
let name = row[0];
console.log(name);
let original = row[1];
let diff = Diff.diffString(groundTruth, original);
return [name, original, diff];
Expand All @@ -19,28 +17,27 @@ let prepareData = (contents) => {
groundTruth: groundTruth,
imagePath: contents['Original'],
pages: entries
}
};
};

let groundTruth = contents["Transcript"];
let image_path = contents['Original'];
let entries = Object.entries(contents).map((row)=>{
let name = row[0];
let original = row[1];
let diff = Diff.diffString(groundTruth, original);
return [name, original, diff];
});
entries.shift();
import execOrder9066 from './exec_order_9066.js';
import commissaryReceipt from './commissary_receipt.js';
import carterPageFisa from './carter_page_fisa.js';

let data = {
execOrder9066: prepareData(execOrder9066),
commissaryReceipt: prepareData(commissaryReceipt),
carterPageFisa: prepareData(carterPageFisa)
};

console.log(data);
const app = new App({
target: document.body,
data: {
image: image_path,
pages: entries,
groundTruth: groundTruth,
activePage: entries[0][0],
showDiff: true,
url: entries[0][0]
data: data,
topic: Object.keys(data)[0],
activePage: "Transcript",
showDiff: true
}
});

Expand Down

0 comments on commit 0b03aff

Please sign in to comment.