Merged into develop.
This commit is contained in:
commit
7d7d4ffd2f
|
@ -8,6 +8,7 @@ class UniversityReviewSerializer(serializers.ModelSerializer):
|
|||
fields = [
|
||||
'pk',
|
||||
'university_name',
|
||||
'rating',
|
||||
'title',
|
||||
'username',
|
||||
'date_published',
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
# Generated by Django 2.0.6 on 2018-09-26 11:12
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('postings', '0003_universityreview_title'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='RateableEntity',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=256)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Review',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('rating', models.IntegerField(default=1)),
|
||||
('title', models.CharField(max_length=128)),
|
||||
('content', models.TextField()),
|
||||
('created_date', models.DateTimeField(auto_now_add=True)),
|
||||
('last_updated_date', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ReviewHelpfulVote',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('helpful', models.BooleanField()),
|
||||
('review', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.Review')),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='universityreview',
|
||||
name='rating',
|
||||
field=models.IntegerField(default=1),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Course',
|
||||
fields=[
|
||||
('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')),
|
||||
],
|
||||
bases=('postings.rateableentity',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Professor',
|
||||
fields=[
|
||||
('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')),
|
||||
],
|
||||
bases=('postings.rateableentity',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='University',
|
||||
fields=[
|
||||
('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')),
|
||||
],
|
||||
bases=('postings.rateableentity',),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='review',
|
||||
name='rateable_entity',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.RateableEntity'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='professor',
|
||||
name='university',
|
||||
field=models.ManyToManyField(to='postings.University'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='course',
|
||||
name='professors',
|
||||
field=models.ManyToManyField(to='postings.Professor'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='course',
|
||||
name='taught_at_university',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.University'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.0.6 on 2018-09-27 07:16
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('postings', '0004_auto_20180926_1312'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='universityreview',
|
||||
name='date_published',
|
||||
field=models.DateField(verbose_name='date published'),
|
||||
),
|
||||
]
|
|
@ -48,7 +48,8 @@ class Course(RateableEntity):
|
|||
class UniversityReview(models.Model):
|
||||
university_name = models.CharField(max_length=200)
|
||||
username = models.CharField(max_length=200)
|
||||
rating = models.IntegerField(default=1)
|
||||
title = models.CharField(max_length=200)
|
||||
date_published = models.DateTimeField('date published')
|
||||
date_published = models.DateField('date published')
|
||||
content = models.CharField(max_length=200)
|
||||
|
|
@ -73,4 +73,14 @@ body {
|
|||
.review-block-description {
|
||||
font-size: 13px; }
|
||||
|
||||
.animated {
|
||||
-webkit-transition: height 0.2s;
|
||||
-moz-transition: height 0.2s;
|
||||
transition: height 0.2s; }
|
||||
|
||||
.stars {
|
||||
margin: 20px 0;
|
||||
font-size: 24px;
|
||||
color: #d17581; }
|
||||
|
||||
/*# sourceMappingURL=main.css.map */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "AACA,IAAI;EACF,QAAQ,EAAE,QAAQ;EAClB,KAAK,EAAE,IAAI;EACX,UAAU,EAAE,0FAA0F;EACtG,KAAK,EAAE,IAAI;EACX,UAAU,EAAE,MAAM;EAClB,aAAa,EAAE,CAAC;EAChB,UAAU,EAAC,MAAM;;AAEnB,cAAe;EACb,OAAO,EAAE,IAAI;EACb,WAAW,EAAE,MAAM;EACnB,MAAM,EAAE,0BAA0B;EAClC,MAAM,EAAE,uBAAuB;EAC/B,MAAM,EAAE,kBAAkB;;AAE5B,iBAAiB;EACf,SAAS,EAAE,IAAI;;AAEjB,iBAAiB;EACf,aAAa,EAAE,IAAI;;AAOrB,KAAM;EACJ,UAAU,EAAE,OAAO;EACnB,QAAQ,EAAE,QAAQ;EAClB,KAAK,EAAE,IAAI;;AAGb,MAAM;EACJ,UAAU,EAAE,KAAK;;AAGnB,IAAK;EACH,WAAW,EAAE,IAAI;;AAEnB,SAAS;EACP,gBAAgB,EAAC,OAAO;EACxB,KAAK,EAAC,IAAI;;AAEZ,aAAa;EACX,gBAAgB,EAAC,OAAO;EACxB,MAAM,EAAC,iBAAiB;EACxB,OAAO,EAAC,mBAAmB;EAC3B,aAAa,EAAC,GAAG;;AAEnB,KAAK;EAC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3B,aAAa,EAAC,GAAG;;AAEnB,KAAK;EACH,WAAW,EAAC,GAAG;;AAEjB,iBAAiB;EACf,cAAc,EAAC,GAAG;;AAGpB,aAAa;EACX,gBAAgB,EAAC,OAAO;EACxB,MAAM,EAAC,iBAAiB;EACxB,OAAO,EAAC,IAAI;EACZ,aAAa,EAAC,GAAG;EACjB,aAAa,EAAC,IAAI;;AAEpB,kBAAkB;EAChB,SAAS,EAAC,IAAI;EACd,MAAM,EAAC,MAAM;;AAEf,kBAAkB;EAChB,SAAS,EAAC,IAAI;;AAEhB,kBAAkB;EAChB,SAAS,EAAC,IAAI;EACd,aAAa,EAAC,IAAI;;AAEpB,mBAAmB;EACjB,SAAS,EAAC,IAAI;EACd,WAAW,EAAC,GAAG;EACf,aAAa,EAAC,IAAI;;AAEpB,yBAAyB;EACvB,SAAS,EAAC,IAAI;;AAGhB,SAAU;EACR,kBAAkB,EAAE,WAAW;EAC/B,eAAe,EAAE,WAAW;EAC5B,UAAU,EAAE,WAAW;;AAGzB,MACA;EACE,MAAM,EAAE,MAAM;EACd,SAAS,EAAE,IAAI;EACf,KAAK,EAAE,OAAO",
|
||||
"sources": ["main.scss"],
|
||||
"names": [],
|
||||
"file": "main.css"
|
||||
|
|
|
@ -81,4 +81,21 @@ body {
|
|||
}
|
||||
.review-block-description{
|
||||
font-size:13px;
|
||||
}
|
||||
|
||||
.animated {
|
||||
-webkit-transition: height 0.2s;
|
||||
-moz-transition: height 0.2s;
|
||||
transition: height 0.2s;
|
||||
}
|
||||
|
||||
.stars
|
||||
{
|
||||
margin: 20px 0;
|
||||
font-size: 24px;
|
||||
color: #d17581;
|
||||
}
|
||||
|
||||
.nopointer{
|
||||
|
||||
}
|
|
@ -12,7 +12,6 @@
|
|||
<link rel="apple-touch-icon" href="apple-touch-icon.png">
|
||||
|
||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||
<link href="css/star-rating.css" media="all" rel="stylesheet" type="text/css"/>
|
||||
<style>
|
||||
body {
|
||||
padding-top: 50px;
|
||||
|
@ -167,6 +166,47 @@
|
|||
<div id="review_container" class="review-block">
|
||||
<!-- All reviews go in this block. -->
|
||||
|
||||
|
||||
|
||||
<hr/>
|
||||
<div class="row" style="margin-top:40px;">
|
||||
<div class="col-md-12">
|
||||
<div class="well-sm">
|
||||
<div class="text-right">
|
||||
<a class="btn btn-success btn-green" href="#reviews-anchor" id="open-review-box">Leave a Review</a>
|
||||
</div>
|
||||
|
||||
<div class="row" id="post-review-box" style="display:none;">
|
||||
<div class="col-md-12">
|
||||
|
||||
<form accept-charset="UTF-8" action="" method="post">
|
||||
<input id="ratings-hidden" name="rating" type="hidden">
|
||||
<p class="text-right date"></p>
|
||||
<div class="form-group">
|
||||
<label for="usr">Name:</label>
|
||||
<input type="text" class="form-control" placeholder="Name..." id="usr">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="usr">Review:</label>
|
||||
<input class="form-control animated" cols="50" id="new-review" name="comment" placeholder="Enter your review here..." rows="5">
|
||||
</div>
|
||||
<div class="text-right">
|
||||
|
||||
<div class="stars starrr" data-rating="0"></div>
|
||||
<a class="btn btn-danger btn-sm" href="#" id="close-review-box" style="display:none; margin-right: 10px;">
|
||||
<span class="glyphicon glyphicon-remove"></span>Cancel</a>
|
||||
<button class="btn btn-success btn-lg" type="submit">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -176,7 +216,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
|
||||
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.2.min.js"><\/script>')</script>
|
||||
<script src="js/vendor/bootstrap.min.js"></script>
|
||||
|
|
|
@ -1,9 +1,70 @@
|
|||
(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',n=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent"],s=e(i).data("autosize",!0)[0];s.style.lineHeight="99px","99px"===e(s).css("lineHeight")&&n.push("lineHeight"),s.style.lineHeight="",e.fn.autosize=function(i){return this.length?(i=e.extend({},o,i||{}),s.parentNode!==document.body&&e(document.body).append(s),this.each(function(){function o(){var t,o;"getComputedStyle"in window?(t=window.getComputedStyle(u,null),o=u.getBoundingClientRect().width,e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,i){o-=parseInt(t[i],10)}),s.style.width=o+"px"):s.style.width=Math.max(p.width(),0)+"px"}function a(){var a={};if(t=u,s.className=i.className,d=parseInt(p.css("maxHeight"),10),e.each(n,function(e,t){a[t]=p.css(t)}),e(s).css(a),o(),window.chrome){var r=u.style.width;u.style.width="0px",u.offsetWidth,u.style.width=r}}function r(){var e,n;t!==u?a():o(),s.value=u.value+i.append,s.style.overflowY=u.style.overflowY,n=parseInt(u.style.height,10),s.scrollTop=0,s.scrollTop=9e4,e=s.scrollTop,d&&e>d?(u.style.overflowY="scroll",e=d):(u.style.overflowY="hidden",c>e&&(e=c)),e+=w,n!==e&&(u.style.height=e+"px",f&&i.callback.call(u,u))}function l(){clearTimeout(h),h=setTimeout(function(){var e=p.width();e!==g&&(g=e,r())},parseInt(i.resizeDelay,10))}var d,c,h,u=this,p=e(u),w=0,f=e.isFunction(i.callback),z={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},g=p.width();p.data("autosize")||(p.data("autosize",!0),("border-box"===p.css("box-sizing")||"border-box"===p.css("-moz-box-sizing")||"border-box"===p.css("-webkit-box-sizing"))&&(w=p.outerHeight()-p.height()),c=Math.max(parseInt(p.css("minHeight"),10)-w||0,p.height()),p.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word",resize:"none"===p.css("resize")||"vertical"===p.css("resize")?"none":"horizontal"}),"onpropertychange"in u?"oninput"in u?p.on("input.autosize keyup.autosize",r):p.on("propertychange.autosize",function(){"value"===event.propertyName&&r()}):p.on("input.autosize",r),i.resizeDelay!==!1&&e(window).on("resize.autosize",l),p.on("autosize.resize",r),p.on("autosize.resizeIncludeStyle",function(){t=null,r()}),p.on("autosize.destroy",function(){t=null,clearTimeout(h),e(window).off("resize",l),p.off("autosize").off(".autosize").css(z).removeData("autosize")}),r())})):this}})(window.jQuery||window.$);
|
||||
|
||||
|
||||
/*
|
||||
$(document).ready(function() {
|
||||
alert( $(".review-block-rate .glyphicon-star").length );
|
||||
alert($(".review-block-rate .btn-grey .glyphicon-star").length);
|
||||
});
|
||||
|
||||
*/
|
||||
$(function(){
|
||||
|
||||
$('#new-review').autosize({append: "\n"});
|
||||
|
||||
var reviewBox = $('#post-review-box');
|
||||
var newReview = $('#new-review');
|
||||
var openReviewBtn = $('#open-review-box');
|
||||
var closeReviewBtn = $('#close-review-box');
|
||||
var ratingsField = $('#ratings-hidden');
|
||||
|
||||
openReviewBtn.click(function(e)
|
||||
{
|
||||
reviewBox.slideDown(400, function()
|
||||
{
|
||||
$('#new-review').trigger('autosize.resize');
|
||||
newReview.focus();
|
||||
});
|
||||
openReviewBtn.fadeOut(100);
|
||||
closeReviewBtn.show();
|
||||
});
|
||||
|
||||
closeReviewBtn.click(function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
reviewBox.slideUp(300, function()
|
||||
{
|
||||
newReview.focus();
|
||||
openReviewBtn.fadeIn(200);
|
||||
});
|
||||
closeReviewBtn.hide();
|
||||
|
||||
});
|
||||
|
||||
$('.starrr').on('starrr:change', function(e, value){
|
||||
ratingsField.val(value);
|
||||
});
|
||||
var i;
|
||||
for(i = 1; i<6; i++) {
|
||||
$(".stars").append("<button value=" + i + " id = \"star" + i +"\" type=\"button\" class=\"btn btn-default btn-grey btn-xs\" aria-label=\"Left Align\">\n" +
|
||||
" <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>\n" +
|
||||
" </button>");
|
||||
}
|
||||
$(".stars .btn").click(function(e, value) {
|
||||
$(".starrr").attr("data-rating", this.value);
|
||||
for (let j = 1; j <= this.value; j++) {
|
||||
$("#star" + j).removeClass("btn-default btn-grey").addClass("btn-warning");
|
||||
}
|
||||
for (let g = this.value; g <= 5; g++) {
|
||||
$("#star" + (g+1)).addClass("btn-default btn-grey").removeClass("btn-warning");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var d = new Date();
|
||||
|
||||
var month = d.getMonth()+1;
|
||||
var day = d.getDate();
|
||||
|
||||
var output =
|
||||
|
||||
((''+day).length<2 ? '0' : '') + day + '/' +
|
||||
((''+month).length<2 ? '0' : '') + month + '/' +
|
||||
d.getFullYear();
|
||||
$(".date").append(output);
|
||||
|
||||
});
|
Loading…
Reference in New Issue