Some UI improvements on the addressbooks settings.

This commit is contained in:
Thomas Tanghus 2012-08-07 00:05:43 +02:00
parent de7f48b050
commit 2eac79b782
3 changed files with 19 additions and 9 deletions

View File

@ -140,4 +140,7 @@ input[type="checkbox"] { width: 20px; height: 20px; vertical-align: bottom; }
.addressbooks-settings .actions * { float: left; }
.addressbooks-settings .actions input.name { width: 5em; }
.addressbooks-settings .actions input.name { width: 7em; }
.addressbooks-settings a.action { opacity: 0.2; }
.addressbooks-settings a.action:hover { opacity: 1; }
.addressbooks-settings td.active, .addressbooks-settings td.action { width: 20px; }

View File

@ -89,8 +89,7 @@ OC.Contacts.Settings = OC.Contacts.Settings || {
+ '<td class="action"><a class="svg action globe" title="'+t('contacts', 'Show CardDav link')+'"></a></td>'
+ '<td class="action"><a class="svg action cloud" title="'+t('contacts', 'Show read-only VCF link')+'"></a></td>'
+ '<td class="action"><a class="svg action download" title="'+t('contacts', 'Download')+'" '
+ 'href="'+totalurl+'/'+encodeURIComponent(oc_current_user)+'/'
+ encodeURIComponent(jsondata.data.addressbook.uri)+'?export"></a></td>'
+ 'href="'+OC.linkTo('contacts', 'export.php')+'?bookid='+jsondata.data.addressbook.id+'"></a></td>'
+ '<td class="action"><a class="svg action edit" title="'+t('contacts', 'Edit')+'"></a></td>'
+ '<td class="action"><a class="svg action delete" title="'+t('contacts', 'Delete')+'"></a></td>'
+ '</tr>');
@ -106,17 +105,27 @@ OC.Contacts.Settings = OC.Contacts.Settings || {
}
});
},
showLink:function(id, row, link) {
console.log('row:', row.length);
row.next('tr.link').remove();
var linkrow = $('<tr class="link"><td colspan="5"><input style="width: 95%;" type="text" value="'+link+'" /></td>'
+ '<td colspan="3"><button>'+t('contacts', 'Cancel')+'</button></td></tr>').insertAfter(row);
linkrow.find('input').focus().select();
linkrow.find('button').click(function() {
$(this).parents('tr').first().remove();
});
},
showCardDAV:function(id) {
console.log('showCardDAV: ', id);
var row = this.adrsettings.find('tr[data-id="'+id+'"]');
this.adractions.find('.link').val(totalurl+'/'+encodeURIComponent(oc_current_user)+'/');
this.showActions(['link','cancel']);
this.showLink(id, row, totalurl+'/'+encodeURIComponent(oc_current_user));
},
showVCF:function(id) {
console.log('showVCF: ', id);
var row = this.adrsettings.find('tr[data-id="'+id+'"]');
this.adractions.find('.link').val(totalurl+'/'+encodeURIComponent(oc_current_user)+'/'+encodeURIComponent(row.data('uri'))+'?export');
this.showActions(['link','cancel']);
var link = totalurl+'/'+encodeURIComponent(oc_current_user)+'/'+encodeURIComponent(row.data('uri'))+'?export';
console.log(link);
this.showLink(id, row, link);
}
}
};

View File

@ -24,8 +24,7 @@
</td>
<td class="action">
<a class="svg action download" title="<?php echo $l->t('Download'); ?>"
href="<?php echo OCP\Util::linkToRemote('carddav').'addressbooks/'.OCP\USER::getUser().'/'
.rawurlencode($addressbook['uri']) ?>?export"></a>
href="<?php echo OCP\Util::linkToAbsolute('contacts', 'export.php'); ?>?bookid=<?php echo $addressbook['id'] ?>"></a>
</td>
<td class="action">
<a class="svg action edit" title="<?php echo $l->t("Edit"); ?>"></a>
@ -41,7 +40,6 @@
<button class="new"><?php echo $l->t('New Address Book') ?></button>
<input class="name hidden" type="text" autofocus="autofocus" placeholder="<?php echo $l->t('Name'); ?>" />
<input class="description hidden" type="text" placeholder="<?php echo $l->t('Description'); ?>" />
<input class="link hidden" style="width: 80%" type="text" autofocus="autofocus" />
<button class="save hidden"><?php echo $l->t('Save') ?></button>
<button class="cancel hidden"><?php echo $l->t('Cancel') ?></button>
</div>