Adds Todo for @georgehrke in the timezone controller and other changes.

This commit is contained in:
raghunayyar 2014-05-13 16:52:55 +05:30 committed by Georg Ehrke
parent fe14544684
commit b3050f29fc
5 changed files with 82 additions and 82 deletions

View File

@ -24,48 +24,48 @@
app.controller('SettingsController', ['$scope','Restangular','$routeParams','TimezoneModel',
function ($scope,Restangular,$routeParams,TimezoneModel) {
// In case, routes are need.
$scope.route = $routeParams;
$scope.timezones = TimezoneModel.getAll();
var calendarResource = Restangular.all('v1/timezones');
// In case, routes are need.
$scope.route = $routeParams;
$scope.timezones = TimezoneModel.getAll();
var calendarResource = Restangular.all('v1/timezones');
// Gets All Calendar Timezones.
calendarResource.getList().then(function (timezones) {
TimezoneModel.addAll(timezones);
});
// Gets All Calendar Timezones.
// TODO: Georg, explain me the structure of the JSON of the Timezones, it's weird.
// this will change accordingly.
// calendarResource.getList().then(function (timezones) {
// TimezoneModel.addAll(timezones);
//});
console.log($scope.timezones);
// Time Format Dropdown
$scope.timeformatSelect = [
{ time : t('calendar', '24h'), val : '24' },
{ time : t('calendar' , '12h'), val : 'ampm' }
];
// Time Format Dropdown
$scope.timeformatSelect = [
{ time : t('calendar', '24h'), val : '24' },
{ time : t('calendar' , '12h'), val : 'ampm' }
];
// First Day Dropdown
$scope.firstdaySelect = [
{ day : t('calendar', 'Monday'), val : 'mo' },
{ day : t('calendar', 'Sunday'), val : 'su' },
{ day : t('calendar', 'Saturday'), val : 'sa' }
];
// First Day Dropdown
$scope.firstdaySelect = [
{ day : t('calendar', 'Monday'), val : 'mo' },
{ day : t('calendar', 'Sunday'), val : 'su' },
{ day : t('calendar', 'Saturday'), val : 'sa' }
];
// Changing the first day
$scope.changefirstday = function (firstday) {
};
// Changing the first day
$scope.changefirstday = function (firstday) {
};
// Creating Timezone, not yet implemented Server Side.
$scope.create = function () {
calendarResource.post().then(function (newtimezone) {
TimezoneModel.add(newtimezone);
});
};
// Creating Timezone, not yet implemented Server Side.
$scope.create = function () {
calendarResource.post().then(function (newtimezone) {
TimezoneModel.add(newtimezone);
});
};
// Deleting Timezone, not yet implemented Server Side.
$scope.delete = function (timezoneId) {
var timezone = TimezoneModel.get(timezoneId);
timezone.remove().then(function () {
TimezoneModel.remove(timezoneId);
});
};
// Deleting Timezone, not yet implemented Server Side.
$scope.delete = function (timezoneId) {
var timezone = TimezoneModel.get(timezoneId);
timezone.remove().then(function () {
TimezoneModel.remove(timezoneId);
});
};
}
]);

View File

@ -29,6 +29,9 @@ app.factory('TimezoneModel', function () {
};
TimezoneModel.prototype = {
add: function (timezone) {
this.timezones.push(timezone);
},
addAll: function (timezones) {
for(var i=0; i<timezones.length; i++) {
this.add(timezones[i]);
@ -40,9 +43,6 @@ app.factory('TimezoneModel', function () {
get: function (id) {
return this.timezoneId[id];
},
add: function (timezone) {
return 0;
},
delete: function (id) {
return 0;
}

View File

@ -62,49 +62,49 @@ app.controller('NavController', ['$scope',
app.controller('SettingsController', ['$scope','Restangular','$routeParams','TimezoneModel',
function ($scope,Restangular,$routeParams,TimezoneModel) {
// In case, routes are need.
$scope.route = $routeParams;
$scope.timezones = TimezoneModel.getAll();
var calendarResource = Restangular.all('v1/timezones');
// In case, routes are need.
$scope.route = $routeParams;
$scope.timezones = TimezoneModel.getAll();
var calendarResource = Restangular.all('v1/timezones');
// Gets All Calendar Timezones.
calendarResource.getList().then(function (timezones) {
TimezoneModel.addAll(timezones);
});
// Gets All Calendar Timezones.
// TODO: Georg, explain me the structure of the JSON of the Timezones, it's weird.
// this will change accordingly.
// calendarResource.getList().then(function (timezones) {
// TimezoneModel.addAll(timezones);
//});
console.log($scope.timezones);
// Time Format Dropdown
$scope.timeformatSelect = [
{ time : t('calendar', '24h'), val : '24' },
{ time : t('calendar' , '12h'), val : 'ampm' }
];
// Time Format Dropdown
$scope.timeformatSelect = [
{ time : t('calendar', '24h'), val : '24' },
{ time : t('calendar' , '12h'), val : 'ampm' }
];
// First Day Dropdown
$scope.firstdaySelect = [
{ day : t('calendar', 'Monday'), val : 'mo' },
{ day : t('calendar', 'Sunday'), val : 'su' },
{ day : t('calendar', 'Saturday'), val : 'sa' }
];
// First Day Dropdown
$scope.firstdaySelect = [
{ day : t('calendar', 'Monday'), val : 'mo' },
{ day : t('calendar', 'Sunday'), val : 'su' },
{ day : t('calendar', 'Saturday'), val : 'sa' }
];
// Changing the first day
$scope.changefirstday = function (firstday) {
};
// Changing the first day
$scope.changefirstday = function (firstday) {
};
// Creating Timezone, not yet implemented Server Side.
$scope.create = function () {
calendarResource.post().then(function (newtimezone) {
TimezoneModel.add(newtimezone);
});
};
// Creating Timezone, not yet implemented Server Side.
$scope.create = function () {
calendarResource.post().then(function (newtimezone) {
TimezoneModel.add(newtimezone);
});
};
// Deleting Timezone, not yet implemented Server Side.
$scope.delete = function (timezoneId) {
var timezone = TimezoneModel.get(timezoneId);
timezone.remove().then(function () {
TimezoneModel.remove(timezoneId);
});
};
// Deleting Timezone, not yet implemented Server Side.
$scope.delete = function (timezoneId) {
var timezone = TimezoneModel.get(timezoneId);
timezone.remove().then(function () {
TimezoneModel.remove(timezoneId);
});
};
}
]);
@ -158,6 +158,9 @@ app.factory('TimezoneModel', function () {
};
TimezoneModel.prototype = {
add: function (timezone) {
this.timezones.push(timezone);
},
addAll: function (timezones) {
for(var i=0; i<timezones.length; i++) {
this.add(timezones[i]);
@ -169,9 +172,6 @@ app.factory('TimezoneModel', function () {
get: function (id) {
return this.timezoneId[id];
},
add: function (timezone) {
return 0;
},
delete: function (id) {
return 0;
}

View File

@ -51,7 +51,7 @@
<!-- The Left Calendar Navigation -->
<div id="app-navigation" ng-controller="NavController">
<ul>
<ul ng-controller="DatePickerController">
<?php print_unescaped($this->inc('part.datepicker')); ?>
</ul>
<ul ng-controller="CalendarListController">

View File

@ -40,7 +40,7 @@
<li>
<label for="timezone" class="bold"><?php p($l->t('Timezone')); ?></label>
<select id="timezone" name="timezone">
<option ng-repeat="zones in timezoneSelect"></option>
<option ng-repeat="timezone in timezones">{{ timezone }}</option>
</select>
</li>
<li>