Commit 1e9f9942 authored by Ben Waters's avatar Ben Waters

Merge branch 'master' of https://github.com/srct/advisor

parents 13135f72 50f452ab
......@@ -59,26 +59,34 @@ Compare | YourSchool Advisor
<div class="row well">
<legend>Automatic comparisons of your selected trajectories.</legend>
<div class="col-md-12">
<p>Trajectory one will take longer to complete.</p>
<p>Trajectory two has fewer higher-level classes.</p>
<p>Trajectory one has the lightest average courseload.</p>
<div class="col-md-4">
<!-- <p><strong><button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="top" data-content="The fewest semesters to complete.">Shortest Time</button></strong>Trajectory 2</p> -->
<p><strong>Shortest Time:</strong> Trajectory Two</p>
</div>
<div class="col-md-12">
<p>Common courses between trajectories include:</p>
<div class="col-md-4">
<p><strong>Easier Classes:</strong>Trajectory Two</p>
<!-- fewer higher level classes -->
</div>
<div class="col-md-4">
<p><strong>Lightest Courseload:</strong>Trajectory One</p>
</div>
<div class="col-md-6">
<p>Common courses between trajectories include:</p>
<h6><span class="label label-primary">Course 309</span>
<span class="label label-primary">Course 367</span></h6>
</div>
<div class="col-md-12">
<p>Additional electives (courses not required for the completion of your
selected program) for trajectory one include:</p>
<h6><span class="label label-primary">Course 194</span>
<span class="label label-primary">Course 208</span>
<span class="label label-primary">Course 211</span></h6>
</div>
<div class="col-md-6">
<div class="col-md-12">
<p>Additional electives (courses not required for the completion of your
selected program) for trajectory two include:</p>
<h6><span class="label label-primary">Course 222</span></h6>
</div>
</div>
<p>Have an if statement for columns if only three trajectories instead of two, etc</p>
......
......@@ -42,6 +42,14 @@ class RequirementAdmin(admin.ModelAdmin):
filter_horizontal = ('courses',)
class TrajectoryAdmin(admin.ModelAdmin):
pass
class SemesterAdmin(admin.ModelAdmin):
pass
admin.site.register(Student, StudentAdmin)
admin.site.register(Course, CourseAdmin)
admin.site.register(CourseGroup, CourseGroupAdmin)
......@@ -50,4 +58,6 @@ admin.site.register(Minor, MinorAdmin)
admin.site.register(GenEd, GenEdAdmin)
admin.site.register(Concentration, ConcentrationAdmin)
admin.site.register(Requirement, RequirementAdmin)
admin.site.register(Trajectory, TrajectoryAdmin)
admin.site.register(Semester, SemesterAdmin)
admin.site.unregister(Group)
var advisor = advisor || {};
$(function () {
advisor.Programs = new advisor.ProgramCollection();
var p = new advisor.Program({id: 3});
advisor.Programs.reset([p]);
(new advisor.ProgramCollectionView())
var t = new advisor.Trajectory({id: 1});
t.fetch({
success: function() {
t.fetchRelated('semesters', {
success: function() {
advisor.Semesters = t.get('semesters');
advisor.SemestersViews = new advisor.SemesterCollectionView();
}
});
}
});
});
$(document).ready(function() {
$('#slide').click(function() {
$('#semesters').slideToggle();
//advisor.SemestersViews.addAll();
})
})
advisor.SemesterCollection = Backbone.Collection.extend({
model: advisor.Semester
});
var advisor = advisor || {};
advisor.Semester = Backbone.RelationalModel.extend({
urlRoot: '/api/semesters',
initialize: function() {
this.fetchRelated('courses')
},
events: {
},
relations: [{
type: Backbone.HasMany,
key: 'courses',
relatedModel: 'advisor.Course',
collectionType: 'advisor.CourseCollection',
reverseRelation: {
key: 'semester',
includeInJSON: 'id'
}
}],
});
var advisor = advisor || {};
advisor.Trajectory = Backbone.RelationalModel.extend({
urlRoot: '/api/trajectories',
initialize: function() {
this.fetch()
},
relations: [{
type: Backbone.HasMany,
key: 'semesters',
relatedModel: 'advisor.Semester',
collectionType: 'advisor.SemesterCollection',
autoFetch: true,
reverseRelation: {
key: 'trajectory',
includeInJSON: 'id'
}
}]
});
var advisor = advisor || {};
advisor.CourseView = Backbone.View.extend({
tagName: 'div',
template: _.template( $('#course-template').html() ),
events: {
},
initialize: function() {
this.listenTo(this.model, 'change', this.render);
},
// Re-renders the titles of the todo item.
render: function() {
$('body').append( this.template( this.model.toJSON() ) );
return this;
},
});
......@@ -8,13 +8,14 @@ advisor.CourseCollectionView = Backbone.View.extend({
var view = new advisor.CourseView({ model: course });
// Fix bug where element render multiple times
var elm = view.render().el
if(!($('#' + elm.id).length))
this.$el.append(elm);
$('#' + elm.id).remove()
this.$el.append(elm);
},
// Add all items in the **Todos** collection at once.
addAll: function(courses) {
courses.each(this.addOne, this);
(function() {console.log("done")})();
}
});
......@@ -8,9 +8,21 @@ advisor.CourseView = Backbone.View.extend({
this.listenTo(this.model, 'change', this.render);
},
events: {
"click": "info"
},
render: function() {
this.$el.addClass('course ' + this.model.get('dept')).attr('id', 'course-' + this.model.get('id'))
.html(this.template(this.model.toJSON()));
return this;
},
info: function() {
var m = this.model;
$('#course-info-title').html(m.get('dept') + ' ' + m.get('courseid'));
$('#course-info-description').text(m.get('description'));
$('#course-info-prereqs').text(m.get('prerequisites'));
$("#infoModal").modal();
}
});
......@@ -16,7 +16,7 @@ advisor.ProgramView = Backbone.View.extend({
},
render_courses: function() {
this.$('.panel-body').html('');
this.$('.courses-panel').html('');
var that = this;
this.model.fetchRelated('requirements', {
success: function(requirements) {
......
var advisor = advisor || {};
advisor.SemesterCollectionView = Backbone.View.extend({
el: '#semesters',
initialize: function() {
this.addAll();
},
addOne: function(semester) {
var view = new advisor.SemesterView({ model: semester });
var el = view.render().el
$('#semesters').append(el);
},
addAll: function() {
//this.$el.html('');
advisor.Semesters.each(this.addOne, this);
},
});
var advisor = advisor || {};
advisor.SemesterView = Backbone.View.extend({
template: _.template( $('#semester-template').html() ),
initialize: function() {
},
events: {
},
render: function() {
this.$el.addClass('semester panel panel-info').attr('id', 'semester-' + this.model.get('id'))
.html(this.template(this.model.toJSON()));
this.render_courses()
return this;
},
render_courses: function() {
//this.$('.panel-body').html('');
var that = this;
this.model.fetchRelated('courses', {
success: function() {
var courseViews = new advisor.CourseCollectionView({el: that.el});
courseViews.addAll(that.model.get('courses'));
},
});
}
});
......@@ -6,10 +6,10 @@
{% block templates %}
<script type="text/template" id="course-template">
<%= dept %> <%= courseid %>
<%= dept %> <%= courseid %>
</script>
<script type="text/template" id="program-template">
<div class="panel-heading">
<div class="panel-heading program-title">
<h3 class="panel-title"><%= name %></h3>
</div>
<div class="panel-body">
......@@ -17,20 +17,39 @@
</div>
</div>
</script>
<script type="text/template" id="semester-template">
<div class="panel-heading">
<h3 class="panel-title">Semester <%= id %></h3>
</div>
<div class="panel-body">
<div class="gridster courses">
</div>
</div>
</script>
{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-12">
<div class="row semester-controls">
<div class="col-lg-2 col-lg-offset-7">
<a href="#NewSemester" class="btn btn-block btn-lg btn-info">Semester <i class="fa fa-plus"></i> </a>
</div>
<div class="col-lg-2">
<a id="save" href="#Save" class="btn btn-block btn-lg btn-primary">Save</a>
</div>
<div class="col-lg-1">
<a id="slide" href="#" class="btn btn-block btn-lg btn-inverse"><i class="fa fa-sort-desc fa-lg"></i></a>
</div>
</div>
<div class="row">
<div id="programs" class="col-lg-12">
<div class="row gridster">
<div id="" class="col-lg-12">
<div id="semesters">
</div>
<div id="programs">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Computer Science Major</h3>
</div>
<div class="panel-body">
<div class="panel-body courses-panel">
<div class="gridster courses">
<ul>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1"></li>
......@@ -81,7 +100,25 @@
</div>
</div>
</div>
</div>
</div>
<div id="infoModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 id="course-info-title" class="modal-title"></h4>
</div>
<div id="course-info-body" class="modal-body">
<p id="course-info-description"></p>
<strong>Prerequsities:</strong><p id="course-info-prereqs"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{% endblock %}
{% block javascript %}
{{ block.super }}
......@@ -89,12 +126,17 @@
<script src="/static/js/advisor/models/course.js"></script>
<script src="/static/js/advisor/models/requirement.js"></script>
<script src="/static/js/advisor/models/program.js"></script>
<script src="/static/js/advisor/models/semester.js"></script>
<script src="/static/js/advisor/models/trajectory.js"></script>
<script src="/static/js/advisor/collections/courses.js"></script>
<script src="/static/js/advisor/collections/requirements.js"></script>
<script src="/static/js/advisor/collections/programs.js"></script>
<script src="/static/js/advisor/collections/semesters.js"></script>
<script src="/static/js/advisor/views/courseView.js"></script>
<script src="/static/js/advisor/views/programView.js"></script>
<script src="/static/js/advisor/views/semesterView.js"></script>
<script src="/static/js/advisor/views/programCollectionView.js"></script>
<script src="/static/js/advisor/views/semesterCollectionView.js"></script>
<script src="/static/js/advisor/views/courseCollectionView.js"></script>
<script src="/static/js/advisor/app.js"></script>
{% endblock %}
This diff is collapsed.
......@@ -21,7 +21,7 @@ body {
height: 16px;
}
#main {
padding-top: 45px;
padding-top: 65px;
}
.courses li {
......@@ -31,8 +31,16 @@ body {
.program {
text-align: center;
max-height: 480px;
overflow-y: scroll;
}
.program-title {
padding: 16px 0;
}
.semester-controls {
margin-bottom: 15px;
}
.course {
width: 160px;
height: 80px;
......@@ -43,6 +51,7 @@ body {
color: #171C21;
display: inline-block;
background-color: #2980B9;
cursor: pointer;
}
.CS {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -24,7 +24,7 @@ YourSchool Advisor
<div class="row">
<div class="col-md-offset-3 col-md-6">
<a href="{% url 'new-trac' %}">
<button type="button" class="btn btn-standard btn-lg btn-block">Create a New Trajectory</button>
<button type="button" class="btn btn-primary btn-lg btn-block">Create a New Trajectory</button>
</a>
</div>
</div>
......
......@@ -10,6 +10,7 @@
<link href="/static/css/flat-ui.css" rel="stylesheet" media="screen">
<link href="/static/css/jquery.gridster.min.css" rel="stylesheet" media="screen">
<link href="/static/css/style.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="/static/css/font-awesome.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.js" type="text/javascript"></script>
{% include 'autocomplete_light/static.html' %}
<!-- <link rel="icon" href="/static/img/favicon.ico"> -->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment