Skip to content

Commit

Permalink
Improve signature display.
Browse files Browse the repository at this point in the history
- Move below body text in dynamic view
- Make signature section expandable
- Save expansion status in prefs
- Set maximum height of signature area.
  • Loading branch information
yunosh committed Oct 16, 2013
1 parent a415f1d commit 0c70e16
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 10 deletions.
4 changes: 4 additions & 0 deletions imp/config/prefs.php
Expand Up @@ -636,6 +636,10 @@
// 'value' => "['Bold','Italic','-','NumberedList','BulletedList','-','Link','Unlink']",
);

$_prefs['signature_expanded'] = array(
'value' => 0,
'type' => 'implicit',
);


// *** Compose Templates Preferences ***
Expand Down
23 changes: 23 additions & 0 deletions imp/js/compose-dimp.js
Expand Up @@ -818,6 +818,7 @@ var DimpCompose = {

var mah,
cmp = $('composeMessageParent'),
sp = $('signatureParent'),
qreply = $('qreply');

if (!cmp || (qreply && !qreply.visible())) {
Expand All @@ -831,6 +832,9 @@ var DimpCompose = {
} catch (ex) {
return;
}
if (sp) {
mah -= sp.getHeight();
}

if (this.rte_loaded) {
this.rte.resize('99%', mah - 1, false);
Expand Down Expand Up @@ -950,6 +954,25 @@ var DimpCompose = {
this.resizeMsgArea();
break;

case 'signatureToggle':
if ($('signature').visible()) {
$('signatureToggle').removeClassName('signatureExpanded');
$('signature').hide();
HordeCore.doAction('setPrefValue', {
pref: 'signature_expanded',
value: 0
});
} else {
$('signatureToggle').addClassName('signatureExpanded');
$('signature').show();
HordeCore.doAction('setPrefValue', {
pref: 'signature_expanded',
value: 1
});
}
this.resizeMsgArea();
break;

case 'compose_close':
case 'redirect_close':
this.confirmCancel();
Expand Down
1 change: 1 addition & 0 deletions imp/lib/Ajax/Application.php
Expand Up @@ -85,6 +85,7 @@ protected function _init()

$this->addHandler('IMP_Ajax_Application_Handler_ImageUnblock');
$this->addHandler('Horde_Core_Ajax_Application_Handler_Imple');
$this->addHandler('Horde_Core_Ajax_Application_Handler_Prefs');

$this->queue = $injector->getInstance('IMP_Ajax_Queue');

Expand Down
1 change: 1 addition & 0 deletions imp/lib/Dynamic/Compose/Common.php
Expand Up @@ -147,6 +147,7 @@ protected function _compose($base, $view, $args)
$view->select_list = $select_list;

$view->signature = $identity->hasSignature(true);
$view->sigExpanded = $prefs->getValue('signature_expanded');
}

/**
Expand Down
18 changes: 10 additions & 8 deletions imp/templates/dynamic/compose.html.php
Expand Up @@ -144,14 +144,6 @@
<?php echo $this->textFieldTag('subject') ?>
</td>
</tr>
<?php if ($this->signature): ?>
<tr>
<td class="label"><?php echo _("Signature")?>:</td>
<td>
<div id="signature"></div>
</td>
</tr>
<?php endif; ?>
<tr class="atcrow">
<?php if ($this->attach): ?>
<td class="label">
Expand Down Expand Up @@ -209,5 +201,15 @@
<div id="composeMessageParent">
<textarea name="message" id="composeMessage" class="fixed"></textarea>
</div>

<?php if ($this->signature): ?>
<div id="signatureParent">
<div class="label">
<span id="signatureToggle" class="iconImg<?php if ($this->sigExpanded) echo ' signatureExpanded' ?>"></span>
<?php echo _("Signature")?>:
</div>
<div id="signature"<?php if (!$this->sigExpanded) echo ' style="display:none"' ?> title="<?php echo _("The signature is not editable.") ?>"></div>
</div>
<?php endif; ?>
</div>
</form>
2 changes: 1 addition & 1 deletion imp/themes/default/basic/screen.css
Expand Up @@ -224,7 +224,7 @@ div.msgActions, #fmanager div.folderActions {
.composebody {
padding: 2px;
}
#text_identity {
#text_identity, #signature {
width: 500px;
}
#compose td.light {
Expand Down
30 changes: 30 additions & 0 deletions imp/themes/default/dynamic/screen.css
Expand Up @@ -684,6 +684,36 @@ div.dimpActionsMsg #windowclose {
width: 100%;
}

#signatureParent {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: #eceff0;
border-top: 1px solid #d0d0d0;
cursor: default;
padding: 10px;
}
#signature {
margin-top: 4px;
}
#signatureParent .label {
white-space: nowrap;
font-weight: bold;
}
#signatureToggle {
cursor: pointer;
float: left;
height: 14px;
width: 12px;
}
#signatureToggle {
background-image: url("../graphics/arrow_collapsed.png");
}
#signatureToggle.signatureExpanded {
background-image: url("../graphics/arrow_expanded.png");
}

#rteloading {
position: absolute;
z-index: 100;
Expand Down
3 changes: 2 additions & 1 deletion imp/themes/default/screen.css
Expand Up @@ -135,13 +135,14 @@ div.partsTreeDiv span span:last-child {
}

/* Compose view */
#to, #cc, #bcc, #subject, #signature {
#to, #cc, #bcc, #subject {
width: 500px;
}
#signature {
overflow: auto;
padding: 1px 5px;
min-height: 20px;
max-height: 52px;
background-color: #ebeff0;
border: 1px solid #d0d0d0;
}
Expand Down

0 comments on commit 0c70e16

Please sign in to comment.