Skip to content

Commit

Permalink
Created Courses Correlatives New View (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatiasMercado authored Feb 3, 2017
1 parent 81410ba commit 40e0f6f
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 0 deletions.
49 changes: 49 additions & 0 deletions app/scripts/controllers/courses/CoursesCorrelativesNewCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict';

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

this.course = {
courseId: '72.03',
credits: 3,
name: 'Introducción a Informática',
semester: 1,
availableCorrelatives: [
{
courseId: '72.03',
credits: 3,
name: 'Introducción a Informática',
semester: 1
},
{
courseId: '94.21',
credits: 6,
name: 'Formacion General I',
semester: 5
},
{
courseId: '72.03',
credits: 3,
name: 'Introducción a Informática',
semester: 1
},
{
courseId: '94.21',
credits: 6,
name: 'Formacion General I',
semester: 5
}
]
};

this.filter = {
id: $routeParams.id,
name: $routeParams.name
};
this.resetSearch = function() {
this.filter = {};
};

}]);
});
2 changes: 2 additions & 0 deletions app/scripts/i18n/translations.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ define([], function() {
// Courses Students Approved
i18nGrade: 'Nota',

// Correlatives
i18nAddCorrelative: 'Agregar correlatividad',

// Search filters
i18nSearchButton: 'Buscar',
Expand Down
5 changes: 5 additions & 0 deletions app/scripts/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ define([], function() {
templateUrl: 'views/courses/students_passed.html',
controller: 'CoursesStudentsPassedCtrl',
relativePath: '/courses'
},
'/courses/:courseId/correlatives/new': {
templateUrl: 'views/courses/correlatives_new.html',
controller: 'CoursesCorrelativesNewCtrl',
relativePath: '/courses'
}
/* ===== yeoman hook ===== */
/* Do not remove these commented lines! Needed for auto-generation */
Expand Down
1 change: 1 addition & 0 deletions app/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ $fa-font-path: '../bower_components/font-awesome/fonts';
@import 'partials/students/edit';
@import 'partials/courses/show';
@import 'partials/courses/students_index';
@import 'partials/courses/correlatives_new';
20 changes: 20 additions & 0 deletions app/styles/partials/courses/_correlatives_new.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@import 'modules/variables/importer';

.courses-correlatives-new-container {
.table {
.actions-container {
display: flex;
flex-wrap: wrap;
width: 100%;
justify-content: flex-start;

.btn {
flex: 1;
min-width: 175px;
max-width: 200px;
margin: 10px;
margin-left: 0;
}
}
}
}
77 changes: 77 additions & 0 deletions app/views/courses/correlatives_new.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<div ng-controller='CoursesCorrelativesNewCtrl as controller' class='courses-correlatives-new-container'>
<!-- Page Heading -->
<div class='page-header break-words'>
<h1 class='inline'>
<span translate='i18nCoursesPanelSection'></span>
</h1>
<h2 class='inline'>
<span> - </span>
<span> {{controller.course.name}} </span>
<small> - </small>
<small translate='i18nAddCorrelative'></small>
</h2>
</div>
<!-- /Page Heading -->

<!-- Filter -->
<div class='filter-container'>
<div class='filter-fields'>
<div class='own-input-group'>
<span class='search-label' translate=i18nCourseId></span>
<input type='text' class='form-input-field' ng-model='controller.filter.id' placeholder="{{ 'i18nCourseId' | translate }}..."/>
</div>
<div class='own-input-group'>
<span class='search-label' translate='i18nCourseName'></span>
<input type='text' class='form-input-field' ng-model='controller.filter.name' placeholder="{{ 'i18nCourseName' | translate }}..."/>
</div>
</div>
<div class='filter-buttons'>
<button class='btn btn-default' type='submit'>
<span class='fa fa-search' aria-hidden='true'></span>
<span translate='i18nSearchButton' translate ></span>
</button>
<button class='btn btn-default' ng-click='controller.resetSearch()' type='submit'>
<span class='fa fa-repeat' aria-hidden='true'></span>
<span translate='i18nResetButton'></span>
</button>
</div>
</div>
<!-- /Filter -->

<!-- Content -->
<div class='table-responsive'>
<table class='table table-hover'>
<thead>
<tr>
<th translate='i18nCourseId'></th>
<th translate='i18nCourseName'></th>
<th translate='i18nCredits'></th>
<th translate='i18nSemester'></th>
<th translate='i18nActions'></th>
</tr>
</thead>
<tbody>
<tr ng-hide='controller.course.availableCorrelatives.length > 0' class='bg-warning'>
<td colspan='5' class='text-danger text-center' translate='i18nNoCoursesFound'></td>
</tr>
<tr ng-repeat='course in controller.course.availableCorrelatives'>
<td>{{ course.courseId }}</td>
<td>{{ course.name }}</td>
<td>{{ course.credits }}</td>
<td>{{ course.semester }}</td>
<td class='actions-container'>
<a class='btn btn-default' role='button'>
<span class='fa fa-info-circle' aria-hidden='true'></span>
<span translate='i18nCourseShow'></span>
</a>
<a class='btn btn-info' role='button'>
<span class='fa fa-pencil-square-o' aria-hidden='true'></span>
<span translate='i18nAddCorrelative'></span>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Content -->
</div>

0 comments on commit 40e0f6f

Please sign in to comment.