Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: Spuds on January 03, 2011, 01:53:47 PM

Title: Minor inconsistency in PersonalMessage.Template
Post by: Spuds on January 03, 2011, 01:53:47 PM
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.
Title: Re: Minor inconsistency in PersonalMessage.Template
Post by: Baby Daisy on January 04, 2011, 12:34:13 AM
I would assume it was leftovers from the previous SMF 1.1 style...
Title: Re: Minor inconsistency in PersonalMessage.Template
Post by: emanuele on May 28, 2011, 04:00:06 PM
Still there. :)
Title: Re: Minor inconsistency in PersonalMessage.Template
Post by: Antechinus on May 28, 2011, 06:57:25 PM
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.
Title: Re: Minor inconsistency in PersonalMessage.Template
Post by: live627 on May 28, 2011, 07:34:34 PM
Yeah add the reset class to the ul and done.
Title: Re: Minor inconsistency in PersonalMessage.Template
Post by: Antechinus on May 28, 2011, 07:37:40 PM
Yup.

ETA: Done.