-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "modulo 5", | ||
"version": "0.0.5", | ||
"homepage": "https://github.com/leamarty/cursoweb", | ||
"description": "Agregamos AngularJS al frontend", | ||
"main": "index.html", | ||
"keywords": [ | ||
"curso" | ||
], | ||
"private": true, | ||
"ignore": [ | ||
"**/.*", | ||
"bower_components" | ||
], | ||
"dependencies": { | ||
"angular": "~1.4.8", | ||
"angular-route": "~1.4.8", | ||
"angular-ui-select2": "~0.0.5", | ||
"bootstrap": "~3.3.5", | ||
"jquery": "~2.1.4", | ||
"restangular": "~1.5.1", | ||
"select2": "~3.5.3", | ||
"underscore": "~1.8.3" | ||
}, | ||
"resolutions": { | ||
"select2": "~3.5.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#boton-buscar { | ||
padding: 13px 15px; | ||
} | ||
.alert { | ||
display: none; | ||
margin-bottom: 0 !important; | ||
} | ||
.bold { | ||
font-weight: bold; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<table> | ||
<thead></thead> | ||
<tbody> | ||
<tr ng-repeat="cliente in clientes"> | ||
<td>{{ cliente.id }}</td> | ||
<td>{{ cliente.razon_social }}</td> | ||
</tr> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
View de nuevo cliente |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" ng-app="cursoweb"> | ||
<head> | ||
<title>La web del curso</title> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link type="text/css" rel="stylesheet" href="estilos.css"/> | ||
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"> | ||
<!-- Vendor --> | ||
<script src="bower_components/jquery/dist/jquery.min.js"></script> | ||
<script src="bower_components/angular/angular.js"></script> | ||
<script src="bower_components/angular-route/angular-route.min.js"></script> | ||
<script src="bower_components/select2/select2.min.js"></script> | ||
<script src="bower_components/angular-ui-select2/src/select2.js"></script> | ||
<script src="bower_components/underscore/underscore-min.js"></script> | ||
<script src="bower_components/restangular/dist/restangular.min.js"></script> | ||
<!-- App --> | ||
<script src="js/angular-app.js"></script> | ||
<script src="js/controllers/main-controller.js"></script> | ||
<script src="js/routes.js"></script> | ||
<script src="js/directivas/ocultar.js"></script> | ||
<!-- Controllers --> | ||
<script src="js/controllers/cliente/listado.js"></script> | ||
<script src="js/controllers/cliente/nuevo.js"></script> | ||
</head> | ||
<body> | ||
<div class="container" ng-controller="MainController"> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="jumbotron text-center"> | ||
<h1>Telapong S.A.</h1> | ||
<p>Listado de clientes oficiales</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<nav class="navbar navbar-default"> | ||
<ul class="nav navbar-nav"> | ||
<li id="menu-listado" class="{{ menuActivo == 'cliente_listado' ? 'active' : '' }}"> | ||
<a href="#/cliente/listado">Listado</a> | ||
</li> | ||
<li id="menu-nuevo" class="{{ menuActivo == 'cliente_nuevo' ? 'active' : '' }}"> | ||
<a href="#/cliente/nuevo">Nuevo</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
</div> | ||
</div> | ||
<div ng-view></div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var cursoweb = angular.module('cursoweb', [ | ||
'ngRoute', | ||
'ui.select2', | ||
'restangular' | ||
]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cursoweb.controller('ClienteListado', function ($scope) { | ||
$scope.$parent.menuActivo = 'cliente_listado'; | ||
|
||
$scope.clientes = [ | ||
{id: 5, razon_social: 'hola'} | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cursoweb.controller('ClienteNuevo', function ($scope, Nombre) { | ||
$scope.$parent.menuActivo = 'cliente_nuevo'; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
cursoweb.controller('MainController', function ($scope, $timeout) { | ||
|
||
$scope.menuActivo = ''; | ||
|
||
$scope.clientes = []; | ||
|
||
$scope.buscar = function () { | ||
$scope.clientes.push({ | ||
id: $scope.clientes.length + 1, | ||
nombre: 'Pepe', | ||
edad: 5 | ||
}); | ||
}; | ||
|
||
$scope.borrar = function (cliente, index) { | ||
$scope.clientes.splice(index, 1); | ||
alert('Ya borre el cliente ' + cliente.nombre); | ||
}; | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cursoweb.directive('ocultar', function () { | ||
return { | ||
restrict: 'A', | ||
link: function (scope, element, attrs) { | ||
setTimeout(function () { | ||
element.hide(); | ||
}, (attrs.ocultarTiempo || 2) * 1000); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
cursoweb.config(function ($routeProvider) { | ||
$routeProvider | ||
.when('/cliente/listado', { | ||
templateUrl: 'html/cliente/listado.html', | ||
controller: 'ClienteListado' | ||
}) | ||
.when('/cliente/nuevo', { | ||
templateUrl: 'html/cliente/nuevo.html', | ||
controller: 'ClienteNuevo' | ||
}) | ||
/* | ||
.when('/cliente/:id', { | ||
templateUrl: '', | ||
controller: '' | ||
}) | ||
*/ | ||
.otherwise({ | ||
redirectTo: '/cliente/listado' | ||
}) | ||
}); |