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 @@ -