diff --git a/src/bodies/components/profListing.js b/src/bodies/components/profListing.js
index 936683f0..2ed60993 100644
--- a/src/bodies/components/profListing.js
+++ b/src/bodies/components/profListing.js
@@ -12,10 +12,12 @@ class ClassListing extends Component {
this.state = {
showPanel:false,
color_blue: false,
- comments:[]
+ comments:[],
+ polls:[]
};
this.comment = this.comment.bind(this)
+
}
changeColor() {
@@ -37,6 +39,16 @@ class ClassListing extends Component {
this.setState({comments});
})
+//poll
+
+ firebase.database().ref('classes/' +this.props.item.key+ '/poll').on('value',(snapshot) =>{
+ var polls = this.state.polls;
+ polls = [];
+ snapshot.forEach(function(item) {
+ polls.push(item);
+ });
+ this.setState({polls});
+ })
}
getRating(item){
@@ -99,7 +111,27 @@ class ClassListing extends Component {
)
}
-
+ poll(item,i){
+ return(
+
+
+
{item.val().pollQuestion}
+
+
+
{item.val().ans1}
+
+
+
{item.val().ans1count}
+
+
+
{item.val().ans2}
+
+
+
{item.val().ans2count}
+
+
+ )
+ }
render() {
let bgColor = this.state.color_blue ? "#3D99D4" : "#FFFFFF";
let fontColor = this.state.color_blue ? "#FFFFFF" : "#3D99D4";
@@ -112,6 +144,7 @@ class ClassListing extends Component {
{
this.state.showPanel ?
+ {this.state.polls.map((item,i)=>this.poll(item, i))}
{this.state.comments.map((item,i)=>this.comment(item, i))}
:
diff --git a/src/bodies/professorLanding.js b/src/bodies/professorLanding.js
index 12e8d70f..2f50751d 100644
--- a/src/bodies/professorLanding.js
+++ b/src/bodies/professorLanding.js
@@ -55,6 +55,7 @@ class ProfLanding extends Component {
window.removeEventListener('resize', this.resize);
}
+
render() {
if(this.state.loading) {
return (Loading
)
@@ -66,16 +67,20 @@ class ProfLanding extends Component {
this.setState({classManager: false})}/>
:
-
+
+
{
myClass.map((item,i)=>{
- return(
+ return(
+
);
})
}
+
+
diff --git a/src/css/_classListing.css b/src/css/_classListing.css
index 8c6fff0c..8cedf90d 100644
--- a/src/css/_classListing.css
+++ b/src/css/_classListing.css
@@ -92,3 +92,38 @@
.bottomsep {
border-bottom: 4px solid rgb(61, 153, 212);
}
+.pollCol{
+ height: 100%;
+}
+.poll{
+ display: block;
+ width: 130%;
+ height: 50px;
+ border-radius: 10px;
+ background: #DC143C;
+ clear: both;
+}
+.pollQuestion {
+ display: block;
+ width: 100%;
+ height: 50%;
+ padding: 5px;
+ background: #DC143C;
+ font-size: 1em;
+}
+.pollAnswers {
+ display: block;
+ float: left;
+ width: 100%;
+ height: 100%;
+ padding: 10px;
+ background: #DC143C;
+ font-size: 1em;
+}
+.pollCount{
+ float: left;
+ height: 100%;
+ text-align: center;
+ font-size: 1.3em;
+ background: #DC143C;
+}