1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-11-29 11:24:11 +01:00

Cleanup contact actions. Close #377

This commit is contained in:
Thomas Tanghus 2014-03-04 21:56:46 +01:00
parent 0c570936f3
commit 3e2f508975
4 changed files with 20 additions and 16 deletions

View File

@ -162,7 +162,7 @@
#contact footer .add {
width: 300px;
}
#contact footer .close, #contact footer .export, #contact header .delete {
#contact footer .cancel, #contact footer .close, #contact footer .export, #contact header .delete {
float: right;
background-image: none;
}

View File

@ -1423,14 +1423,7 @@ OC.Contacts = OC.Contacts || {
this.hideActions();
console.log('Contacts.openContact', id, typeof id);
if(this.currentid && this.currentid !== id) {
var contact = this.contacts.findById(this.currentid);
if(contact) {
// Only show the list element if contact is in current group
var showListElement = contact.inGroup(this.groups.nameById(this.currentgroup))
|| this.currentgroup === 'all'
|| (this.currentgroup === 'uncategorized' && contact.groups().length === 0);
contact.close(showListElement);
}
this.closeContact(this.currentid);
}
this.currentid = id;
var contact = this.contacts.findById(this.currentid);

View File

@ -181,10 +181,17 @@ OC.Contacts = OC.Contacts || {};
};
Contact.prototype.showActions = function(act) {
this.$footer.children().hide();
if(act && act.length > 0) {
this.$footer.children('.'+act.join(',.')).show();
}
// non-destructive merge.
var $actions = $.merge($.merge([], this.$footer.children()), this.$header.children());
$.each($actions, function(idx, action) {
$(action).hide();
$.each(act, function(i, a) {
if($(action).hasClass(a)) {
$(action).show();
return false; // break
}
});
});
};
Contact.prototype.setAsSaving = function(obj, state) {

View File

@ -211,7 +211,7 @@
<form action="<?php print_unescaped(OCP\Util::linkTo('contacts', 'index.php')); ?>" method="post" enctype="multipart/form-data">
<section id="contact" data-id="{id}">
<header>
<a class="delete text tooltipped downwards">
<a class="delete">
<?php p($l->t('Delete')); ?>
<img class="svg" alt="<?php p($l->t('Delete'))?>" src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
</a>
@ -353,11 +353,15 @@
<option value="NOTE"><?php p($l->t('Note')); ?></option>
<option value="URL"><?php p($l->t('Web site')); ?></option>
</select>
<a class="close text tooltipped downwards">
<a class="cancel">
<?php p($l->t('Cancel')); ?>
<img class="svg" alt="<?php p($l->t('Cancel'))?>" src="<?php print_unescaped(OCP\image_path("core", "actions/close.svg")); ?>" />
</a>
<a class="close">
<?php p($l->t('Close')); ?>
<img class="svg" alt="<?php p($l->t('Close'))?>" src="<?php print_unescaped(OCP\image_path("core", "actions/checkmark.svg")); ?>" />
</a>
<a class="export text tooltipped downwards">
<a class="export">
<?php p($l->t('Download')); ?>
<img class="svg" alt="<?php p($l->t('Download'))?>" src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>" />
</a>