Skip to content

Commit 8235ab3

Browse files
author
Robert Jackson
committed
Make possible to select various sample files...
1 parent 959d694 commit 8235ab3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

app/controllers/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import Ember from 'ember';
22
import fetch from "ember-network/fetch";
33
import config from '../config/environment';
44

5-
const SAMPLE_DATA = config.rootURL + 'broccoli-viz-files/initial-build-canary-20161220.json';
6-
75
export default Ember.Controller.extend({
86
init() {
97
this._super(...arguments);
@@ -22,8 +20,8 @@ export default Ember.Controller.extend({
2220
reader.readAsText(event.target.files[0]);
2321
},
2422

25-
useSample() {
26-
fetch(SAMPLE_DATA)
23+
useSample(url) {
24+
fetch(url)
2725
.then((response) => {
2826
return response.json();
2927
})

app/templates/index.hbs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
<input name="file-upload" type="file" onchange={{action 'parseFile'}}>
55
</div>
66
<div>
7-
<button {{action 'useSample'}}>Display sample</button>
7+
<select onchange={{action 'useSample' value="target.value"}}>
8+
<option selected disabled>Choose sample file</option>
9+
<option value="./broccoli-viz-files/initial-build-canary-20161220.json">Empty Project - 2016-12-20</option>
10+
<option value="./broccoli-viz-files/ghost-initial-build-canary-ember-cli-20161222.json">Ghost Admin Client - 2016-12-22</option>
11+
</select>
812
</div>
913
</form>
1014

0 commit comments

Comments
 (0)