1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +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 { #contact footer .add {
width: 300px; 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; float: right;
background-image: none; background-image: none;
} }

View File

@ -1423,14 +1423,7 @@ OC.Contacts = OC.Contacts || {
this.hideActions(); this.hideActions();
console.log('Contacts.openContact', id, typeof id); console.log('Contacts.openContact', id, typeof id);
if(this.currentid && this.currentid !== id) { if(this.currentid && this.currentid !== id) {
var contact = this.contacts.findById(this.currentid); this.closeContact(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.currentid = id; this.currentid = id;
var contact = this.contacts.findById(this.currentid); var contact = this.contacts.findById(this.currentid);

View File

@ -181,10 +181,17 @@ OC.Contacts = OC.Contacts || {};
}; };
Contact.prototype.showActions = function(act) { Contact.prototype.showActions = function(act) {
this.$footer.children().hide(); // non-destructive merge.
if(act && act.length > 0) { var $actions = $.merge($.merge([], this.$footer.children()), this.$header.children());
this.$footer.children('.'+act.join(',.')).show(); $.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) { 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"> <form action="<?php print_unescaped(OCP\Util::linkTo('contacts', 'index.php')); ?>" method="post" enctype="multipart/form-data">
<section id="contact" data-id="{id}"> <section id="contact" data-id="{id}">
<header> <header>
<a class="delete text tooltipped downwards"> <a class="delete">
<?php p($l->t('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")); ?>" /> <img class="svg" alt="<?php p($l->t('Delete'))?>" src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
</a> </a>
@ -353,11 +353,15 @@
<option value="NOTE"><?php p($l->t('Note')); ?></option> <option value="NOTE"><?php p($l->t('Note')); ?></option>
<option value="URL"><?php p($l->t('Web site')); ?></option> <option value="URL"><?php p($l->t('Web site')); ?></option>
</select> </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')); ?> <?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")); ?>" /> <img class="svg" alt="<?php p($l->t('Close'))?>" src="<?php print_unescaped(OCP\image_path("core", "actions/checkmark.svg")); ?>" />
</a> </a>
<a class="export text tooltipped downwards"> <a class="export">
<?php p($l->t('Download')); ?> <?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")); ?>" /> <img class="svg" alt="<?php p($l->t('Download'))?>" src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>" />
</a> </a>