From 96d095e44eb5487495d9306ea743546c3ed59850 Mon Sep 17 00:00:00 2001 From: Jakub Klekociuk Date: Mon, 13 Apr 2015 20:01:27 +0200 Subject: [PATCH] add missing endpoints adding assignments fixes --- static_files/app/gradebook/gradebook.js | 4 - .../modules/gradebook/gradebook.html | 75 ++++++++------- .../modules/gradebook/gradebookCtrl.js | 69 +++++++++++++- .../app/gradebook/scss/gradebook-styles.scss | 94 +++++++++++++++++-- .../gradebook/services/assignmentFactory.js | 64 ++++++++++++- .../app/gradebook/services/categoryFactory.js | 40 -------- templates/spa.html | 2 +- 7 files changed, 258 insertions(+), 90 deletions(-) delete mode 100644 static_files/app/gradebook/services/categoryFactory.js diff --git a/static_files/app/gradebook/gradebook.js b/static_files/app/gradebook/gradebook.js index 0449e1cc..345e4c71 100644 --- a/static_files/app/gradebook/gradebook.js +++ b/static_files/app/gradebook/gradebook.js @@ -26,10 +26,6 @@ angular.module('gradeBookApp', [ controller: 'gradeBookCtrl', templateUrl: staticURL('app/gradebook/modules/gradebook/gradebook.html') }) - //.when('/gradebook/',{ - // controller: 'coursesCtrl', - // templateUrl: 'courses/courses.html' - //}) .when('/gradebook/sections/:sectionId',{ controller: 'singleSectionCtrl', templateUrl: staticURL('app/gradebook/modules/singleSection/singleSection.html') diff --git a/static_files/app/gradebook/modules/gradebook/gradebook.html b/static_files/app/gradebook/modules/gradebook/gradebook.html index d839160c..b872df7c 100644 --- a/static_files/app/gradebook/modules/gradebook/gradebook.html +++ b/static_files/app/gradebook/modules/gradebook/gradebook.html @@ -34,34 +34,11 @@

Gradebook

-
  • Math 101 - -
  • -
  • Math 102 - -
  • -
    -

    Math 101: Group A

    +
    +

    {{section.course.fullname}} : {{section.name}}

    @@ -92,7 +69,7 @@

    Math 101: Group A

    -
    +

    Add Assignment Add Assignments @@ -113,12 +90,17 @@

    View Assignment

    - +

    Super long assignment

    - +

    1/1/15

    @@ -128,23 +110,44 @@

    View Assignment

    - +

    Category 1

    - +

    Homework

    - +

    MAth101: Group A

    - +

    Normal

    @@ -158,7 +161,7 @@

    View Assignment

    -
    +

    Filters

    @@ -207,7 +210,7 @@

    Filters

    -
    +

    Settings

    @@ -401,7 +404,7 @@

    Settings

    -
    +

    Icon/Color Guide

    @@ -422,7 +425,7 @@

    Icon/Color Guide

    -
    +

    Data is saving

    sda dasd asdadadasd asdasdasd asdasdad asdada

    diff --git a/static_files/app/gradebook/modules/gradebook/gradebookCtrl.js b/static_files/app/gradebook/modules/gradebook/gradebookCtrl.js index b2060c7f..c839e7f3 100644 --- a/static_files/app/gradebook/modules/gradebook/gradebookCtrl.js +++ b/static_files/app/gradebook/modules/gradebook/gradebookCtrl.js @@ -4,12 +4,18 @@ angular.module('gradeBookApp.controllers') [ '$scope', 'courseFactory', + 'assignmentCategoryFactory', 'assignmentFactory', + 'assignmentTypeFactory', + 'benchmarkFactory', 'schoolYearFactory', 'sectionFactory', '$log', - function ($scope, courseFactory, assignmentFactory, schoolYearFactory, sectionFactory, $log) { + function ($scope, courseFactory, assignmentCategoryFactory, assignmentFactory, assignmentTypeFactory, benchmarkFactory, schoolYearFactory, sectionFactory, $log) { + /*** + * GET LIST OF COURSES + */ var getCourses = function () { courseFactory.get().$promise.then( function (result) { @@ -18,6 +24,40 @@ angular.module('gradeBookApp.controllers') ) }; + /*** + * GET LIST OF CATEGORIES + */ + var getCategoryList = function () { + assignmentCategoryFactory.get().$promise.then( + function (result) { + $scope.assignmentCategories = result; + } + ) + }; + + + /*** + * GET LIST OF ASSIGNMENT TYPES + */ + var getAssignmentTypeList = function () { + assignmentTypeFactory.get().$promise.then( + function (result) { + $scope.assignmentTypes = result; + } + ) + }; + + /*** + * GET BENCHMARK LIST + */ + var getBenchmarkList = function () { + benchmarkFactory.get().$promise.then( + function (result) { + $scope.benchmarkList = result; + } + ) + } + var hideRightColumn = function () { $scope.filtersVisible = false; $scope.settingsVisible = false; @@ -27,6 +67,9 @@ angular.module('gradeBookApp.controllers') $scope.notificationType = null; }; + /*** + * GET ACTIVE MARKING PERIOD + */ var getActiveMarkingPeriod = function () { schoolYearFactory.get().$promise.then( function (result){ @@ -40,8 +83,20 @@ angular.module('gradeBookApp.controllers') ) }; + var dateToYMD = function (date) { + var d = date.getDate(); + var m = date.getMonth() + 1; + var y = date.getFullYear(); + return '' + y + '-' + (m<=9 ? '0' + m : m) + '-' + (d <= 9 ? '0' + d : d); + }; + + /*** + * GET SECTION BY SECTION ID + * @param sectionId + */ $scope.getSection = function (sectionId) { - $scope.activeSection = sectionId; + + $scope.activeSection = sectionId; sectionFactory.get({sectionId: sectionId}).$promise.then( function (result) { $scope.sectionSelected = true; @@ -63,10 +118,17 @@ angular.module('gradeBookApp.controllers') $scope.markingPeriodSet = []; + /*** + * SAVE ASSIGNMENT + */ $scope.saveAssignment = function () { + + $scope.newAssignment.course_section = $scope.activeSection; + assignmentFactory.create($scope.newAssignment).$promise.then( function (result) { console.log(result); + $scope.newAssignment = {}; hideRightColumn(); } ) @@ -139,6 +201,9 @@ angular.module('gradeBookApp.controllers') getCourses(); + getCategoryList(); + getAssignmentTypeList(); + getBenchmarkList(); getActiveMarkingPeriod(); } diff --git a/static_files/app/gradebook/scss/gradebook-styles.scss b/static_files/app/gradebook/scss/gradebook-styles.scss index 3f6d88ab..a8976d52 100644 --- a/static_files/app/gradebook/scss/gradebook-styles.scss +++ b/static_files/app/gradebook/scss/gradebook-styles.scss @@ -3,6 +3,11 @@ cursor:pointer; } + nav > li.active > a { + text-decoration: none; + background-color: #eeeeee; + } + h2{ font-size: 2.625rem; font-weight: normal; @@ -147,16 +152,93 @@ } } -.handsontable tr:first-child th, -.handsontable tr:first-child td{ +//.handsontable tr:first-child th, +//.handsontable tr:first-child td{ +// border-top:0; +//} +// +// +//table tbody tr td, +//table tbody tr th , +//table tbody tr td:first-child, +//table tbody tr th:first-child{ +// vertical-align: top +//} + + +.handsontableInput{ + box-sizing: content-box; +} +h2{ + font-size: 2.625rem; + font-weight: normal; + line-height: 4rem; +} + +h3{ + font-size: 1.8rem; + font-weight: normal; + line-height: 3rem; +} + +p{ + font-weight: 400; + font-size: 16px; + font-size: 1rem; + margin-bottom: 13px; + line-height: 1.625em; +} + +label.year-teacher{ + line-height:36px; +} +a{ + font-family: Arial, sans-serif; +} + +.button{ + margin-left: 5px; + margin-right: 10px; + +} + +.handsontable tr:first-child th, .handsontable tr:first-child td{ border-top:0; } +.handsontable thead th{ + text-transform: uppercase; +} +.handsontable th, .handsontable td{ + height: 30px; + line-height: 30px; +} +.handsontable th{ + color: #888; + white-space: nowrap; + border-left: 1px solid #ccc; + border-bottom: 1px solid #ccc; + background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgi…pZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); + background-size: 100%; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #eeeeee),color-stop(100%, #e0e0e0)); + background-image: -moz-linear-gradient(#eeeeee,#e0e0e0); + background-image: -webkit-linear-gradient(#eeeeee,#e0e0e0); + background-image: linear-gradient(#eeeeee,#e0e0e0); +} -table tbody tr td, -table tbody tr th , -table tbody tr td:first-child, -table tbody tr th:first-child{ +table tbody tr td,table tbody tr th , +table tbody tr td:first-child, table tbody tr th:first-child{ + // border-bottom: 1px solid #e0e0e0; + // border-left: 1px solid #e4e4e4 !important; vertical-align: top } +.modal{ + background: rgba(255,255,255,.6); +} +.modal > .content{ + border: 1px solid #e4e4e4; + border-radius: 4px; +} + + diff --git a/static_files/app/gradebook/services/assignmentFactory.js b/static_files/app/gradebook/services/assignmentFactory.js index 70a241b0..04aa4b09 100644 --- a/static_files/app/gradebook/services/assignmentFactory.js +++ b/static_files/app/gradebook/services/assignmentFactory.js @@ -20,4 +20,66 @@ angular.module('gradeBookApp.services') ) } ] -); +) + .factory( + 'assignmentTypeFactory', + [ + 'appConfig', + '$resource', + function (appConfig, $resource) { + return $resource( + appConfig.apiUrl + 'assignment_types/:typeId', + { + typeId: '@typeId' + }, + { + get: { + isArray: true + } + } + ) + } + ] +) + .factory( + 'assignmentCategoryFactory', + [ + 'appConfig', + '$resource', + '$log', + function (appConfig, $resource, $log) { + return $resource(appConfig.apiUrl + 'assignment_categorys/:categoryId ', + { + categoryId: '@categoryId' + }, + { + get: { + isArray: true + } + } + ) + } + ] +) + .factory( + 'benchmarkFactory', + [ + 'appConfig', + '$resource', + '$log', + function (appConfig, $resource, $log) { + return $resource(appConfig.apiUrl + 'benchmarks/:benchmarkId ', + { + benchmarkId: '@benchmarkId' + }, + { + get: { + isArray: true + } + } + ) + } + ] +) + +; diff --git a/static_files/app/gradebook/services/categoryFactory.js b/static_files/app/gradebook/services/categoryFactory.js deleted file mode 100644 index ef4ad312..00000000 --- a/static_files/app/gradebook/services/categoryFactory.js +++ /dev/null @@ -1,40 +0,0 @@ -angular.module('gradeBookApp.services') - .factory( - 'categoryFactory', - [ - 'appConfig', - '$resource', - '$log', - function (appConfig, $resource, $log) { - return $resource(appConfig.apiUrl + '/categories/ ', - { - }, - { - get: { - method: 'GET', - isArray: true, - interceptor: { - responseError: function (error) { - $log.error('GET CATEGORY LIST'); - return [ - { - id: 1, - name: 'Category 1' - }, - { - id: 2, - name: 'Category 2' - }, - { - id: 3, - name: 'Category 3' - } - ]; - } - } - } - } - ) - } - ] -); diff --git a/templates/spa.html b/templates/spa.html index 984a9559..16f22090 100644 --- a/templates/spa.html +++ b/templates/spa.html @@ -40,7 +40,7 @@ - +