1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-18 07:52:21 +01:00

Contacts: Add group select to contact popup.

This commit is contained in:
Thomas Tanghus 2012-12-22 02:01:08 +01:00
parent ccac1f9ab6
commit 0294d704a3
2 changed files with 18 additions and 1 deletions

View File

@ -638,8 +638,19 @@ OC.Contacts = OC.Contacts || {};
* @return A jquery object to be inserted in the DOM
*/
Contact.prototype.renderContact = function(groupprops) {
this.groupprops = groupprops;
var self = this;
this.groupprops = groupprops;
var buildGroupSelect = function($groupSelect, availableGroups) {
$.each(availableGroups, function(idx, group) {
var $option = $('<option value="' + group.id + '">' + group.name + '</option>');
if(self.inGroup(group.name)) {
$option.attr('selected', 'selected');
}
$groupSelect.append($option);
});
};
var n = this.getPreferredValue('N', ['', '', '', '', '']);
//console.log('Contact.renderContact', this.data);
var values = this.data
@ -667,6 +678,11 @@ OC.Contacts = OC.Contacts || {};
this.$fullelem.on('submit', function() {
return false;
});
this.$groupSelect = this.$fullelem.find('#contactgroups');
buildGroupSelect(this.$groupSelect, groupprops.groups);
this.$groupSelect.multiSelect();
this.$addMenu = this.$fullelem.find('#addproperty');
this.$addMenu.on('change', function(event) {
//console.log('add', $(this).val());

View File

@ -173,6 +173,7 @@
</ul>
<a class="favorite action {favorite}"></a>
</div>
<select id="contactgroups" multiple></select>
<div class="singleproperties">
<input data-element="fn" class="fullname value propertycontainer" type="text" name="value" value="{name}" required />
<a class="action edit"></a>