Skip to content

Commit

Permalink
Added ui-router, changed folder structure, using controller as, compl…
Browse files Browse the repository at this point in the history
…eted, logout
  • Loading branch information
adamkleingit committed Mar 18, 2015
1 parent d34ab34 commit 5ccc27a
Show file tree
Hide file tree
Showing 22 changed files with 233 additions and 262 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
# general
.idea
.DS_Store
.tmp/**

# package control
node_modules
Expand Down
81 changes: 0 additions & 81 deletions .tmp/styles/main.css

This file was deleted.

27 changes: 27 additions & 0 deletions app/app.js
@@ -0,0 +1,27 @@
'use strict';

angular.module('mytodoApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ui.router',
'ui.sortable',
'LocalStorageModule',
'common.interceptors.http',
'backand'
])
.config(['$stateProvider','$httpProvider', '$urlRouterProvider', function($stateProvider, $httpProvider, $urlRouterProvider) {
$httpProvider.interceptors.push('httpInterceptor');
$urlRouterProvider.otherwise("/");
$stateProvider
.state('todos', {
url: '/',
templateUrl: 'views/main/main.html',
controller: 'MainCtrl as vm'
})
.state('login', {
url: '/login',
templateUrl: 'views/login/login.html',
controller: 'LoginCtrl as vm'
});
}]);
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
4 changes: 4 additions & 0 deletions app/styles/main.css → app/assets/styles/main.css
Expand Up @@ -77,3 +77,7 @@ body {
border-bottom: 0;
}
}

.todo-completed, .todo-completed input {
text-decoration: line-through;
}
File renamed without changes.
15 changes: 8 additions & 7 deletions app/index.html
Expand Up @@ -15,7 +15,7 @@
<!-- endbower -->
<!-- endbuild -->
<!-- build:css({.tmp,app}) styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<link rel="stylesheet" href="assets/styles/main.css">
<!-- endbuild -->
</head>
<body ng-app="mytodoApp">
Expand All @@ -24,7 +24,7 @@
<![endif]-->

<!-- Add your site or application content here -->
<div class="container" ng-view=""></div>
<div class="container" ui-view></div>

<!-- Google Analytics: change UA-XXXXX-X to be your site's ID -->
<script>
Expand Down Expand Up @@ -56,18 +56,19 @@
<script src="bower_components/jquery-ui/jquery-ui.js"></script>
<script src="bower_components/angular-ui-sortable/sortable.js"></script>
<script src="bower_components/angular-local-storage/dist/angular-local-storage.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<!-- endbower -->
<!-- endbuild -->

<!-- Backand SDK for Angular -->
<script src="//cdn.backand.net/backand/dist/1.5.1/backand.min.js"></script>

<!-- build:js({.tmp,app}) scripts/scripts.js -->
<script src="scripts/app.js"></script>
<script src="scripts/controllers/main.js"></script>
<script src="scripts/controllers/login.js"></script>
<script src="scripts/services/backand.js"></script>
<script src="scripts/common/interceptors/httpInterceptor.js"></script>
<script src="app.js"></script>
<script src="views/main/main.js"></script>
<script src="views/login/login.js"></script>
<script src="services/backand.js"></script>
<script src="config/interceptors/httpInterceptor.js"></script>
<!-- endbuild -->

</body>
Expand Down
27 changes: 0 additions & 27 deletions app/scripts/app.js

This file was deleted.

33 changes: 0 additions & 33 deletions app/scripts/controllers/login.js

This file was deleted.

79 changes: 0 additions & 79 deletions app/scripts/controllers/main.js

This file was deleted.

15 changes: 13 additions & 2 deletions app/scripts/Services/backand.js → app/services/backand.js
Expand Up @@ -14,13 +14,20 @@
return $http({
method: 'GET',
url: Backand.configuration.apiUrl + baseUrl + self.tableName
}).then(function(response) {
return response.data.data.map(function(todo) {
todo.id = parseInt(todo.id);
return todo;
});
});
};

self.readOne = function (id) {
return $http({
method: 'GET',
url: Backand.configuration.apiUrl + baseUrl + self.tableName + '/' + id
}).then(function(response) {
return response.data;
});
};

Expand All @@ -32,15 +39,19 @@
params: {
returnObject: true
}
})
}).then(function(response) {
return response.data;
});
};

self.update = function (id, data) {
return $http({
method: 'PUT',
url : Backand.configuration.apiUrl + baseUrl + self.tableName + '/' + id,
data: data
})
}).then(function(response) {
return response.data;
});
};

self.delete = function (id) {
Expand Down
10 changes: 5 additions & 5 deletions app/views/login.html → app/views/login/login.html
Expand Up @@ -4,14 +4,14 @@ <h2>Backand Login</h2>
<h4>Use your Backand username and password to login</h4>
</div>
<div class="body">
<form class="form" name="form" ng-submit="signIn()" >
<form class="form" name="form" ng-submit="vm.signIn()" >
<fieldset>
<div class="form-group">
<input type="email"
class="form-control"
name = "username"
placeholder="Your Backand username"
ng-model = "username"
ng-model = "vm.username"
ng-model-options="{debounce: 200}"
required>
<div class="text-danger" ng-show="form.username.$error.email">This is not a valid email.</div>
Expand All @@ -21,7 +21,7 @@ <h4>Use your Backand username and password to login</h4>
class="form-control"
name = "password"
placeholder="Your Backand password"
ng-model = "password"
ng-model = "vm.password"
ng-model-options="{debounce: 200}"
required>
</div>
Expand All @@ -30,7 +30,7 @@ <h4>Use your Backand username and password to login</h4>
class="form-control"
name = "appName"
placeholder="Your Backand app name"
ng-model = "appName"
ng-model = "vm.appName"
ng-model-options="{debounce: 200}"
required>
</div>
Expand All @@ -42,7 +42,7 @@ <h4>Use your Backand username and password to login</h4>
</div>
</fieldset>
</form>
<div ng-show="error" class="alert alert-danger">{{error}}</div>
<div ng-show="error" class="alert alert-danger">{{vm.error}}</div>
<div class="divider"></div>
<section class="additional-info">
<p class="text-center">
Expand Down

0 comments on commit 5ccc27a

Please sign in to comment.