From 8a4ac744830f61f1309ad83221a9736f0364fe1c Mon Sep 17 00:00:00 2001 From: Michael Foiani Date: Sat, 4 Aug 2018 20:35:19 -0400 Subject: Deployed on firebase using the firebase.json config file. Also, fixed a spelling issue with forums. --- src/components/mao-app.js | 6 +- src/components/mao-competitions.js | 2 +- src/components/mao-forums.js | 199 +++++++++++++++++++++++++++++++++++++ src/components/mao-fourms.js | 199 ------------------------------------- src/components/mao-tutoring.js | 2 +- 5 files changed, 204 insertions(+), 204 deletions(-) create mode 100644 src/components/mao-forums.js delete mode 100644 src/components/mao-fourms.js (limited to 'src/components') diff --git a/src/components/mao-app.js b/src/components/mao-app.js index 530d460..7fc57f1 100644 --- a/src/components/mao-app.js +++ b/src/components/mao-app.js @@ -205,7 +205,7 @@ class MaoApp extends connect(store)(LitElement) { Home Tutoring Compete - Fourms + Forums Account Admin @@ -219,7 +219,7 @@ class MaoApp extends connect(store)(LitElement) { Home Tutoring Compete - Fourms + Forums Account Admin @@ -232,7 +232,7 @@ class MaoApp extends connect(store)(LitElement) { - + diff --git a/src/components/mao-competitions.js b/src/components/mao-competitions.js index 9a50d9e..2f3277f 100644 --- a/src/components/mao-competitions.js +++ b/src/components/mao-competitions.js @@ -219,7 +219,7 @@ class MaoCompetitions extends connect(store)(PageViewElement) { + + paper-card { + display: block; + } + + .card-actions > paper-button { + margin-left: auto; + margin-right: auto; + display: block; + width: 50%; + } + + .card-content > h4 { + text-align: right; + font-weight: lighter; + font-style: italic; + word-break: break-all; + } + + .card-content > h3, p { + word-break: break-all; + } + + .card-content > h3, p { + text-align: center; + } + + + .post-grid { + display: grid; + grid-gap: 10px; + + grid-template-columns: 1fr; + } + + @media (min-width: 460px) { + .post-grid { + grid-template-columns: 1fr 1fr; + } + } + + + + + +
+ +

Recent Posts

+ +
+ +
+ `; + } + + static get properties() { return { + // This is the data from the store. + signedIn: Boolean, + authMessage: String, + forumPosts: Array + }} + + _stateChanged(state) { + this.signedIn = state.firebase.initialized; + this.authMessage = state.firebase.authMessage; + + this.forumPosts = state.firebase.forumPosts; + this.updateSection(); + } + + submitForum() { + if(this.shadowRoot) { + var subjectElement = this.shadowRoot.getElementById('subject-field'); + var contentElement = this.shadowRoot.getElementById('content-field'); + + if(!contentElement.value) { + contentElement.value = ""; + } + + if( subjectElement.value.trim() === "" || + contentElement.value.trim() === "" + ) + { + alert("Please fill out all fields when creating a form post."); + } else { + if(confirm('Are you sure you want to submit this to the forum page? It will be public to everyone.')) { + store.dispatch(createForumPost(subjectElement.value, contentElement.value)); + + subjectElement.value = ""; + contentElement.value = ""; + } + } + } + + } + + updateSection() { + if(this.shadowRoot) { + var postsGrid = this.shadowRoot.getElementById('posts-grid'); + postsGrid.innerHTML = ""; + + for(var i = this.forumPosts.length-1; i >=0; i--) { + var paperCard = document.createElement('paper-card'); + var cardContent = document.createElement('div'); + var forumAuthor = document.createElement('h4'); + var forumSubject = document.createElement('h3'); + var forumContent = document.createElement('p'); + + forumAuthor.innerHTML = this.forumPosts[i].email .replace('@communityschoolnaples.org', ''); + forumSubject.innerHTML = this.forumPosts[i].subject; + forumContent.innerHTML = this.forumPosts[i].content; + + cardContent.classList.add('card-content'); + cardContent.appendChild( forumAuthor); + cardContent.appendChild( forumSubject); + cardContent.appendChild( forumContent); + + paperCard.elevation = 0; + paperCard.appendChild( cardContent); + + postsGrid.appendChild(paperCard); + } + } + } + +} + +window.customElements.define('mao-forums', MaoForums); diff --git a/src/components/mao-fourms.js b/src/components/mao-fourms.js deleted file mode 100644 index 0672da4..0000000 --- a/src/components/mao-fourms.js +++ /dev/null @@ -1,199 +0,0 @@ -/** -@license -Copyright (c) 2018 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt -*/ - -import { html } from '@polymer/lit-element'; -import { PageViewElement } from './page-view-element.js'; -import { connect } from 'pwa-helpers/connect-mixin.js'; - -// This element is connected to the Redux store. -import { store } from '../store.js'; - -//These are the actions needed by this element. -import { requestHours, createFourmPost } from '../actions/firebase.js'; - -// We are lazy loading its reducer. -import firebase from '../reducers/firebase.js'; - -store.addReducers({ - firebase -}); - -// These are the shared styles needed by this element. -import { SharedStyles } from './shared-styles.js'; -import { ButtonSharedStyles } from './button-shared-styles.js' - -// Import paper elements -import '@polymer/paper-input/paper-input.js'; -import '@polymer/paper-input/paper-textarea.js'; -import '@polymer/paper-card/paper-card.js'; -import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js'; -import '@polymer/paper-item/paper-item.js'; -import '@polymer/paper-slider/paper-slider.js'; -import '@polymer/paper-button/paper-button.js'; - -// Import other customElements -import '@vaadin/vaadin-date-picker/vaadin-date-picker.js'; - -class MaoFourms extends connect(store)(PageViewElement) { - _render(props) { - return html` - ${SharedStyles} - ${ButtonSharedStyles} - - - - - -
- -

Recent Posts

- -
- -
- `; - } - - static get properties() { return { - // This is the data from the store. - signedIn: Boolean, - authMessage: String, - fourmPosts: Array - }} - - _stateChanged(state) { - this.signedIn = state.firebase.initialized; - this.authMessage = state.firebase.authMessage; - - this.fourmPosts = state.firebase.fourmPosts; - this.updateSection(); - } - - submitFourm() { - if(this.shadowRoot) { - var subjectElement = this.shadowRoot.getElementById('subject-field'); - var contentElement = this.shadowRoot.getElementById('content-field'); - - if(!contentElement.value) { - contentElement.value = ""; - } - - if( subjectElement.value.trim() === "" || - contentElement.value.trim() === "" - ) - { - alert("Please fill out all fields when creating a form post."); - } else { - if(confirm('Are you sure you want to submit this to the fourm page? It will be public to everyone.')) { - store.dispatch(createFourmPost(subjectElement.value, contentElement.value)); - - subjectElement.value = ""; - contentElement.value = ""; - } - } - } - - } - - updateSection() { - if(this.shadowRoot) { - var postsGrid = this.shadowRoot.getElementById('posts-grid'); - postsGrid.innerHTML = ""; - - for(var i = this.fourmPosts.length-1; i >=0; i--) { - var paperCard = document.createElement('paper-card'); - var cardContent = document.createElement('div'); - var fourmAuthor = document.createElement('h4'); - var fourmSubject = document.createElement('h3'); - var fourmContent = document.createElement('p'); - - fourmAuthor.innerHTML = this.fourmPosts[i].email .replace('@communityschoolnaples.org', ''); - fourmSubject.innerHTML = this.fourmPosts[i].subject; - fourmContent.innerHTML = this.fourmPosts[i].content; - - cardContent.classList.add('card-content'); - cardContent.appendChild( fourmAuthor); - cardContent.appendChild( fourmSubject); - cardContent.appendChild( fourmContent); - - paperCard.elevation = 0; - paperCard.appendChild( cardContent); - - postsGrid.appendChild(paperCard); - } - } - } - -} - -window.customElements.define('mao-fourms', MaoFourms); diff --git a/src/components/mao-tutoring.js b/src/components/mao-tutoring.js index c25c570..9bce4a7 100644 --- a/src/components/mao-tutoring.js +++ b/src/components/mao-tutoring.js @@ -256,7 +256,7 @@ class MaoTutoring extends connect(store)(PageViewElement) {

Need Help Finiding A Tutor?

Please meet with your friends to create tutring sessions.

-

Also, ypu can try the fourm page if you want.

+

Also, you can try the fourm page if you want.

Otherwise, contact our tutoring coordinator Mike Binkowski.

-- cgit v1.2.3-70-g09d2