From 25f31ee2a67bf170078c248b7645854b7c387da6 Mon Sep 17 00:00:00 2001 From: Melody Date: Tue, 2 Jun 2015 22:50:28 -0700 Subject: [PATCH] Add more to settings --- scripts/SettingsController.js | 60 +++++++++++++-------- templates/settings.html | 122 ++++++++++++++++++++++++++++-------------- 2 files changed, 119 insertions(+), 63 deletions(-) diff --git a/scripts/SettingsController.js b/scripts/SettingsController.js index bc406f7..926c780 100644 --- a/scripts/SettingsController.js +++ b/scripts/SettingsController.js @@ -1,34 +1,50 @@ angular.module('flashy.SettingsController', ['ui.router']). - controller('SettingsController', function($scope, $http) { + controller('SettingsController', function($rootScope, $resource, $scope, $state, $http, UserService) { $scope.error = false; - $scope.success = false; - $scope.mismatch = false; - $scope.unacceptable = false; + $scope.success = false; + $scope.mismatch = false; + $scope.unacceptable = false; - $scope.changePassword = function(oldPassword, newPassword, confirmedNewPassword) { - console.log('in change password'); + $scope.changePassword = function(oldPassword, newPassword, confirmedNewPassword) { + console.log('in change password'); + + $http.patch('/api/me/', { + 'old_password': oldPassword, + 'new_password': newPassword + }). + success(function(data) { - $http.patch('/api/me/', { - 'old_password': oldPassword, - 'new_password': newPassword - }). - success(function(data) { - - console.log('password successfully changes'); - - }). - error(function(data) { - console.log('not changed'); - }); + console.log('password successfully changes'); + + }). + error(function(data) { + console.log('not changed'); + }); - - }; + + }; + + $rootScope.SectionResource = $resource('/api/sections/:sectionId/'); + $rootScope.currentSection = {}; + $rootScope.UserService = UserService; + + $scope.dropClass = function(section) { + $http.post('/api/sections/' + section.id + '/drop/'). + success(function(data) { + console.log(section.short_name + ' dropped'); + + Materialize.toast('Dropped', 3000, 'rounded'); + }). + error(function(err) { + console.log('no drop for you'); + }); + }; - console.log('checking to see if chrome'); - if (!chrome) { + console.log('checking to see if chrome'); + if (true/*!chrome*/) { return; } console.log('chrome'); diff --git a/templates/settings.html b/templates/settings.html index dd8644b..cc4d0f2 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -1,55 +1,95 @@ -
+
+
+
+

Notification Settings

+ +
+ + +
+
+
+
- -
- - -
+
+
+
-

Change Password

+

Change Password

-
-
+ -
-
- - +
+
+ + +
-
-
- - Required! -
+
+ + Required! +
-
-
- - +
+
+ + +
+
+ +
+ + New password must be at least 8 characters.
-
- -
- - New password must be at least 8 characters. -
-
-
- - +
+
+ + +
+
+ +
+ + Must be the same as the new password.
-
- -
- - Must be the same as the new password. -
- - + Change Password +
+
+
+ +
+
+
+ +

Enrolled Classes

+
+ + + + + + + + + + + + + + +
ClassDrop?
+ {{section.short_name}} +

{{section.long_name}}

+
+
+
+
+
-- 1.9.1