Skip to content

Commit d4a0b5c

Browse files
author
Jessica Lord
committed
ready
1 parent 492f291 commit d4a0b5c

File tree

10 files changed

+158
-544
lines changed

10 files changed

+158
-544
lines changed

buildpage.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cpr('./demos', './site/demos', function(err, files) {
1515
})
1616
})
1717

18-
fs.readFile('new-readme.md', function(err, file) {
18+
fs.readFile('readme.md', function(err, file) {
1919
if (err) return console.log(err)
2020
var name = "index"
2121
var content = file.toString()
@@ -50,16 +50,16 @@ function applyTemplate(html, name) {
5050
var rawTemplate = fs.readFileSync(file).toString()
5151
var template = hbs.compile(rawTemplate)
5252
var page = template(content)
53-
writeFile(page, name)
53+
writeFile(page, name)
5454
}
5555

5656
function writeFile(page, name) {
5757
if (name === "index") {
58-
return fs.writeFileSync('./site/' + name + '.html' , page)
58+
return fs.writeFileSync('./site/' + name + '.html' , page)
5959
}
6060
mkdirp('./site/docs', function (err) {
6161
if (err) return console.error(err)
62-
fs.writeFileSync('./site/docs/' + name + '.html' , page)
62+
fs.writeFileSync('./site/docs/' + name + '.html' , page)
6363
})
6464
}
6565

@@ -71,4 +71,3 @@ function changeExtensions(html, name) {
7171
var newHtml = html.replace(/\.md/g, '.html')
7272
return newHtml
7373
}
74-

demos/demo-chart.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
</head>
1212

1313
<style>
14-
body {font-family: Helvetica;}
1514
p {font-family: Baskerville, Libre Baskerville, Georgia, serif;}
1615
#pennies.axis {shape-rendering: crispEdges;}
1716
#pennies.x.axis .minor, #pennies.y.axis .minor {stroke-opacity: .5;}
@@ -20,7 +19,7 @@
2019
#pennies .x.axis line {stroke: #acacac; stroke-opacity: .75;}
2120
.bigg {-webkit-transition: all .2s ease-in-out; -webkit-transform: scale(2);}
2221
path.chartLine {stroke: #14ECC8; stroke-width: 3; fill: none;}
23-
div.tooltip {position: absolute; text-align: left; padding: 4px 8px; width: auto; font-size: 10px; height: auto; background: #fff; border: 0px; pointer-events: none;}
22+
#pennies div.tooltip {position: absolute; text-align: left; padding: 4px 8px; width: auto; font-size: 10px; height: auto; background: #fff; border: 0px; pointer-events: none; font-family: Helvetica, Arial, sans-serif;}
2423
circle {fill: #fff; cursor: pointer;}
2524
path.domain {fill: #CCF4FF;}
2625
</style>

docs/basics.md

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
# Spreadsheets as Databases
22

3-
Spreadsheets are a great _lightweight_ database. Google Spreadsheets in particular are easy to work with and share, making this unlike most traditional database set ups. That being said, traditional databases are great for bigger, more secure jobs. If you're storing lots and lots and lots of information, or storing sensitive or complex information -- the spreadsheet is not for you. But if you're working on small to medium sized personal or community projects, try a spreadsheet!
3+
Spreadsheets are a great _lightweight_ databases. Google Spreadsheets in particular are easy to work with and share, making this unlike most traditional database setups. That being said, traditional databases are great for bigger, more secure jobs. If you're storing lots and lots and lots of information, or storing sensitive or complex information -- the spreadsheet is not for you. But if you're working on small to medium sized personal or community projects, try a spreadsheet!
44

55
## The Short & Sweet
66

7-
1. Link to Sheetsee.js, [tabletop.js](https://github.com/jsoma/tabletop/) and [jquery](http://www.jquery.org) in your HTML head.
7+
1. Link to Sheetsee.js, [tabletop.js](https://github.com/jsoma/tabletop/) and [jQuery](http://www.jquery.org) in your HTML head.
88
2. Create a place holder `<div>` in your HTML for any chart, map or table you want to have.
99
3. Create templates for tables in `<script>` tags.
10-
4. Copy the script tag that waits for the document to load and then initializes tabletop and runs your functions when it's returned with the spreadsheet data.
11-
6. Use the Sheetsee.js functions that you need for the maps, charts and tables you desire. Style it up with some CSS.
10+
4. Inside of a `<script>` tag initialize Tabletop.js. It waits for the document to load and then initializes tabletop and calls back a function when it has returned with the spreadsheet data.
11+
```JAVASCRIPT
12+
document.addEventListener('DOMContentLoaded', function() {
13+
var gData
14+
var URL = "YOURSPREADSHEETSKEYHERE"
15+
Tabletop.init( { key: URL, callback: callback, simpleSheet: true } )
16+
})
17+
```
18+
6. Define the function that Tabletop.js calls when it returns with the data. This function will contain all the Sheetsee.js functions that you use for the maps, charts and tables you desire. Style it up with some CSS.
19+
```JAVASCRIPT
20+
function callback(data) {
21+
// All the sheetsee things you want to do!
22+
}
23+
```
1224
5. Set it and forget. Now all you need to do is edit the spreadsheet and visitors will get the latest information every time they load the page.
1325

1426
## Bare Minimum Setup
1527

16-
Ignoring some HTML things to conserve space, you get the point. This gives you a page with a map of your spreadsheets points.
28+
Ignoring some HTML things to conserve space, you get the point. This is a basic setup.
1729

1830
```HTML
1931
<html>
2032
<head>
2133
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
2234
<script src="//cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.1.0/tabletop.min.js"></script>
23-
<script type="text/javascript" src='dist/sheetsee.full.js'></script>
24-
<link rel="stylesheet" type="text/css" href="css/sss.css">
35+
<script type="text/javascript" src='js/sheetsee.js'></script>
36+
<link rel="stylesheet" type="text/css" href="css/sss.css">
2537
</head>
2638
<body>
2739
<div id="placeholder"></div>
@@ -31,14 +43,13 @@ Ignoring some HTML things to conserve space, you get the point. This gives you a
3143
</script>
3244

3345
<script type="text/javascript">
34-
// document.addEventListener('DOMContentLoaded', function() {
35-
// var gData
36-
// var URL = "YOURSPREADSHEETSKEYHERE"
37-
// Tabletop.init( { key: URL, callback: myData, simpleSheet: true } )
38-
// })
39-
// function myData(data) {
40-
// All the sheetsee things you want to do!
41-
// }
46+
document.addEventListener('DOMContentLoaded', function() {
47+
var URL = "YOURSPREADSHEETSKEYHERE"
48+
Tabletop.init( { key: URL, callback: myData, simpleSheet: true } )
49+
})
50+
function myData(data) {
51+
All the sheetsee things you want to do!
52+
}
4253
</script>
4354
</body>
4455
</html>
@@ -60,15 +71,13 @@ There shouldn't be any breaks or horizontal organization in the spreadsheet. But
6071

6172
![sheetsee](https://raw.github.com/jllord/sheetsee-cache/master/img/hexcolors.png)
6273

63-
You must add a column to your spreadsheet with the heading _hexcolor_ (case insensitive). The maps, charts and such use colors and this is the easiest way to standardize that. The color scheme is up to you, all you need to do is fill the column with hexidecimal color values. This [color picker](http://color.hailpixel.com/) by [Devin Hunt](https://twitter.com/hailpixel) is really nice. #Funtip: Coloring the background of the cell it's hexcolor brings delight!
74+
You must add a column to your spreadsheet with the heading _hexcolor_ (case insensitive). The maps, charts and such use colors and this is the easiest way to standardize that. The color scheme is up to you, all you need to do is fill the column with hexidecimal color values. This [color picker](http://color.hailpixel.com/) by [Devin Hunt](https://twitter.com/hailpixel) is really nice. #Funtip: Coloring the background of the cell it's hexcolor brings delight!
6475

6576
### Geocoding
6677

6778
If you intend to map your data and only have addresses you'll need to geocode the addresses into lat/long coordinates. Mapbox built a [plugin](http://mapbox.com/tilemill/docs/guides/google-docs/#geocoding)
6879
that does this for you in Google Docs. You can also use websites like [latlong.net](http://www.latlong.net/) to get the coordinates and paste them into rows with column headers _lat_ and _long_.
6980

70-
> image of lat and long column headers
71-
7281
### Publishing Your Spreadsheet
7382

7483
![sheetsee](https://raw.github.com/jllord/sheetsee-cache/master/img/publish.png)
@@ -77,7 +86,7 @@ You need to do this in order to generate a unique key for your spreadsheet, whic
7786

7887
![sheetsee](https://raw.github.com/jllord/sheetsee-cache/master/img/key.png)
7988

80-
You should have an address in a box at the bottom, your key is the portion between the = and the &. You'll retrieve this later when you hook up your site to the spreadsheet.
89+
You should have an address in a box at the bottom, your key is the portion between the = and the &. You'll retrieve this later when you hook up your site to the spreadsheet. _Actually, you technically can use the whole URL, but it's so long..._
8190

8291
### CSS
8392

docs/tips.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ A few things to think about beyond charts, maps and tables.
44

55
## ICanHaz.js
66

7-
You can use templates for more than just tables. Use them to create lists `ol`, `ul`; array of images... You'll need a placeholder `<div>` in your HTML, a `<script>` for your template and a script to call ICanHaz from your Tabletop.js callback.
7+
You can use templates for more than just tables. Use them to create lists `ol`, `ul`; array of images... You'll need a placeholder `<div>` in your HTML, a `<script>` for your template and a script to call ICanHaz from your Tabletop.js callback. For a live example, see the bottom photo grid of the [sheetsee-table demo](../demos/demo-table.html).
88

99
_HTML_
1010

1111
```HTML
1212
<div id="divID"></div>
1313
```
1414

15-
_Tempalte_
15+
_Template_
1616

1717
```JavaScript
1818
<script id="divID" type="text/html">
@@ -22,7 +22,7 @@ _Tempalte_
2222
</script>
2323
```
2424

25-
_Tempalte_
25+
_Script_
2626

2727
```JavaScript
2828
<script type="text/html">
@@ -32,7 +32,7 @@ _Tempalte_
3232
</script>
3333
```
3434

35-
_non-table template_
35+
_non-table example output_
3636

3737
![lib](http://jlord.s3.amazonaws.com/wp-content/uploads/lending-ss.png)
3838

@@ -64,6 +64,33 @@ With a some CSS and such, the resulting website has a table with the hack spots
6464

6565
When the page builds, it creates the correct link for each row. When someone clicks on the buttons it takes them directly to the Google Map search result for that address. BAM!
6666

67-
# IFTTT
67+
## IFTTT
6868

69-
[Ifttt.com](http://www.ifttt.com) offers lots of options sending data from your actions (Twitter, Instagram, GitHub, Pocket...) to Google Spreadsheets.
69+
[Ifttt.com](http://www.ifttt.com) offers lots of options sending data from your actions (Twitter, Instagram, GitHub, Pocket...) to Google Spreadsheets.
70+
71+
## Row Numbers
72+
73+
When Tabletop.js returns your spreadsheet data, it adds a key/value of `rownumber`. This is great to use when you need to uniquely match or find a row in your data.
74+
75+
## Images
76+
77+
Your spreadsheet can contain URLs to images which you can use to display the images on the page you build. Your template would look something like this:
78+
79+
```HTML
80+
<img src='{{imgurl}}'/>
81+
```
82+
83+
## Data as Classes
84+
85+
You can use your data as classes to style with CSS. For instance, if you had data about recipes and a column called 'Taste' that contained either 'savory' or 'sweet'. In a table of the recipes you could do something like:
86+
87+
```HTML
88+
<tr><td class="{{taste}}"></tr>
89+
```
90+
91+
Then in your CSS:
92+
93+
```CSS
94+
td .savory {}
95+
td .sweet {}
96+
```

0 commit comments

Comments
 (0)