├── .gitattributes
├── app
├── robots.txt
├── styles
│ └── main.css
├── test
│ ├── tests.html
│ └── index.html
├── scripts
│ └── app.js
├── index.html
├── elements
│ ├── questions
│ │ ├── answer-form.html
│ │ ├── answer.html
│ │ ├── view.html
│ │ └── list.html
│ └── app.html
├── 404.html
├── favicon.ico
└── .htaccess
├── .bowerrc
├── .yo-rc.json
├── .gitignore
├── bower.json
├── security.json
├── .editorconfig
├── .jshintrc
├── README.md
├── package.json
├── LICENSE
└── Gruntfile.js
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
--------------------------------------------------------------------------------
/app/robots.txt:
--------------------------------------------------------------------------------
1 | # robotstxt.org
2 |
3 | User-agent: *
4 |
--------------------------------------------------------------------------------
/.bowerrc:
--------------------------------------------------------------------------------
1 | {
2 | "directory": "app/bower_components"
3 | }
4 |
--------------------------------------------------------------------------------
/.yo-rc.json:
--------------------------------------------------------------------------------
1 | {
2 | "generator-polymer": {
3 | "includeSass": false
4 | }
5 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | dist
3 | test/temp
4 | .sass-cache
5 | app/bower_components
6 | .tmp
7 | test/bower_components/
8 | .divshot-cache
--------------------------------------------------------------------------------
/app/styles/main.css:
--------------------------------------------------------------------------------
1 | body {
2 | background: #fafafa;
3 | font-family: RobotoDraft, "Helvetica Neue", Helvetica, Arial;
4 | color: #333;
5 | }
6 |
7 | html /deep/ paper-action-dialog paper-input {
8 | width: 100%;
9 | }
10 |
11 | html /deep/ paper-action-dialog paper-autogrow-textarea textarea {
12 | font-size: 14px;
13 | }
--------------------------------------------------------------------------------
/app/test/tests.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
13 |
--------------------------------------------------------------------------------
/app/scripts/app.js:
--------------------------------------------------------------------------------
1 | (function(document) {
2 | 'use strict';
3 |
4 | document.addEventListener('polymer-ready', function() {
5 | // Perform some behaviour
6 | console.log('Polymer is ready to rock!');
7 | });
8 |
9 | // wrap document so it plays nice with other libraries
10 | // http://www.polymer-project.org/platform/shadow-dom.html#wrappers
11 | })(wrap(document));
12 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "polymer-firebase-qa",
3 | "version": "1.0.0",
4 | "dependencies": {
5 | "core-elements": "Polymer/core-elements#~0.5.0",
6 | "paper-elements": "Polymer/paper-elements#~0.5.0",
7 | "pvc-globals": "Divshot/pvc-globals",
8 | "firebase-element": "Polymer/firebase-element#~0.5.0",
9 | "app-router": "~2.0.2"
10 | },
11 | "devDependencies": {
12 | "polymer-test-tools": "Polymer/polymer-test-tools#^0.4.0"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/security.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "questions": {
4 | ".read": true,
5 | "$question_id": {
6 | ".write": "(!data.exists() && newData.exists() && auth != null) || (data.child('user/uid').val() == auth.uid)",
7 | "answers": {
8 | "$answer_id": {
9 | ".write": "(!data.exists() && newData.exists() && auth != null) || (data.child('user/uid').val() == auth.uid)"
10 | }
11 | }
12 | }
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/app/test/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Core Elements Test Runner
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent
2 | # coding styles between different editors and IDEs
3 | # editorconfig.org
4 |
5 | root = true
6 |
7 |
8 | [*]
9 |
10 | # Change these settings to your own preference
11 | indent_style = space
12 | indent_size = 2
13 |
14 | # We recommend you to keep these unchanged
15 | end_of_line = lf
16 | charset = utf-8
17 | trim_trailing_whitespace = true
18 | insert_final_newline = true
19 |
20 | [*.md]
21 | trim_trailing_whitespace = false
22 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true,
3 | "browser": true,
4 | "esnext": true,
5 | "bitwise": true,
6 | "camelcase": true,
7 | "curly": true,
8 | "eqeqeq": true,
9 | "immed": true,
10 | "indent": 2,
11 | "latedef": true,
12 | "noarg": true,
13 | "quotmark": "single",
14 | "regexp": true,
15 | "undef": true,
16 | "unused": true,
17 | "strict": true,
18 | "trailing": true,
19 | "smarttabs": true,
20 | "jquery": true,
21 | "globals": {
22 | "wrap": true,
23 | "unwrap": true,
24 | "Polymer": true,
25 | "Platform": true
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Polymer + Firebase Q&A
2 |
3 | A simple Q&A app built with Polymer and Firebase. Covers routing, authentication, material design, and CRUD operations.
4 |
5 | - [Live Demo](http://polymer-qa.divshot.io/)
6 | - [Video Walkthrough](https://www.youtube.com/watch?v=gErWcBdd-F8)
7 |
8 | ## Running Locally
9 |
10 | Create a new app in Firebase. Set up a new GitHub application and [configure authentication](https://www.firebase.com/docs/web/guide/login/github.html) in Forge. Run the following command in your terminal:
11 |
12 | npm install && bower install
13 |
14 | Edit `/app/elements/app.html` and change `` to your Firebase URL:
15 |
16 | ```javascript
17 | Polymer({
18 | ready: function() {
19 | this.globals.firebase = '';
20 | },
21 | ```
22 |
23 | Run the server locally with Grunt:
24 |
25 | grunt serve
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "divshot-qa-walkthrough",
3 | "version": "0.0.0",
4 | "dependencies": {},
5 | "devDependencies": {
6 | "grunt": "~0.4.1",
7 | "grunt-contrib-copy": "~0.5.0",
8 | "grunt-autoprefixer": "^1.0.0",
9 | "grunt-minify-html": "^0.1.0",
10 | "grunt-contrib-concat": "~0.5.0",
11 | "grunt-contrib-uglify": "~0.5.0",
12 | "grunt-contrib-jshint": "~0.10.0",
13 | "grunt-contrib-cssmin": "~0.10.0",
14 | "grunt-contrib-connect": "0.8.0",
15 | "grunt-contrib-clean": "0.5.0",
16 | "grunt-contrib-imagemin": "0.7.1",
17 | "grunt-contrib-watch": "~0.6.1",
18 | "grunt-usemin": "~2.3.0",
19 | "grunt-pagespeed": "~0.3.0",
20 | "grunt-rev": "~0.1.0",
21 | "grunt-open": "~0.2.3",
22 | "grunt-vulcanize": "~0.3.0",
23 | "connect-livereload": "~0.4.0",
24 | "time-grunt": "~0.4.0",
25 | "load-grunt-tasks": "~0.6.0",
26 | "jshint-stylish": "~0.4.0"
27 | },
28 | "engines": {
29 | "node": ">=0.10.0"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Firebase Q&A
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Divshot, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/app/elements/questions/answer-form.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
54 |
--------------------------------------------------------------------------------
/app/elements/questions/answer.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
38 |
39 |
40 |
41 |
42 |
48 |
49 |
{{answer.content}}
50 |
51 |
52 |
or
Cancel
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
81 |
--------------------------------------------------------------------------------
/app/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Page Not Found :(
7 |
123 |
124 |
125 |
126 |
127 |
Not found
128 | :(
129 |
130 |
Sorry, but the page you were trying to view does not exist.
131 |
It looks like this was the result of either:
132 |
133 | - a mistyped address
134 | - an out-of-date link
135 |
136 |
140 |
141 |
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/app/elements/questions/view.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
44 |
45 |
46 |
47 |
48 |
49 |
56 |
57 |
{{question.title}}
58 |
59 | {{question.content}}
60 |
61 |
62 |
or
Cancel
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
104 |
--------------------------------------------------------------------------------
/app/elements/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
57 |
58 |
59 |
60 |
75 |
81 |
82 |
83 |
107 |
--------------------------------------------------------------------------------
/app/favicon.ico:
--------------------------------------------------------------------------------
1 | � ( @ -2Op"=p�Jt��Jt��b���������������������������������������������������b���Jt��Jt��"=p�Op-2 O`O�O�O�O�O�O�O�$\�Jt��������������v���v���������������Jt��$\�O�O�O�O�O�O�O�O` O�O�O�O�O�O�O�O�O�O� ;n�s���>���>���>���>���s��� ;n�O�O�O�O�O�O�O�O�O�O� O`O�O�O�O�O�O�O�O�O�O�$\�]���^n��^n��]���$\�O�O�O�O�O�O�O�O�O�O�O` O�O�O�O�O�O�O�O�O�O�O�n�* ��* ��n�O�O�O�O�O�O�O�O�O�O�O� O�O�O�O�O�O�O�O�O�O�O�5>Y�5>Y�O�O�O�O�O�O�O�O�O�O�O� -2O�O�O�O�O�O�O�O�O�O�&6e�&6e�O�O�O�O�O�O�O�O�O�O�-2 5r�4���E���$\�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�O�$\�E���4���5r� 5r�E���M���M���v���0\��O�O�O�O�O�O�O�$\�$\�O�O�O�O�O�O�O�0\��v���M���M���E���5r� )��p&��p��&��������������b���Jt��Jt��Jt��0\��#i��.r��.r��#i��0\��Jt��Jt��Jt��b���������������&��p��&��)��p 4���&��-���_������������������]���]�������7���p�����������p���7�������]���]�������������������_��-���-���4��� qֈp��p��p����������������������p���7���#i��p�����������p���#i��7���p�����������������������p��&��-���qֈ 8��(p��p��I���v���v���]���7���n���v���p���#i��]���v���v���]���#i��p���v���n���7���]���v���v���I���-���-���8��( ;��`-���M���7���7���7���.r��R��E��R��E��7���7���7���7���E��R��E��R��.r��7���7���7���M���M���;��` ���������������������������z ���������������������������
2 | � ���
3 | �
9�
9�
9�
9�
9�
9�
9�
9�
4 | �n�n�
5 | �
9�
9�
9�
9�
9�
9�
9�
9�
6 | ���� * �x* ��* ��* ��* ��* ��* ��* ��n�&