Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pre-CFB tweaks
  • Loading branch information
Joel Salisbury committed Sep 21, 2017
1 parent a59316e commit 54b9467
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 83 deletions.
2 changes: 1 addition & 1 deletion app/app.route.js
@@ -1,7 +1,7 @@
app.config( function ($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'app/pages/food/view.html',
templateUrl: 'app/pages/categories/view.html',
controller: 'FoodCtrl'
})

Expand Down
30 changes: 1 addition & 29 deletions app/root/_nav.kit
Expand Up @@ -2,19 +2,10 @@

<!-- Logo -->
<div class="logo-area">
<i class="material-icons">local_pizza</i>
<h4 class="logo">F2E</h4>
<h4 class="logo">Manage NAIP Categories</h4>
</div>


<!-- Links -->
<div class="links">
<ul class="tabs tabs-transparent">
<li class="tab"><a ng-class="{active: page.id==='food'}" ng-click="go('/food')">Food</a></li>
<li class="tab"><a ng-class="{active: page.id==='cat'}" ng-click="go('/categories')">Categories</a></li>
<!-- <li class="tab"><a ng-class="{active: page.id==='nutrients'}" ng-click="go('/nutrients')">Nutrients</a></li> -->
</ul>
</div>


<!-- Sign in/up Buttons -->
Expand All @@ -29,26 +20,7 @@



<ul id="slide-out" class="side-nav">
<li><div class="userView">
<div class="background"><img src="assets/img/gabe.jpg"></div>
<a href="#!user"><img class="circle" src="assets/img/gabe.jpg"></a>
<a href="#!name"><span class="white-text name">John Doe</span></a>
<a href="#!email"><span class="white-text email">jdandturk@gmail.com</span></a>
</div></li>

<li><a ng-click="view('comp')"><i class="material-icons">cloud</i> Profile</a></li>
<li><a ng-click="view('comp')"><i class="material-icons">cloud</i> Settings</a></li>
<li><a ng-click="view('comp')"><i class="material-icons">cloud</i> Sign out</a></li>

<li><div class="divider"></div></li>

<li><a class="subheader">Flash CMS</a></li>
<li><a ng-click="view('news')"><i class="material-icons">cloud</i> News</a></li>
<li><a ng-click="view('comp')"><i class="material-icons">cloud</i> Competitions</a></li>
<li><a ng-click="view('feat')"><i class="material-icons">cloud</i> Featured user</a></li>
<li><a ng-click="view('acct')"><i class="material-icons">cloud</i> Manage accounts</a></li>
</ul>

<script>
$('.profile-btn').sideNav({
Expand Down
107 changes: 54 additions & 53 deletions assets/js/bundle.js
Expand Up @@ -43,7 +43,7 @@ app.factory('Nutrients', function($resource) {
app.config( function ($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'app/pages/food/view.html',
templateUrl: 'app/pages/categories/view.html',
controller: 'FoodCtrl'
})

Expand Down Expand Up @@ -245,58 +245,6 @@ app.controller('CategoryCtrl', ['$scope', '$http', 'Categories', 'Nutrients', fu
};
}]);

app.controller('LoginCtrl', ['$scope', 'loginService', function ($scope, loginService) {
$scope.page.title = 'Login';
$scope.page.id = 'login';
$scope.page.yourVar = "globalStuff";

$scope.selected = {
username: "",
password: ""
};

$scope.loginAttempt = {
username: "",
password: "",
attempt: false,
login: false
};

$scope.loginService = loginService;

$scope.login = function( username, password ) {
$scope.loginAttempt.username = username;
$scope.loginAttempt.password = password;
$scope.loginAttempt.attempt = true;
// Sanitize? Pre-check?
console.log($scope.loginService);
$scope.loginService.login( username, password ).then(function(response) {
console.log(response);
// Mock the fact that this takes longer
setTimeout(function() {
$scope.$apply(function() {
$scope.loginAttempt.login = response.login;
$scope.loginAttempt.attempt = false;
});
}, 1000);
}, function(error) {
console.error(error);
});
};

}]);

app.factory('loginService', ['$http', function($http) {
return {
login: function( username, password ) {
return $http.get('/app/pages/login/example.json').then(function(response) {
return response.data;
}, function(error) {
return error;
});
}
};
}]);
app.controller('FoodCtrl', ['$scope', '$http', 'Foods', 'FoodDetail', 'Categories', '$cookies', function ($scope, $http, Foods, FoodDetail, Categories, $cookies) {
$scope.page.title = 'Food';
$scope.page.id = 'food';
Expand Down Expand Up @@ -457,3 +405,56 @@ app.controller('NutrientsCtrl', ['$scope', 'Nutrients', function ($scope, Nutrie
$scope.cancel(); // hide modal
};
}]);

app.controller('LoginCtrl', ['$scope', 'loginService', function ($scope, loginService) {
$scope.page.title = 'Login';
$scope.page.id = 'login';
$scope.page.yourVar = "globalStuff";

$scope.selected = {
username: "",
password: ""
};

$scope.loginAttempt = {
username: "",
password: "",
attempt: false,
login: false
};

$scope.loginService = loginService;

$scope.login = function( username, password ) {
$scope.loginAttempt.username = username;
$scope.loginAttempt.password = password;
$scope.loginAttempt.attempt = true;
// Sanitize? Pre-check?
console.log($scope.loginService);
$scope.loginService.login( username, password ).then(function(response) {
console.log(response);
// Mock the fact that this takes longer
setTimeout(function() {
$scope.$apply(function() {
$scope.loginAttempt.login = response.login;
$scope.loginAttempt.attempt = false;
});
}, 1000);
}, function(error) {
console.error(error);
});
};

}]);

app.factory('loginService', ['$http', function($http) {
return {
login: function( username, password ) {
return $http.get('/app/pages/login/example.json').then(function(response) {
return response.data;
}, function(error) {
return error;
});
}
};
}]);

0 comments on commit 54b9467

Please sign in to comment.