Skip to content

Commit 4c44eb8

Browse files
vabarbosaglynnbird
authored andcommitted
quick access to pre-canned data (#54)
1 parent 287948c commit 4c44eb8

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

public/js/seams.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ seamsApp.controller('navController', ['$scope', '$route', '$routeParams', '$wind
5959
$('#remoteFileError').html("");
6060
$('#file').change(function () {
6161
$scope.$root.fileUploaded();
62-
});
62+
});
6363
$scope.$root.getPreview(function(data) {
64-
$scope.$root.$apply();
65-
});
64+
$scope.$root.$apply();
65+
$('.btn-shortcut').on('click', function() {
66+
$('#fileurl').val(this.getAttribute('data-url'));
67+
angular.element($('#fileurl')).triggerHandler('input');
68+
});
69+
});
6670
break;
6771
case 'import':
6872
if ($scope.$root.schema) {
@@ -1177,3 +1181,9 @@ var datatypechange = function(e) {
11771181
i.prop("disabled", true);
11781182
}
11791183
}
1184+
1185+
function toggle(selector) {
1186+
if (selector) {
1187+
$(selector).slideToggle(500);
1188+
}
1189+
}

public/seams.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,19 @@ td.error {
8484
background-color: #92a4af;
8585
border-color: #000000;
8686
}
87+
88+
.remote-files {
89+
margin-top: 0;
90+
}
91+
92+
.remote-files.hidden {
93+
display: none;
94+
}
95+
96+
button.type_link {
97+
background-color: transparent;
98+
border: 0 none;
99+
cursor: pointer;
100+
font-size: 1em;
101+
padding: 0;
102+
}

views/templates/upload.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,18 @@ <h1 class="type_heading"><mark class="type_mark">Upload Data</mark></h1>
3333
<p class="type_copy">Once you select your file, we'll automatically move to the next step, where you'll create the index for your search service.</p>
3434
</div>
3535

36-
<div id="viewasfileurl" class="tabbed-panel_panel" ng-show="currentUploadPanel == 'fileurl'">
36+
<div id="viewasfileurl" class="tabbed-panel_panel theme_light" ng-show="currentUploadPanel == 'fileurl'">
37+
<p class="type_copy">
38+
No data. No problem. <button class="type_link" onclick="toggle('.remote-files')">We got you covered.</button>
39+
</p>
40+
<div class="button_group remote-files hidden">
41+
<button type="button" class="button_secondary btn-shortcut"
42+
data-url="https://raw.githubusercontent.com/ibm-cds-labs/open-data/master/uk/hp.csv"
43+
data-name="addresses">UK Addresses</button>
44+
<button type="button" class="button_secondary btn-shortcut"
45+
data-url="https://raw.githubusercontent.com/ibm-cds-labs/open-data/master/movies/movies.tsv"
46+
data-name="movies">Movies</button>
47+
</div>
3748
<form name="fileurlform" class="form_standard" novalidate>
3849
<fieldset class="form_field">
3950
<input type="url" class="input_text" name="fileurl" id="fileurl" required ng-model="fileurl" placeholder="Enter File Url">

0 commit comments

Comments
 (0)