Skip to content

Commit

Permalink
Created Students Show View (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatiasMercado authored Jan 30, 2017
1 parent 452a96f commit 0063175
Show file tree
Hide file tree
Showing 12 changed files with 223 additions and 12 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ module.exports = function (grunt) { // eslint-disable-line strict
},
files: [
'<%= yeoman.app %>/**/*.html',
'!**/coverage/**',
'.tmp/styles/**/*.css',
'<%= yeoman.app %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}'
]
Expand Down
30 changes: 30 additions & 0 deletions app/scripts/controllers/students/StudentsShowCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

define(['paw'], function(paw) {
paw.controller('StudentsShowCtrl', ['$routeParams', function($routeParams) {
var _this = this;

var docket = $routeParams.docket; // For future Service calls

this.student = {
docket: '55019',
firstName: 'Matías',
lastName: 'Mercado',
email: 'mmercado@itba.edu.ar',
genre: 'Masculino',
dni: '38917403',
birthday: '1995-05-04',
address: {
country: 'Argentina',
city: 'Buenos Aires',
neighborhood: 'Almagro',
number: '682',
street: 'Corrientes',
floor: '2',
door: 'A',
telephone: '1544683390',
zipCode: '1100'
}
};
}]);
});
21 changes: 18 additions & 3 deletions app/scripts/i18n/translations.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

define([], function() {
return {
i18nProfile: 'Mi perfil',
i18nMyProfile: 'Mi perfil',
i18nLogout: 'Cerrar sesión',
i18nWebAbbreviation: 'SGA',
i18nWebName: 'Sistema de Gestión Académica',
Expand Down Expand Up @@ -49,13 +49,28 @@ define([], function() {
i18nCourseAddCorrelative: 'Agregar correlativa',
i18nCourseDelete: 'Eliminar',

// Tables common headers
i18Actions: 'Acciones',

//
// User show
i18nStudents: 'Alumnos',
i18nProfile: 'Perfil',
i18nDni: 'DNI',
i18Docket: 'Legajo',
i18nFirstName: 'Nombre',
i18nLastName: 'Apellido',
i18Actions: 'Acciones',
i18Birthday: 'Fecha de nacimiento',
i18Email: 'Email',
i18Genre: 'Género',
i18Telephone: 'Teléfono',
i18Country: 'País',
i18City: 'Ciudad',
i18Neighborhood: 'Localidad',
i18Street: 'Calle',
i18Number: 'Altura',
i18Floor: 'Piso nro.',
i18Door: 'Departamento',
i18ZipCode: 'Código postal',

//
i18nId: 'Código',
Expand Down
5 changes: 5 additions & 0 deletions app/scripts/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ define([], function() {
templateUrl: 'views/students/index.html',
controller: 'StudentsIndexCtrl',
relativePath: '/students'
},
'/students/:docket': {
templateUrl: 'views/students/show.html',
controller: 'StudentsShowCtrl',
relativePath: '/students'
}
/* ===== yeoman hook ===== */
/* Do not remove these commented lines! Needed for auto-generation */
Expand Down
51 changes: 51 additions & 0 deletions app/specs/controllers/StudentsShowCtrl.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// disable max-nested-callbacks linter for this test
// it is good to have a good separation of contexts inside tests

/* eslint-disable max-nested-callbacks */

'use strict';

define(['paw',
'angular-mocks',
'controllers/students/StudentsShowCtrl'],
function() {
describe('Students Show Ctrl', function() {
beforeEach(module('paw'));

var expectedStudent = {
docket: '55019',
firstName: 'Matías',
lastName: 'Mercado',
email: 'mmercado@itba.edu.ar',
genre: 'Masculino',
dni: '38917403',
birthday: '1995-05-04',
address: {
country: 'Argentina',
city: 'Buenos Aires',
neighborhood: 'Almagro',
number: '682',
street: 'Corrientes',
floor: '2',
door: 'A',
telephone: '1544683390',
zipCode: '1100'
}
};

var expectedDocket = {docket: '55019'};

var $controller, controller, $routeParams;

beforeEach(inject(
function(_$controller_, _$routeParams_) {
$controller = _$controller_;
$routeParams = _$routeParams_;
controller = $controller('StudentsShowCtrl', {$routeParams: expectedDocket});
}));

it('correctly fetch the student', function() {
expect(controller.student).toEqual(expectedStudent);
});
});
});
1 change: 1 addition & 0 deletions app/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ $fa-font-path: '../bower_components/font-awesome/fonts';
@import 'directives/backdrop';
@import 'partials/index';
@import 'partials/home';
@import 'partials/students/show';
1 change: 0 additions & 1 deletion app/styles/modules/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ html {
}

body {
font-family: 'Roboto', sans-serif;
background: $alabaster;
height: 100%;

Expand Down
4 changes: 2 additions & 2 deletions app/styles/modules/variables/sizes.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
$navbarHeight: 50px;
$topNavMaxWidth: 300px;
$topNavDropdownMenuMaxWidth: 300px;
$sidebarWidth: 225px;
$sidebarWidth: 240px;
$sidebarButtonHeight: 50px;
$navbarZIndex: 1001;
$sidebarZIndex: 1002;
$containerPadding: 30px;
$bootstrapMobileMaxWidth: 768px;
$bootstrapMobileMaxWidth: 767px;
24 changes: 24 additions & 0 deletions app/styles/partials/students/_show.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.students-show-container {
.data-container {
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;

.data-item {
width: 240px;
padding: 5px;

.break-words {
display: inline-block;
word-wrap: break-word; /* Internet Explorer 5.5+ */
width: 230px; /* width is mandatory to make break-word work on Mozzila */
}
}
}

.user-address-data {
padding-top: 15px;
border-top: 1px solid #eeeeee;
}
}
2 changes: 1 addition & 1 deletion app/views/directives/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{{ controller.user.fullName }}
</li>
<li class='dropdown-option'>
<a ng-href='{{ controller.user.profileUrl }}'><i class='fa fa-fw fa-user'></i> {{ 'i18nProfile' | translate }}</a>
<a ng-href='{{ controller.user.profileUrl }}'><i class='fa fa-fw fa-user'></i> {{ 'i18nMyProfile' | translate }}</a>
</li>
<li class='dropdown-option'>
<a href='/logout'><i class="fa fa-fw fa-power-off"></i> {{ 'i18nLogout' | translate }}</a>
Expand Down
6 changes: 1 addition & 5 deletions app/views/students/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<div ng-controller='StudentsIndexCtrl as controller'>
<div class='students-index-container'>
<!-- Page Heading -->
<div class='row'>
<div class='col-xs-12'>
<h1 translate='i18nStudentsPanelSection' class='page-header'></h1>
</div>
</div>
<h1 translate='i18nStudentsPanelSection' class='page-header'></h1>
<!-- /Page Heading -->

<!-- Filter -->
Expand Down
89 changes: 89 additions & 0 deletions app/views/students/show.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<div class='students-show-container' ng-controller='StudentsShowCtrl as controller'>
<!-- Page Heading -->
<div class='page-header break-words'>
<h1 class='inline'>
<span translate='i18nStudents'></span>
</h1>
<h2 class='inline'>
<span> - </span>
<span> {{controller.student.firstName}} {{controller.student.lastName}}</span>
<small> - </small>
<small translate='i18nProfile'></small>
</h2>
</div>
<!-- /Page Heading -->

<!-- User Data -->
<div class='data-container'>
<div class='data-item'>
<p class='bold static-label' translate='i18nDni'></p>
<p class='break-words'>{{controller.student.dni}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18Docket'></p>
<p class='break-words'>{{controller.student.docket}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18nFirstName'></p>
<p class='break-words'>{{controller.student.firstName}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18nLastName'></p>
<p class='break-words'>{{controller.student.lastName}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18Birthday'></p>
<p class='break-words'>{{controller.student.birthday}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18Genre'></p>
<p class='break-words'>{{controller.student.genre}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18Telephone'></p>
<p class='break-words'>{{controller.student.address.telephone}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18Email'></p>
<p class='break-words'>{{controller.student.email}}</p>
</div>
</div>
<!-- /User Data -->

<!-- Address Data -->
<div class='data-container user-address-data'>
<div class='data-item'>
<p class='bold static-label' translate='i18Country'></p>
<p class='break-words'>{{controller.student.address.country}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18City'></p>
<p class='break-words'>{{controller.student.address.city}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18Neighborhood'></p>
<p class='break-words'>{{controller.student.address.neighborhood}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18Street'></p>
<p class='break-words'>{{controller.student.address.street}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18Number'></p>
<p class='break-words'>{{controller.student.address.number}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18Floor'></p>
<p class='break-words'>{{controller.student.address.floor}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18Door'></p>
<p class='break-words'>{{controller.student.address.door}}</p>
</div>
<div class='data-item'>
<p class='bold static-label' translate='i18ZipCode'></p>
<p class='break-words'>{{controller.student.address.zipCode}}</p>
</div>
</div>
<!-- /Address Data -->
</div>

0 comments on commit 0063175

Please sign in to comment.