Wednesday, September 28, 2016

9 Hot Tips to Enhance Your Spark Experience

A while ago, I wrote about a product I wanted to build, to allow easy remote backups for Pagekit sites. I've been working on it (periodically) since then, and have come across a few interesting bits of advice.

I decided to use Laravel Spark as the foundation for the product, and I thought it would be helpful to share the advice. Whether you're just starting your Spark app, or are in maintenance mode, I think you'll find some of these tips useful!

Laravel Spark Website Splash Screen

1. You don't have to keep all the base files

You may be worried about removing too many of the base files from the standard Spark installation. When I first started, I thought it vital not to change the auth controllers (in app/Http/Controllers/Auth), for fear that it'd break the registration and login system.

Turns out, these files aren't used by Spark. In fact, if you add routes to them, and you try to register/log in, you'll probably just encounter problems. These default auth controllers share the same auth guard (session driver), so logging in through one will make you authenticated through the other.

If, however, you try to register through the non-Spark controllers, your user and team accounts will be missing vital Spark information. It's cleaner and simpler to just delete these auxiliary auth controllers.

If you're unsure, make a full backup. Then you can roll back in case your tests pick up any regressions.

2. Use simple repositories

Spark includes a few simple repositories. These are like static config lists (for countries and other mostly-static data), but they can be loaded through the IoC container. They look like this:

namespace Laravel\Spark\Repositories\Geography;

use Laravel\Spark\Contracts\Repositories\↩
    Geography\CountryRepository as Contract;

class CountryRepository implements Contract
{
    /**
     * {@inheritdoc}
     */
    public function all()
    {
        return [
            'AF' => 'Afghanistan',
            'AX' => 'Ă…land Islands',
            'AL' => 'Albania',
            // ...snip
            'YE' => 'Yemen',
            'ZM' => 'Zambia',
            'ZW' => 'Zimbabwe',
        ];
    }
}

This is from vendor/bin/laravel/spark/src/Repositories/Geography/CountryRepository.php

We can see instances of this being used in some of the registration views:

<select class="form-control" v-model="registerForm.country"↩
    lazy>
    @foreach (app(Laravel\Spark\Repositories\↩
        Geography\CountryRepository::class)->all()↩
        as $key => $country)
        <option value=""></option>
    @endforeach
</select>

This is from resources/views/vendor/spark/auth/register-address.blade.php

I highly recommend you use these repositories for country and state data. I also recommend you use this repository style for your own lists:

namespace App\Repositories;

use DateTimeZone;

class TimezoneRepository
{
    /**
     * @return array
     */
    public function get()
    {
        $identifiers = DateTimeZone::listIdentifiers(DateTimeZone::ALL);

        return array_combine(
            $identifiers,
            array_map(function ($identifier) {
                return str_replace("_", " ", $identifier);
            }, $identifiers)
        );
    }
}

You don't have to make an interface for each repository. In fact, I think that's a bit of an overkill. But I think these tiny repositories are much cleaner and easier to use than the alternatives.

In addition, you can alias these in an application service provider:

Continue reading %9 Hot Tips to Enhance Your Spark Experience%


by Christopher Pitt via SitePoint

Get Started With Angular 2 and TypeScript

Form UX: Sometimes Even Apple, Google and Amazon Make Mistakes

Slipping on a banana peel

Ever been asked to design something ‘as beautiful as Apple’, ‘as simple as Google’ or ‘as popular as Amazon’? The success of technology’s big names makes them appealing goal posts for clients – and in many cases, you’d do well to learn from them.

But when it comes to forms, even the giants of digital sometimes get it wrong.

Apple and Accessibility

Clients often start with a reference to Apple, so let’s do that too. Apple designs interfaces that are minimalist and modern, including their forms. An example is shown in Figure 1.

[caption id="attachment_140213" align="aligncenter" width="400"]Figure 1 - Apple shipping address form Figure 1 - Apple shipping address form[/caption]

The problem is: sometimes they’re too minimalist.

I’m in my forties and consider myself still fairly young. But my eyesight, as it does with all humans, started to deteriorate in my thirties. Of course, many people need glasses even earlier than that, and there are people of all ages that use a screen magnifier, reverse the colours on screen, reduce brightness and so on.

For a form to be accessible by all its users, it must have enough contrast between colours, especially text versus background. The Web Content Accessibility Guidelines version 2.0 require a contrast ratio of 4.5:1 at a minimum. The ratio between the grey labels and the white background is XX:XX. Even worse, the ratio between the lighter grey text box borders and the white background is XX:XX.

So Apple fails the minimum standard of accessibility for all users.

[caption id="attachment_140214" align="aligncenter" width="400"]Figure 2: Contrast increased Figure 2: Contrast increased[/caption]

Figure 2 shows an alternative design for the same form, with sufficient contrast ratios. Still minimalist, now much more usable.

All the colors of Google

Like Apple, Google also has a small color issue. Figure 3 shows that red is used for errors (see Birthday at the bottom of the screen) but also the form title (“Create your Google Account” near the top of the screen).

[caption id="attachment_140215" align="aligncenter" width="400"]Figure 3: Google account creation Figure 3: Google account creation[/caption]

Another unusual difference is the background color behind fields. On text boxes, the background is white, contrasting nicely with the gray form background. Yet dropdowns and the form have the save background color, making these fields quite difficult to see. Some users are likely to be slowed down or confused by this inconsistency.

Figure 3 also shows that birthday is collected via three dropdowns: one for day, one for month, and one for year. This approach can reduce – although not eliminate – errors. But it means more work for the user. For a variety of reasons, on balance three text boxes is a better approach. See how thinks would look in Figure 4.

[caption id="attachment_140218" align="aligncenter" width="400"]Figure 4: Google's account creation tweaked. Figure 4: Google's account creation tweaked.[/caption]

Amazon takes control

Finally to Amazon, who have been constantly evolving their forms for over two decades. A recent change has been the ability to show password on their account creation form (see Figure 5). Allowing the unmasking of passwords improves usability and reduces errors. When implemented well it also has little to no effect on security – unfortunately, Amazon really missed the mark here.

[caption id="attachment_140264" align="aligncenter" width="495"]Amazon reveal your password below the masked password field. Figure 5: By default, Amazon displays your password in the clear below the masked password field.[/caption]

Amazon has the “show password” option selected by default. A typical user will jump straight to filling in the fields from top to bottom, only to be shocked to see their password shown in the clear underneath their masked entry. By that time, anyone nearby may have seen it too.

Continue reading %Form UX: Sometimes Even Apple, Google and Amazon Make Mistakes%


by Jessica Enders via SitePoint

MagicBook

Magicbook

'MagicBook' is a unique 3D flipbook-style WordPress Theme. Features include turn-page-style browsing, skills section, work timeline, portfolio, testimonials and even a contact form. It's not for everyone but I bet there are a few individuals and agencies after this unique flipbook-style layout. Great to know the theme comes with Visual Composer (valued at $34) page builder plugin bundled in.

by Rob Hope via One Page Love

HelloVote

opl-small-hello-vote

Useful and important One Pager for 'HelloVote' - a chat bot that helps you register to vote.

by Rob Hope via One Page Love

MailChimp Holiday Tips 2016

opl-small

Super long but useful One Pager by newsletter big dogs MailChimp sharing useful holiday (email) marketing tips.

by Rob Hope via One Page Love

Create a PokĂ©mon GO Style Augmented Reality Game With Vuforia