Advertisement:

Author Topic: Minor inconsistency in PersonalMessage.Template  (Read 4393 times)

Offline Spuds

  • SMF Hero
  • ******
  • Posts: 1,798
  • Gender: Male
Minor inconsistency in PersonalMessage.Template
« 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

Code: [Select]
// 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:

Code: [Select]
// 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.
« Last Edit: May 05, 2011, 08:22:37 AM by Norv »

Offline Baby Daisy

  • Jr. Member
  • **
  • Posts: 350
  • Gender: Female
Re: Minor inconsistency in PersonalMessage.Template
« Reply #1 on: January 04, 2011, 12:34:13 AM »
I would assume it was leftovers from the previous SMF 1.1 style...
あなたは私のお尻にキスするとき、私はそれを愛する

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Minor inconsistency in PersonalMessage.Template
« Reply #2 on: May 28, 2011, 04:00:06 PM »
Still there. :)


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.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,136
  • Master of BBC Abuse
Re: Minor inconsistency in PersonalMessage.Template
« Reply #3 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.

Offline live627

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,265
  • Gender: Male
  • Cat: Destroy!
    • live627 on Facebook
    • live627 on GitHub
    • live627 on LinkedIn
    • @live627 on Twitter
    • livemods
Re: Minor inconsistency in PersonalMessage.Template
« Reply #4 on: May 28, 2011, 07:34:34 PM »
Yeah add the reset class to the ul and done.
Try not to become a man of success, but rather try to become a man of value.
- Albert Einstein

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,136
  • Master of BBC Abuse
Re: Minor inconsistency in PersonalMessage.Template
« Reply #5 on: May 28, 2011, 07:37:40 PM »
Yup.

ETA: Done.
« Last Edit: May 28, 2011, 07:46:42 PM by Antechinus »