This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yvonne Yip
committed
Sep 21, 2013
1 parent
bd707c9
commit 6783c7b
Showing
6 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<link href="../../../../polymer-elements/polymer-selector/polymer-selector.html" rel="import"> | ||
<link href="../../../../polymer-ui-elements/polymer-ui-pages/polymer-ui-pages.html" rel="import"> | ||
<link href="gs-import-selector.html" rel="import"> | ||
<polymer-element name="gs-app" attributes="page imports selectedImportsIndex projectName projectPath"> | ||
<template> | ||
<style> | ||
polymer-ui-pages { | ||
display: block; | ||
} | ||
polymer-selector .polymer-selected { | ||
color: white; | ||
background: black; | ||
} | ||
</style> | ||
<polymer-ui-pages selected="{{page}}"> | ||
<section> | ||
<h1>Getting Started with Polymer</h1> | ||
<h2>What's the name of your project?</h2> | ||
<input value="{{projectName}}"> | ||
<h2>Create at:</h2> | ||
<input value="{{projectPath}}">/{{projectName}} | ||
<button on-click="nextAction">Next!</button> | ||
</section> | ||
<section> | ||
<gs-import-selector imports="{{imports}}"></gs-import-selector> | ||
<button on-click="nextAction">Next!</button> | ||
</section> | ||
<section> | ||
<p> | ||
Project: {{projectName}} at {{projectPath}}/{{projectName}} | ||
</p> | ||
<p> | ||
Imports:<br> | ||
<template repeat="{{projectImports}}"> | ||
{{}}<br> | ||
</template> | ||
</p> | ||
<button on-click="generateAction">Generate!</button> | ||
</section> | ||
</polymer-ui-pages> | ||
</template> | ||
<script> | ||
Polymer('gs-app', { | ||
page: 0, | ||
imports: [ | ||
'polymer-ui-elements/polymer-ui-accordion/polymer-ui-accordion.html', | ||
'polymer-ui-elements/polymer-ui-arrow/polymer-ui-arrow.html', | ||
'polymer-ui-elements/polymer-ui-breadcrumbs/polymer-ui-breadcrumbs.html', | ||
'polymer-ui-elements/polymer-ui-card/polymer-ui-card.html', | ||
'polymer-ui-elements/polymer-ui-collapsible/polymer-ui-collapsible.html', | ||
], | ||
selectedImportsIndex: [], | ||
projectName: '', | ||
projectPath: '', | ||
projectImports: [], | ||
nextAction: function() { | ||
this.page += 1; | ||
if (this.selectedImportsIndex) { | ||
this.projectImports = []; | ||
for (var i = 0; i < this.selectedImportsIndex.length; i++) { | ||
var idx = this.selectedImportsIndex[i]; | ||
this.projectImports.push(this.imports[idx]); | ||
} | ||
} | ||
}, | ||
generateAction: function() { | ||
} | ||
}); | ||
</script> | ||
</polymer-element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<link href="../../../../polymer-elements/polymer-selector/polymer-selector.html" rel="import"> | ||
<polymer-element name="gs-import-selector" attributes="imports selectedIndex results"> | ||
<template> | ||
<style> | ||
polymer-selector .polymer-selected { | ||
color: white; | ||
background: black; | ||
} | ||
</style> | ||
<polymer-selector selected="{{selectedIndex}}" multi on-polymer-activate="activateAction"> | ||
<template repeat="{{imports}}"> | ||
<div>{{}}</div> | ||
</template> | ||
</polymer-selector> | ||
</template> | ||
<script> | ||
Polymer('gs-import-selector', { | ||
imports: [], | ||
selectedIndex: [], | ||
results: [], | ||
created: function() { | ||
this.selectedIndexChanged(); | ||
}, | ||
importsChanged: function() { | ||
this.selectedIndex = []; | ||
this.results = []; | ||
}, | ||
selectedIndexChanged: function(old) { | ||
if (old) { | ||
this.observer && this.observer.close(); | ||
} | ||
if (this.selectedIndex) { | ||
this.observer = new ArrayObserver(this.selectedIndex, this.selectedIndexMutated.bind(this)); | ||
} | ||
}, | ||
selectedIndexMutated: function(records) { | ||
var record = records[0]; | ||
if (record.addedCount) { | ||
this.results.push(this.imports[this.selectedIndex[record.index]]); | ||
} | ||
for (var i = 0; i < record.removed.length; i++) { | ||
this.results.splice(this.results.indexOf(record.removed[i])); | ||
} | ||
} | ||
}); | ||
</script> | ||
</polymer-element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<link href="components/gs-app.html" rel="import"> | ||
<script src="polymer/polymer/polymer.js"></script> | ||
</head> | ||
<body> | ||
<gs-app></gs-app> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
|
||
var server = require('./lib/server'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var port = 8888; | ||
var project_dir = __dirname + '/../'; | ||
var root_dir = __dirname + '/../../../../'; | ||
|
||
var express = require('express'); | ||
|
||
var app = express(); | ||
app.use(express.bodyParser()); | ||
|
||
app.get('/', function(req, res) { | ||
res.sendfile('index.html', {root: project_dir}); | ||
}); | ||
|
||
app.get('/components/*', function(req, res) { | ||
res.sendfile(req.params[0], {root: project_dir + 'components/'}); | ||
}); | ||
|
||
app.get('/polymer/*', function(req, res) { | ||
res.sendfile(req.params[0], {root: root_dir}); | ||
}); | ||
|
||
app.get('/polymer-elements/*', function(req, res) { | ||
res.sendfile(req.params[0], {root: root_dir + 'polymer-elements/'}); | ||
}); | ||
|
||
app.get('/polymer-ui-elements/*', function(req, res) { | ||
res.sendfile(req.params[0], {root: root_dir + 'polymer-ui-elements/'}); | ||
}); | ||
|
||
app.listen(port); | ||
console.log('Listening on port ' + port); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "getting-started", | ||
"description": "Polymer bootstrap app", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"express": "3.x" | ||
} | ||
} |