Minor inconsistency in PersonalMessage.Template

Started by Spuds, January 03, 2011, 01:53:47 PM

Previous topic - Next topic

Spuds

2.0 RC4, no mods

The way error messages are handled / displayed varies from template to template and they really should be more consistent in appearance.

In the personal message template they are formed as

// If there were errors for sending the PM, show them.
if (!empty($context['post_error']['messages']))
{
echo '
<div class="errorbox">
<strong>', $txt['error_while_submitting'], '</strong>
<ul>';

foreach ($context['post_error']['messages'] as $error)
echo '
<li class="error">', $error, '</li>';

echo '
</ul>
</div>';
}


So you get bullets next to the error message, the only place I could find that style was in the PM template.  I changed mine to be like the post template error, specifically:

// If there were errors for sending the PM, show them.
if (!empty($context['post_error']['messages']))
{
echo '
<div class="errorbox"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
<dl>
<dt>
<strong style="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'display: none;' : '', '" id="error_serious">', $txt['error_while_submitting'], '</strong>
</dt>
<dt class="error" id="error_list">
', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '
</dt>
</dl>
</div>';
}


Note for this to work correctly the $context['error_type'] also needs to be set to minor or serious in personalmessage.php, similar to how its done in post.php.

IMO I'd consider changing minor errors to show a notification style error and the serious (ie not is the form fill out) errors to be error style.  For example  I don't think we really need a red background for forgetting to put in a subject, but perhaps a more gentile caution triangle yellow and a you forgot to fill in the subject message.  So basically move form fields to minor and provide a minor css style and show that if there are not serious errors returned.

Baby Daisy

I would assume it was leftovers from the previous SMF 1.1 style...
あなたは私のお尻にキスするとき、私はそれを愛する

emanuele



Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Antechinus

Missed this one. Frankly I like the code in the PM template better. It's less messy and does a perfectly good job. Removing bullets is easy.

live627

Yeah add the reset class to the ul and done.

Antechinus

#5
Yup.

ETA: Done.

Advertisement: