Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/assets/javascripts/app.js.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
CourseRegistrationApp = angular.module('CourseRegistrationApp', ['Controllers', 'Services', 'Directives']);
CourseRegistrationApp = angular.module('CourseRegistrationApp', ['Controllers', 'Services', 'Directives', 'filters']);

CourseRegistrationApp.config(['$routeProvider', ($routeProvider) ->
$routeProvider.when('/', {templateUrl: '/views/requirements.html', controller: 'RequirementsController', resolve: {ClassesStub: 'ClassesStub'}})
$routeProvider.when('/courseList', { templateUrl: '/views/courseList.html', controller: 'ClassListController', resolve: {ClassesStub: 'ClassesStub'} } );
$routeProvider.when('/search/:searchQuery', { templateUrl: '/views/courseList.html', controller: 'ClassListController', resolve: {ClassesStub: 'ClassesStub'} } );
$routeProvider.when('/requirements', { templateUrl: '/views/requirements.html', controller: 'RequirementsController', resolve: {ClassesStub: 'ClassesStub'}} )
$routeProvider.otherwise('/')
]);
]);
18 changes: 18 additions & 0 deletions app/assets/javascripts/filters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
angular.module('filters', []).
filter('truncate', function () {
return function (text, length, end) {
if (isNaN(length))
length = 10;

if (end === undefined)
end = "...";

if (text.length <= length || text.length - end.length <= length) {
return text;
}
else {
return String(text).substring(0, length-end.length) + end;
}

};
});
17 changes: 13 additions & 4 deletions public/views/courseList.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@
<div class="row" ng-repeat="course in classList">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{{course.className}}</h3>
<p>{{course.professor}}</p>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-6">
<h3 class="panel-title">{{course.className}}</h3>
</div>
<div class="col-md-6 col-sm-6 col-xs-6">
<p align="right">{{course.professor}}</p>
</div>
</div>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-6">
<p>{{course.description}}</p>
<div class="col-md-12 col-sm-12 col-xs-12">
<p>{{course.description|truncate:25:"..."}}</p> <!-- |truncate:25:"..." TODO: implement truncate-->
<button type="button" class="btn btn-info">More Info</button>
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-6">
<div class="btn-group" ng-repeat="section in course.sections">
<div class="row">
Expand Down