-
Notifications
You must be signed in to change notification settings - Fork 4
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
9 changed files
with
355 additions
and
0 deletions.
There are no files selected for viewing
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,157 @@ | ||
body { | ||
|
||
margin: 0; | ||
padding: 0; | ||
font-family: 'Ubuntu', sans-serif; | ||
} | ||
ul { | ||
list-style: none; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
p { | ||
margin: 0; | ||
} | ||
h1 { | ||
margin: 0; | ||
font-size: 4em; | ||
line-height: 3em; | ||
color: #FF0085; | ||
} | ||
body>header { | ||
text-align: center; | ||
margin: 0; | ||
font-family: 'Pacifico', cursive; | ||
} | ||
header a, | ||
header a:visited { | ||
text-decoration: none; | ||
|
||
} | ||
|
||
.sugerencia { | ||
width: 50%; | ||
margin: 50px auto; | ||
text-align: center; | ||
} | ||
.sugerencia .loading { | ||
font-size: 2em; | ||
color: #FF0085; | ||
} | ||
.sugerencia header { | ||
font-size: 2em; | ||
line-height: 1em; | ||
} | ||
|
||
.sugerencia p { | ||
font-size: 3em; | ||
line-height: 2em; | ||
text-transform: capitalize; | ||
} | ||
|
||
.filter { | ||
text-align: center; | ||
line-height: 18px; | ||
} | ||
.filter .fields { | ||
margin-bottom: 10px; | ||
} | ||
.filter i { | ||
font-size: 3em; | ||
cursor: pointer; | ||
|
||
-moz-transition: transform 0.4s ; | ||
-webkit-transition: transform 0.4s ; | ||
-o-transition: transform 0.4s ; | ||
transition: transform 0.4s ; | ||
} | ||
.filter i:active { | ||
color: #FF0085; | ||
-ms-transform: rotate(360deg); | ||
-webkit-transform: rotate(360deg); | ||
transform: rotate(360deg); | ||
} | ||
|
||
footer { | ||
position: fixed; | ||
bottom: 0; | ||
text-align: center; | ||
width: 100%; | ||
font-size: 1em; | ||
padding-bottom: 5px; | ||
} | ||
|
||
footer a, | ||
footer a:visited { | ||
color: #FF0085; | ||
} | ||
|
||
label { | ||
display: inline-block; | ||
cursor: pointer; | ||
position: relative; | ||
padding-left: 25px; | ||
margin-right: 15px; | ||
font-size: 13px; | ||
} | ||
|
||
input[type=radio] { | ||
display: none; | ||
} | ||
label:before { | ||
content: ""; | ||
display: inline-block; | ||
|
||
width: 15px; | ||
height: 15px; | ||
|
||
margin-right: 10px; | ||
position: absolute; | ||
left: 0; | ||
bottom: 1px; | ||
background-color: #FFF; | ||
border:1px solid #555555; | ||
} | ||
|
||
label:before { | ||
border-radius: 9px; | ||
} | ||
|
||
input[type=radio]:checked + label:before { | ||
content: "\2022"; | ||
color: #FF0085; | ||
font-size: 32px; | ||
text-align: center; | ||
line-height: 15px; | ||
} | ||
|
||
input[type=checkbox]:checked + label:before { | ||
content: "\2713"; | ||
text-shadow: 1px 1px 1px rgba(0, 0, 0, .2); | ||
font-size: 15px; | ||
color: #FF0085; | ||
text-align: center; | ||
line-height: 15px; | ||
} | ||
|
||
table { | ||
width: 80%; | ||
margin: auto; | ||
border-spacing: 0; | ||
} | ||
td,th{ | ||
text-align: center; | ||
} | ||
td:first-child { | ||
text-align: left; | ||
text-transform: capitalize; | ||
} | ||
th { | ||
border-bottom: 2px solid #000; | ||
} | ||
tr { | ||
line-height: 28px; | ||
} | ||
tr:nth-child(2n+2) { | ||
background: rgba(255, 0, 71, 0.2); | ||
} |
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,14 @@ | ||
var meals = [ | ||
{name:"milanesa", main:true, allowSideDish:true, light:false}, | ||
{name:"pollo", main:true, allowSideDish:true, light:true}, | ||
{name:"tarta de verdura", main:true, allowSideDish:false, light:true}, | ||
{name:"pure de papa", main:false, allowSideDish:false, light:false}, | ||
{name:"pure de calabaza", main:false, allowSideDish:false, light:true}, | ||
{name:"pure mixto", main:false, allowSideDish:false, light:true}, | ||
{name:"ensalada", main:false, allowSideDish:false, light:true}, | ||
{name:"papas fritas", main:false, allowSideDish:false, light:false}, | ||
{name:"papas españolas", main:false, allowSideDish:false, light:false}, | ||
{name:"super ensalada", main:true, allowSideDish:false, light:true}, | ||
{name:"pizza", main:true, allowSideDish:false, light:false}, | ||
{name:"empanadas", main:true, allowSideDish:false, light:false}, | ||
]; |
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,36 @@ | ||
<!doctype html> | ||
<html ng-app="queComo"> | ||
<head> | ||
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> | ||
<link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'> | ||
<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'> | ||
<link rel="stylesheet" href="/css/main.css"> | ||
<script src="/data/data.js"></script> | ||
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script> | ||
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.4/angular.min.js"></script> | ||
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.4/angular-route.min.js"></script> | ||
<script src="/js/app.js"></script> | ||
<script src="/js/filters.js"></script> | ||
<script src="/js/routes.js"></script> | ||
<script src="/js/controllers.js"></script> | ||
</head> | ||
<body> | ||
|
||
<header><a href="#/sugerir"><h1>¿Qué como?</h1></a></header> | ||
|
||
<div ng-view> | ||
|
||
<article class="sugerencia"> | ||
<p>Cargando...</p> | ||
<i class="fa fa-circle-o-notch fa-spin loading"></i> | ||
</article> | ||
|
||
</div> | ||
|
||
<footer> | ||
<a href="#/sugerir">Sugerir</a> | ||
- <a href="#/mostrar-platos">Listado de comidas</a> | ||
- <a href="http://germanlena.com.ar">Germán Lena</a> | ||
</footer> | ||
</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 @@ | ||
angular.module('queComo', ['ngRoute']); |
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,69 @@ | ||
|
||
angular.module('queComo') | ||
|
||
.controller('SugerirCtrl', ['$scope', function ($scope) { | ||
|
||
$scope.tipoSugerencia = 'balanceada'; | ||
|
||
function sugerenciasFilter(isMain, isPreviousLight) | ||
{ | ||
var filter = null; | ||
switch($scope.tipoSugerencia) | ||
{ | ||
case 'balanceada': | ||
filter = function(e){ | ||
return (isMain === e.main) && (isPreviousLight || e.light); | ||
} | ||
break; | ||
case 'light': | ||
filter = function(e){ | ||
return (isMain === e.main) && e.light; | ||
} | ||
break; | ||
case 'heavy': | ||
filter = function(e){ | ||
return (isMain === e.main) && !e.light; | ||
} | ||
break; | ||
case 'todo': | ||
filter = function(e){ | ||
return (isMain === e.main); | ||
} | ||
break; | ||
} | ||
return filter; | ||
} | ||
|
||
$scope.findMeAMeal = function(){ | ||
|
||
var selected = _.shuffle( | ||
meals.filter( sugerenciasFilter(true) ) | ||
)[0]; | ||
|
||
$scope.suggested = selected.name; | ||
|
||
if (selected.allowSideDish) | ||
{ | ||
var sideSelected = _.shuffle( | ||
meals.filter( sugerenciasFilter(false, selected.light) ) | ||
)[0]; | ||
|
||
$scope.suggested += ' con '; | ||
$scope.suggested += sideSelected.name; | ||
} | ||
|
||
}; | ||
|
||
$scope.findMeAMeal(); | ||
|
||
|
||
}]) | ||
|
||
.controller('ShowDataCtrl', ['$scope', function ($scope) { | ||
|
||
$scope.data = meals; | ||
|
||
}]); | ||
|
||
|
||
|
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 @@ | ||
angular.module('queComo') | ||
.filter('transformBoolean', function () { | ||
return function(input) { | ||
return input?'Si':'No'; | ||
} | ||
}); |
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,22 @@ | ||
|
||
angular.module('queComo') | ||
|
||
.config(['$routeProvider', function($routeProvider) { | ||
|
||
$routeProvider. | ||
|
||
when('/sugerir', { | ||
templateUrl: 'partials/sugerir.html', | ||
controller: 'SugerirCtrl' | ||
}). | ||
|
||
when('/mostrar-platos', { | ||
templateUrl: 'partials/showData.html', | ||
controller: 'ShowDataCtrl' | ||
}). | ||
|
||
otherwise({ | ||
redirectTo: '/sugerir' | ||
}); | ||
|
||
}]); |
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,29 @@ | ||
|
||
<table> | ||
<thead> | ||
|
||
<tr> | ||
|
||
<th>Nombre</th> | ||
<th>¿Principal?</th> | ||
<th>¿Light?</th> | ||
<th>¿Tiene acompañamiento?</th> | ||
|
||
</tr> | ||
|
||
</thead> | ||
<tbody> | ||
|
||
|
||
<tr ng-repeat="item in data"> | ||
|
||
<td>{{item.name}}</td> | ||
<td>{{item.main | transformBoolean}}</td> | ||
<td>{{item.light | transformBoolean}}</td> | ||
<td>{{item.allowSideDish | transformBoolean}}</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,21 @@ | ||
|
||
<article class="sugerencia"> | ||
<header>Sugerencia:</header> | ||
<p>{{suggested}}</p> | ||
</article> | ||
|
||
<div class="filter"> | ||
<div class="fields"> | ||
<span>Tipo de sugerencia:</span> | ||
|
||
<input type="radio" ng-model="tipoSugerencia" name="tipoSugerencia" value="balanceada" id="sugerencia-balanceada" /><label for="sugerencia-balanceada">Balanceada</label> | ||
|
||
<input type="radio" ng-model="tipoSugerencia" name="tipoSugerencia" value="light" id="sugerencia-light" /><label for="sugerencia-light">Light</label> | ||
|
||
<input type="radio" ng-model="tipoSugerencia" name="tipoSugerencia" value="heavy" id="sugerencia-heavy" /><label for="sugerencia-heavy">Heavy</label> | ||
|
||
<input type="radio" ng-model="tipoSugerencia" name="tipoSugerencia" value="todo" id="sugerencia-todo" /><label for="sugerencia-todo">Cualquier cosa</label> | ||
</div> | ||
|
||
<i class="fa fa-refresh" ng-click="findMeAMeal();"></i> | ||
</div> |