Skip to content

Commit

Permalink
Don't use wellknown if not needed - fixes #41
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Feb 19, 2016
1 parent c4dbf40 commit 080341e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 50 deletions.
2 changes: 1 addition & 1 deletion js/dav/dav.js
Expand Up @@ -683,7 +683,7 @@ var serviceDiscovery = _co2['default'].wrap(regeneratorRuntime.mark(function cal
uri = _url2['default'].format({
protocol: endpoint.protocol,
host: endpoint.host,
pathname: '/.well-known/' + options.accountType
pathname: !options.useProvidedPath ? '/.well-known/' + options.accountType : endpoint.pathname
});
req = request.basic({ method: 'GET' });
context$1$0.prev = 5;
Expand Down
2 changes: 1 addition & 1 deletion js/dav/lib/accounts.js
Expand Up @@ -30,7 +30,7 @@ let serviceDiscovery = co.wrap(function *(account, options) {
let uri = url.format({
protocol: endpoint.protocol,
host: endpoint.host,
pathname: `/.well-known/${options.accountType}`
pathname: (!options.useProvidedPath ? '/.well-known/' + options.accountType : endpoint.pathname)
});

let req = request.basic({ method: 'GET' });
Expand Down
95 changes: 48 additions & 47 deletions js/public/script.js
Expand Up @@ -18,6 +18,22 @@ app.config(['$routeProvider', function($routeProvider){

}]);

app.controller('addressbookCtrl', function() {
var ctrl = this;
console.log(this);
});
app.directive('addressbook', function() {
return {
restrict: 'A', // has to be an attribute to work with core css
scope: {},
controller: 'addressbookCtrl',
controllerAs: 'ctrl',
bindToController: {
addressBook: "=data"
},
templateUrl: OC.linkTo('contactsrework', 'templates/addressBook.html')
};
});
app.controller('addressbooklistCtrl', ['$scope', 'AddressBookService', 'SettingsService', function(scope, AddressBookService, SettingsService) {
var ctrl = this;

Expand Down Expand Up @@ -45,38 +61,54 @@ app.directive('addressbooklist', function() {
};
});

app.controller('addressbookCtrl', function() {
app.controller('contactCtrl', [function() {
var ctrl = this;
console.log(this);
});
app.directive('addressbook', function() {

console.log("Contact: ",ctrl.contact);

}]);

app.directive('contact', function() {
return {
restrict: 'A', // has to be an attribute to work with core css
scope: {},
controller: 'addressbookCtrl',
controller: 'contactCtrl',
controllerAs: 'ctrl',
bindToController: {
addressBook: "=data"
contact: '=data'
},
templateUrl: OC.linkTo('contactsrework', 'templates/addressBook.html')
templateUrl: OC.linkTo('contactsrework', 'templates/contact.html')
};
});
app.controller('contactCtrl', [function() {
app.controller('contactlistCtrl', ['$scope', 'ContactService', function($scope, ContactService) {
var ctrl = this;

console.log("Contact: ",ctrl.contact);
ContactService.registerObserverCallback(function(contacts) {
$scope.$apply(function() {
ctrl.contacts = contacts;
});
});

ContactService.getAll().then(function(contacts) {
$scope.$apply(function(){
ctrl.contacts = contacts;
});
});

ctrl.createContact = function() {
ContactService.create();
};
}]);

app.directive('contact', function() {
app.directive('contactlist', function() {
return {
priority: 1,
scope: {},
controller: 'contactCtrl',
controller: 'contactlistCtrl',
controllerAs: 'ctrl',
bindToController: {
contact: '=data'
addressbook: '=adrbook'
},
templateUrl: OC.linkTo('contactsrework', 'templates/contact.html')
templateUrl: OC.linkTo('contactsrework', 'templates/contactList.html')
};
});
app.controller('contactdetailsCtrl', ['ContactService', '$routeParams', '$scope', function(ContactService, $routeParams, $scope) {
Expand Down Expand Up @@ -116,38 +148,6 @@ app.directive('contactdetails', function() {
};
});

app.controller('contactlistCtrl', ['$scope', 'ContactService', function($scope, ContactService) {
var ctrl = this;

ContactService.registerObserverCallback(function(contacts) {
$scope.$apply(function() {
ctrl.contacts = contacts;
});
});

ContactService.getAll().then(function(contacts) {
$scope.$apply(function(){
ctrl.contacts = contacts;
});
});

ctrl.createContact = function() {
ContactService.create();
};
}]);

app.directive('contactlist', function() {
return {
priority: 1,
scope: {},
controller: 'contactlistCtrl',
controllerAs: 'ctrl',
bindToController: {
addressbook: '=adrbook'
},
templateUrl: OC.linkTo('contactsrework', 'templates/contactList.html')
};
});
app.factory('AddressBook', function()
{
return function AddressBook(data) {
Expand Down Expand Up @@ -468,7 +468,8 @@ app.service('DavClient', function() {
app.service('DavService', ['DavClient', function(client) {
return client.createAccount({
server: OC.linkToRemoteBase('dav/addressbooks'),
accountType: 'carddav'
accountType: 'carddav',
useProvidedPath: true
});
}]);

Expand Down
3 changes: 2 additions & 1 deletion js/services/dav_service.js
@@ -1,6 +1,7 @@
app.service('DavService', ['DavClient', function(client) {
return client.createAccount({
server: OC.linkToRemoteBase('dav/addressbooks'),
accountType: 'carddav'
accountType: 'carddav',
useProvidedPath: true
});
}]);

0 comments on commit 080341e

Please sign in to comment.