Commit 742c7cd5f8e6029542158eba73b2429faecb70ae
1 parent
a2c4eb4fdf
Exists in
master
and in
1 other branch
'fixed' autocomplete. css still broke
Showing 3 changed files with 39 additions and 29 deletions Side-by-side Diff
home.html
View file @
742c7cd
... | ... | @@ -4,6 +4,8 @@ |
4 | 4 | <head> |
5 | 5 | <link type="text/css" rel="stylesheet" href="styles/materialize.min.css" media="screen,projection"/> |
6 | 6 | <!--<link rel="stylesheet" href="styles/bootstrap-3.3.4-dist/css/bootstrap.css"/>--> |
7 | + <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.3/angular-material.min.css"> | |
8 | + | |
7 | 9 | <link rel="stylesheet" href="flashy.css"/> |
8 | 10 | </head> |
9 | 11 | |
... | ... | @@ -32,7 +34,7 @@ |
32 | 34 | <script src="scripts/DeckController.js"></script> |
33 | 35 | <script src="scripts/RequestResetController.js"></script> |
34 | 36 | <script src="scripts/ClassAddController.js"></script> |
35 | -<script src="scripts/StudyController.js"></script> | |
37 | +<!--<script src="scripts/StudyController.js"></script>--> | |
36 | 38 | <script src="scripts/UserService.js"></script> |
37 | 39 | <script src="//ghiden.github.io/angucomplete-alt/js/libs/angucomplete-alt.js"></script> |
38 | 40 | <!--<script src="scripts/bootstrap.js"></script>--> |
scripts/ClassAddController.js
View file @
742c7cd
1 | 1 | angular.module('flashy.ClassAddController', ['ui.router', 'angucomplete-alt', 'ngMaterial']). |
2 | 2 | |
3 | - controller('ClassAddController', ['$scope', '$state', '$http', function($scope, $state, $http) { | |
3 | + controller('ClassAddController', ['$scope', '$state', '$http', function ($scope, $state, $http) { | |
4 | 4 | |
5 | - $scope.trySearch = function() { | |
6 | - return $http.get('/api/sections/search').then(function(response){ | |
7 | - return response.data; | |
8 | - })}; | |
5 | + $scope.trySearch = function (searchText) { | |
6 | + return $http.get('/api/sections/search/', { | |
7 | + params: { | |
8 | + q: searchText | |
9 | + } | |
10 | + }).then(function (response) { | |
11 | + return response.data; | |
12 | + }) | |
13 | + }; | |
9 | 14 | |
10 | 15 | $scope.searchText = ""; |
11 | 16 | |
12 | 17 | /*$scope.trySearch = function() { |
13 | - $http.get('/api/sections/search', [$scope.searchText]). | |
14 | - success(function(data) { | |
15 | - return data; | |
16 | - }). | |
17 | - error(function(err) { | |
18 | - console.log('you eejit'); | |
19 | - }); | |
20 | - };*/ | |
18 | + $http.get('/api/sections/search', [$scope.searchText]). | |
19 | + success(function(data) { | |
20 | + return data; | |
21 | + }). | |
22 | + error(function(err) { | |
23 | + console.log('you eejit'); | |
24 | + }); | |
25 | + };*/ | |
21 | 26 | |
22 | 27 | }]); |
templates/addclass.html
View file @
742c7cd
1 | -<!DOCTYPE html> | |
2 | 1 | <div layout="column"> |
3 | - <md-content layout-padding layout="column"> | |
4 | - <form> | |
2 | + <div> | |
3 | + <md-content layout-padding layout="column"> | |
4 | + <form> | |
5 | 5 | <md-autocomplete flex |
6 | - nd-no-cache="noCache" | |
7 | - md-selected-item="selectedItem" | |
8 | - md-search-text="searchText" | |
9 | - md-items="item in trySearch(searchText)" | |
10 | - md-item-text="item.display" | |
11 | - md-floating-label="Search Classes"> | |
12 | - <span md-highlight-text="searchText">{{item.display}}</span> | |
13 | - <md-not-found> | |
14 | - No matches found. | |
15 | - </md-not-found> | |
6 | + nd-no-cache="noCache" | |
7 | + md-selected-item="selectedItem" | |
8 | + md-search-text="searchText" | |
9 | + md-items="item in trySearch(searchText)" | |
10 | + md-item-text="item.short_name" | |
11 | + md-floating-label="Search Classes"> | |
12 | + <md-item-template> | |
13 | + <span md-highlight-text="searchText">{{item.long_name}}</span> | |
14 | + </md-item-template> | |
15 | + <md-not-found> | |
16 | + No matching classes found. | |
17 | + </md-not-found> | |
16 | 18 | </md-autocomplete> |
17 | - </form> | |
18 | - </md-content> | |
19 | + </form> | |
20 | + </md-content> | |
21 | + </div> | |
19 | 22 | </div> |