mirror of https://github.com/nextcloud/contacts
parent
7d43efebfb
commit
4bd9608d8e
|
@ -363,7 +363,6 @@ li.addressBook-share-item span.shareeIdentifier {
|
|||
|
||||
/* Contacts List */
|
||||
#new-contact-button {
|
||||
margin: 14px auto; /* to have the same height than a contact*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ angular.module('contactsApp')
|
|||
ctrl.invalid = false;
|
||||
|
||||
ctrl.t = {
|
||||
addContact : t('contacts', 'Add contact'),
|
||||
addContact : t('contacts', '+ New contact'),
|
||||
emptySearch : t('contacts', 'No search result for {query}', {query: ctrl.searchTerm})
|
||||
};
|
||||
|
||||
|
@ -157,21 +157,6 @@ angular.module('contactsApp')
|
|||
ctrl.invalid = (displayName === '');
|
||||
});
|
||||
|
||||
ctrl.createContact = function() {
|
||||
ContactService.create().then(function(contact) {
|
||||
['tel', 'adr', 'email'].forEach(function(field) {
|
||||
var defaultValue = vCardPropertiesService.getMeta(field).defaultValue || {value: ''};
|
||||
contact.addProperty(field, defaultValue);
|
||||
} );
|
||||
if ([t('contacts', 'All contacts'), t('contacts', 'Not grouped')].indexOf($routeParams.gid) === -1) {
|
||||
contact.categories($routeParams.gid);
|
||||
} else {
|
||||
contact.categories('');
|
||||
}
|
||||
$('#details-fullName').focus();
|
||||
});
|
||||
};
|
||||
|
||||
ctrl.hasContacts = function () {
|
||||
if (!ctrl.contacts) {
|
||||
return false;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
angular.module('contactsApp')
|
||||
.controller('newContactButtonCtrl', function($scope, ContactService, $routeParams, vCardPropertiesService) {
|
||||
var ctrl = this;
|
||||
|
||||
ctrl.t = {
|
||||
addContact : t('contacts', '+ New contact')
|
||||
};
|
||||
|
||||
ctrl.createContact = function() {
|
||||
ContactService.create().then(function(contact) {
|
||||
['tel', 'adr', 'email'].forEach(function(field) {
|
||||
var defaultValue = vCardPropertiesService.getMeta(field).defaultValue || {value: ''};
|
||||
contact.addProperty(field, defaultValue);
|
||||
} );
|
||||
if ([t('contacts', 'All contacts'), t('contacts', 'Not grouped')].indexOf($routeParams.gid) === -1) {
|
||||
contact.categories($routeParams.gid);
|
||||
} else {
|
||||
contact.categories('');
|
||||
}
|
||||
$('#details-fullName').focus();
|
||||
});
|
||||
};
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
angular.module('contactsApp')
|
||||
.directive('newcontactbutton', function() {
|
||||
return {
|
||||
restrict: 'EA', // has to be an attribute to work with core css
|
||||
scope: {},
|
||||
controller: 'newContactButtonCtrl',
|
||||
controllerAs: 'ctrl',
|
||||
bindToController: {},
|
||||
templateUrl: OC.linkTo('contacts', 'templates/newContactButton.html')
|
||||
};
|
||||
});
|
|
@ -1,6 +1,4 @@
|
|||
<div style="height: 90%" class="contacts-list" ng-class="{loading: ctrl.loading, 'mobile-show': ctrl.show}">
|
||||
<button ng-show="!ctrl.loading && !ctrl.invalid" class="app-content-list-button" id="new-contact-button"
|
||||
type="button" name="button" ng-click="ctrl.createContact()">{{ctrl.t.addContact}}</button>
|
||||
<div class="app-content-list-item"
|
||||
ng-repeat="contact in ctrl.contactList = (ctrl.contacts | contactGroupFilter:ctrl.routeParams.gid | localeOrderBy:'displayName' | filter:query) as filtered track by contact.uid()"
|
||||
contact data="contact"
|
||||
|
|
|
@ -25,7 +25,7 @@ vendor_style('select2/select2');
|
|||
|
||||
<div id="app" ng-app="contactsApp">
|
||||
<div id="app-navigation">
|
||||
|
||||
<newContactButton></newContactButton>
|
||||
<ul groupList></ul>
|
||||
|
||||
<div id="app-settings">
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<button ng-show="!ctrl.loading && !ctrl.invalid" class="app-content-list-button" id="new-contact-button"
|
||||
type="button" name="button" ng-click="ctrl.createContact()">{{ctrl.t.addContact}}</button>
|
Loading…
Reference in New Issue